[Piuparts-devel] [Git][debian/piuparts][master] 8 commits: start preparing 1.1.3

Holger Levsen gitlab at salsa.debian.org
Fri Feb 26 17:59:00 GMT 2021



Holger Levsen pushed to branch master at Debian / piuparts


Commits:
df19a512 by Holger Levsen at 2021-02-21T10:27:00+01:00
start preparing 1.1.3

Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -
dbb8af43 by Michael Prokop at 2021-02-21T10:27:00+01:00
p: new option --update-retries <num> to re-run apt-get update

If the Packages file gets rewritten during `apt-get update`
execution, then piupart might fail with a hashsum mismatch
error, like:

| DEBUG: Starting command: ['chroot', '/var/cache/pbuilder/tmp.3l19K3MgeX_piuparts_tmp/tmp1m34xz', 'apt-get', 'update']
| DUMP:
| [...]
| Err:5 https://deb.example.com/autobuild gerrit_mika_foobar/main amd64 Packages
|   File has unexpected size (1338 != 1346). Mirror sync in progress? [IP: 10.10.42.42 443]
|   Hashes of expected file:
|    - Filesize:1346 [weak]
|    - SHA256:5af5db54c0d80e595a247a2070a1f8381468cbdacea1b62ead353d5bea074697
|    - SHA1:61962e3dcd01055a4baf3ab8e318c17832b6b0fd [weak]
|    - MD5Sum:92f602acb8051cfd90b3e33900a29932 [weak]
|   Release file created at: Tue, 16 Feb 2021 01:13:26 +0000
| [...]
| Reading package lists...
| E: Failed to fetch https://deb.example.com/autobuild/dists/gerrit_mika_foobar/main/binary-amd64/Packages.gz  File has unexpected size (1338 != 1346). Mirror sync in progress? [IP: 10.10.42.42 443]
|    Hashes of expected file:
|     - Filesize:1346 [weak]
|     - SHA256:5af5db54c0d80e595a247a2070a1f8381468cbdacea1b62ead353d5bea074697
|     - SHA1:61962e3dcd01055a4baf3ab8e318c17832b6b0fd [weak]
|     - MD5Sum:92f602acb8051cfd90b3e33900a29932 [weak]
|    Release file created at: Tue, 16 Feb 2021 01:13:26 +0000
| E: Some index files failed to download. They have been ignored, or old ones used instead.
| ERROR: Command failed (status=100): ['chroot', '/var/cache/pbuilder/tmp.3l19K3MgeX_piuparts_tmp/tmp1m34xz', 'apt-get', 'update']

By giving the user an option to retry the update procedure (up to
<num> times, as specified on the command line), we increase
chances for a successful build. This is useful especially in busy
continuous integration/delivery environments, lacking by-hash
support (see
https://www.chiark.greenend.org.uk/~cjwatson/blog/no-more-hash-sum-mismatch-errors.html),
for example all repositories using reprepro, which doesn't support
by-hash yet (see https://bugs.debian.org/820660).

Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -
36429f7a by Holger Levsen at 2021-02-22T10:42:02+01:00
d/copyright: update my copyright years.

Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -
bc9c1fcf by Holger Levsen at 2021-02-26T11:10:29+01:00
d/control: Add adequate and pkg-config to piuparts-slave-from-git-deps' depends. #Closes: 893022

Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -
90bf2987 by Holger Levsen at 2021-02-26T11:11:17+01:00
d/control: Add myself back to uploaders

Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -
0a14124c by Holger Levsen at 2021-02-26T13:33:32+00:00
Upgrade to newer source format 3.0 (native).

Changes-By: lintian-brush
Fixes: lintian: older-source-format
See-also: https://lintian.debian.org/tags/older-source-format.html

- - - - -
245a6bc3 by Holger Levsen at 2021-02-26T13:33:33+00:00
Remove unnecessary Team Upload line in changelog.

Changes-By: lintian-brush

- - - - -
89182d0c by Holger Levsen at 2021-02-26T18:53:21+01:00
release as 1.1.3

Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -


6 changed files:

- debian/changelog
- debian/control
- debian/copyright
- debian/source/format
- docs/piuparts/piuparts.1.txt
- piuparts.py


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,21 @@
+piuparts (1.1.3) unstable; urgency=medium
+
+  [ Michael Prokop ]
+  * p: new option --update-retries <num> to re-run apt-get update.
+    (MR: debian/piuparts!34)
+
+  [ Holger Levsen ]
+  * d/control:
+    - add adequate and pkg-config to piuparts-slave-from-git-deps' depends.
+      Closes: #893022.
+    - add myself back to uploaders.
+  * d/copyright: update my copyright years.
+
+  [ Debian Janitor ]
+  * Upgrade to newer source format 3.0 (native).
+
+ -- Holger Levsen <holger at debian.org>  Fri, 26 Feb 2021 18:51:48 +0100
+
 piuparts (1.1.2) unstable; urgency=medium
 
   * Team upload.


=====================================
debian/control
=====================================
@@ -1,6 +1,7 @@
 Source: piuparts
 Maintainer: piuparts developers team <piuparts-devel at alioth-lists.debian.net>
-Uploaders: Nicolas Dandrimont <olasd at debian.org>
+Uploaders: Nicolas Dandrimont <olasd at debian.org>,
+ Holger Levsen <holger at debian.org>
 Section: devel
 Priority: optional
 Standards-Version: 4.5.1
@@ -146,7 +147,9 @@ Description: piuparts slave components
 Package: piuparts-slave-from-git-deps
 Architecture: all
 Depends:
+ adequate,
  git,
+ pkg-config,
 # this list is synced from piuparts-slave
  adduser,
  openssh-client,


=====================================
debian/copyright
=====================================
@@ -3,7 +3,7 @@ Upstream-Name: piuparts
 Upstream-Contact: Holger Levsen <holger at debian.org>
 Source: https://salsa.debian.org/debian/piuparts.git
 Copyright: © 2005-2008 Lars Wirzenius
-           © 2008-2019 Holger Levsen
+           © 2008-2021 Holger Levsen
            © 2011-2019 Andreas Beckmann
 Comment: Original author is also Lars Wirzenius <liw at iki.fi>
  Upstream is bunch of lunatics who don't make release tarballs publicly
@@ -11,7 +11,7 @@ Comment: Original author is also Lars Wirzenius <liw at iki.fi>
 
 Files: *
 Copyright: © 2005-2008 Lars Wirzenius <liw at iki.fi>
-           © 2008-2019 Holger Levsen <holger at debian.org>
+           © 2008-2021 Holger Levsen <holger at debian.org>
            © 2011-2019 Andreas Beckmann <anbe at debian.org>
 License: GPL-2+
  This program is free software; you can redistribute it


=====================================
debian/source/format
=====================================
@@ -1 +1 @@
-1.0
+3.0 (native)


=====================================
docs/piuparts/piuparts.1.txt
=====================================
@@ -304,6 +304,10 @@ Options must come before the other command line arguments.
   Use directory as the place where temporary files and directories are created. The default is the environment variable *TMPDIR*, or */tmp* if not set.
   Note: the temporary directory must *not* be mounted with the _nodev_ or _nosuid_ mount option.
 
+*-*-update-retries*='num-retries'::
+  Rerun 'apt-get update` up to "num-retries" times.
+  Useful to work around temporary network failures and hashsum mismatch errors.
+
 *-*-upgrade-before-dist-upgrade*::
   Perform two-stage upgrades: 'apt-get upgrade && apt-get dist-upgrade'.
 


=====================================
piuparts.py
=====================================
@@ -182,6 +182,7 @@ class Settings:
         self.scriptsdirs = []
         self.bindmounts = []
         self.allow_database = False
+        self.update_retries = None
         # chroot setup
         self.arch = None
         self.basetgz = None
@@ -820,7 +821,8 @@ class Chroot:
         # Useful for adjusting apt configuration e.g. for internal mirror usage
         self.run_scripts("post_chroot_unpack")
 
-        self.run(["apt-get", "update"])
+        self.aptupdate_run()
+
         if settings.basetgz or settings.docker_image or settings.schroot or settings.existing_chroot:
             self.run(["apt-get", "-yf", "dist-upgrade"])
         self.minimize()
@@ -1005,6 +1007,28 @@ class Chroot:
                     "\n".join(lines) + "\n")
         logging.debug("sources.list:\n" + indent_string("\n".join(lines)))
 
+    def aptupdate_run(self):
+        """Resynchronize the package index files.
+           If executed under --update-retries <num>, retry
+           its execution up to <num> times, useful e.g.
+           on temporary network failures or hashsum mismatch
+           errors."""
+        if not settings.update_retries:
+            self.run(["apt-get", "update"])
+            return
+
+        count = 0
+        for count, run in enumerate(range(settings.update_retries), 1):
+            (status, output) = self.run(["apt-get", "update"],
+                                        ignore_errors=True)
+            if status == 0:
+                break
+            else:
+                logging.info("apt-get update failed to execute " +
+                             "(run #%d, re-trying up to %d times)" % (count, settings.update_retries))
+
+        return status
+
     def enable_testdebs_repo(self, update=True):
         if settings.testdebs_repo:
             if settings.testdebs_repo.startswith("deb"):
@@ -1016,7 +1040,7 @@ class Chroot:
             logging.debug("enabling testdebs repository '%s'" % debline)
             create_file(self.relative("etc/apt/sources.list.d/piuparts-testdebs-repo.list"), debline + "\n")
             if update:
-                self.run(["apt-get", "update"])
+                self.aptupdate_run()
 
     def disable_testdebs_repo(self):
         if settings.testdebs_repo:
@@ -1171,7 +1195,7 @@ class Chroot:
             self.create_apt_sources(distro)
             # Run custom scripts before upgrade
             self.run_scripts("pre_distupgrade")
-            self.run(["apt-get", "update"])
+            self.aptupdate_run()
             if apt_get_upgrade:
                 self.run(["apt-get", "-y", "upgrade"])
             self.run(["apt-get", "-yf", "dist-upgrade"])
@@ -2939,6 +2963,11 @@ def parse_command_line():
                       help="Use DIR for temporary storage. Default is " +
                            "$TMPDIR or /tmp.")
 
+    parser.add_option("--update-retries", metavar="UPDATE_RETRIES", type="int",
+                      help="Rerun `apt-get update` up to UPDATE_RETRIES "
+                           "times. Useful to work around temporary network failures "
+                           "and hashsum mismatch errors.")
+
     parser.add_option("-v", "--verbose",
                       action="store_true", default=False,
                       help="No meaning anymore.")
@@ -3033,6 +3062,7 @@ def parse_command_line():
     settings.scriptsdirs = opts.scriptsdir
     settings.bindmounts += opts.bindmount
     settings.allow_database = opts.allow_database
+    settings.update_retries = opts.update_retries
     # chroot setup
     settings.arch = opts.arch
     settings.basetgz = opts.basetgz



View it on GitLab: https://salsa.debian.org/debian/piuparts/-/compare/31862192384ea68ad5d490c6fbf99f6f78f11314...89182d0ca342b129efc5b2750230c0e6f97b8621

-- 
View it on GitLab: https://salsa.debian.org/debian/piuparts/-/compare/31862192384ea68ad5d490c6fbf99f6f78f11314...89182d0ca342b129efc5b2750230c0e6f97b8621
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/20210226/0e761520/attachment-0001.htm>


More information about the Piuparts-devel mailing list