@ -22,14 +22,14 @@ def setup():
else :
programs + = [ ' lxc ' , ' debootstrap ' ]
subprocess . check_call ( [ ' sudo ' , ' apt-get ' , ' install ' , ' -qq ' ] + programs )
if not os . path . isdir ( ' gitian.sigs ' ) :
subprocess . check_call ( [ ' git ' , ' clone ' , ' https://github.com/ bitcoin-core/gitian.sigs .git' ] )
if not os . path . isdir ( ' bit coin-detached-sigs' ) :
subprocess . check_call ( [ ' git ' , ' clone ' , ' https://github.com/ bitcoin-core/bit coin-detached-sigs.git' ] )
if not os . path . isdir ( ' gitian.sigs .ltc ' ) :
subprocess . check_call ( [ ' git ' , ' clone ' , ' https://github.com/ litecoin-project/gitian.sigs.ltc .git' ] )
if not os . path . isdir ( ' lite coin-detached-sigs' ) :
subprocess . check_call ( [ ' git ' , ' clone ' , ' https://github.com/ litecoin-project/lite coin-detached-sigs.git' ] )
if not os . path . isdir ( ' gitian-builder ' ) :
subprocess . check_call ( [ ' git ' , ' clone ' , ' https://github.com/devrandom/gitian-builder.git ' ] )
if not os . path . isdir ( ' bit coin' ) :
subprocess . check_call ( [ ' git ' , ' clone ' , ' https://github.com/ bitcoin/bit coin.git' ] )
if not os . path . isdir ( ' lite coin' ) :
subprocess . check_call ( [ ' git ' , ' clone ' , ' https://github.com/ litecoin-project/lite coin.git' ] )
os . chdir ( ' gitian-builder ' )
make_image_prog = [ ' bin/make-base-vm ' , ' --suite ' , ' bionic ' , ' --arch ' , ' amd64 ' ]
if args . docker :
@ -46,40 +46,40 @@ def setup():
def build ( ) :
global args , workdir
os . makedirs ( ' bit coin-binaries/' + args . version , exist_ok = True )
os . makedirs ( ' lite coin-binaries/' + args . version , exist_ok = True )
print ( ' \n Building Dependencies \n ' )
os . chdir ( ' gitian-builder ' )
os . makedirs ( ' inputs ' , exist_ok = True )
subprocess . check_call ( [ ' wget ' , ' -N ' , ' -P ' , ' inputs ' , ' http://downloads.sourceforge.net/project/osslsigncode/osslsigncode/osslsigncode-1.7.1.tar.gz ' ] )
subprocess . check_call ( [ ' wget ' , ' -N ' , ' -P ' , ' inputs ' , ' https://bitcoincore.org/cfields/osslsigncode-Backports-to-1.7.1.patch ' ] )
subprocess . check_call ( [ ' make ' , ' -C ' , ' ../ bit coin/depends' , ' download ' , ' SOURCES_PATH= ' + os . getcwd ( ) + ' /cache/common ' ] )
subprocess . check_call ( [ ' make ' , ' -C ' , ' ../ lite coin/depends' , ' download ' , ' SOURCES_PATH= ' + os . getcwd ( ) + ' /cache/common ' ] )
if args . linux :
print ( ' \n Compiling ' + args . version + ' Linux ' )
subprocess . check_call ( [ ' bin/gbuild ' , ' -j ' , args . jobs , ' -m ' , args . memory , ' --commit ' , ' bit coin=' + args . commit , ' --url ' , ' bitcoin=' + args . url , ' ../bit coin/contrib/gitian-descriptors/gitian-linux.yml' ] )
subprocess . check_call ( [ ' bin/gsign ' , ' -p ' , args . sign_prog , ' --signer ' , args . signer , ' --release ' , args . version + ' -linux ' , ' --destination ' , ' ../gitian.sigs /' , ' ../ bit coin/contrib/gitian-descriptors/gitian-linux.yml' ] )
subprocess . check_call ( ' mv build/out/ bitcoin-*.tar.gz build/out/src/bitcoin-*.tar.gz ../bit coin-binaries/' + args . version , shell = True )
subprocess . check_call ( [ ' bin/gbuild ' , ' -j ' , args . jobs , ' -m ' , args . memory , ' --commit ' , ' lite coin=' + args . commit , ' --url ' , ' litecoin=' + args . url , ' ../lite coin/contrib/gitian-descriptors/gitian-linux.yml' ] )
subprocess . check_call ( [ ' bin/gsign ' , ' -p ' , args . sign_prog , ' --signer ' , args . signer , ' --release ' , args . version + ' -linux ' , ' --destination ' , ' ../gitian.sigs .ltc /' , ' ../ lite coin/contrib/gitian-descriptors/gitian-linux.yml' ] )
subprocess . check_call ( ' mv build/out/ litecoin-*.tar.gz build/out/src/litecoin-*.tar.gz ../lite coin-binaries/' + args . version , shell = True )
if args . windows :
print ( ' \n Compiling ' + args . version + ' Windows ' )
subprocess . check_call ( [ ' bin/gbuild ' , ' -j ' , args . jobs , ' -m ' , args . memory , ' --commit ' , ' bit coin=' + args . commit , ' --url ' , ' bitcoin=' + args . url , ' ../bit coin/contrib/gitian-descriptors/gitian-win.yml' ] )
subprocess . check_call ( [ ' bin/gsign ' , ' -p ' , args . sign_prog , ' --signer ' , args . signer , ' --release ' , args . version + ' -win-unsigned ' , ' --destination ' , ' ../gitian.sigs /' , ' ../ bit coin/contrib/gitian-descriptors/gitian-win.yml' ] )
subprocess . check_call ( ' mv build/out/ bitcoin-*-win-unsigned.tar.gz inputs/bit coin-win-unsigned.tar.gz' , shell = True )
subprocess . check_call ( ' mv build/out/ bitcoin-*.zip build/out/bitcoin-*.exe ../bit coin-binaries/' + args . version , shell = True )
subprocess . check_call ( [ ' bin/gbuild ' , ' -j ' , args . jobs , ' -m ' , args . memory , ' --commit ' , ' lite coin=' + args . commit , ' --url ' , ' litecoin=' + args . url , ' ../lite coin/contrib/gitian-descriptors/gitian-win.yml' ] )
subprocess . check_call ( [ ' bin/gsign ' , ' -p ' , args . sign_prog , ' --signer ' , args . signer , ' --release ' , args . version + ' -win-unsigned ' , ' --destination ' , ' ../gitian.sigs .ltc /' , ' ../ lite coin/contrib/gitian-descriptors/gitian-win.yml' ] )
subprocess . check_call ( ' mv build/out/ litecoin-*-win-unsigned.tar.gz inputs/lite coin-win-unsigned.tar.gz' , shell = True )
subprocess . check_call ( ' mv build/out/ litecoin-*.zip build/out/litecoin-*.exe ../lite coin-binaries/' + args . version , shell = True )
if args . macos :
print ( ' \n Compiling ' + args . version + ' MacOS ' )
subprocess . check_call ( [ ' bin/gbuild ' , ' -j ' , args . jobs , ' -m ' , args . memory , ' --commit ' , ' bit coin=' + args . commit , ' --url ' , ' bitcoin=' + args . url , ' ../bit coin/contrib/gitian-descriptors/gitian-osx.yml' ] )
subprocess . check_call ( [ ' bin/gsign ' , ' -p ' , args . sign_prog , ' --signer ' , args . signer , ' --release ' , args . version + ' -osx-unsigned ' , ' --destination ' , ' ../gitian.sigs /' , ' ../ bit coin/contrib/gitian-descriptors/gitian-osx.yml' ] )
subprocess . check_call ( ' mv build/out/ bitcoin-*-osx-unsigned.tar.gz inputs/bit coin-osx-unsigned.tar.gz' , shell = True )
subprocess . check_call ( ' mv build/out/ bitcoin-*.tar.gz build/out/bitcoin-*.dmg ../bit coin-binaries/' + args . version , shell = True )
subprocess . check_call ( [ ' bin/gbuild ' , ' -j ' , args . jobs , ' -m ' , args . memory , ' --commit ' , ' lite coin=' + args . commit , ' --url ' , ' litecoin=' + args . url , ' ../lite coin/contrib/gitian-descriptors/gitian-osx.yml' ] )
subprocess . check_call ( [ ' bin/gsign ' , ' -p ' , args . sign_prog , ' --signer ' , args . signer , ' --release ' , args . version + ' -osx-unsigned ' , ' --destination ' , ' ../gitian.sigs .ltc /' , ' ../ lite coin/contrib/gitian-descriptors/gitian-osx.yml' ] )
subprocess . check_call ( ' mv build/out/ litecoin-*-osx-unsigned.tar.gz inputs/lite coin-osx-unsigned.tar.gz' , shell = True )
subprocess . check_call ( ' mv build/out/ litecoin-*.tar.gz build/out/litecoin-*.dmg ../lite coin-binaries/' + args . version , shell = True )
os . chdir ( workdir )
if args . commit_files :
print ( ' \n Committing ' + args . version + ' Unsigned Sigs \n ' )
os . chdir ( ' gitian.sigs ' )
os . chdir ( ' gitian.sigs .ltc ' )
subprocess . check_call ( [ ' git ' , ' add ' , args . version + ' -linux/ ' + args . signer ] )
subprocess . check_call ( [ ' git ' , ' add ' , args . version + ' -win-unsigned/ ' + args . signer ] )
subprocess . check_call ( [ ' git ' , ' add ' , args . version + ' -osx-unsigned/ ' + args . signer ] )
@ -92,22 +92,22 @@ def sign():
if args . windows :
print ( ' \n Signing ' + args . version + ' Windows ' )
subprocess . check_call ( [ ' bin/gbuild ' , ' -i ' , ' --commit ' , ' signature= ' + args . commit , ' ../ bit coin/contrib/gitian-descriptors/gitian-win-signer.yml' ] )
subprocess . check_call ( [ ' bin/gsign ' , ' -p ' , args . sign_prog , ' --signer ' , args . signer , ' --release ' , args . version + ' -win-signed ' , ' --destination ' , ' ../gitian.sigs /' , ' ../ bit coin/contrib/gitian-descriptors/gitian-win-signer.yml' ] )
subprocess . check_call ( ' mv build/out/ bitcoin-*win64-setup.exe ../bit coin-binaries/' + args . version , shell = True )
subprocess . check_call ( ' mv build/out/ bitcoin-*win32-setup.exe ../bit coin-binaries/' + args . version , shell = True )
subprocess . check_call ( [ ' bin/gbuild ' , ' -i ' , ' --commit ' , ' signature= ' + args . commit , ' ../ lite coin/contrib/gitian-descriptors/gitian-win-signer.yml' ] )
subprocess . check_call ( [ ' bin/gsign ' , ' -p ' , args . sign_prog , ' --signer ' , args . signer , ' --release ' , args . version + ' -win-signed ' , ' --destination ' , ' ../gitian.sigs .ltc /' , ' ../ lite coin/contrib/gitian-descriptors/gitian-win-signer.yml' ] )
subprocess . check_call ( ' mv build/out/ litecoin-*win64-setup.exe ../lite coin-binaries/' + args . version , shell = True )
subprocess . check_call ( ' mv build/out/ litecoin-*win32-setup.exe ../lite coin-binaries/' + args . version , shell = True )
if args . macos :
print ( ' \n Signing ' + args . version + ' MacOS ' )
subprocess . check_call ( [ ' bin/gbuild ' , ' -i ' , ' --commit ' , ' signature= ' + args . commit , ' ../ bit coin/contrib/gitian-descriptors/gitian-osx-signer.yml' ] )
subprocess . check_call ( [ ' bin/gsign ' , ' -p ' , args . sign_prog , ' --signer ' , args . signer , ' --release ' , args . version + ' -osx-signed ' , ' --destination ' , ' ../gitian.sigs /' , ' ../ bit coin/contrib/gitian-descriptors/gitian-osx-signer.yml' ] )
subprocess . check_call ( ' mv build/out/ bitcoin-osx-signed.dmg ../bit coin-binaries/' + args . version + ' / bit coin-' + args . version + ' -osx.dmg ' , shell = True )
subprocess . check_call ( [ ' bin/gbuild ' , ' -i ' , ' --commit ' , ' signature= ' + args . commit , ' ../ lite coin/contrib/gitian-descriptors/gitian-osx-signer.yml' ] )
subprocess . check_call ( [ ' bin/gsign ' , ' -p ' , args . sign_prog , ' --signer ' , args . signer , ' --release ' , args . version + ' -osx-signed ' , ' --destination ' , ' ../gitian.sigs .ltc /' , ' ../ lite coin/contrib/gitian-descriptors/gitian-osx-signer.yml' ] )
subprocess . check_call ( ' mv build/out/ litecoin-osx-signed.dmg ../lite coin-binaries/' + args . version + ' / lite coin-' + args . version + ' -osx.dmg ' , shell = True )
os . chdir ( workdir )
if args . commit_files :
print ( ' \n Committing ' + args . version + ' Signed Sigs \n ' )
os . chdir ( ' gitian.sigs ' )
os . chdir ( ' gitian.sigs .ltc ' )
subprocess . check_call ( [ ' git ' , ' add ' , args . version + ' -win-signed/ ' + args . signer ] )
subprocess . check_call ( [ ' git ' , ' add ' , args . version + ' -osx-signed/ ' + args . signer ] )
subprocess . check_call ( [ ' git ' , ' commit ' , ' -a ' , ' -m ' , ' Add ' + args . version + ' signed binary sigs for ' + args . signer ] )
@ -118,15 +118,15 @@ def verify():
os . chdir ( ' gitian-builder ' )
print ( ' \n Verifying v ' + args . version + ' Linux \n ' )
subprocess . check_call ( [ ' bin/gverify ' , ' -v ' , ' -d ' , ' ../gitian.sigs /' , ' -r ' , args . version + ' -linux ' , ' ../ bit coin/contrib/gitian-descriptors/gitian-linux.yml' ] )
subprocess . check_call ( [ ' bin/gverify ' , ' -v ' , ' -d ' , ' ../gitian.sigs .ltc /' , ' -r ' , args . version + ' -linux ' , ' ../ lite coin/contrib/gitian-descriptors/gitian-linux.yml' ] )
print ( ' \n Verifying v ' + args . version + ' Windows \n ' )
subprocess . check_call ( [ ' bin/gverify ' , ' -v ' , ' -d ' , ' ../gitian.sigs /' , ' -r ' , args . version + ' -win-unsigned ' , ' ../ bit coin/contrib/gitian-descriptors/gitian-win.yml' ] )
subprocess . check_call ( [ ' bin/gverify ' , ' -v ' , ' -d ' , ' ../gitian.sigs .ltc /' , ' -r ' , args . version + ' -win-unsigned ' , ' ../ lite coin/contrib/gitian-descriptors/gitian-win.yml' ] )
print ( ' \n Verifying v ' + args . version + ' MacOS \n ' )
subprocess . check_call ( [ ' bin/gverify ' , ' -v ' , ' -d ' , ' ../gitian.sigs /' , ' -r ' , args . version + ' -osx-unsigned ' , ' ../ bit coin/contrib/gitian-descriptors/gitian-osx.yml' ] )
subprocess . check_call ( [ ' bin/gverify ' , ' -v ' , ' -d ' , ' ../gitian.sigs .ltc /' , ' -r ' , args . version + ' -osx-unsigned ' , ' ../ lite coin/contrib/gitian-descriptors/gitian-osx.yml' ] )
print ( ' \n Verifying v ' + args . version + ' Signed Windows \n ' )
subprocess . check_call ( [ ' bin/gverify ' , ' -v ' , ' -d ' , ' ../gitian.sigs /' , ' -r ' , args . version + ' -win-signed ' , ' ../ bit coin/contrib/gitian-descriptors/gitian-win-signer.yml' ] )
subprocess . check_call ( [ ' bin/gverify ' , ' -v ' , ' -d ' , ' ../gitian.sigs .ltc /' , ' -r ' , args . version + ' -win-signed ' , ' ../ lite coin/contrib/gitian-descriptors/gitian-win-signer.yml' ] )
print ( ' \n Verifying v ' + args . version + ' Signed MacOS \n ' )
subprocess . check_call ( [ ' bin/gverify ' , ' -v ' , ' -d ' , ' ../gitian.sigs /' , ' -r ' , args . version + ' -osx-signed ' , ' ../ bit coin/contrib/gitian-descriptors/gitian-osx-signer.yml' ] )
subprocess . check_call ( [ ' bin/gverify ' , ' -v ' , ' -d ' , ' ../gitian.sigs .ltc /' , ' -r ' , args . version + ' -osx-signed ' , ' ../ lite coin/contrib/gitian-descriptors/gitian-osx-signer.yml' ] )
os . chdir ( workdir )
@ -135,7 +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 ( ' -u ' , ' --url ' , dest = ' url ' , default = ' https://github.com/ bitcoin/bit coin' , help = ' Specify the URL of the repository. Default is %(default)s ' )
parser . add_argument ( ' -u ' , ' --url ' , dest = ' url ' , default = ' https://github.com/ litecoin-project/lite coin' , 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 ' )
parser . add_argument ( ' -s ' , ' --sign ' , action = ' store_true ' , dest = ' sign ' , help = ' Make signed binaries for Windows and MacOS ' )
@ -202,7 +202,7 @@ def main():
if args . setup :
setup ( )
os . chdir ( ' bit coin' )
os . chdir ( ' lite coin' )
subprocess . check_call ( [ ' git ' , ' fetch ' ] )
subprocess . check_call ( [ ' git ' , ' checkout ' , args . commit ] )
os . chdir ( workdir )