Skip to content

Commit cbbd988

Browse files
committed
Fix Docker related issues for gitian-build.py
The Docker does not depend on apt-cacher-ng package. Do not try to install the Docker if docker.service is detected on the system (e.g., the Docker was installed manually). Also small style corrections were applied.
1 parent 387eb5b commit cbbd988

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

contrib/gitian-build.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@
77

88
def setup():
99
global args, workdir
10-
programs = ['ruby', 'git', 'apt-cacher-ng', 'make', 'wget']
10+
programs = ['ruby', 'git', 'make', 'wget']
1111
if args.kvm:
12-
programs += ['python-vm-builder', 'qemu-kvm', 'qemu-utils']
13-
elif args.docker:
12+
programs += ['apt-cacher-ng', 'python-vm-builder', 'qemu-kvm', 'qemu-utils']
13+
elif args.docker and not os.path.isfile('/lib/systemd/system/docker.service'):
1414
dockers = ['docker.io', 'docker-ce']
1515
for i in dockers:
1616
return_code = subprocess.call(['sudo', 'apt-get', 'install', '-qq', i])
1717
if return_code == 0:
1818
break
1919
if return_code != 0:
20-
print('Cannot find any way to install docker', file=sys.stderr)
21-
exit(1)
20+
print('Cannot find any way to install Docker.', file=sys.stderr)
21+
sys.exit(1)
2222
else:
23-
programs += ['lxc', 'debootstrap']
23+
programs += ['apt-cacher-ng', 'lxc', 'debootstrap']
2424
subprocess.check_call(['sudo', 'apt-get', 'install', '-qq'] + programs)
2525
if not os.path.isdir('gitian.sigs'):
2626
subprocess.check_call(['git', 'clone', 'https://github.com/bitcoin-core/gitian.sigs.git'])
@@ -41,7 +41,7 @@ def setup():
4141
if args.is_bionic and not args.kvm and not args.docker:
4242
subprocess.check_call(['sudo', 'sed', '-i', 's/lxcbr0/br0/', '/etc/default/lxc-net'])
4343
print('Reboot is required')
44-
exit(0)
44+
sys.exit(0)
4545

4646
def build():
4747
global args, workdir
@@ -165,8 +165,8 @@ def main():
165165
args.is_bionic = b'bionic' in subprocess.check_output(['lsb_release', '-cs'])
166166

167167
if args.buildsign:
168-
args.build=True
169-
args.sign=True
168+
args.build = True
169+
args.sign = True
170170

171171
if args.kvm and args.docker:
172172
raise Exception('Error: cannot have both kvm and docker')
@@ -193,11 +193,11 @@ def main():
193193
if args.signer == '':
194194
print(script_name+': Missing signer.')
195195
print('Try '+script_name+' --help for more information')
196-
exit(1)
196+
sys.exit(1)
197197
if args.version == '':
198198
print(script_name+': Missing version.')
199199
print('Try '+script_name+' --help for more information')
200-
exit(1)
200+
sys.exit(1)
201201

202202
# Add leading 'v' for tags
203203
if args.commit and args.pull:

0 commit comments

Comments
 (0)