Skip to content

Commit a5fc1aa

Browse files
committed
Merge #13765: contrib: add gitian build support for github pull request
46f8345 contrib: Support github pull request gitian-build (Chun Kuan Lee) Pull request description: - Add `-p` or `--pull` to specify the version is github pull request number - `./gitian-build.py -bpDn test 13765` should work. This is helpful for someone want to try cross compiling. Tree-SHA512: b474b089127ffb2a67a42d99c1888bd5812a5ba725c8915a13a01cf93bde32b5b5011314e4193fa6b231caa5de2137e709ee5aa5bf889c4ac60a97aa83caac5c
2 parents 17d6449 + 46f8345 commit a5fc1aa

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

contrib/gitian-build.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ def main():
135135

136136
parser = argparse.ArgumentParser(usage='%(prog)s [options] signer version')
137137
parser.add_argument('-c', '--commit', action='store_true', dest='commit', help='Indicate that the version argument is for a commit or branch')
138+
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')
138139
parser.add_argument('-u', '--url', dest='url', default='https://github.com/bitcoin/bitcoin', help='Specify the URL of the repository. Default is %(default)s')
139140
parser.add_argument('-v', '--verify', action='store_true', dest='verify', help='Verify the Gitian build')
140141
parser.add_argument('-b', '--build', action='store_true', dest='build', help='Do a Gitian build')
@@ -196,13 +197,21 @@ def main():
196197
exit(1)
197198

198199
# Add leading 'v' for tags
200+
if args.commit and args.pull:
201+
raise Exception('Cannot have both commit and pull')
199202
args.commit = ('' if args.commit else 'v') + args.version
200-
print(args.commit)
201203

202204
if args.setup:
203205
setup()
204206

205207
os.chdir('bitcoin')
208+
if args.pull:
209+
subprocess.check_call(['git', 'fetch', args.url, 'refs/pull/'+args.version+'/merge'])
210+
os.chdir('../gitian-builder/inputs/bitcoin')
211+
subprocess.check_call(['git', 'fetch', args.url, 'refs/pull/'+args.version+'/merge'])
212+
args.commit = subprocess.check_output(['git', 'show', '-s', '--format=%H', 'FETCH_HEAD'], universal_newlines=True).strip()
213+
args.version = 'pull-' + args.version
214+
print(args.commit)
206215
subprocess.check_call(['git', 'fetch'])
207216
subprocess.check_call(['git', 'checkout', args.commit])
208217
os.chdir(workdir)

0 commit comments

Comments
 (0)