Skip to content

Commit

Permalink
Merge #13765: contrib: add gitian build support for github pull request
Browse files Browse the repository at this point in the history
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
  • Loading branch information
laanwj committed Aug 22, 2018
2 parents 17d6449 + 46f8345 commit a5fc1aa
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion contrib/gitian-build.py
Expand Up @@ -135,6 +135,7 @@ def main():

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

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

if args.setup:
setup()

os.chdir('bitcoin')
if args.pull:
subprocess.check_call(['git', 'fetch', args.url, 'refs/pull/'+args.version+'/merge'])
os.chdir('../gitian-builder/inputs/bitcoin')
subprocess.check_call(['git', 'fetch', args.url, 'refs/pull/'+args.version+'/merge'])
args.commit = subprocess.check_output(['git', 'show', '-s', '--format=%H', 'FETCH_HEAD'], universal_newlines=True).strip()
args.version = 'pull-' + args.version
print(args.commit)
subprocess.check_call(['git', 'fetch'])
subprocess.check_call(['git', 'checkout', args.commit])
os.chdir(workdir)
Expand Down

0 comments on commit a5fc1aa

Please sign in to comment.