From 78295c9de2915030b49d46fedd811275bc330cf7 Mon Sep 17 00:00:00 2001 From: Kevin Crumb Date: Fri, 19 Jan 2024 17:02:20 +0000 Subject: [PATCH] gitian: use latest builder and optimize git interaction Fetching only the Monero version to be built reduces the downloaded volume by two thirds (from ~240 MB down to ~80 MB). While a non-issue for users on modern networks, the optimization is critical on slow/flaky connections (read: hidden networks) where any increase in volume makes the clone-step more likely to fail with error: RPC failed; curl 18 transfer closed with outstanding read data remaining. Personally I wasn't able to get past this issue on a torified-connection at all without this patch, hence the PR. I've confirmed (with dockrun.sh) that this builds the v0.18.3.1-linux binaries with checksums matching those reported by other builders: https://github.com/monero-project/gitian.sigs/tree/master/v0.18.3.1-linux --- contrib/depends/builders/darwin.mk | 2 +- contrib/depends/builders/linux.mk | 2 +- contrib/gitian/dockrun.sh | 4 ++-- contrib/gitian/gitian-build.py | 5 +++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/contrib/depends/builders/darwin.mk b/contrib/depends/builders/darwin.mk index 27f550ab0..82a54b501 100644 --- a/contrib/depends/builders/darwin.mk +++ b/contrib/depends/builders/darwin.mk @@ -7,7 +7,7 @@ build_darwin_OTOOL: = $(shell xcrun -f otool) build_darwin_NM: = $(shell xcrun -f nm) build_darwin_INSTALL_NAME_TOOL:=$(shell xcrun -f install_name_tool) build_darwin_SHA256SUM = shasum -a 256 -build_darwin_DOWNLOAD = curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o +build_darwin_DOWNLOAD = curl --location --fail --continue-at - --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o #darwin host on darwin builder. overrides darwin host preferences. darwin_CC=$(shell xcrun -f clang) -mmacosx-version-min=$(OSX_MIN_VERSION) diff --git a/contrib/depends/builders/linux.mk b/contrib/depends/builders/linux.mk index b03f42401..2ffab79ef 100644 --- a/contrib/depends/builders/linux.mk +++ b/contrib/depends/builders/linux.mk @@ -1,2 +1,2 @@ build_linux_SHA256SUM = sha256sum -build_linux_DOWNLOAD = curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o +build_linux_DOWNLOAD = curl --location --fail --continue-at - --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o diff --git a/contrib/gitian/dockrun.sh b/contrib/gitian/dockrun.sh index 396db126b..b17214c81 100755 --- a/contrib/gitian/dockrun.sh +++ b/contrib/gitian/dockrun.sh @@ -43,8 +43,8 @@ WORKDIR $WORKDIR RUN git clone https://github.com/monero-project/gitian.sigs.git sigs; \ git clone https://github.com/devrandom/gitian-builder.git builder; \ - cd builder; git checkout c0f77ca018cb5332bfd595e0aff0468f77542c23; mkdir -p inputs var; cd inputs; \ - git clone https://github.com/monero-project/monero + cd builder; git checkout 6f21a0ef5c9ea3df1a515c4b8b9a9296512821dd; mkdir -p inputs var; cd inputs; \ + git clone -v --branch $VERSION --depth 1 https://github.com/monero-project/monero CMD ["sleep", "infinity"] EOF diff --git a/contrib/gitian/gitian-build.py b/contrib/gitian/gitian-build.py index 859f460a7..1029c45c9 100755 --- a/contrib/gitian/gitian-build.py +++ b/contrib/gitian/gitian-build.py @@ -7,6 +7,7 @@ import sys gsigs = 'https://github.com/monero-project/gitian.sigs.git' gbrepo = 'https://github.com/devrandom/gitian-builder.git' +gbcommit = '6f21a0ef5c9ea3df1a515c4b8b9a9296512821dd' platforms = {'l': ['Linux', 'linux', 'tar.bz2'], 'a': ['Android', 'android', 'tar.bz2'], @@ -28,7 +29,7 @@ def setup(): if not os.path.isdir('builder'): subprocess.check_call(['git', 'clone', gbrepo, 'builder']) os.chdir('builder') - subprocess.check_call(['git', 'checkout', 'c0f77ca018cb5332bfd595e0aff0468f77542c23']) + subprocess.check_call(['git', 'checkout', gbcommit]) os.makedirs('inputs', exist_ok=True) os.chdir('inputs') if os.path.isdir('monero'): @@ -67,7 +68,7 @@ def rebuild(): print('\nCompiling ' + args.version + ' ' + os_name) infile = 'inputs/monero/contrib/gitian/gitian-' + tag_name + '.yml' - subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'monero='+args.commit, '--url', 'monero='+args.url, infile]) + subprocess.check_call(['bin/gbuild', '--skip-fetch', '-j', args.jobs, '-m', args.memory, '--commit', 'monero='+args.commit, '--url', 'monero='+args.url, infile]) subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-'+tag_name, '--destination', '../sigs/', infile]) subprocess.check_call('mv build/out/monero-*.' + suffix + ' ../out/'+args.version, shell=True) print('Moving var/install.log to var/install-' + tag_name + '.log')