[elbe-devel] [PATCH] elbepack: pbuilder: fix shell loop in config file

Thomas Weißschuh thomas.weissschuh at linutronix.de
Wed Aug 7 12:25:00 CEST 2024


Commit e3bf8851af87 ("Clean up the code to match python PEP8 standard")
added a linebreak in the middle of a conditional, which is invalid syntax.

Make sure that the condition stays up on one line in the config
file, while still maintaining resonable source line length.

Closes #410

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/pbuilder.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/elbepack/pbuilder.py b/elbepack/pbuilder.py
index 61accde89d60..c73044e80544 100644
--- a/elbepack/pbuilder.py
+++ b/elbepack/pbuilder.py
@@ -34,8 +34,10 @@ def pbuilder_write_config(builddir, xml, noccache):
 
     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('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! :)
@@ -72,8 +74,10 @@ def pbuilder_write_cross_config(builddir, xml, noccache):
     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('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:

---
base-commit: c3246bd329003b515343b97b963db36aa33f5b83
change-id: 20240807-pbuilder-debootstrapopts-8c603d3176e1

Best regards,
-- 
Thomas Weißschuh <thomas.weissschuh at linutronix.de>



More information about the elbe-devel mailing list