You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge #15236: scripts and tools: Make --setup command independent
e0eae1b Make --setup command independent (Hennadii Stepanov)
Pull request description:
This PR allows a user to run:
```sh
./gitian-build.py --setup
```
without unused `signer` and `version` options.
In master the `signer` and `version` options are mandatory. This implies the following code is dead:
https://github.com/bitcoin/bitcoin/blob/387eb5b34307448f16d3769ac0245c4e3d996a38/contrib/gitian-build.py#L192-L200
This PR fixes those lines of code.
Also this PR has a nice side effect: there is no more warnings about macOS build during processing `--setup` command. Ref: bitcoin/bitcoin#13998 (comment)
Note: https://github.com/bitcoin-core/docs/blob/master/gitian-building.md will be updated when this PR is merged.
ACKs for commit e0eae1:
Tree-SHA512: df851fe461e402229c57b410f30f1d8bc816e8a2600ece4249aa39c763566de5b661e7aa0af171d484727eb463a6d0e10cfcf459aa60ae1a5d4e12974a8615c6
parser = argparse.ArgumentParser(description='Script for running full Gitian builds.')
156
156
parser.add_argument('-c', '--commit', action='store_true', dest='commit', help='Indicate that the version argument is for a commit or branch')
157
157
parser.add_argument('-p', '--pull', action='store_true', dest='pull', help='Indicate that the version argument is the number of a github repository pull request')
158
158
parser.add_argument('-u', '--url', dest='url', default='https://github.com/bitcoin/bitcoin', help='Specify the URL of the repository. Default is %(default)s')
@@ -168,27 +168,17 @@ def main():
168
168
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)')
169
169
parser.add_argument('-D', '--detach-sign', action='store_true', dest='detach_sign', help='Create the assert file for detached signing. Will not commit anything.')
170
170
parser.add_argument('-n', '--no-commit', action='store_false', dest='commit_files', help='Do not commit anything to git')
171
-
parser.add_argument('signer', help='GPG signer to sign each build assert file')
172
-
parser.add_argument('version', help='Version number, commit, or branch to build. If building a commit or branch, the -c option must be specified')
171
+
parser.add_argument('signer', nargs='?', help='GPG signer to sign each build assert file')
172
+
parser.add_argument('version', nargs='?', help='Version number, commit, or branch to build. If building a commit or branch, the -c option must be specified')
173
173
174
174
args = parser.parse_args()
175
175
workdir = os.getcwd()
176
176
177
-
args.linux = 'l' in args.os
178
-
args.windows = 'w' in args.os
179
-
args.macos = 'm' in args.os
180
-
181
177
args.is_bionic = b'bionic' in subprocess.check_output(['lsb_release', '-cs'])
182
178
183
-
if args.buildsign:
184
-
args.build = True
185
-
args.sign = True
186
-
187
179
if args.kvm and args.docker:
188
180
raise Exception('Error: cannot have both kvm and docker')
189
181
190
-
args.sign_prog = 'true' if args.detach_sign else 'gpg --detach-sign'
191
-
192
182
# Ensure no more than one environment variable for gitian-builder (USE_LXC, USE_VBOX, USE_DOCKER) is set as they
193
183
# can interfere (e.g., USE_LXC being set shadows USE_DOCKER; for details see gitian-builder/libexec/make-clean-vm).
194
184
os.environ['USE_LXC'] = ''
@@ -203,19 +193,34 @@ def main():
203
193
if 'LXC_GUEST_IP' not in os.environ.keys():
204
194
os.environ['LXC_GUEST_IP'] = '10.0.3.5'
205
195
196
+
if args.setup:
197
+
setup()
198
+
199
+
if args.buildsign:
200
+
args.build = True
201
+
args.sign = True
202
+
203
+
if not args.build and not args.sign and not args.verify:
204
+
sys.exit(0)
205
+
206
+
args.linux = 'l' in args.os
207
+
args.windows = 'w' in args.os
208
+
args.macos = 'm' in args.os
209
+
206
210
# Disable for MacOS if no SDK found
207
211
if args.macos and not os.path.isfile('gitian-builder/inputs/MacOSX10.11.sdk.tar.gz'):
208
212
print('Cannot build for MacOS, SDK does not exist. Will build for other OSes')
209
213
args.macos = False
210
214
215
+
args.sign_prog = 'true' if args.detach_sign else 'gpg --detach-sign'
216
+
211
217
script_name = os.path.basename(sys.argv[0])
212
-
# Signer and version shouldn't be empty
213
-
if args.signer == '':
214
-
print(script_name+': Missing signer.')
218
+
if not args.signer:
219
+
print(script_name+': Missing signer')
215
220
print('Try '+script_name+' --help for more information')
216
221
sys.exit(1)
217
-
if args.version == '':
218
-
print(script_name+': Missing version.')
222
+
if not args.version:
223
+
print(script_name+': Missing version')
219
224
print('Try '+script_name+' --help for more information')
220
225
sys.exit(1)
221
226
@@ -224,9 +229,6 @@ def main():
224
229
raise Exception('Cannot have both commit and pull')
225
230
args.commit = ('' if args.commit else 'v') + args.version
0 commit comments