[elbe-devel] [PATCH v3 2/2] elbeproject: prevent pbuilder from checking signature with noauth is given

bage at linutronix.de bage at linutronix.de
Tue Jul 27 11:34:40 CEST 2021


From: Christian Teklenborg <chris at linutronix.de>

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>
[Rebase on comma correcting patch]
Reviewed-by: Bastian Germann <bage 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 68938b933..6ea98b1a3 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 82cf43562..5dae0f918 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.30.2



More information about the elbe-devel mailing list