Merge #21004: contrib: Fix docker args conditional in gitian-build

624091b7b9 Fix docker args conditional (setpill)

Pull request description:

  The conditional that checks if docker needs to be installed has the side effect of triggering the default `lxc` branch in case docker comes preinstalled. This is clearly not intentional.

ACKs for top commit:
  laanwj:
    Code review ACK 624091b7b9
  theStack:
    Code review ACK 624091b7b9

Tree-SHA512: e37e2c35aaed813762223e5963e5416d5865b3fb53efb2aac86daaa03b95ccf07db9c3a779446029d055ab89491147c4d900117273e22caed201b21bdf287c58
This commit is contained in:
MarcoFalke 2021-01-28 17:42:56 +01:00
commit 6ba2ffd28b
No known key found for this signature in database
GPG Key ID: D2EA4850E7528B25

View File

@ -13,15 +13,16 @@ def setup():
programs = ['ruby', 'git', 'make', 'wget', 'curl'] programs = ['ruby', 'git', 'make', 'wget', 'curl']
if args.kvm: if args.kvm:
programs += ['apt-cacher-ng', 'python-vm-builder', 'qemu-kvm', 'qemu-utils'] programs += ['apt-cacher-ng', 'python-vm-builder', 'qemu-kvm', 'qemu-utils']
elif args.docker and not os.path.isfile('/lib/systemd/system/docker.service'): elif args.docker:
dockers = ['docker.io', 'docker-ce'] if not os.path.isfile('/lib/systemd/system/docker.service'):
for i in dockers: dockers = ['docker.io', 'docker-ce']
return_code = subprocess.call(['sudo', 'apt-get', 'install', '-qq', i]) for i in dockers:
if return_code == 0: return_code = subprocess.call(['sudo', 'apt-get', 'install', '-qq', i])
break if return_code == 0:
if return_code != 0: break
print('Cannot find any way to install Docker.', file=sys.stderr) if return_code != 0:
sys.exit(1) print('Cannot find any way to install Docker.', file=sys.stderr)
sys.exit(1)
else: else:
programs += ['apt-cacher-ng', 'lxc', 'debootstrap'] programs += ['apt-cacher-ng', 'lxc', 'debootstrap']
subprocess.check_call(['sudo', 'apt-get', 'install', '-qq'] + programs) subprocess.check_call(['sudo', 'apt-get', 'install', '-qq'] + programs)