[Merge] ~brian-murray/ubuntu-release-upgrader:python-dbg-fix into ubuntu-release-upgrader:ubuntu/master

Lukas Märdian lukas.maerdian at canonical.com
Tue Aug 4 15:36:06 UTC 2020


I can confirm this resolves the minimal test case described. I've added two smaller comments inline.

Should we hard-code all those transition xnox described in the upgrader, or should src:what-is-python provide proper upgrade paths for those packages? There is python-dev-is-python2 already: https://packages.ubuntu.com/focal/python-dev-is-python2

Diff comments:

> diff --git a/DistUpgrade/DistUpgradeQuirks.py b/DistUpgrade/DistUpgradeQuirks.py
> index c414424..144335e 100644
> --- a/DistUpgrade/DistUpgradeQuirks.py
> +++ b/DistUpgrade/DistUpgradeQuirks.py
> @@ -848,26 +848,30 @@ class DistUpgradeQuirks(object):
>          other package and the python-is-python2 package is installed instead,
>          if python-minimal was installed.
>          """
> -        old = 'python-minimal'
> -        new = 'python-is-python2'
> +        # python-dbg must come first for reasons unknown
> +        replacements = [('python-dbg','python2-dbg'),
> +                        ('python-minimal', 'python-is-python2')]

You could be using a tuple instead of the outer list here, as those are all immutable values.

>          cache = self.controller.cache
> -        if old in cache and cache[old].is_installed:
> -            logging.info("installing %s because %s was installed" % (new, old))
> -            reason = "%s was installed on the system" % old
> -            if not cache.mark_install(new, reason):
> -                logging.info("failed to install %s" % new)
> -            logging.info("removing %s because %s is being installed" %
> -                         (old, new))
> -            reason = "%s is being installed on the system" % new
> -            if not cache.mark_remove(old, reason):
> -                logging.info("failed to remove %s", old)
> -
> -            # protect our decision to remove legacy 'python' (as a dependency
> -            # of python-minimal, removed above)
> -            py = 'python'
> -            if py in cache and cache[py].marked_delete:
> -                resolver = apt.cache.ProblemResolver(cache)
> -                resolver.protect(cache[py])
> +        for old, new in replacements:
> +            logging.info("checking for %s" % old)
> +            if old in cache and cache[old].is_installed:
> +                logging.info("installing %s because %s was installed" %
> +                             (new, old))
> +                reason = "%s was installed on the system" % old
> +                if not cache.mark_install(new, reason):
> +                    logging.info("failed to install %s" % new)
> +                logging.info("removing %s because %s is being installed" %
> +                             (old, new))
> +                reason = "%s is being installed on the system" % new
> +                if not cache.mark_remove(old, reason):
> +                    logging.info("failed to remove %s", old)
> +
> +                # protect our decision to remove legacy 'python' (as a
> +                # dependency of python-minimal, removed above)
> +                py = 'python'
> +                if py in cache and cache[py].marked_delete:

We do not need to indent this block and repeat the package protection for 'python' in the for loop each time. It should be fine to execute this only once after the loop finished.

> +                    resolver = apt.cache.ProblemResolver(cache)
> +                    resolver.protect(cache[py])
>  
>      def ensure_recommends_are_installed_on_desktops(self):
>          """ ensure that on a desktop install recommends are installed


-- 
https://code.launchpad.net/~brian-murray/ubuntu-release-upgrader/+git/ubuntu-release-upgrader/+merge/388513
Your team Ubuntu Core Development Team is requested to review the proposed merge of ~brian-murray/ubuntu-release-upgrader:python-dbg-fix into ubuntu-release-upgrader:ubuntu/master.



More information about the Ubuntu-reviews mailing list