[elbe-devel] [PATCH 1/1] Remove --force-check-gpg from DEBOOTSTRAPOPTS when <noauth>

dion at linutronix.de dion at linutronix.de
Fri Jul 19 15:41:46 CEST 2019


From: Olivier Dion <dion at linutronix.de>

Nasty behavior of pbuilder that add --force-check-gpg by default in
the DEBOOTSTRAPOPTS env variable.

This should remove it no matter what when <noauth> is set.  It's very
ugly, but the only way I know to remove an element in a bash array.

* NOTE

  pbuilder will _always_ read in that order:

  1. /etc/pbuildderrc
  2. /usr/share/pbuilder/pbuilderrc
  3. ~/.pbuildderrc
  4. --configfile=file

  And when meant _always_, I mean there's no way to not read
  /usr/share/pbuilder/pbuilderrc, even if we provide --configfile.

  As described by the man page:
  --------------------------------------------------------------------
  --configfile [configuration file to load]
  Additional configuration file to read after all other
  configuration files have been read.
  --------------------------------------------------------------------

  Thus, we might have conflicts between the system wide configuration
  and the local config file (e.g. this patch).  This is utterly
  stupid.

  We should probably overwrite everything mentioned in pbuilderrc(5)
  ourself in the project's pbuilderrc file to avoid any surprise in
  the future.

Signed-off-by: Olivier Dion <dion at linutronix.de>
Tested-by: Yegor Yefremov <yegorslists at googlemail.com>
---
 elbepack/pbuilder.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/elbepack/pbuilder.py b/elbepack/pbuilder.py
index b38136de..6bc2945f 100644
--- a/elbepack/pbuilder.py
+++ b/elbepack/pbuilder.py
@@ -50,6 +50,7 @@ def pbuilder_write_config(builddir, xml, _log):
     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')
 
     # aptitude segfaults with armhf changeroots, great! :)
-- 
2.11.0




More information about the elbe-devel mailing list