[elbe-devel] [PATCH] elbeproject: prevent pbuilder from checking signature if noauth is given

Christian Teklenborg chris at linutronix.de
Thu Jul 22 16:25:02 CEST 2021


Make pbuilder use "debootstrapopts --no-check-gpg" if noauth is given to
prevent pbuilder from the signature check. For some reason pbuilder ignores
the "--no-check-gpg" in the pbuilderrc file.
Add the examination of noauth in the pbuilder_write_cross_config function
as in the pbuilder_write_config function.

Signed-off-by: Christian Teklenborg <chris at linutronix.de>
---
 elbepack/elbeproject.py | 13 +++++++++----
 elbepack/pbuilder.py    |  7 +++++++
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
index 8617d80f..a3931c47 100644
--- a/elbepack/elbeproject.py
+++ b/elbepack/elbeproject.py
@@ -871,18 +871,23 @@ class ElbeProject:
         pbuilder_write_apt_conf(self.builddir, self.xml)
 
         # Run pbuilder --create
+        no_check_gpg = ""
+        if self.xml.prj.has('noauth'):
+            no_check_gpg = "--debootstrapopts --no-check-gpg"
         if cross:
             do('pbuilder --create --buildplace "%s" '
                '--configfile "%s" --aptconfdir "%s" '
-               '--debootstrapopts --include="git gnupg";' %
+               '--debootstrapopts --include="git gnupg" %s;' %
                (os.path.join(self.builddir, "pbuilder_cross"),
                 os.path.join(self.builddir, "cross_pbuilderrc"),
-                os.path.join(self.builddir, "aptconfdir")))
+                os.path.join(self.builddir, "aptconfdir"),
+                no_check_gpg))
         else:
             do('pbuilder --create --configfile "%s" --aptconfdir "%s" '
-               '--debootstrapopts --include="git gnupg"' %
+               '--debootstrapopts --include="git gnupg" %s' %
                (os.path.join(self.builddir, "pbuilderrc"),
-                os.path.join(self.builddir, "aptconfdir")))
+                os.path.join(self.builddir, "aptconfdir"),
+                no_check_gpg))
 
     def sync_xml_to_disk(self):
         try:
diff --git a/elbepack/pbuilder.py b/elbepack/pbuilder.py
index 82cf4356..5dae0f91 100644
--- a/elbepack/pbuilder.py
+++ b/elbepack/pbuilder.py
@@ -90,6 +90,13 @@ def pbuilder_write_cross_config(builddir, xml, noccache):
     fp.write('HOOKDIR="%s"\n' % os.path.join(builddir, 'pbuilder_cross', 'hooks.d'))
     fp.write('PBUILDERSATISFYDEPENDSCMD='
              '/usr/lib/pbuilder/pbuilder-satisfydepends-apt\n')
+
+    if xml.prj.has('noauth'):
+        fp.write(
+            'DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}" "--no-check-gpg")\n')
+        fp.write("""for i in "${!DEBOOTSTRAPOPTS[@]}"; do if [[ ${DEBOOTSTRAPOPTS[i]} == "--force-check-gpg" ]]; then unset 'DEBOOTSTRAPOPTS[i]'; break; fi done\n""")
+        fp.write('export ALLOWUNTRUSTED="yes"\n')
+
     if not noccache:
         fp.write('export CCACHE_DIR="%s/ccache"\n' % builddir)
         fp.write('export PATH="/usr/lib/ccache:${PATH}"\n')
-- 
2.20.1



More information about the elbe-devel mailing list