[Piuparts-commits] [piuparts] 05/14: p: ignore --end-meta on mismatching fake-essential packages

Holger Levsen holger at layer-acht.org
Mon Aug 21 14:33:05 UTC 2017


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch develop
in repository piuparts.

commit bb771e26395104d03fa4f89f8fcdb4a50f3cb6ef
Author: Andreas Beckmann <anbe at debian.org>
Date:   Mon Aug 14 06:44:20 2017 +0200

    p: ignore --end-meta on mismatching fake-essential packages
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 debian/changelog  |  3 +++
 piuparts-slave.py | 11 +++++++----
 piuparts.py       | 18 ++++++++++++++++++
 3 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index ff23b17..5594fa7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,6 +15,9 @@ piuparts (0.79) UNRELEASED; urgency=medium
       packages that would fail anyway, but are resource hogs or otherwise
       break piuparts.
     - Silence diff_meta_data() for "others" for --warn-on-others.
+    - Store the initial package selections in the --save-end-meta meta-data
+      and ignore meta-data from --end-meta if these selections don't match,
+      e.g. due to different fake-essential package sets.
     - Let debsums always ignore obsolete conffiles.
     - Run debootstrap with --no-merged-usr.
   * piuparts.conf:
diff --git a/piuparts-slave.py b/piuparts-slave.py
index 3ffbde9..00e2066 100644
--- a/piuparts-slave.py
+++ b/piuparts-slave.py
@@ -781,11 +781,14 @@ class Section:
             elif not "piuparts run ends" in lastline:
                 ret += 1024
                 output.write(" *** PIUPARTS OUTPUT INCOMPLETE ***\n")
-            elif distupgrade and self._config["chroot-meta-auto"] and \
-                    "History of available packages does not match - reference chroot may be outdated" in f:
+            elif distupgrade and self._config["chroot-meta-auto"]:
                 try:
-                    os.unlink(self._config["chroot-meta-auto"])
-                    logging.info("Deleting outdated %s" % self._config["chroot-meta-auto"])
+                    if "History of available packages does not match - reference chroot may be outdated" in f:
+                        os.unlink(self._config["chroot-meta-auto"])
+                        logging.info("Deleting outdated %s" % self._config["chroot-meta-auto"])
+                    elif "Initial package selections do not match - ignoring loaded reference chroot state" in f:
+                        os.unlink(self._config["chroot-meta-auto"])
+                        logging.info("Deleting mismatching %s" % self._config["chroot-meta-auto"])
                 except OSError:
                     pass
 
diff --git a/piuparts.py b/piuparts.py
index 355a948..fdb0d4c 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -753,6 +753,7 @@ class Chroot:
         self.name = None
         self.bootstrapped = False
         self.mounts = []
+        self.initial_selections = None
         self.avail_md5_history = []
 
     def create_temp_dir(self):
@@ -1101,6 +1102,10 @@ class Chroot:
         errorcode, avail_md5 = self.run(["sh", "-c", "apt-cache dumpavail | md5sum"])
         self.avail_md5_history.append(avail_md5.split()[0])
 
+    def remember_initial_selections(self):
+        """Remember initial selections to easily recognize mismatching chroot metadata"""
+        self.initial_selections = self.get_selections()
+
     def upgrade_to_distros(self, distros, packages, apt_get_upgrade=False):
         """Upgrade a chroot installation to each successive distro."""
         for distro in distros:
@@ -1571,6 +1576,7 @@ class Chroot:
 
     def get_state_meta_data(self):
         chroot_state = {}
+        chroot_state["initial_selections"] = self.initial_selections
         chroot_state["avail_md5"] = self.avail_md5_history
         chroot_state["tree"] = self.get_tree_meta_data()
         chroot_state["selections"] = self.get_selections()
@@ -2705,6 +2711,7 @@ def install_and_upgrade_between_distros(package_files, packages_qualified):
 
     chroot = get_chroot()
     chroot.create()
+    chroot.remember_initial_selections()
 
     chroot_state = None
     if settings.end_meta:
@@ -2713,6 +2720,17 @@ def install_and_upgrade_between_distros(package_files, packages_qualified):
         else:
             logging.info("Cannot load chroot state from %s - generating it on-the-fly." % settings.end_meta)
 
+    if chroot_state is not None:
+        if chroot.initial_selections != chroot_state["initial_selections"]:
+            logging.warn("Initial package selections do not match - ignoring loaded reference chroot state")
+            refsel = [(s, p, v) for p, (s, v) in chroot_state["initial_selections"].iteritems()]
+            cursel = [(s, p, v) for p, (s, v) in chroot.initial_selections.iteritems()]
+            rsel = [x for x in refsel if not x in cursel]
+            csel = [x for x in cursel if not x in refsel]
+            [logging.debug("  -%s" % " ".join(x)) for x in rsel]
+            [logging.debug("  +%s" % " ".join(x)) for x in csel]
+            chroot_state = None
+
     if chroot_state is None:
         temp_tgz = None
         if chroot.was_bootstrapped():

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/piuparts/piuparts.git



More information about the Piuparts-commits mailing list