[Piuparts-devel] [Git][debian/piuparts][develop] 5 commits: lib/db: lookup reserved/*.log as waiting-to-be-tested

Holger Levsen gitlab at salsa.debian.org
Thu Apr 11 13:25:45 BST 2019



Holger Levsen pushed to branch develop at Debian / piuparts


Commits:
af69f719 by Andreas Beckmann at 2019-04-11T12:25:35Z
lib/db: lookup reserved/*.log as waiting-to-be-tested

Signed-off-by: Andreas Beckmann <anbe at debian.org>
Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -
bb1b3e27 by Andreas Beckmann at 2019-04-11T12:25:35Z
lib/db: add log_exists2(self, package, version, subdirs)

Signed-off-by: Andreas Beckmann <anbe at debian.org>
Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -
91fce71e by Andreas Beckmann at 2019-04-11T12:25:35Z
lib/db: delete (same version) old logs upon receiving a reserved log

Signed-off-by: Andreas Beckmann <anbe at debian.org>
Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -
7788d16f by Andreas Beckmann at 2019-04-11T12:25:35Z
lib/db: keep recycled pass logs while waiting for new test results

Signed-off-by: Andreas Beckmann <anbe at debian.org>
Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -
659bba96 by Andreas Beckmann at 2019-04-11T12:25:35Z
the signature for archived wheezy/updates has expired

Signed-off-by: Andreas Beckmann <anbe at debian.org>
Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -


4 changed files:

- custom-scripts/scripts/post_chroot_unpack_allow_unauthenticated
- custom-scripts/scripts/pre_distupgrade_allow_unauthenticated
- debian/changelog
- piupartslib/packagesdb.py


Changes:

=====================================
custom-scripts/scripts/post_chroot_unpack_allow_unauthenticated
=====================================
@@ -22,6 +22,14 @@ Acquire::Check-Valid-Until "false";
 EOF
 fi
 
+if [ "$PIUPARTS_DISTRIBUTION" = "wheezy" ]; then
+	echo "Creating /etc/apt/apt.conf.d/unauthenticated-wheezy ..."
+	tee /etc/apt/apt.conf.d/unauthenticated-wheezy <<EOF
+# The Release file is not getting updated.
+Acquire::Check-Valid-Until "false";
+EOF
+fi
+
 if [ "$PIUPARTS_DISTRIBUTION" = "jessie-backports" ]; then
 	echo "Creating /etc/apt/apt.conf.d/unauthenticated-jessie ..."
 	tee /etc/apt/apt.conf.d/unauthenticated-jessie <<EOF


=====================================
custom-scripts/scripts/pre_distupgrade_allow_unauthenticated
=====================================
@@ -10,6 +10,8 @@ if [ -e /etc/apt/apt.conf.d/unauthenticated-lenny ]; then
 	exit 1
 fi
 
+############################################################################
+
 if [ "$PIUPARTS_DISTRIBUTION_NEXT" = "wheezy" ]; then
 	rm -fv /etc/apt/apt.conf.d/unauthenticated-squeeze
 fi
@@ -30,6 +32,25 @@ elif [ -e /etc/apt/apt.conf.d/unauthenticated-squeeze ]; then
 	exit 1
 fi
 
+############################################################################
+
+if [ "$PIUPARTS_DISTRIBUTION_NEXT" = "jessie" ]; then
+	rm -fv /etc/apt/apt.conf.d/unauthenticated-wheezy
+fi
+
+if [ "$PIUPARTS_DISTRIBUTION_NEXT" = "wheezy" ]; then
+	echo "Creating /etc/apt/apt.conf.d/unauthenticated-wheezy ..."
+	tee /etc/apt/apt.conf.d/unauthenticated-wheezy <<EOF
+# The Release file is not getting updated.
+Acquire::Check-Valid-Until "false";
+EOF
+elif [ -e /etc/apt/apt.conf.d/unauthenticated-wheezy ]; then
+	echo "FAIL: /etc/apt/apt.conf.d/unauthenticated-wheezy exists"
+	exit 1
+fi
+
+############################################################################
+
 if [ "$PIUPARTS_DISTRIBUTION_NEXT" = "stretch" ]; then
 	rm -fv /etc/apt/apt.conf.d/unauthenticated-jessie
 fi


=====================================
debian/changelog
=====================================
@@ -22,11 +22,14 @@ piuparts (0.99) UNRELEASED; urgency=medium
     - Add bullseye-proposed-updates.
   * piuparts.conf:
     - Add section [sid-merged-usr], using --merged-usr.  (Closes: #848968)
+  * piupartslib/packagesdb.py:
+    - Keep recycled pass logs while waiting for new test results, continuing
+      to show them as "successfully-tested" instead of "waiting-to-be-tested".
   * piuparts-slave.py:
     - New option "slave-flush-interval" to flush logs more frequently to the
       master. Set to 30 minutes.
   * scripts/{post_chroot_unpack,pre_distupgrade}_allow_unauthenticated:
-    - Disable Check-Valid-Until for jessie-backports.
+    - Disable Check-Valid-Until for wheezy/updates and jessie-backports.
   * scripts/post_distupgrade_exceptions:
     - Handle /var/lib/pam/seen stretch -> buster upgrade by running
       pam-auth-update if needed. Workaround for #920760.


=====================================
piupartslib/packagesdb.py
=====================================
@@ -236,13 +236,16 @@ class LogDB:
     def _log_name(self, package, version):
         return "%s_%s.log" % (package, version)
 
-    def log_exists(self, package, subdirs):
-        log_name = self._log_name(package.name(), package.test_versions())
+    def log_exists2(self, package, version, subdirs):
+        log_name = self._log_name(package, version)
         for subdir in subdirs:
             if self.exists(os.path.join(subdir, log_name)):
                 return True
         return False
 
+    def log_exists(self, package, subdirs):
+        return self.log_exists2(package.name(), package.test_versions(), subdirs)
+
     def create(self, subdir, package, version, contents):
         (fd, temp_name) = tempfile.mkstemp(dir=subdir)
         if os.write(fd, contents) != len(contents):
@@ -383,6 +386,7 @@ class PackagesDB:
         if recycle:
             self._recycle = pformat % recycle
             self._all.append(self._recycle)
+        self._most = [x for x in self._all if x not in [self._reserved, self._recycle]]
 
     def create_subdirs(self):
         for sdir in self._all:
@@ -490,8 +494,11 @@ class PackagesDB:
                 if dep_ver is not None and apt_pkg.version_compare(curr_ver, dep_ver) < 0:
                     #logging.info("[%s] outdated: %s %s < %s @[%s]" % (self.prefix, package.name(), curr_ver, dep_ver, db.prefix))
                     return "outdated";
-        if self._recycle_mode and self._logdb.log_exists(package, [self._recycle]):
-            return "unknown"
+        if self._recycle_mode:
+            if self._logdb.log_exists(package, [self._reserved]):
+                return "waiting-to-be-tested"
+            if self._logdb.log_exists(package, [self._recycle]):
+                return "unknown"
         if self._logdb.log_exists(package, [self._ok]):
             success = True
             if not use_cached_success:
@@ -507,6 +514,8 @@ class PackagesDB:
             return "failed-testing"
         if self._logdb.log_exists(package, [self._evil]):
             return "cannot-be-tested"
+        if self._logdb.log_exists(package, [self._reserved]):
+            return "waiting-to-be-tested"
         return "unknown"
 
     def _compute_package_state(self, package):
@@ -822,14 +831,16 @@ class PackagesDB:
         self._candidates_for_testing.remove(p)
 
     def reserve_package(self):
-        all_but_recycle = [x for x in self._all if x != self._recycle]
         for p in self._find_packages_ready_for_testing():
+            if self._logdb.log_exists(p, [self._reserved]):
+                self._remove_unavailable_candidate(p)
+                continue
             if self._recycle_mode and self._logdb.log_exists(p, [self._recycle]):
-                for vdir in all_but_recycle:
+                for vdir in [x for x in self._most if x != self._ok]:
                     if self._logdb.log_exists(p, [vdir]):
                         self._logdb.remove(vdir, p.name(), p.test_versions())
                         logging.info("Recycled %s %s %s" % (vdir, p.name(), p.test_versions()))
-            if self._logdb.log_exists(p, all_but_recycle):
+            elif self._logdb.log_exists(p, self._most):
                 self._remove_unavailable_candidate(p)
                 continue
             if self._logdb.log_exists(p, [self._recycle]):
@@ -846,16 +857,29 @@ class PackagesDB:
         with open(self._submissions, "a") as submissions:
             submissions.write("%d %s %s %s\n" % (time.time(), category, package, version))
 
+    def _remove_logs_if_reserved(self, package, version):
+        if self._logdb.log_exists2(package, version, [self._reserved]):
+            for vdir in self._most:
+                if self._logdb.log_exists2(package, version, [vdir]):
+                    self._logdb.remove(vdir, package, version)
+                    logging.info("Recycled %s %s %s" % (vdir, package, version))
+            self._logdb.remove(self._reserved, package, version)
+
     def unreserve_package(self, package, version):
         self._check_for_acceptability_as_filename(package)
         self._check_for_acceptability_as_filename(version)
+        if self._logdb.log_exists2(package, version, [self._reserved]):
+            if not self._logdb.log_exists2(package, version, [self._recycle]):
+                # restore possible recycle marker
+                if self._logdb.log_exists2(package, version, self._most):
+                    self._logdb.create(self._recycle, package, version, "")
         self._logdb.remove(self._reserved, package, version)
 
     def pass_package(self, package, version, log):
         self._check_for_acceptability_as_filename(package)
         self._check_for_acceptability_as_filename(version)
+        self._remove_logs_if_reserved(package, version)
         if self._logdb.create(self._ok, package, version, log):
-            self._logdb.remove(self._reserved, package, version)
             self._record_submission("pass", package, version)
         else:
             raise LogfileExists(self._ok, package, version)
@@ -863,8 +887,8 @@ class PackagesDB:
     def fail_package(self, package, version, log):
         self._check_for_acceptability_as_filename(package)
         self._check_for_acceptability_as_filename(version)
+        self._remove_logs_if_reserved(package, version)
         if self._logdb.create(self._fail, package, version, log):
-            self._logdb.remove(self._reserved, package, version)
             self._record_submission("fail", package, version)
         else:
             raise LogfileExists(self._fail, package, version)
@@ -872,8 +896,8 @@ class PackagesDB:
     def make_package_untestable(self, package, version, log):
         self._check_for_acceptability_as_filename(package)
         self._check_for_acceptability_as_filename(version)
+        self._remove_logs_if_reserved(package, version)
         if self._logdb.create(self._evil, package, version, log):
-            self._logdb.remove(self._reserved, package, version)
             self._record_submission("untestable", package, version)
         else:
             raise LogfileExists(self._evil, package, version)



View it on GitLab: https://salsa.debian.org/debian/piuparts/compare/eb4e8782b118c1e167f79e0ea96c4b831da5f610...659bba96a90f1dceb8e5610e5aca28f95333e039

-- 
View it on GitLab: https://salsa.debian.org/debian/piuparts/compare/eb4e8782b118c1e167f79e0ea96c4b831da5f610...659bba96a90f1dceb8e5610e5aca28f95333e039
You're receiving this email because of your account on salsa.debian.org.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/piuparts-devel/attachments/20190411/5433f729/attachment-0001.html>


More information about the Piuparts-devel mailing list