mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-26 21:03:28 +01:00
Streamline build setup
Use shorter, prefix-unique directory names gitian-builder -> builder gitian-sigs -> sigs monero-binaries -> out Just use builder/inputs/monero, no need for 2nd repo clone
This commit is contained in:
parent
2c171a9b02
commit
5f8524ef5f
@ -5,6 +5,9 @@ import os
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
gsigs = 'https://github.com/monero-project/gitian.sigs.git'
|
||||||
|
gbrepo = 'https://github.com/devrandom/gitian-builder.git'
|
||||||
|
|
||||||
def setup():
|
def setup():
|
||||||
global args, workdir
|
global args, workdir
|
||||||
programs = ['apt-cacher-ng', 'ruby', 'git', 'make', 'wget']
|
programs = ['apt-cacher-ng', 'ruby', 'git', 'make', 'wget']
|
||||||
@ -14,14 +17,21 @@ def setup():
|
|||||||
programs += ['lxc', 'debootstrap']
|
programs += ['lxc', 'debootstrap']
|
||||||
if not args.no_apt:
|
if not args.no_apt:
|
||||||
subprocess.check_call(['sudo', 'apt-get', 'install', '-qq'] + programs)
|
subprocess.check_call(['sudo', 'apt-get', 'install', '-qq'] + programs)
|
||||||
if not os.path.isdir('gitian.sigs'):
|
if not os.path.isdir('sigs'):
|
||||||
subprocess.check_call(['git', 'clone', 'https://github.com/monero-project/gitian.sigs.git'])
|
subprocess.check_call(['git', 'clone', gsigs, 'sigs'])
|
||||||
if not os.path.isdir('gitian-builder'):
|
if not os.path.isdir('builder'):
|
||||||
subprocess.check_call(['git', 'clone', 'https://github.com/devrandom/gitian-builder.git'])
|
subprocess.check_call(['git', 'clone', gbrepo, 'builder'])
|
||||||
if not os.path.isdir('monero'):
|
os.chdir('builder')
|
||||||
subprocess.check_call(['git', 'clone', 'https://github.com/monero-project/monero.git'])
|
subprocess.check_call(['git', 'config', 'user.email', 'gitianuser@localhost'])
|
||||||
os.chdir('gitian-builder')
|
subprocess.check_call(['git', 'config', 'user.name', 'gitianuser'])
|
||||||
subprocess.check_call(['git', 'checkout', '963322de8420c50502c4cc33d4d7c0d84437b576'])
|
subprocess.check_call(['git', 'checkout', '963322de8420c50502c4cc33d4d7c0d84437b576'])
|
||||||
|
subprocess.check_call(['git', 'fetch', 'origin', '72c51f0bd2adec4eedab4dbd06c9229b9c4eb0e3'])
|
||||||
|
subprocess.check_call(['git', 'cherry-pick', '72c51f0bd2adec4eedab4dbd06c9229b9c4eb0e3'])
|
||||||
|
os.makedirs('inputs', exist_ok=True)
|
||||||
|
os.chdir('inputs')
|
||||||
|
if not os.path.isdir('monero'):
|
||||||
|
subprocess.check_call(['git', 'clone', args.url, 'monero'])
|
||||||
|
os.chdir('..')
|
||||||
make_image_prog = ['bin/make-base-vm', '--suite', 'bionic', '--arch', 'amd64']
|
make_image_prog = ['bin/make-base-vm', '--suite', 'bionic', '--arch', 'amd64']
|
||||||
if args.docker:
|
if args.docker:
|
||||||
if not subprocess.call(['docker', '--help'], shell=False, stdout=subprocess.DEVNULL):
|
if not subprocess.call(['docker', '--help'], shell=False, stdout=subprocess.DEVNULL):
|
||||||
@ -39,40 +49,40 @@ def setup():
|
|||||||
def build():
|
def build():
|
||||||
global args, workdir
|
global args, workdir
|
||||||
|
|
||||||
os.makedirs('monero-binaries/' + args.version, exist_ok=True)
|
os.makedirs('out/' + args.version, exist_ok=True)
|
||||||
print('\nBuilding Dependencies\n')
|
print('\nBuilding Dependencies\n')
|
||||||
os.chdir('gitian-builder')
|
os.chdir('builder')
|
||||||
os.makedirs('inputs', exist_ok=True)
|
os.makedirs('inputs', exist_ok=True)
|
||||||
|
|
||||||
subprocess.check_call(['wget', '-N', '-P', 'inputs', 'https://downloads.sourceforge.net/project/osslsigncode/osslsigncode/osslsigncode-1.7.1.tar.gz'])
|
subprocess.check_call(['wget', '-N', '-P', 'inputs', 'https://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(['wget', '-N', '-P', 'inputs', 'https://bitcoincore.org/cfields/osslsigncode-Backports-to-1.7.1.patch'])
|
||||||
subprocess.check_output(["echo 'a8c4e9cafba922f89de0df1f2152e7be286aba73f78505169bc351a7938dd911 inputs/osslsigncode-Backports-to-1.7.1.patch' | sha256sum -c"], shell=True)
|
subprocess.check_output(["echo 'a8c4e9cafba922f89de0df1f2152e7be286aba73f78505169bc351a7938dd911 inputs/osslsigncode-Backports-to-1.7.1.patch' | sha256sum -c"], shell=True)
|
||||||
subprocess.check_output(["echo 'f9a8cdb38b9c309326764ebc937cba1523a3a751a7ab05df3ecc99d18ae466c9 inputs/osslsigncode-1.7.1.tar.gz' | sha256sum -c"], shell=True)
|
subprocess.check_output(["echo 'f9a8cdb38b9c309326764ebc937cba1523a3a751a7ab05df3ecc99d18ae466c9 inputs/osslsigncode-1.7.1.tar.gz' | sha256sum -c"], shell=True)
|
||||||
subprocess.check_call(['make', '-C', '../monero/contrib/depends', 'download', 'SOURCES_PATH=' + os.getcwd() + '/cache/common'])
|
subprocess.check_call(['make', '-C', 'inputs/monero/contrib/depends', 'download', 'SOURCES_PATH=' + os.getcwd() + '/cache/common'])
|
||||||
|
|
||||||
if args.linux:
|
if args.linux:
|
||||||
print('\nCompiling ' + args.version + ' Linux')
|
print('\nCompiling ' + args.version + ' Linux')
|
||||||
subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'monero='+args.commit, '--url', 'monero='+args.url, '../monero/contrib/gitian/gitian-linux.yml'])
|
subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'monero='+args.commit, '--url', 'monero='+args.url, 'inputs/monero/contrib/gitian/gitian-linux.yml'])
|
||||||
subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-linux', '--destination', '../gitian.sigs/', '../monero/contrib/gitian/gitian-linux.yml'])
|
subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-linux', '--destination', '../sigs/', 'inputs/monero/contrib/gitian/gitian-linux.yml'])
|
||||||
subprocess.check_call('mv build/out/monero-*.tar.bz2 ../monero-binaries/'+args.version, shell=True)
|
subprocess.check_call('mv build/out/monero-*.tar.bz2 ../out/'+args.version, shell=True)
|
||||||
|
|
||||||
if args.windows:
|
if args.windows:
|
||||||
print('\nCompiling ' + args.version + ' Windows')
|
print('\nCompiling ' + args.version + ' Windows')
|
||||||
subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'monero='+args.commit, '--url', 'monero='+args.url, '../monero/contrib/gitian/gitian-win.yml'])
|
subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'monero='+args.commit, '--url', 'monero='+args.url, 'inputs/monero/contrib/gitian/gitian-win.yml'])
|
||||||
subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-win', '--destination', '../gitian.sigs/', '../monero/contrib/gitian/gitian-win.yml'])
|
subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-win', '--destination', '../sigs/', 'inputs/monero/contrib/gitian/gitian-win.yml'])
|
||||||
subprocess.check_call('mv build/out/monero*.zip ../monero-binaries/'+args.version, shell=True)
|
subprocess.check_call('mv build/out/monero*.zip ../out/'+args.version, shell=True)
|
||||||
|
|
||||||
if args.macos:
|
if args.macos:
|
||||||
print('\nCompiling ' + args.version + ' MacOS')
|
print('\nCompiling ' + args.version + ' MacOS')
|
||||||
subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'monero='+args.commit, '--url', 'monero='+args.url, '../monero/contrib/gitian/gitian-osx.yml'])
|
subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'monero='+args.commit, '--url', 'monero'+args.url, 'inputs/monero/contrib/gitian/gitian-osx.yml'])
|
||||||
subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-osx', '--destination', '../gitian.sigs/', '../monero/contrib/gitian/gitian-osx.yml'])
|
subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-osx', '--destination', '../sigs/', 'inputs/monero/contrib/gitian/gitian-osx.yml'])
|
||||||
subprocess.check_call('mv build/out/monero*.tar.bz2 ../monero-binaries/'+args.version, shell=True)
|
subprocess.check_call('mv build/out/monero*.tar.bz2 ../out/'+args.version, shell=True)
|
||||||
|
|
||||||
os.chdir(workdir)
|
os.chdir(workdir)
|
||||||
|
|
||||||
if args.commit_files:
|
if args.commit_files:
|
||||||
print('\nCommitting '+args.version+' Unsigned Sigs\n')
|
print('\nCommitting '+args.version+' Unsigned Sigs\n')
|
||||||
os.chdir('gitian.sigs')
|
os.chdir('sigs')
|
||||||
subprocess.check_call(['git', 'add', args.version+'-linux/'+args.signer])
|
subprocess.check_call(['git', 'add', args.version+'-linux/'+args.signer])
|
||||||
subprocess.check_call(['git', 'add', args.version+'-win/'+args.signer])
|
subprocess.check_call(['git', 'add', args.version+'-win/'+args.signer])
|
||||||
subprocess.check_call(['git', 'add', args.version+'-osx/'+args.signer])
|
subprocess.check_call(['git', 'add', args.version+'-osx/'+args.signer])
|
||||||
@ -81,14 +91,14 @@ def build():
|
|||||||
|
|
||||||
def verify():
|
def verify():
|
||||||
global args, workdir
|
global args, workdir
|
||||||
os.chdir('gitian-builder')
|
os.chdir('builder')
|
||||||
|
|
||||||
print('\nVerifying v'+args.version+' Linux\n')
|
print('\nVerifying v'+args.version+' Linux\n')
|
||||||
subprocess.check_call(['bin/gverify', '-v', '-d', '../gitian.sigs/', '-r', args.version+'-linux', '../monero/contrib/gitian/gitian-linux.yml'])
|
subprocess.check_call(['bin/gverify', '-v', '-d', '../sigs/', '-r', args.version+'-linux', 'inputs/monero/contrib/gitian/gitian-linux.yml'])
|
||||||
print('\nVerifying v'+args.version+' Windows\n')
|
print('\nVerifying v'+args.version+' Windows\n')
|
||||||
subprocess.check_call(['bin/gverify', '-v', '-d', '../gitian.sigs/', '-r', args.version+'-win', '../monero/contrib/gitian/gitian-win.yml'])
|
subprocess.check_call(['bin/gverify', '-v', '-d', '../sigs/', '-r', args.version+'-win', 'inputs/monero/contrib/gitian/gitian-win.yml'])
|
||||||
print('\nVerifying v'+args.version+' MacOS\n')
|
print('\nVerifying v'+args.version+' MacOS\n')
|
||||||
subprocess.check_call(['bin/gverify', '-v', '-d', '../gitian.sigs/', '-r', args.version+'-osx', '../monero/contrib/gitian/gitian-osx.yml'])
|
subprocess.check_call(['bin/gverify', '-v', '-d', '../sigs/', '-r', args.version+'-osx', 'inputs/monero/contrib/gitian/gitian-osx.yml'])
|
||||||
os.chdir(workdir)
|
os.chdir(workdir)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@ -142,7 +152,7 @@ def main():
|
|||||||
os.environ['LXC_GUEST_IP'] = '10.0.3.5'
|
os.environ['LXC_GUEST_IP'] = '10.0.3.5'
|
||||||
|
|
||||||
# Disable MacOS build if no SDK found
|
# Disable MacOS build if no SDK found
|
||||||
if args.build and args.macos and not os.path.isfile('gitian-builder/inputs/MacOSX10.11.sdk.tar.gz'):
|
if args.build and args.macos and not os.path.isfile('builder/inputs/MacOSX10.11.sdk.tar.gz'):
|
||||||
print('Cannot build for MacOS, SDK does not exist. Will build for other OSes')
|
print('Cannot build for MacOS, SDK does not exist. Will build for other OSes')
|
||||||
args.macos = False
|
args.macos = False
|
||||||
|
|
||||||
@ -165,10 +175,9 @@ def main():
|
|||||||
if args.setup:
|
if args.setup:
|
||||||
setup()
|
setup()
|
||||||
|
|
||||||
os.chdir('monero')
|
os.makedirs('builder/inputs/monero', exist_ok=True)
|
||||||
|
os.chdir('builder/inputs/monero')
|
||||||
if args.pull:
|
if args.pull:
|
||||||
subprocess.check_call(['git', 'fetch', args.url, 'refs/pull/'+args.version+'/merge'])
|
|
||||||
os.chdir('../gitian-builder/inputs/monero')
|
|
||||||
subprocess.check_call(['git', 'fetch', args.url, 'refs/pull/'+args.version+'/merge'])
|
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.commit = subprocess.check_output(['git', 'show', '-s', '--format=%H', 'FETCH_HEAD'], universal_newlines=True).strip()
|
||||||
args.version = 'pull-' + args.version
|
args.version = 'pull-' + args.version
|
||||||
|
Loading…
Reference in New Issue
Block a user