diff -Nru ubuntu-release-upgrader-18.04.19/data/DistUpgrade.cfg ubuntu-release-upgrader-18.04.21/data/DistUpgrade.cfg --- ubuntu-release-upgrader-18.04.19/data/DistUpgrade.cfg 2018-04-12 19:13:56.000000000 +0000 +++ ubuntu-release-upgrader-18.04.21/data/DistUpgrade.cfg 2018-07-09 20:56:35.000000000 +0000 @@ -23,6 +23,7 @@ KeepInstalledPkgs=xserver-xorg-video-all KeepInstalledSection=translations RemoveObsoletes=yes +PurgeObsoletes=yes #ForcedObsoletes=ksplash-engine-moodin, powernowd, laptop-mode-tools # hints for for stuff that should be done right after the cache calculated # the dist-upgrade (not to be confused with the PostUpgrade hooks in the diff -Nru ubuntu-release-upgrader-18.04.19/data/DistUpgrade.cfg.xenial ubuntu-release-upgrader-18.04.21/data/DistUpgrade.cfg.xenial --- ubuntu-release-upgrader-18.04.19/data/DistUpgrade.cfg.xenial 2017-11-06 16:21:20.000000000 +0000 +++ ubuntu-release-upgrader-18.04.21/data/DistUpgrade.cfg.xenial 2018-07-09 20:56:47.000000000 +0000 @@ -23,6 +23,7 @@ KeepInstalledPkgs=xserver-xorg-video-all KeepInstalledSection=translations RemoveObsoletes=yes +PurgeObsoletes=yes #ForcedObsoletes=ksplash-engine-moodin, powernowd, laptop-mode-tools # hints for for stuff that should be done right after the cache calculated # the dist-upgrade (not to be confused with the PostUpgrade hooks in the diff -Nru ubuntu-release-upgrader-18.04.19/data/mirrors.cfg ubuntu-release-upgrader-18.04.21/data/mirrors.cfg --- ubuntu-release-upgrader-18.04.19/data/mirrors.cfg 2018-05-02 19:43:44.000000000 +0000 +++ ubuntu-release-upgrader-18.04.21/data/mirrors.cfg 2018-07-15 17:16:16.000000000 +0000 @@ -204,7 +204,6 @@ http://ucmirror.canterbury.ac.nz/ubuntu/ http://www-ftp.lip6.fr/pub/linux/distributions/Ubuntu/archive/ http://archive.ubuntu.nautile.nc/ubuntu/ -http://cosmos.cites.illinois.edu/pub/ubuntu/ http://ftp.arnes.si/pub/mirrors/ubuntu/ http://ftp.litnet.lt/ubuntu/ http://ftp.sjtu.edu.cn/ubuntu/ @@ -239,7 +238,6 @@ http://ftp.uni-mainz.de/ubuntu/ http://mirror.cogentco.com/pub/linux/ubuntu/ http://mirror.easyspeedy.com/ubuntu/ -http://mirror.jmu.edu/pub/ubuntu/ http://mirror.overthewire.com.au/ubuntu/ http://mirror.unej.ac.id/ubuntu/ http://mirrors.arpnetworks.com/Ubuntu/ @@ -314,9 +312,7 @@ http://mirror.mythic-beasts.com/ubuntu/ http://ftp.rz.tu-bs.de/pub/mirror/ubuntu-packages/ http://ubuntu.mirror.garr.it/ubuntu/ -http://mirrors.eastera.tj/ubuntu/ http://ubuntu.inode.at/ubuntu/ -http://ubuntu.uni-sofia.bg/ubuntu/ http://ftp.udc.es/ubuntu/ http://mirror.fairway.ne.jp/ubuntu/ http://mirror.idealhosting.net.tr/ubuntu/ @@ -337,7 +333,6 @@ http://ftp.aso.ee/ubuntu/ http://ftp.rezopole.net/ubuntu/ http://deb-mirror.habari.co.tz/ubuntu/ -http://ftp.utexas.edu/ubuntu/ http://giano.com.dist.unige.it/ubuntu/ http://mirror.math.princeton.edu/pub/ubuntu/ http://mirror.datacenter.az/ubuntu/ @@ -358,7 +353,6 @@ http://ftp.sh.cvut.cz/ubuntu/ http://ubuntu.mirror.ftn.uns.ac.rs/archive/ http://uk-mirrors.evowise.com/ubuntu/ -http://ubuntu.uniminuto.edu/ubuntu/ http://ubuntu-mirror.parsdev.net/ubuntu-archive/ http://mirror.aminidc.com/ubuntu/ http://ubuntu.man.lodz.pl/ubuntu/ @@ -369,7 +363,6 @@ http://la-mirrors.evowise.com/ubuntu/ http://mirror.rasanegar.com/ubuntu/archive/ http://ubuntu.mirror.true.nl/ubuntu/ -http://mirror.atomki.mta.hu/ubuntu/ http://mirror.vnet.sk/ubuntu/ http://mirror.cedille.club/ubuntu/ http://es-mirrors.evowise.com/ubuntu/ @@ -388,12 +381,10 @@ http://ubuntu.asis.io/ http://mirrors.bangmod.cloud/ubuntu/ http://mirrors.sohu.com/ubuntu/ -http://ubuntu-archive.adsolux.com/ubuntu/ http://mirrors.cloud.linets.cl/ubuntu/ http://archive.ubuntu.mirror.ba/ubuntu/ http://mirror.upb.edu.co/ubuntu/ http://pubmirror01.lwlcom.net/ubuntu/ -http://mirror.squ.edu.om/ubuntuarchive/ http://mirror.datacenter.mn/ubuntu/ http://buaya.klas.or.id/ubuntu/ http://fireball-public.phys.wvu.edu/mirror/ubuntu/ @@ -418,17 +409,14 @@ http://repo.iut.ac.ir/repo/Ubuntu/ http://mirror.previder.nl/ubuntu/ http://mirror.team-cymru.org/ubuntu/ -http://mirror.blizoo.mk/ubuntu/ http://mirror.clibre.uqam.ca/ubuntu/ http://mirror.renu.ac.ug/ubuntu/ http://mirror.library.ucy.ac.cy/linux/ubuntu/archive/ http://ubuntu.hostiran.ir/ubuntuarchive/ -http://ftp.cc.uoc.gr/mirrors/linux/ubuntu/packages/ http://mirror.vpsnet.com/ubuntu/ http://mirrors.xservers.ro/ubuntu/ http://mirror1.totbb.net/ubuntu/ http://download.nust.na/pub/ubuntu/ubuntu/ -http://mirror.kumi.systems/ubuntu/ http://mirror.truenetwork.ru/ubuntu/ http://ubuntu.mirror.iodc.dk/ubuntu/ http://ubuntu.vargonen.com/ubuntu/ @@ -452,15 +440,12 @@ http://ubuntu.cs.nctu.edu.tw/ubuntu/ http://mirror.muvhost.com/ubuntu/ http://mirror.clearsky.vn/ubuntu/ -http://ftp.harukasan.org/ubuntu/ http://mirror.aptus.co.tz/pub/ubuntuarchive/ http://mirror.as24220.net/pub/ubuntu/ http://mirror.vpgrp.io/ubuntu/ http://mirrors.nxthost.com/ubuntu/ http://ubuntu.cybertips.info/ubuntu/ http://mirror.picosecond.org/ubuntu/ -http://del-mirrors.extreme-ix.org/ubuntu/ -http://mirror.uzcloud.uz/ubuntu/ http://mirror.xeonbd.com/ubuntu-archive/ http://ubuntu.colocall.net/ubuntu/ http://ubuntu.mirror.serverloft.de/ubuntu/ @@ -470,7 +455,6 @@ http://mirror.espol.edu.ec/ubuntu/ http://mirror.intergrid.com.au/ubuntu/ http://mirror.sjc02.svwh.net/ubuntu/ -http://be.mirror.guru/ubuntu/ http://ubuntu.tuxuri.com/ubuntu/ http://ubuntu.melbourneitmirror.net/archive/ http://linuxmirrors.ir/pub/ubuntu/ @@ -486,27 +470,45 @@ http://ubuntu.byteiran.com/ubuntu/ http://ubuntu-mirror.jbstuff.net/ubuntu/ http://mirrors.powernet.com.ru/ubuntu/archive/ -http://nl.mirror.guru/ubuntu/ http://mirrors.nav.ro/ubuntu/ http://mirror.wtnet.de/ubuntu/ http://mirror.kakao.com/ubuntu/ http://ubuntu.mirror.neology.co.za/ubuntu/ -http://se.mirror.guru/ubuntu/ http://rawpower.ddns.net/ubuntu/ http://mirror.cse.iitk.ac.in/ubuntu/ http://mirrors.mivocloud.com/ubuntu/ -http://ubuntu.mirror.solnode.io/ubuntu/ http://mirror.serverius.net/ubuntu/ http://ubuntu.mirrors.skynet.be/ubuntu/ http://mirror.armaghan.net/ubuntu/ http://ftp.klid.dk/ftp/ubuntu/ -http://ubuntu.repo.unpas.ac.id/ubuntu/ http://mirrors.layeronline.com/ubuntu/ -http://ftp.heikorichter.name/ubuntu/ http://repo.unpatti.ac.id/ubuntu/ http://ftp.heanet.ie/pub/ubuntu/ http://mirror.iodc.dk/ubuntu/ http://mirror.unesp.br/ubuntu/ http://mirror.mrjester.net/ubuntu/archive/ http://mirror.ehost.vn/ubuntu/ -http://mirror.delorahosting.com/ubuntu/ +http://mirrors.serverhost.ro/ubuntu/ +http://mirror.thaidns.co.th/ubuntu/ +http://archive.tunnelbiz.com/ubuntu/ +http://mirror.ps.kz/ubuntu/ +http://mirror.kamp.de/ubuntu/ +http://mirror.team-cymru.com/ubuntu/ +http://mirror.cs.jmu.edu/pub/ubuntu/ +http://del-repos.extreme-ix.org/ubuntu/ +http://mirrors.cat.pdx.edu/ubuntu/ +http://mirrors.nju.edu.cn/ubuntu/ +http://mirrors.ulbsibiu.ro/ubuntu/ +http://mirror.onevip.mk/ubuntu/ +http://mirrors.huaweicloud.com/repository/ubuntu/ +http://mirror.connorfreebairn.rocks/ubuntu/ +http://mirrors.opencas.org/ubuntu/ +http://linux.yz.yamagata-u.ac.jp/ubuntu/ +http://mirror.nwlab.tk/ubuntu/ +http://mirror.cc.columbia.edu/pub/linux/ubuntu/archive/ +http://mirror.iranserver.com/ubuntu/ +http://packages.oth-regensburg.de/ubuntu/ +http://ftp.harukasan.org/ubuntu/ +http://ftp.cc.uoc.gr/mirrors/linux/ubuntu/packages/ +http://ftp.utexas.edu/ubuntu/ +http://mirrors.nwafu.edu.cn/ubuntu/ diff -Nru ubuntu-release-upgrader-18.04.19/debian/changelog ubuntu-release-upgrader-18.04.21/debian/changelog --- ubuntu-release-upgrader-18.04.19/debian/changelog 2018-05-03 13:55:34.000000000 +0000 +++ ubuntu-release-upgrader-18.04.21/debian/changelog 2018-07-15 17:16:16.000000000 +0000 @@ -1,3 +1,29 @@ +ubuntu-release-upgrader (1:18.04.21) bionic; urgency=medium + + * DistUpgradeQuirks.py: when a snap fails to install try the next one + instead of trying to check the return code of the called process which + causes a Traceback. (LP: #1781412) + * data/mirrors.cfg: Update the list of official mirrors. + + -- Brian Murray Sun, 15 Jul 2018 10:16:16 -0700 + +ubuntu-release-upgrader (1:18.04.20) bionic; urgency=medium + + * Purge obsolete packages, if user agrees to remove obsolete + packages. LP: #1775660 + * DistUpgradeQuirks.py, DistUpgradeController.py: move inhibiting of + gnome-session idle so that it is called immediately after the upgrade + starts (LP: #1778817), present a dialog notifying that the lock screen has + been disabled (LP: #1174093), and do not reenable the lock screen as it + may fail to work after a release upgrade. (LP: #1780342) + * DistUpgradeQuirks.py: Add in a quirk for upgrading to Bionic that will + check if the system has connectivity to the snap store and replace some + desktop packages with snaps to ensure the system is similar to a fresh + install. (LP: #1780841) + * data/mirrors.cfg: Update the list of official mirrors. + + -- Brian Murray Mon, 09 Jul 2018 13:59:08 -0700 + ubuntu-release-upgrader (1:18.04.19) bionic; urgency=medium * Add upgrade telemetry information (LP: #1755456) diff -Nru ubuntu-release-upgrader-18.04.19/DistUpgrade/DistUpgradeController.py ubuntu-release-upgrader-18.04.21/DistUpgrade/DistUpgradeController.py --- ubuntu-release-upgrader-18.04.19/DistUpgrade/DistUpgradeController.py 2018-05-03 13:55:34.000000000 +0000 +++ ubuntu-release-upgrader-18.04.21/DistUpgrade/DistUpgradeController.py 2018-07-09 20:59:08.000000000 +0000 @@ -188,6 +188,9 @@ # apt cron job self._aptCronJobPerms = 0o755 + # for inhibiting idle + self._uid = '' + self._user_env = {} def openCache(self, lock=True, restore_sources_list_on_fail=False): logging.debug("openCache()") @@ -1894,6 +1897,7 @@ self._view.updateStatus(_("Calculating the changes")) if not self.askDistUpgrade(): self.abort() + self._inhibitIdle() # fetch the stuff self._view.setStep(Step.FETCH) @@ -1984,6 +1988,57 @@ _("The partial upgrade was completed.")) return True + def _inhibitIdle(self): + if os.path.exists("/usr/bin/gnome-session-inhibit"): + self._uid = os.environ.get('SUDO_UID', '') + if not self._uid: + self._uid = os.environ.get('PKEXEC_UID', '') + if not self._uid: + logging.debug("failed to determine user upgrading") + logging.error("failed to inhibit gnome-session idle") + return + self._getUserEnv() + if not self._user_env: + return + #seteuid so dbus user session can be accessed + os.seteuid(int(self._uid)) + + logging.debug("inhibit gnome-session idle") + try: + xdg_desktop = self._user_env.get("XDG_CURRENT_DESKTOP", "") + if not xdg_desktop: + logging.debug("failed to find XDG_CURRENT_DESKTOP") + logging.error("failed to inhibit gnome-session idle") + return + subprocess.Popen(["gnome-session-inhibit", "--inhibit", + "idle", "--inhibit-only"], + env=self._user_env) + self._view.information(_("Lock screen disabled"), + _("Your lock screen has been " + "disabled and will remain " + "disabled until you reboot.")) + except (OSError, ValueError): + logging.exception("failed to inhibit gnome-session idle") + os.seteuid(os.getuid()) + + def _getUserEnv(self): + try: + pid = subprocess.check_output(["pgrep", "-u", self._uid, + "gnome-session"]) + pid = pid.decode().split('\n')[0] + with open('/proc/' + pid + '/environ', 'r') as f: + data = f.read().split('\x00') + for line in data: + if len(line): + env = line.split('=', 1) + self._user_env[env[0]] = env[1] + except subprocess.CalledProcessError as e: + if e.returncode == 1: + logging.debug("gnome-session not running for user") + else: + logging.exception("failed to read user env") + + if __name__ == "__main__": from .DistUpgradeViewText import DistUpgradeViewText diff -Nru ubuntu-release-upgrader-18.04.19/DistUpgrade/DistUpgradeQuirks.py ubuntu-release-upgrader-18.04.21/DistUpgrade/DistUpgradeQuirks.py --- ubuntu-release-upgrader-18.04.19/DistUpgrade/DistUpgradeQuirks.py 2018-04-12 19:13:28.000000000 +0000 +++ ubuntu-release-upgrader-18.04.21/DistUpgrade/DistUpgradeQuirks.py 2018-07-15 17:16:13.000000000 +0000 @@ -124,6 +124,19 @@ """ run before the apt cache is opened the first time """ logging.debug("running Quirks.PreCacheOpen") + # individual quirks handler that run *after* the cache is opened + def bionicPostInitialUpdate(self): + # PreCacheOpen would be better but controller.abort fails terribly + """ run after the apt cache is opened the first time """ + logging.debug("running Quirks.bionicPostInitialUpdate") + if self.controller.cache['ubuntu-desktop'].is_installed: + self._checkStoreConnectivity() + + def bionicPostUpgrade(self): + logging.debug("running Quirks.bionicPostUpgrade") + if self.controller.cache['ubuntu-desktop'].is_installed: + self._replaceDebsWithSnaps() + # individual quirks handler when the dpkg run is finished --------- def PostCleanup(self): " run after cleanup " @@ -131,6 +144,7 @@ # run right before the first packages get installed def StartUpgrade(self): + logging.debug("running Quirks.StartUpgrade") self._applyPatches() self._removeOldApportCrashes() self._killUpdateNotifier() @@ -471,6 +485,69 @@ except Exception as e: logging.warning("error during unlink of old crash files (%s)" % e) + def _checkStoreConnectivity(self): + """ check for connectivity to the snap store to install snaps""" + res = False + connected = Popen(["snap", "debug", "connectivity"], stdout=PIPE, + stderr=PIPE, universal_newlines=True).communicate() + if re.search("^ \* PASS", connected[0], re.MULTILINE): + return + # can't connect + elif re.search("^ \*.*unreachable", connected[0], re.MULTILINE): + logging.error("No snap store connectivity") + res = self._view.askYesNoQuestion( + _("Connection to Snap Store failed"), + _("Your system does not have a connection to the Snap " + "Store. For the best upgrade experience make sure " + "that your system can connect to api.snapcraft.io.\n" + "Do you still want to continue with the upgrade?") + ) + # debug command not available + elif 'error: unknown command' in connected[1]: + logging.error("snap debug command not available") + res = self._view.askYesNoQuestion( + _("Outdated snapd package"), + _("Your system does not have the latest version of snapd. " + "Please update the version of snapd on your system to " + "improve the upgrade experience.\n" + "Do you still want to continue with the upgrade?") + ) + # not running as root + elif 'error: access denied' in connected[1]: + res = False + logging.error("Not running as root!") + if not res: + self.controller.abort() + + def _replaceDebsWithSnaps(self): + """ install a snap and mark its corresponding package for removal """ + # gtk-common-themes isn't a package name but is this risky? + snaps = ['gtk-common-themes', 'gnome-calculator', 'gnome-characters', + 'gnome-logs', 'gnome-system-monitor'] + installed_snaps = subprocess.Popen(["snap", "list"], + universal_newlines=True, + stdout=PIPE).communicate() + for snap in snaps: + installed = False + # check to see if the snap is already installed + if re.search("^%s " % snap, installed_snaps[0], re.MULTILINE): + logging.debug("Snap %s is already installed" % snap) + installed = True + if not installed: + try: + proc = subprocess.run(["snap", "install", "--channel", + "stable/ubuntu-18.04", snap], + stdout=subprocess.PIPE, + check=True) + except subprocess.CalledProcessError: + logging.debug("Install of snap %s failed" % snap) + continue + if proc.returncode == 0: + logging.debug("Install of snap %s succeeded" % snap) + installed = True + if installed: + self.controller.forced_obsoletes.append(snap) + def _checkPae(self): " check PAE in /proc/cpuinfo " # upgrade from Precise will fail if PAE is not in cpu flags diff -Nru ubuntu-release-upgrader-18.04.19/DistUpgrade/DistUpgradeVersion.py ubuntu-release-upgrader-18.04.21/DistUpgrade/DistUpgradeVersion.py --- ubuntu-release-upgrader-18.04.19/DistUpgrade/DistUpgradeVersion.py 2018-05-02 19:43:44.000000000 +0000 +++ ubuntu-release-upgrader-18.04.21/DistUpgrade/DistUpgradeVersion.py 2018-07-15 17:16:16.000000000 +0000 @@ -1 +1 @@ -VERSION = '18.04.18' +VERSION = '18.04.21' diff -Nru ubuntu-release-upgrader-18.04.19/tests/test_pyflakes.py ubuntu-release-upgrader-18.04.21/tests/test_pyflakes.py --- ubuntu-release-upgrader-18.04.19/tests/test_pyflakes.py 2017-05-18 17:38:50.000000000 +0000 +++ ubuntu-release-upgrader-18.04.21/tests/test_pyflakes.py 2018-07-09 20:59:08.000000000 +0000 @@ -45,7 +45,7 @@ def test_pyflakes_clean(self): # mvo: type -f here to avoid running pyflakes on imported files # that are symlinks to other packages - cmd = 'find %s/.. -type f -name "*.py" | xargs pyflakes' % CURDIR + cmd = 'find %s/.. -type f -name "*.py" | xargs pyflakes3' % CURDIR p = subprocess.Popen( cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True, shell=True, universal_newlines=True)