X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Fporterbox%2Ffiles%2Fdd-schroot-cmd;h=6506b6ed10b4ab62f7f44bfe9555cc840e7f5842;hb=7128b2333feb772d787aaf0382e5366866894363;hp=76f3c9d113d62253554764432da9bf2b57fd3518;hpb=48bc7ea6289b52409b355c4f0a08bbb27128eae6;p=mirror%2Fdsa-puppet.git diff --git a/modules/porterbox/files/dd-schroot-cmd b/modules/porterbox/files/dd-schroot-cmd index 76f3c9d11..6506b6ed1 100755 --- a/modules/porterbox/files/dd-schroot-cmd +++ b/modules/porterbox/files/dd-schroot-cmd @@ -80,7 +80,7 @@ def ensure_ok(session): die("Session owner mismatch.") def os_supports_unshare(): - if platform.uname()[0] == 'GNU/kFreeBSD': + if platform.uname()[0] in ('GNU/kFreeBSD', 'GNU'): return False return True @@ -88,7 +88,7 @@ class WrappedRunner(): def __init__(self, session, args, unshare=True): self.unshare = unshare if not os_supports_unshare(): self.unshare = False - s,r = self.run('schroot', '-c', session, '--run-session', '--', 'env', 'DEBIAN_FRONTEND=noninteractive', *args) + s,r = self.run('schroot', '-c', session, '--directory=/', '--run-session', '--', 'env', 'DEBIAN_FRONTEND=noninteractive', *args) if s != 0: die("Command %s exited due to signal %d."%(' '.join(args), s)) if r != 0: @@ -154,7 +154,12 @@ class AptSchroot: elif op == "install": self.apt_install(args) elif op == "build-dep": - self.apt_build_dep(args) + try: + args.remove("--arch-only") + archonly = True + except ValueError: + archonly = False + self.apt_build_dep(args, archonly) else: die("Invalid operation %s"%(op,)) @@ -174,8 +179,9 @@ class AptSchroot: def apt_install(self, packages): self.apt_simulate_and_ask(['install', '--'] + packages) - def apt_build_dep(self, packages): - self.apt_simulate_and_ask(['build-dep', '--'] + packages) + def apt_build_dep(self, packages, archonly=False): + cmd = (['--arch-only'] if archonly else []) + ['build-dep', '--'] + self.apt_simulate_and_ask(cmd + packages) def apt_simulate_and_ask(self, cmd, split_download=True, run_clean=True): if not self.assume_yes: