git ssb

0+

Monero Pub / gitian.sigs



Commit 4b0d2bf5d945de34edd37485b4c156c9d8409ad4

Merge pull request #31 into master

TheCharlatan committed on 11/19/2019, 11:55:59 PM
Parent: b53b89087262d29dec6eb41cf0d562715fd9c5d6
Parent: 8ac63f4f313a1e94636964cb047c9e999e91ba3b

Files changed

verify-merge.pychanged
verify-merge.pyView
@@ -11,10 +11,10 @@
1111 def verify():
1212 global args, workdir
1313 if args.import_keys:
1414 os.chdir('gitian-pubkeys')
15- print('Importing pubkeys...')
16- keys = [f for f in glob.glob("*.asc", recursive=True)]
15+ print('Importing gpg pubkeys...')
16+ keys = [f for f in glob.glob('*.asc', recursive=False)]
1717 for key in keys:
1818 subprocess.check_call([GPG, '--import', key])
1919 os.chdir('../')
2020 if args.refresh_keys:
@@ -37,67 +37,67 @@
3737 exit(1)
3838
3939 print('All signatures verified correctly.\n')
4040 print('Beginning checksum comparison...\n')
41- # Check that the contents between the assertion signers match. This is meant for quick verification, not for validation of their contents
41+ # Check that the contents between the assertion signers match.
42+ # This is meant for quick verification, not for validation of their contents.
4243 # TODO: prevent false positives related to filenames / whitespace / formatting.
4344 builds = glob.glob(ver_pattern + '*')
4445 for build in builds:
4546 first_file = glob.glob(build + '/*/*.assert', recursive=False)[0]
46- f = open(first_file, "r")
47+ f = open(first_file, 'r')
4748 first_file_contents = f.readlines()
4849 f.close()
4950 for assert_file in glob.glob(build + '/*/*.assert', recursive=False):
50- f = open(assert_file, "r")
51+ f = open(assert_file, 'r')
5152 assert_file_contents = f.readlines()
5253 f.close()
5354 for i in range(len(assert_file_contents)):
54- # compare everything in the assertions until the base image manifests
55- if assert_file_contents[i] == "- base_manifests: !!omap\n":
55+ # Compare each line in the assertion file until base_manifests:
56+ if assert_file_contents[i] == '- base_manifests: !!omap\n':
5657 break
57- # the OSX SDK may change from time to time
58- if "sdk" in assert_file_contents[i]:
58+ # The OSX SDK may change from time to time:
59+ if 'sdk' in assert_file_contents[i]:
5960 continue
6061 if assert_file_contents[i] != first_file_contents[i]:
61- print("ERROR: Found conflicting contents on line:", i)
62- print(assert_file, ":\n", assert_file_contents[i])
63- print(first_file, ":\n", first_file_contents[i])
62+ sys.stderr.write('ERROR: Found conflicting contents on line:', i)
63+ sys.stderr.write(assert_file + ':\n' + assert_file_contents[i])
64+ sys.stderr.write(first_file + ':\n' + first_file_contents[i])
6465 exit(1)
6566
6667 print('No discrepancies found in assertion files.')
6768 print('All checks passed.')
6869 os.chdir(workdir)
6970
7071 def main():
71- host_repo = "git@github.com/monero-project/gitian.sigs"
72+ host_repo = 'git@github.com/monero-project/gitian.sigs'
7273 global args, workdir
7374 parser = argparse.ArgumentParser(usage='%(prog)s [options]', description='Use this script to verify the signatures of existing gitian assert files and / or assert files in a specific pull request.')
74- parser.add_argument('-p', '--pull_id', dest='pull_id', help='Github Pull request id to check')
75- parser.add_argument('-r', '--remote', dest='remote', default='upstream', help='git remote repository')
75+ parser.add_argument('-p', '--pull_id', dest='pull_id', help='GitHub Pull request id to check')
76+ parser.add_argument('-r', '--remote', dest='remote', default='upstream', help='The git remote repository')
7677 parser.add_argument('-t', '--target-branch', dest='target_branch', default='master', help='Remote repository merge into branch')
7778 parser.add_argument('-m', '--merge', action='store_true', dest='merge', help='Merge the given pull request id')
78- parser.add_argument('-k', '--refresh-keys', action='store_true', dest='refresh_keys', help='refresh all pgp public keys that are currently in the gpg keyring.')
79- parser.add_argument('-i', '--import-keys', action='store_true', dest='import_keys', help='import all public keys in the gitian-pubkeys directory to the gpg keyring.')
79+ parser.add_argument('-k', '--refresh-keys', action='store_true', dest='refresh_keys', help='Refresh all public keys that are currently in the gpg keyring.')
80+ parser.add_argument('-i', '--import-keys', action='store_true', dest='import_keys', help='Import all public keys in the gitian-pubkeys directory to the gpg keyring.')
8081 parser.add_argument('-o', '--no-verify', action='store_true', dest='no_verify', help='Do not run any signature verification')
8182 parser.add_argument('-v', '--version', dest='version', help='Version number of sigs to be verified (defaults to all versions if not specified).')
8283
8384 args = parser.parse_args()
8485
8586 workdir = os.getcwd()
8687 if args.pull_id != None:
8788 # Get branch from remote pull request and compare
88- head_branch = args.pull_id+'_head'
89-
89+ head_branch = args.pull_id + '_head'
9090 subprocess.check_call([GIT, 'fetch', args.remote])
91- subprocess.check_call([GIT, 'checkout', args.remote+'/'+args.target_branch])
92- subprocess.check_call([GIT, 'fetch','-q', args.remote, 'pull/'+args.pull_id+'/head:'+head_branch])
91+ subprocess.check_call([GIT, 'checkout', args.remote + '/' + args.target_branch])
92+ subprocess.check_call([GIT, 'fetch', '-q', args.remote, 'pull/' + args.pull_id + '/head:' + head_branch])
9393 subprocess.check_call([GIT, 'checkout', '-f', head_branch])
9494 if args.merge:
9595 # Hard reset the target branch to the remote's state and merge the pull request's head branch into it
9696 subprocess.check_call([GIT, 'checkout', args.target_branch])
9797 subprocess.check_call([GIT, 'reset', '--hard', args.remote + '/' + args.target_branch])
9898 print('Merging and signing pull request #' + args.pull_id + ' , if you are using a smartcard, confirm the signature now.')
99- subprocess.check_call([GIT, 'merge','-q', '--commit', '--no-edit', '-m', 'Merge pull request #'+args.pull_id+' into '+args.target_branch, '--no-ff', '--gpg-sign', head_branch])
99+ subprocess.check_call([GIT, 'merge', '-q', '--commit', '--no-edit', '-m', 'Merge pull request #' + args.pull_id + ' into ' + args.target_branch, '--no-ff', '--gpg-sign', head_branch])
100100 if not args.no_verify:
101101 verify()
102102 subprocess.check_call([GIT, 'checkout', 'master'])
103103 subprocess.check_call([GIT, 'branch', '-D', head_branch])

Built with git-ssb-web