diff -Nru update-manager-16.04.3/data/com.ubuntu.update-manager.gschema.xml.in update-manager-16.04.12/data/com.ubuntu.update-manager.gschema.xml.in --- update-manager-16.04.3/data/com.ubuntu.update-manager.gschema.xml.in 2013-04-12 20:46:35.000000000 +0000 +++ update-manager-16.04.12/data/com.ubuntu.update-manager.gschema.xml.in 2017-03-20 16:28:24.000000000 +0000 @@ -45,7 +45,7 @@ make check-new-release-gtk ignore a given new release This will permanently hide the new release prompt from check-new-release-gtk. Note that the small button in the main update-manager UI will still be there. - + 0 Time when update-manager got launched last The last time update-manager was run. diff -Nru update-manager-16.04.3/data/update-manager.8 update-manager-16.04.12/data/update-manager.8 --- update-manager-16.04.3/data/update-manager.8 2013-08-06 16:45:38.000000000 +0000 +++ update-manager-16.04.12/data/update-manager.8 2017-07-18 22:48:02.000000000 +0000 @@ -37,7 +37,7 @@ Check if a new distribution release is available .TP \fB-d\fR, \fB\-\-devel-release\fR -Check if upgrading to the latest devel release is possible +If using the latest supported release, upgrade to the development release .TP \fB-p\fR, \fB\-\-proposed\fR Upgrade using the latest proposed version of the release upgrader diff -Nru update-manager-16.04.3/debian/changelog update-manager-16.04.12/debian/changelog --- update-manager-16.04.3/debian/changelog 2016-04-12 01:49:21.000000000 +0000 +++ update-manager-16.04.12/debian/changelog 2018-02-12 12:29:23.000000000 +0000 @@ -1,3 +1,93 @@ +update-manager (1:16.04.12) xenial-security; urgency=medium + + * No change rebuild in security pocket (LP: #1748397) + + -- Marc Deslauriers Mon, 12 Feb 2018 07:29:03 -0500 + +update-manager (1:16.04.11) xenial; urgency=medium + + [ Steve Langasek ] + * ubuntu-support-status: instead of checking the Release timestamp in + the releases file for every single package on the system, get the + release date from distro-info-data because it will always be the same. + This speeds up the script by > 50% in testing. + + [ Marc Deslauriers ] + * ubuntu-support-status: use component to differentiate packages + supported by the community and packages supported by Canonical, and + override the Supported tag for main and restricted to work around the + inaccurate Packages files. (LP: #1574670) + + -- Marc Deslauriers Fri, 02 Feb 2018 09:02:45 -0500 + +update-manager (1:16.04.10) xenial; urgency=medium + + * UpdateManager/UpdatesAvailable.py: Provide instructions when mount points + have insufficient free space for the upgrade to complete. (LP: #1477455) + * test_update_origin.py: fix the extended origin matcher test as it was + making wrong assumptions, not checking if packages actually had ANY package + in -security. This should fix the current autopkgtest failures. + (LP: #1717360) + + -- Brian Murray Wed, 20 Sep 2017 14:39:17 -0700 + +update-manager (1:16.04.9) xenial; urgency=medium + + * UpdateManager/Core/UpdateList.py: Instead of trying to print an error + when trying to find the desktop file log it. (LP: #1428297) + * tests/test_update_origin.py: This does not need to be architecture + specific so just set the arch to amd64 like test_update_list.py. Replace + references to lucid with xenial as lucid is no longer on the archive. + * tests/test_utils.py: mock /proc/net/tcp and processes in proc so that we + are testing the code and not the system under test. + * tests/test_cache.py: pass an empty list when getting a changelog for 3rd + party packages. + * tests/test_hwe_support_status.py: port to python3. + * tests/test_meta_release_core.py: switch to a site that works with no proxy + in the autopkgtest environment. + * Resolve pep8 and pyflakes issues. + + -- Brian Murray Thu, 10 Aug 2017 15:08:15 -0700 + +update-manager (1:16.04.8) xenial; urgency=medium + + * Recommend libgtk2-perl be installed so we have a working debconf frontend. + (LP: #1607929) + + -- Brian Murray Mon, 24 Jul 2017 17:40:35 -0700 + +update-manager (1:16.04.7) xenial; urgency=medium + + * update-manager: Clarify that the "-d" switch is only for upgrading from + the latest supported release to the development release, not any release. + (LP: #1700829) + + -- Brian Murray Mon, 17 Jul 2017 09:31:17 -0700 + +update-manager (1:16.04.6) xenial; urgency=medium + + * Use a 64 bit integer for launch-time instead of a 32 bit one which won't + work someday. (LP: #1654008) + + -- Brian Murray Mon, 20 Mar 2017 15:03:58 -0700 + +update-manager (1:16.04.5) xenial; urgency=medium + + [ Iain Lane ] + * ChangelogViewer: Fix an API call to work with GTK < and ≥ 3.20. Upstream + gave gtk_text_view_get_iter_at_location a gboolean return type, which + makes gobject-introspection return (return value, out parameter). (LP: + #1548425) + + -- Brian Murray Mon, 19 Dec 2016 13:46:30 -0800 + +update-manager (1:16.04.4) xenial; urgency=medium + + * Correctly calculate the end of support, and return correctly when support + has ended. Patch from Andrew Gaul, with thanks. (LP: #1574193) + + -- Brian Murray Fri, 30 Sep 2016 09:16:37 -0700 + update-manager (1:16.04.3) xenial; urgency=medium * Quote URL parameters for the Release Announcement. (LP: #1561215) diff -Nru update-manager-16.04.3/debian/control update-manager-16.04.12/debian/control --- update-manager-16.04.3/debian/control 2016-04-06 19:52:00.000000000 +0000 +++ update-manager-16.04.12/debian/control 2017-07-25 00:40:35.000000000 +0000 @@ -59,7 +59,9 @@ ubuntu-release-upgrader-gtk, update-notifier, policykit-1-gnome | policykit-1-kde | lxpolkit | mate-polkit | razorqt-policykit-agent -Recommends: software-properties-gtk (>= 0.71.2), +Breaks: update-notifier (<< 3.168.4) +Recommends: software-properties-gtk (>= 0.71.2), + libgtk2-perl Suggests: gir1.2-dbusmenu-glib-0.4, gir1.2-unity-5.0, Description: GNOME application that manages apt updates diff -Nru update-manager-16.04.3/debian/source_update-manager.py update-manager-16.04.12/debian/source_update-manager.py --- update-manager-16.04.3/debian/source_update-manager.py 2014-02-26 23:24:45.000000000 +0000 +++ update-manager-16.04.12/debian/source_update-manager.py 2017-08-10 22:08:15.000000000 +0000 @@ -24,10 +24,7 @@ if response: os.execlp('apport-bug', 'apport-bug', 'ubuntu-release-upgrader') else: - try: - attach_gsettings_package(report, 'update-manager') - except: - pass + attach_gsettings_package(report, 'update-manager') attach_file_if_exists(report, '/var/log/apt/history.log', 'DpkgHistoryLog.txt') attach_file_if_exists(report, '/var/log/apt/term.log', diff -Nru update-manager-16.04.3/janitor/plugincore/tests/test_documentation.py update-manager-16.04.12/janitor/plugincore/tests/test_documentation.py --- update-manager-16.04.3/janitor/plugincore/tests/test_documentation.py 2012-07-02 22:48:22.000000000 +0000 +++ update-manager-16.04.12/janitor/plugincore/tests/test_documentation.py 2017-08-10 22:08:15.000000000 +0000 @@ -72,7 +72,7 @@ def additional_tests(): "Run the doc tests (README.rst and docs/*, if any exist)" doctest_files = [ - ## os.path.abspath(resource_filename(WHOAMI, 'README.rst')), + # os.path.abspath(resource_filename(WHOAMI, 'README.rst')), ] if resource_exists(WHOAMI, 'docs'): for name in resource_listdir(WHOAMI, 'docs'): diff -Nru update-manager-16.04.3/setup.py update-manager-16.04.12/setup.py --- update-manager-16.04.3/setup.py 2014-08-05 22:45:20.000000000 +0000 +++ update-manager-16.04.12/setup.py 2017-08-10 22:08:15.000000000 +0000 @@ -34,7 +34,7 @@ class CustomBuild(build_extra.build_extra): def run(self): with open("UpdateManager/UpdateManagerVersion.py", "w") as f: - f.write("VERSION = '%s'" % version) + f.write("VERSION = '%s'\n" % version) build_extra.build_extra.run(self) diff -Nru update-manager-16.04.3/tests/aptroot-update-origin/etc/apt/sources.list update-manager-16.04.12/tests/aptroot-update-origin/etc/apt/sources.list --- update-manager-16.04.3/tests/aptroot-update-origin/etc/apt/sources.list 2012-01-25 00:35:35.000000000 +0000 +++ update-manager-16.04.12/tests/aptroot-update-origin/etc/apt/sources.list 2017-08-10 22:08:15.000000000 +0000 @@ -1,5 +1,5 @@ -deb http://archive.ubuntu.com/ubuntu lucid main -deb http://archive.ubuntu.com/ubuntu lucid-security main -deb http://security.ubuntu.com/ubuntu lucid-security main -deb http://archive.ubuntu.com/ubuntu lucid-updates main +deb http://archive.ubuntu.com/ubuntu xenial main +deb http://archive.ubuntu.com/ubuntu xenial-security main +deb http://security.ubuntu.com/ubuntu xenial-security main +deb http://archive.ubuntu.com/ubuntu xenial-updates main diff -Nru update-manager-16.04.3/tests/test_cache.py update-manager-16.04.12/tests/test_cache.py --- update-manager-16.04.3/tests/test_cache.py 2013-04-12 20:46:35.000000000 +0000 +++ update-manager-16.04.12/tests/test_cache.py 2017-08-10 22:08:15.000000000 +0000 @@ -76,6 +76,7 @@ [self.cache["package-one"]], [pkg for pkg in self.cache if pkg.marked_delete]) + if __name__ == '__main__': if len(sys.argv) > 1 and sys.argv[1] == "-v": logging.basicConfig(level=logging.DEBUG) diff -Nru update-manager-16.04.3/tests/test_changelog.py update-manager-16.04.12/tests/test_changelog.py --- update-manager-16.04.3/tests/test_changelog.py 2013-04-12 20:46:35.000000000 +0000 +++ update-manager-16.04.12/tests/test_changelog.py 2017-08-10 22:08:15.000000000 +0000 @@ -76,6 +76,7 @@ self.assertEqual(self.cache.all_changes[pkgname].count(error), 1) self.cache.CHANGELOG_ORIGIN = real_origin + if __name__ == '__main__': if len(sys.argv) > 1 and sys.argv[1] == "-v": logging.basicConfig(level=logging.DEBUG) diff -Nru update-manager-16.04.3/tests/test_meta_release_core.py update-manager-16.04.12/tests/test_meta_release_core.py --- update-manager-16.04.3/tests/test_meta_release_core.py 2016-04-07 21:25:40.000000000 +0000 +++ update-manager-16.04.12/tests/test_meta_release_core.py 2017-08-10 22:08:15.000000000 +0000 @@ -113,33 +113,33 @@ logging.debug("proxy 1") environ["http_proxy"] = "http://localhost:%s/" % self.port install_opener(None) - self.assertTrue(url_downloadable("http://www.ubuntu.com/desktop", + self.assertTrue(url_downloadable("http://archive.ubuntu.com", logging.debug), "download with proxy %s failed" % environ["http_proxy"]) logging.debug("proxy 2") environ["http_proxy"] = "http://localhost:%s" % self.port install_opener(None) - self.assertTrue(url_downloadable("http://www.ubuntu.com/desktop", + self.assertTrue(url_downloadable("http://archive.ubuntu.com", logging.debug), "download with proxy %s failed" % environ["http_proxy"]) logging.debug("no proxy") del environ["http_proxy"] install_opener(None) - self.assertTrue(url_downloadable("http://www.ubuntu.com/desktop", + self.assertTrue(url_downloadable("http://archive.ubuntu.com", logging.debug), "download with no proxy failed") logging.debug("no proxy, no valid adress") - self.assertFalse(url_downloadable("http://www.ubuntu.com/xxx", + self.assertFalse(url_downloadable("http://archive.ubuntu.com/xxx", logging.debug), "download with no proxy failed") logging.debug("proxy, no valid adress") environ["http_proxy"] = "http://localhost:%s" % self.port install_opener(None) - self.assertFalse(url_downloadable("http://www.ubuntu.com/xxx", + self.assertFalse(url_downloadable("http://archive.ubuntu.com/xxx", logging.debug), "download with no proxy failed") @@ -152,12 +152,10 @@ self.assertTrue("ver%3D16.04%20LTS" in q) def test_html_uri_real(self): + # test parsing of a meta-releaes file from the server with EnvironmentVarGuard() as environ: environ["META_RELEASE_FAKE_CODENAME"] = "lucid" - # useDevelopmentRelease=True is only needed until precise is - # released - meta = MetaReleaseCore(forceDownload=True, forceLTS=True, - useDevelopmentRelease=True) + meta = MetaReleaseCore(forceDownload=True) while meta.downloading: time.sleep(0.1) self.assertIsNotNone(meta.new_dist) @@ -251,6 +249,7 @@ self.assertEqual(meta.upgradable_to.version, "2.0") self.assertEqual(meta.upgradable_to.supported, False) + if __name__ == '__main__': if len(sys.argv) > 1 and sys.argv[1] == "-v": logging.basicConfig(level=logging.DEBUG) diff -Nru update-manager-16.04.3/tests/test_pep8.py update-manager-16.04.12/tests/test_pep8.py --- update-manager-16.04.3/tests/test_pep8.py 2014-08-05 22:45:20.000000000 +0000 +++ update-manager-16.04.12/tests/test_pep8.py 2017-08-10 22:08:15.000000000 +0000 @@ -6,7 +6,7 @@ import unittest # pep8 is overdoing it a bit IMO -IGNORE_PEP8 = "E265" +IGNORE_PEP8 = "E265,E402" IGNORE_FILES = ( ) diff -Nru update-manager-16.04.3/tests/test_proxy.py update-manager-16.04.12/tests/test_proxy.py --- update-manager-16.04.3/tests/test_proxy.py 2014-02-26 23:23:42.000000000 +0000 +++ update-manager-16.04.12/tests/test_proxy.py 2017-08-10 22:08:15.000000000 +0000 @@ -34,6 +34,7 @@ detected_proxy = init_proxy(settings) self.assertEqual(detected_proxy, self.proxy) + if __name__ == '__main__': if len(sys.argv) > 1 and sys.argv[1] == "-v": logging.basicConfig(level=logging.DEBUG) diff -Nru update-manager-16.04.3/tests/test_pyflakes.py update-manager-16.04.12/tests/test_pyflakes.py --- update-manager-16.04.3/tests/test_pyflakes.py 2015-04-14 19:41:38.000000000 +0000 +++ update-manager-16.04.12/tests/test_pyflakes.py 2017-08-10 22:08:15.000000000 +0000 @@ -55,6 +55,7 @@ print(line) self.assertEqual(0, len(filtered_contents)) + if __name__ == "__main__": import logging logging.basicConfig(level=logging.DEBUG) diff -Nru update-manager-16.04.3/tests/test_stop_update.py update-manager-16.04.12/tests/test_stop_update.py --- update-manager-16.04.3/tests/test_stop_update.py 2013-01-22 17:46:39.000000000 +0000 +++ update-manager-16.04.12/tests/test_stop_update.py 2017-08-10 22:08:15.000000000 +0000 @@ -47,6 +47,7 @@ self.assertIsInstance(p, UpdatesAvailable) self.assertIsNone(p.custom_header) + if __name__ == '__main__': if len(sys.argv) > 1 and sys.argv[1] == "-v": logging.basicConfig(level=logging.DEBUG) diff -Nru update-manager-16.04.3/tests/test_update_error.py update-manager-16.04.12/tests/test_update_error.py --- update-manager-16.04.3/tests/test_update_error.py 2013-08-06 16:45:38.000000000 +0000 +++ update-manager-16.04.12/tests/test_update_error.py 2017-08-10 22:08:15.000000000 +0000 @@ -65,6 +65,7 @@ update_backend.start() main.start_error.assert_called_once_with(True, "string", "desc") + if __name__ == '__main__': if len(sys.argv) > 1 and sys.argv[1] == "-v": logging.basicConfig(level=logging.DEBUG) diff -Nru update-manager-16.04.3/tests/test_update_list.py update-manager-16.04.12/tests/test_update_list.py --- update-manager-16.04.3/tests/test_update_list.py 2014-09-30 17:15:15.000000000 +0000 +++ update-manager-16.04.12/tests/test_update_list.py 2017-08-10 22:08:15.000000000 +0000 @@ -183,5 +183,6 @@ self.assertIsNone(group.core_item) self.assertListEqual([x.pkg.name for x in group.items], ['base-pkg']) + if __name__ == "__main__": unittest.main() diff -Nru update-manager-16.04.3/tests/test_update_origin.py update-manager-16.04.12/tests/test_update_origin.py --- update-manager-16.04.3/tests/test_update_origin.py 2013-04-12 20:46:35.000000000 +0000 +++ update-manager-16.04.12/tests/test_update_origin.py 2017-09-20 21:39:14.000000000 +0000 @@ -15,6 +15,12 @@ class TestOriginMatcher(unittest.TestCase): def setUp(self): + # mangle the arch + real_arch = apt.apt_pkg.config.find("APT::Architecture") + apt.apt_pkg.config.set("APT::Architecture", "amd64") + self.addCleanup( + lambda: apt.apt_pkg.config.set("APT::Architecture", real_arch)) + self.aptroot = os.path.join(CURDIR, "aptroot-update-origin") self.dpkg_status = open("%s/var/lib/dpkg/status" % self.aptroot, "w") @@ -45,14 +51,14 @@ for pkg in self.cache: if pkg.candidate and pkg.candidate.origins: if [l.archive for l in pkg.candidate.origins - if l.archive == "lucid-security"]: + if l.archive == "xenial-security"]: test_pkgs.add(pkg.name) self.assertTrue(len(test_pkgs) > 0) - ul = UpdateList(None, dist="lucid") + ul = UpdateList(None, dist="xenial") for pkgname in test_pkgs: pkg = self.cache[pkgname] self.assertTrue(ul._is_security_update(pkg), - "pkg '%s' is not in lucid-security" % pkg.name) + "pkg '%s' is not in xenial-security" % pkg.name) def testOriginMatcherWithVersionInUpdatesAndSecurity(self): # empty dpkg status @@ -70,14 +76,23 @@ # ensure that the origin is not -updates and -security is_in_updates = False is_in_security = False + had_security = False for v in pkg.candidate.origins: # test if the package is not in both updates and security - if v.archive == "lucid-updates": + if v.archive == "xenial-updates": is_in_updates = True - elif v.archive == "lucid-security": + elif v.archive == "xenial-security": is_in_security = True + # ensure that the package actually has any version in -security + for v in pkg.versions: + for (pkgfile, _unused) in v._cand.file_list: + o = apt.package.Origin(pkg, pkgfile) + if o.archive == "xenial-security": + had_security = True + break if (is_in_updates and not is_in_security and + had_security and len(pkg._pkg.version_list) > 2): test_pkgs.add(pkg.name) self.assertTrue(len(test_pkgs) > 0, @@ -86,11 +101,11 @@ "newer") # now test if versions in -security are detected - ul = UpdateList(None, dist="lucid") + ul = UpdateList(None, dist="xenial") for pkgname in test_pkgs: pkg = self.cache[pkgname] self.assertTrue(ul._is_security_update(pkg), - "package '%s' from lucid-updates contains also a " + "package '%s' from xenial-updates contains also a " "(not yet installed) security updates, but it is " "not labeled as such" % pkg.name) @@ -116,7 +131,7 @@ "no package '%s' installed" % pkg.name) candidate_version = getattr(pkg.candidate, "version", None) self.assertFalse(ul._is_security_update(pkg), - "package '%s' (%s) from lucid-updates is " + "package '%s' (%s) from xenial-updates is " "labelled as a security update even though we " "have marked this version as installed already" % (pkg.name, candidate_version)) diff -Nru update-manager-16.04.3/tests/test_upgrade.py update-manager-16.04.12/tests/test_upgrade.py --- update-manager-16.04.3/tests/test_upgrade.py 2013-10-02 23:18:19.000000000 +0000 +++ update-manager-16.04.12/tests/test_upgrade.py 2017-08-10 22:08:15.000000000 +0000 @@ -42,6 +42,7 @@ "/usr/bin/pkexec /usr/bin/do-release-upgrade " "--frontend=DistUpgradeViewGtk3 -d -p -s") + if __name__ == '__main__': if len(sys.argv) > 1 and sys.argv[1] == "-v": logging.basicConfig(level=logging.DEBUG) diff -Nru update-manager-16.04.3/tests/test_utils.py update-manager-16.04.12/tests/test_utils.py --- update-manager-16.04.3/tests/test_utils.py 2015-04-14 14:41:45.000000000 +0000 +++ update-manager-16.04.12/tests/test_utils.py 2017-08-10 22:08:15.000000000 +0000 @@ -31,16 +31,27 @@ self.assertTrue(estimate > 0) def test_is_child_of_process_name(self): - self.assertTrue(utils.is_child_of_process_name("init") or - utils.is_child_of_process_name("systemd")) - self.assertFalse(utils.is_child_of_process_name("mvo")) - for e in glob.glob("/proc/[0-9]*"): - pid = int(e[6:]) - utils.is_child_of_process_name("gdm", pid) + data = "1 (systemd) S 0 1 1 0 -1 4194560 255183 71659081 87 18403 \ +816 737 430168 107409 20 0 1 0 2 218931200 1882 18446744073709551615 1 1 0 0 \ +0 0 671173123 4096 1260 0 0 0 17 3 0 0 469245113 0 258124 0 0 0 0 0 0 0 0" + with mock.patch("builtins.open", + mock.mock_open(read_data=data)) as mock_file: + assert open("/proc/1/stat").read() == data + mock_file.assert_called_with("/proc/1/stat") + self.assertTrue(utils.is_child_of_process_name("init") or + utils.is_child_of_process_name("systemd")) + self.assertFalse(utils.is_child_of_process_name("mvo")) def test_is_port_listening(self): from UpdateManager.Core.utils import is_port_already_listening - self.assertTrue(is_port_already_listening(22)) + data = "9: 00000000:0016 00000000:0000 0A 00000000:00000000 \ +00:00000000 00000000 0 0 11366514 1 0000000000000000 100 \ +0 0 10 0" + with mock.patch("builtins.open", + mock.mock_open(read_data=data)) as mock_file: + assert open("/proc/net/tcp").readlines() == [data] + mock_file.assert_called_with("/proc/net/tcp") + self.assertTrue(is_port_already_listening(22)) def test_strip_auth_from_source_entry(self): from aptsources.sourceslist import SourceEntry diff -Nru update-manager-16.04.3/ubuntu-support-status update-manager-16.04.12/ubuntu-support-status --- update-manager-16.04.3/ubuntu-support-status 2014-08-05 22:45:20.000000000 +0000 +++ update-manager-16.04.12/ubuntu-support-status 2018-02-02 14:02:17.000000000 +0000 @@ -3,27 +3,63 @@ from __future__ import print_function import apt +import csv import locale import datetime import operator import os import subprocess +import time import gettext import sys from apt.utils import ( get_maintenance_end_date, - get_release_date_from_release_file, - get_release_filename_for_pkg, ) from optparse import OptionParser -from UpdateManager.Core.utils import twrap +from UpdateManager.Core.utils import twrap, get_dist -CODENAME = subprocess.Popen(["lsb_release","-c","-s"], - stdout=subprocess.PIPE, - universal_newlines=True).communicate()[0].strip() +CODENAME = get_dist() -def get_maintenance_status(cache, pkgname, supported_tag): +def get_release_date(dist): + distro_data = '/usr/share/distro-info/ubuntu.csv' + release_date = None + try: + with open(distro_data) as csvfile: + csv_reader = csv.DictReader(csvfile) + for row in csv_reader: + if row['series'] == CODENAME: + release_date = row['release'] + break + except FileNotFoundError: + return None + + if not release_date: + return None + + time_t = time.mktime(time.strptime(release_date, '%Y-%m-%d')) + release_date = datetime.datetime.fromtimestamp(time_t) + return release_date + +def get_component(origin_tag, filename_tag): + if origin_tag != "Ubuntu": + return None + + if not filename_tag: + return None + + for component in ["main", "restricted", "universe", "multiverse"]: + if filename_tag.startswith("pool/" + component): + return component + + return None + +def support_tag_override(support_tag, component): + if component in ["main", "restricted"]: + return ("5y") + return support_tag + +def get_maintenance_status(supported_tag, component, release_date): if supported_tag.endswith("y"): supported_for_n_month = 12*int(supported_tag.rstrip("y")) elif supported_tag.endswith("m"): @@ -31,25 +67,11 @@ else: raise Exception("Unsupported tag '%s'" % supported_tag) - # try to figure out the support dates of the release and make - # sure to look only for stuff in "Ubuntu" and "distro_codename" - # (to exclude stuff in ubuntu-updates for the support time - # calculation because the "Release" file time for that gets - # updated regularly) - for suite in ["", "-updates", "-proposed", "-security"]: - releasef = get_release_filename_for_pkg(cache, pkgname, - "Ubuntu", CODENAME+suite) - if releasef: - break + if component in ['main', 'restricted']: + supported_by = "Canonical" else: - raise Exception("No Release file found for %s" % pkgname) + supported_by = _("Community") - time_t = get_release_date_from_release_file(releasef) - # check the release date and show support information - # based on this - if not time_t: - raise Exception("No date tag found") - release_date = datetime.datetime.fromtimestamp(time_t) now = datetime.datetime.now() # mvo: we do not define the end date very precisely @@ -58,17 +80,16 @@ (support_end_year, support_end_month) = get_maintenance_end_date(release_date, supported_for_n_month) support_end_month_str = locale.nl_langinfo(getattr(locale,"MON_%d" % support_end_month)) # check if the support has ended - support_ended = (now.year >= support_end_year and - now.month > support_end_month) + support_ended = (now.year > support_end_year or + (now.year == support_end_year and now.month > support_end_month)) # build dict for the argument string - d = { 'support_tag' : supported_tag, + d = { 'support_duration' : supported_tag, 'support_end_month_str' : support_end_month_str, - 'support_end_year' : support_end_year } + 'support_end_year' : support_end_year, + 'supported_by' : supported_by } - if support_ended: - (False, "%(support_end_month_str)s %(support_end_year)s (%(support_tag)s)" % d) - return (True, "%(support_end_month_str)s %(support_end_year)s (%(support_tag)s)" % d) + return (not support_ended, d) if __name__ == "__main__": #FIXME: Workaround a bug in optparser which doesn't handle unicode/str @@ -118,6 +139,15 @@ # total count, for statistics total = 0 + release_date = None + + if CODENAME != 'unknown distribution': + release_date = get_release_date(CODENAME) + + if not release_date: + print ("No valid Ubuntu release found, support status unknown") + sys.exit(1) + # analyze with apt.Cache() as cache: for pkg in cache: @@ -131,12 +161,27 @@ continue # get support time support_tag = pkg.candidate.record["Supported"] - (still_supported, support_str) = get_maintenance_status(cache, - pkg.name, support_tag) + component = get_component( + pkg.candidate.record.get("Origin"), + pkg.candidate.record.get("Filename")) + if not component: + unsupported.add(pkg.name) + continue + + # Override the support tag because of inaccurate Packages + # files (LP: #1574670) + support_tag = support_tag_override(support_tag, component) + + (still_supported, details) = get_maintenance_status( + support_tag, component, release_date) if not still_supported: unsupported.add(pkg.name) continue - supported_time_for_pkgname[pkg.name] = support_tag + supported_time_for_pkgname[pkg.name] = ( + "%(support_duration)s - %(supported_by)s" % details) + support_str = ( + "%(support_end_month_str)s %(support_end_year)s " + "(%(supported_by)s - %(support_duration)s)" % details) if not support_str in supported_by_time: supported_by_time[support_str] = set() supported_by_time[support_str].add(pkg.name) diff -Nru update-manager-16.04.3/update-manager update-manager-16.04.12/update-manager --- update-manager-16.04.3/update-manager 2014-08-05 22:45:20.000000000 +0000 +++ update-manager-16.04.12/update-manager 2017-07-17 16:31:01.000000000 +0000 @@ -26,7 +26,7 @@ from __future__ import print_function from gi.repository import Gtk -from gi.repository import Gio +from gi.repository import Gio, GLib import gi gi.require_version("Gtk", "3.0") @@ -77,8 +77,8 @@ help=_("Check if a new Ubuntu release is available")) parser.add_option ("-d", "--devel-release", action="store_true", dest="devel_release", default=False, - help=_("Check if upgrading to the latest devel release " - "is possible")) + help=_("If using the latest supported release, " + "upgrade to the development release")) parser.add_option ("-p","--proposed", action="store_true", dest="use_proposed", default=False, help=_("Upgrade using the latest proposed version of the release upgrader")) @@ -114,7 +114,8 @@ # keep track when we run (for update-notifier) settings = Gio.Settings.new("com.ubuntu.update-manager") - settings.set_int("launch-time", int(time.time())) + launch_time = GLib.Variant('x', time.time()) + settings.set_value("launch-time", launch_time) init_proxy(settings) app = UpdateManager(data_dir, options) diff -Nru update-manager-16.04.3/UpdateManager/backend/InstallBackendAptdaemon.py update-manager-16.04.12/UpdateManager/backend/InstallBackendAptdaemon.py --- update-manager-16.04.3/UpdateManager/backend/InstallBackendAptdaemon.py 2014-08-05 22:45:20.000000000 +0000 +++ update-manager-16.04.12/UpdateManager/backend/InstallBackendAptdaemon.py 2017-08-10 22:08:15.000000000 +0000 @@ -69,7 +69,7 @@ self._action_done(self.ACTION_UPDATE, authorized=False, success=False, error_string=None, error_desc=None) - except: + except Exception as e: self._action_done(self.ACTION_UPDATE, authorized=True, success=False, error_string=None, error_desc=None) diff -Nru update-manager-16.04.3/UpdateManager/ChangelogViewer.py update-manager-16.04.12/UpdateManager/ChangelogViewer.py --- update-manager-16.04.3/UpdateManager/ChangelogViewer.py 2014-09-30 17:15:58.000000000 +0000 +++ update-manager-16.04.12/UpdateManager/ChangelogViewer.py 2016-12-19 21:46:10.000000000 +0000 @@ -213,10 +213,15 @@ # get the iter at the mouse position (x, y) = self.window_to_buffer_coords(Gtk.TextWindowType.WIDGET, int(event.x), int(event.y)) - iter = self.get_iter_at_location(x, y) - # call open_url or menu.popup if an URL is assigned to the iter - tags = iter.get_tags() + try: + iter = self.get_iter_at_location(x, y) + tags = iter.get_tags() + except AttributeError: + # GTK > 3.20 added a return type to this function + (over_text, iter) = self.get_iter_at_location(x, y) + tags = iter.get_tags() + for tag in tags: if hasattr(tag, "url"): if event.button == 1: @@ -253,10 +258,15 @@ a hand cursor""" _hovering = False # get the iter at the mouse position - iter = self.get_iter_at_location(x, y) + try: + iter = self.get_iter_at_location(x, y) + tags = iter.get_tags() + except AttributeError: + # GTK > 3.20 added a return type to this function + (over_text, iter) = self.get_iter_at_location(x, y) + tags = iter.get_tags() # set _hovering if the iter has the tag "url" - tags = iter.get_tags() for tag in tags: if hasattr(tag, "url"): _hovering = True diff -Nru update-manager-16.04.3/UpdateManager/Core/MetaRelease.py update-manager-16.04.12/UpdateManager/Core/MetaRelease.py --- update-manager-16.04.3/UpdateManager/Core/MetaRelease.py 2016-04-07 21:16:56.000000000 +0000 +++ update-manager-16.04.12/UpdateManager/Core/MetaRelease.py 2017-08-10 22:08:15.000000000 +0000 @@ -236,42 +236,46 @@ # parse the metarelease_information file index_tag = apt_pkg.TagFile(self.metarelease_information) - while index_tag.step(): - for required_key in ("Dist", "Version", "Supported", "Date"): - if required_key not in index_tag.section: - raise MetaReleaseParseError( - "Required key '%s' missing" % required_key) - name = index_tag.section["Dist"] - self._debug("found distro name: '%s'" % name) - rawdate = index_tag.section["Date"] - parseddate = list(email.utils.parsedate(rawdate)) - parseddate[8] = 0 # assume no DST - date = time.mktime(tuple(parseddate)) - supported = int(index_tag.section["Supported"]) - version = index_tag.section["Version"] - # add the information to a new date object - dist = Dist(name, version, date, supported) - if "ReleaseNotes" in index_tag.section: - dist.releaseNotesURI = index_tag.section["ReleaseNotes"] - lang = get_lang() - if lang: - dist.releaseNotesURI += "?lang=%s" % lang - if "ReleaseNotesHtml" in index_tag.section: - dist.releaseNotesHtmlUri = index_tag.section[ - "ReleaseNotesHtml"] - query = self._get_release_notes_uri_query_string(dist) - if query: - dist.releaseNotesHtmlUri += query - if "UpgradeTool" in index_tag.section: - dist.upgradeTool = index_tag.section["UpgradeTool"] - if "UpgradeToolSignature" in index_tag.section: - dist.upgradeToolSig = index_tag.section[ - "UpgradeToolSignature"] - if "UpgradeBroken" in index_tag.section: - dist.upgrade_broken = index_tag.section["UpgradeBroken"] - dists.append(dist) - if name == current_dist_name: - current_dist = dist + try: + while index_tag.step(): + for required_key in ("Dist", "Version", "Supported", "Date"): + if required_key not in index_tag.section: + raise MetaReleaseParseError( + "Required key '%s' missing" % required_key) + name = index_tag.section["Dist"] + self._debug("found distro name: '%s'" % name) + rawdate = index_tag.section["Date"] + parseddate = list(email.utils.parsedate(rawdate)) + parseddate[8] = 0 # assume no DST + date = time.mktime(tuple(parseddate)) + supported = int(index_tag.section["Supported"]) + version = index_tag.section["Version"] + # add the information to a new date object + dist = Dist(name, version, date, supported) + if "ReleaseNotes" in index_tag.section: + dist.releaseNotesURI = index_tag.section["ReleaseNotes"] + lang = get_lang() + if lang: + dist.releaseNotesURI += "?lang=%s" % lang + if "ReleaseNotesHtml" in index_tag.section: + dist.releaseNotesHtmlUri = index_tag.section[ + "ReleaseNotesHtml"] + query = self._get_release_notes_uri_query_string(dist) + if query: + dist.releaseNotesHtmlUri += query + if "UpgradeTool" in index_tag.section: + dist.upgradeTool = index_tag.section["UpgradeTool"] + if "UpgradeToolSignature" in index_tag.section: + dist.upgradeToolSig = index_tag.section[ + "UpgradeToolSignature"] + if "UpgradeBroken" in index_tag.section: + dist.upgrade_broken = index_tag.section["UpgradeBroken"] + dists.append(dist) + if name == current_dist_name: + current_dist = dist + except SystemError: + raise MetaReleaseParseError("Unable to parse %s" % + self.METARELEASE_URI) self.metarelease_information.close() self.metarelease_information = None @@ -366,7 +370,7 @@ self._debug("have self.metarelease_information") try: self.parse() - except: + except Exception as e: logging.exception("parse failed for '%s'" % self.METARELEASE_FILE) # no use keeping a broken file around diff -Nru update-manager-16.04.3/UpdateManager/Core/MyCache.py update-manager-16.04.12/UpdateManager/Core/MyCache.py --- update-manager-16.04.3/UpdateManager/Core/MyCache.py 2014-08-05 22:45:20.000000000 +0000 +++ update-manager-16.04.12/UpdateManager/Core/MyCache.py 2017-08-10 22:08:15.000000000 +0000 @@ -175,9 +175,9 @@ def _strip_epoch(self, verstr): " strip of the epoch " - l = verstr.split(":") - if len(l) > 1: - verstr = "".join(l[1:]) + vers_no_epoch = verstr.split(":") + if len(vers_no_epoch) > 1: + verstr = "".join(vers_no_epoch[1:]) return verstr def _get_changelog_or_news(self, name, fname, strict_versioning=False, @@ -199,9 +199,9 @@ srcver = self._strip_epoch(srcver_epoch) #print("bin: %s" % binver) - l = section.split("/") - if len(l) > 1: - src_section = l[0] + split_section = section.split("/") + if len(split_section) > 1: + src_section = split_section[0] # lib is handled special prefix = srcpkg[0] @@ -302,7 +302,7 @@ self.get_changelog(name) try: lock.release() - except: + except Exception as e: pass def get_news(self, name): diff -Nru update-manager-16.04.3/UpdateManager/Core/roam.py update-manager-16.04.12/UpdateManager/Core/roam.py --- update-manager-16.04.3/UpdateManager/Core/roam.py 2012-07-02 22:48:22.000000000 +0000 +++ update-manager-16.04.12/UpdateManager/Core/roam.py 2017-08-10 22:08:15.000000000 +0000 @@ -194,6 +194,7 @@ res |= mmhelper.is_cdma_roaming() return res + if __name__ == "__main__": # test code diff -Nru update-manager-16.04.3/UpdateManager/Core/UpdateList.py update-manager-16.04.12/UpdateManager/Core/UpdateList.py --- update-manager-16.04.3/UpdateManager/Core/UpdateList.py 2015-10-05 21:49:01.000000000 +0000 +++ update-manager-16.04.12/UpdateManager/Core/UpdateList.py 2017-08-10 22:08:15.000000000 +0000 @@ -98,9 +98,9 @@ # This shouldn't really happen. If we land here often, it's a sign # that something has gone wrong. Unless all pkgs are None it's not # a critical issue - a hit to the performance at most. - reason = ((not pkg or not pkg.candidate) - and "Package was None or didn't have a candidate." - or "%s already in _deps." % pkg.name) + reason = ((not pkg or not pkg.candidate) and + "Package was None or didn't have a candidate." or + "%s already in _deps." % pkg.name) logging.debug("Useless call to _add_deps. %s" % reason) return if len(self._deps) % 200 == 0 and callable(eventloop_callback): @@ -273,8 +273,8 @@ desktop_file) application.set_desktop_env(self.current_desktop) except Exception as e: - print("Error loading .desktop file %s: %s" % - (desktop_file, e)) + logging.warning("Error loading .desktop file %s: %s" % + (desktop_file, e)) continue score = self._rate_application_for_package(application, pkg) if score > 0: diff -Nru update-manager-16.04.3/UpdateManager/Core/utils.py update-manager-16.04.12/UpdateManager/Core/utils.py --- update-manager-16.04.3/UpdateManager/Core/utils.py 2016-04-07 18:03:15.000000000 +0000 +++ update-manager-16.04.12/UpdateManager/Core/utils.py 2017-08-10 22:08:15.000000000 +0000 @@ -105,7 +105,7 @@ import dbus bus = dbus.SessionBus() unity_running = bus.name_has_owner("com.canonical.Unity") - except: + except Exception as e: logging.exception("could not check for Unity dbus service") return unity_running @@ -370,16 +370,14 @@ from gi.repository import Gio, GLib connection = Gio.bus_get_sync(Gio.BusType.SYSTEM) - var, fdlist = connection.call_with_unix_fd_list_sync('org.freedesktop.login1', - '/org/freedesktop/login1', - 'org.freedesktop.login1.Manager', - 'Inhibit', - GLib.Variant('(ssss)', - ('shutdown:sleep', - 'UpdateManager', - 'Updating System', - 'block')), - None, 0, -1, None, None) + var, fdlist = connection.call_with_unix_fd_list_sync( + 'org.freedesktop.login1', '/org/freedesktop/login1', + 'org.freedesktop.login1.Manager', 'Inhibit', + GLib.Variant('(ssss)', + ('shutdown:sleep', + 'UpdateManager', 'Updating System', + 'block')), + None, 0, -1, None, None) inhibitor = Gio.UnixInputStream(fd=fdlist.steal_fds()[var[0]]) return inhibitor @@ -387,6 +385,7 @@ #print("could not send the dbus Inhibit signal: %s" % e) return False + def str_to_bool(str): if str == "0" or str.upper() == "FALSE": return False @@ -502,7 +501,7 @@ STATE_LISTENING = '0A' # read the data with open("/proc/net/tcp") as net_tcp: - for line in net_tcp: + for line in net_tcp.readlines(): line = line.strip() if not line: continue diff -Nru update-manager-16.04.3/UpdateManager/Dialogs.py update-manager-16.04.12/UpdateManager/Dialogs.py --- update-manager-16.04.3/UpdateManager/Dialogs.py 2015-02-18 19:36:22.000000000 +0000 +++ update-manager-16.04.12/UpdateManager/Dialogs.py 2017-08-10 22:08:15.000000000 +0000 @@ -302,7 +302,7 @@ iface.RequestReboot() except dbus.DBusException: self._request_reboot_via_consolekit() - except: + except Exception as e: pass def _request_reboot_via_consolekit(self): @@ -315,7 +315,7 @@ iface.Restart() except dbus.DBusException: self._request_reboot_via_logind() - except: + except Exception as e: pass def _request_reboot_via_logind(self): diff -Nru update-manager-16.04.3/UpdateManager/UpdateManager.py update-manager-16.04.12/UpdateManager/UpdateManager.py --- update-manager-16.04.3/UpdateManager/UpdateManager.py 2014-09-30 17:15:32.000000000 +0000 +++ update-manager-16.04.12/UpdateManager/UpdateManager.py 2017-08-10 22:08:15.000000000 +0000 @@ -365,7 +365,7 @@ # listening on dbus try: bus = dbus.SessionBus() - except: + except Exception as e: print("warning: could not initiate dbus") return try: @@ -403,7 +403,7 @@ try: self.parent.start_install() return True - except: + except Exception as e: return False def _on_network_alert(self, watcher, state): diff -Nru update-manager-16.04.3/UpdateManager/UpdatesAvailable.py update-manager-16.04.12/UpdateManager/UpdatesAvailable.py --- update-manager-16.04.3/UpdateManager/UpdatesAvailable.py 2016-04-07 18:01:59.000000000 +0000 +++ update-manager-16.04.12/UpdateManager/UpdatesAvailable.py 2017-09-20 21:39:17.000000000 +0000 @@ -821,25 +821,56 @@ def on_button_install_clicked(self): self.unity.set_install_menuitem_visible(False) - #print("on_button_install_clicked") + # print("on_button_install_clicked") err_sum = _("Not enough free disk space") - err_long = _("The upgrade needs a total of %s free space on " - "disk '%s'. " - "Please free at least an additional %s of disk " - "space on '%s'. " - "Empty your trash and remove temporary " - "packages of former installations using " - "'sudo apt-get clean'.") + err_msg = _("The upgrade needs a total of %s free space on " + "disk '%s'. " + "Please free at least an additional %s of disk " + "space on '%s'. %s") + # specific ways to resolve lack of free space + remedy_archivedir = _("Remove temporary packages of former " + "installations using 'sudo apt clean'.") + remedy_boot = _("You can remove old kernels using " + "'sudo apt autoremove', and you could also " + "set COMPRESS=xz in " + "/etc/initramfs-tools/initramfs.conf to " + "reduce the size of your initramfs.") + remedy_root = _("Empty your trash and remove temporary " + "packages of former installations using " + "'sudo apt clean'.") + remedy_tmp = _("Reboot to clean up files in /tmp.") + remedy_usr = _("") # check free space and error if its not enough try: self.cache.checkFreeSpace() except NotEnoughFreeSpaceError as e: + # CheckFreeSpace examines where packages are cached + archivedir = apt_pkg.config.find_dir("Dir::Cache::archives") + err_long = "" for req in e.free_space_required_list: - self.window_main.start_error(False, err_sum, - err_long % (req.size_total, - req.dir, - req.size_needed, - req.dir)) + if err_long != "": + err_long += " " + if req.dir == archivedir: + err_long += err_msg % (req.size_total, req.dir, + req.size_needed, req.dir, + remedy_archivedir) + elif req.dir == "/boot": + err_long += err_msg % (req.size_total, req.dir, + req.size_needed, req.dir, + remedy_boot) + elif req.dir == "/": + err_long += err_msg % (req.size_total, req.dir, + req.size_needed, req.dir, + remedy_root) + elif req.dir == "/tmp": + err_long += err_msg % (req.size_total, req.dir, + req.size_needed, req.dir, + remedy_tmp) + elif req.dir == "/usr": + err_long += err_msg % (req.size_total, req.dir, + req.size_needed, req.dir, + remedy_usr) + self.window_main.start_error(False, err_sum, err_long) return except SystemError as e: logging.exception("free space check failed") diff -Nru update-manager-16.04.3/UpdateManagerText/UpdateManagerText.py update-manager-16.04.12/UpdateManagerText/UpdateManagerText.py --- update-manager-16.04.3/UpdateManagerText/UpdateManagerText.py 2012-07-02 22:48:22.000000000 +0000 +++ update-manager-16.04.12/UpdateManagerText/UpdateManagerText.py 2017-08-10 22:08:15.000000000 +0000 @@ -185,6 +185,7 @@ res = self.cache.commit(apt.progress.text.AcquireProgress(), apt.progress.base.InstallProgress()) + if __name__ == "__main__": umt = UpdateManagerText()