launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #24903
[Merge] ~xnox/launchpad-buildd:image-targets-fix into launchpad-buildd:master
Dimitri John Ledkov has proposed merging ~xnox/launchpad-buildd:image-targets-fix into launchpad-buildd:master.
Commit message:
target/chroot: fix passing space separate env variable values
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~xnox/launchpad-buildd/+git/launchpad-buildd/+merge/386328
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~xnox/launchpad-buildd:image-targets-fix into launchpad-buildd:master.
diff --git a/lpbuildd/target/chroot.py b/lpbuildd/target/chroot.py
index 203142c..cbed3c7 100644
--- a/lpbuildd/target/chroot.py
+++ b/lpbuildd/target/chroot.py
@@ -61,9 +61,27 @@ class Chroot(Backend):
echo=False, **kwargs):
"""See `Backend`."""
if env:
- args = ["env"] + [
- "%s=%s" % (key, shell_escape(value))
- for key, value in env.items()] + args
+ # Currently pylxd backend does not quote the k=v pairs
+ # when passing them to the lxc executor, but it does quote
+ # every arg if cwd is changed. Match that behaviour in
+ # chroot executor too, and do not quote the value, of the
+ # key, if shell_escape will happen later when cwd is set.
+ # Otherwise instead of the expected 'IMAGE_TARGETS=tarball
+ # squashfs' arg, it becomes \'IMAGE_TARGET\'"\'"\'tarball
+ # squashfs\'"\'"\'\', and when decoded by make-config
+ # python script in livecd-rootfs it ends up getting parsed
+ # as ["'tarball", "squashfs'"], as in first value prefixed
+ # and last value suffixed with ' Alternatively,
+ # make-config script in livecd-rootfs can add a workaround
+ # to parse such bad values.
+ if cwd:
+ args = ["env"] + [
+ "%s=%s" % (key, value)
+ for key, value in env.items()] + args
+ else:
+ args = ["env"] + [
+ "%s=%s" % (key, shell_escape(value))
+ for key, value in env.items()] + args
if self.arch is not None:
args = set_personality(args, self.arch, series=self.series)
if cwd is not None: