Skip to content

Commit 4c56a79

Browse files
committed
Set/unset USE_LXC, USE_VBOX, USE_DOCKER explicitly
This prevents the setting of more than one environment variable for the gitian-builder (e.g., USE_LXC being set shadows USE_DOCKER; for details see gitian-builder/libexec/make-clean-vm).
1 parent cbbd988 commit 4c56a79

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

contrib/gitian-build.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def main():
149149
parser.add_argument('-m', '--memory', dest='memory', default='2000', help='Memory to allocate in MiB. Default %(default)s')
150150
parser.add_argument('-k', '--kvm', action='store_true', dest='kvm', help='Use KVM instead of LXC')
151151
parser.add_argument('-d', '--docker', action='store_true', dest='docker', help='Use Docker instead of LXC')
152-
parser.add_argument('-S', '--setup', action='store_true', dest='setup', help='Set up the Gitian building environment. Uses LXC. If you want to use KVM, use the --kvm option. Only works on Debian-based systems (Ubuntu, Debian)')
152+
parser.add_argument('-S', '--setup', action='store_true', dest='setup', help='Set up the Gitian building environment. Only works on Debian-based systems (Ubuntu, Debian)')
153153
parser.add_argument('-D', '--detach-sign', action='store_true', dest='detach_sign', help='Create the assert file for detached signing. Will not commit anything.')
154154
parser.add_argument('-n', '--no-commit', action='store_false', dest='commit_files', help='Do not commit anything to git')
155155
parser.add_argument('signer', help='GPG signer to sign each build assert file')
@@ -173,14 +173,18 @@ def main():
173173

174174
args.sign_prog = 'true' if args.detach_sign else 'gpg --detach-sign'
175175

176-
# Set environment variable USE_LXC or USE_DOCKER, let gitian-builder know that we use lxc or docker
176+
# Ensure no more than one environment variable for gitian-builder (USE_LXC, USE_VBOX, USE_DOCKER) is set as they
177+
# can interfere (e.g., USE_LXC being set shadows USE_DOCKER; for details see gitian-builder/libexec/make-clean-vm).
178+
os.environ['USE_LXC'] = ''
179+
os.environ['USE_VBOX'] = ''
180+
os.environ['USE_DOCKER'] = ''
177181
if args.docker:
178182
os.environ['USE_DOCKER'] = '1'
179183
elif not args.kvm:
180184
os.environ['USE_LXC'] = '1'
181-
if not 'GITIAN_HOST_IP' in os.environ.keys():
185+
if 'GITIAN_HOST_IP' not in os.environ.keys():
182186
os.environ['GITIAN_HOST_IP'] = '10.0.3.1'
183-
if not 'LXC_GUEST_IP' in os.environ.keys():
187+
if 'LXC_GUEST_IP' not in os.environ.keys():
184188
os.environ['LXC_GUEST_IP'] = '10.0.3.5'
185189

186190
# Disable for MacOS if no SDK found

0 commit comments

Comments
 (0)