0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-10 10:52:31 -05:00

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.
This commit is contained in:
Hennadii Stepanov 2019-05-18 16:40:39 +03:00
parent 387eb5b343
commit cbbd98863b
No known key found for this signature in database
GPG key ID: 410108112E7EA81F

View file

@ -7,20 +7,20 @@ import sys
def setup(): def setup():
global args, workdir global args, workdir
programs = ['ruby', 'git', 'apt-cacher-ng', 'make', 'wget'] programs = ['ruby', 'git', 'make', 'wget']
if args.kvm: if args.kvm:
programs += ['python-vm-builder', 'qemu-kvm', 'qemu-utils'] programs += ['apt-cacher-ng', 'python-vm-builder', 'qemu-kvm', 'qemu-utils']
elif args.docker: elif args.docker and not os.path.isfile('/lib/systemd/system/docker.service'):
dockers = ['docker.io', 'docker-ce'] dockers = ['docker.io', 'docker-ce']
for i in dockers: for i in dockers:
return_code = subprocess.call(['sudo', 'apt-get', 'install', '-qq', i]) return_code = subprocess.call(['sudo', 'apt-get', 'install', '-qq', i])
if return_code == 0: if return_code == 0:
break break
if return_code != 0: if return_code != 0:
print('Cannot find any way to install docker', file=sys.stderr) print('Cannot find any way to install Docker.', file=sys.stderr)
exit(1) sys.exit(1)
else: else:
programs += ['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)
if not os.path.isdir('gitian.sigs'): if not os.path.isdir('gitian.sigs'):
subprocess.check_call(['git', 'clone', 'https://github.com/bitcoin-core/gitian.sigs.git']) subprocess.check_call(['git', 'clone', 'https://github.com/bitcoin-core/gitian.sigs.git'])
@ -41,7 +41,7 @@ def setup():
if args.is_bionic and not args.kvm and not args.docker: if args.is_bionic and not args.kvm and not args.docker:
subprocess.check_call(['sudo', 'sed', '-i', 's/lxcbr0/br0/', '/etc/default/lxc-net']) subprocess.check_call(['sudo', 'sed', '-i', 's/lxcbr0/br0/', '/etc/default/lxc-net'])
print('Reboot is required') print('Reboot is required')
exit(0) sys.exit(0)
def build(): def build():
global args, workdir global args, workdir
@ -193,11 +193,11 @@ def main():
if args.signer == '': if args.signer == '':
print(script_name+': Missing signer.') print(script_name+': Missing signer.')
print('Try '+script_name+' --help for more information') print('Try '+script_name+' --help for more information')
exit(1) sys.exit(1)
if args.version == '': if args.version == '':
print(script_name+': Missing version.') print(script_name+': Missing version.')
print('Try '+script_name+' --help for more information') print('Try '+script_name+' --help for more information')
exit(1) sys.exit(1)
# Add leading 'v' for tags # Add leading 'v' for tags
if args.commit and args.pull: if args.commit and args.pull: