Skip to content

Commit 8bc1b3a

Browse files
committed
Merge pull request #6422
c73a8ea Clarifying offline build process using gbuild --url and noting it is not done automatically. (Midnight Magic)
2 parents 83f0e22 + c73a8ea commit 8bc1b3a

File tree

2 files changed

+106
-21
lines changed

2 files changed

+106
-21
lines changed

doc/gitian-building.md

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,11 @@ There will be a lot of warnings printed during the build of the image. These can
330330
Getting and building the inputs
331331
--------------------------------
332332

333-
Follow the instructions in [doc/release-process.md](release-process.md#fetch-and-build-inputs-first-time-or-when-dependency-versions-change)
334-
in the bitcoin repository to install sources which require manual intervention. Also follow
335-
the next step: 'Seed the Gitian sources cache', which will fetch all the necessary source
336-
files to allow gitian to work offline.
333+
Follow the instructions in [doc/release-process.md](release-process.md#fetch-and-build-inputs-first-time-or-when-dependency-versions-change)
334+
in the bitcoin repository under 'Fetch and build inputs' to install sources which require
335+
manual intervention. Also optionally follow the next step: 'Seed the Gitian sources cache
336+
and offline git repositories' which will fetch the remaining files required for building
337+
offline.
337338

338339
Building Bitcoin
339340
----------------
@@ -391,6 +392,57 @@ COMMIT=2014_03_windows_unicode_path
391392
./bin/gbuild --commit bitcoin=${COMMIT} --url bitcoin=${URL} ../bitcoin/contrib/gitian-descriptors/gitian-osx.yml
392393
```
393394

395+
Building fully offline
396+
-----------------------
397+
398+
For building fully offline including attaching signatures to unsigned builds, the detached-sigs repository
399+
and the bitcoin git repository with the desired tag must both be available locally, and then gbuild must be
400+
told where to find them. It also requires an apt-cacher-ng which is fully-populated but set to offline mode, or
401+
manually disabling gitian-builder's use of apt-get to update the VM build environment.
402+
403+
To configure apt-cacher-ng as an offline cacher, you will need to first populate its cache with the relevant
404+
files. You must additionally patch target-bin/bootstrap-fixup to set its apt sources to something other than
405+
plain archive.ubuntu.com: us.archive.ubuntu.com works.
406+
407+
So, if you use LXC:
408+
409+
```bash
410+
export PATH="$PATH":/path/to/gitian-builder/libexec
411+
export USE_LXC=1
412+
cd /path/to/gitian-builder
413+
./libexec/make-clean-vm --suite precise --arch amd64
414+
415+
LXC_ARCH=amd64 LXC_SUITE=precise on-target -u root apt-get update
416+
LXC_ARCH=amd64 LXC_SUITE=precise on-target -u root \
417+
-e DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends -y install \
418+
$( sed -ne '/^packages:/,/[^-] .*/ {/^- .*/{s/"//g;s/- //;p}}' ../bitcoin/contrib/gitian-descriptors/*|sort|uniq )
419+
LXC_ARCH=amd64 LXC_SUITE=precise on-target -u root apt-get -q -y purge grub
420+
LXC_ARCH=amd64 LXC_SUITE=precise on-target -u root -e DEBIAN_FRONTEND=noninteractive apt-get -y dist-upgrade
421+
```
422+
423+
And then set offline mode for apt-cacher-ng:
424+
425+
```
426+
/etc/apt-cacher-ng/acng.conf
427+
[...]
428+
Offlinemode: 1
429+
[...]
430+
431+
service apt-cacher-ng restart
432+
```
433+
434+
Then when building, override the remote URLs that gbuild would otherwise pull from the gitian descriptors::
435+
```bash
436+
437+
cd /some/root/path/
438+
git clone https://github.com/bitcoin/bitcoin-detached-sigs.git
439+
440+
BTCPATH=/some/root/path/bitcoin.git
441+
SIGPATH=/some/root/path/bitcoin-detached-sigs.git
442+
443+
./bin/gbuild --url bitcoin=${BTCPATH},signature=${SIGPATH} ../bitcoin/contrib/gitian-descriptors/gitian-win-signer.yml
444+
```
445+
394446
Signing externally
395447
-------------------
396448

doc/release-process.md

Lines changed: 50 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,54 @@ Release Process
66

77
* * *
88

9-
###update (commit) version in sources
9+
###first time only or for new builders, check out the source in the following directory hierarchy
1010

11+
cd /path/to/your/toplevel/build
12+
git clone https://github.com/bitcoin/gitian.sigs.git
13+
git clone https://github.com/devrandom/gitian-builder.git
14+
git clone https://github.com/bitcoin/bitcoin.git
15+
16+
###for bitcoin maintainers/release engineers, update (commit) version in sources
17+
18+
pushd ./bitcoin
1119
contrib/verifysfbinaries/verify.sh
1220
doc/README*
1321
share/setup.nsi
1422
src/clientversion.h (change CLIENT_VERSION_IS_RELEASE to true)
1523

16-
###tag version in git
24+
###for bitcoin maintainers/release engineers, tag version in git
1725

1826
git tag -s v(new version, e.g. 0.8.0)
1927

20-
###write release notes. git shortlog helps a lot, for example:
28+
###for bitcoin maintainers/release engineers, write release notes. git shortlog helps a lot, for example:
2129

2230
git shortlog --no-merges v(current version, e.g. 0.7.2)..v(new version, e.g. 0.8.0)
31+
popd
2332

2433
* * *
2534

26-
###update gitian
27-
28-
In order to take advantage of the new caching features in gitian, be sure to update to a recent version (`e9741525c` or later is recommended)
35+
###update gitian, gitian.sigs, checkout bitcoin version, and perform gitian builds
2936

30-
###perform gitian builds
31-
32-
From a directory containing the bitcoin source, gitian-builder and gitian.sigs
37+
To ensure your gitian descriptors are accurate for direct reference for gbuild, below, run the following from a directory containing the bitcoin source:
3338

39+
pushd ./bitcoin
3440
export SIGNER=(your gitian key, ie bluematt, sipa, etc)
3541
export VERSION=(new version, e.g. 0.8.0)
36-
pushd ./bitcoin
3742
git checkout v${VERSION}
3843
popd
44+
45+
Ensure your gitian.sigs are up-to-date if you wish to gverify your builds against other gitian signatures:
46+
47+
pushd ./gitian.sigs
48+
git pull
49+
popd
50+
51+
Ensure your gitian-builder sources are up-to-date to take advantage of the new caching features of gitian (`e9741525c` or later is recommended)
52+
3953
pushd ./gitian-builder
54+
git pull
4055

41-
###fetch and build inputs: (first time, or when dependency versions change)
56+
###fetch and create inputs: (first time, or when dependency versions change)
4257

4358
mkdir -p inputs
4459
wget -P inputs https://bitcoincore.org/cfields/osslsigncode-Backports-to-1.7.1.patch
@@ -52,28 +67,44 @@ Release Process
5267

5368
tar -C /Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ -czf MacOSX10.9.sdk.tar.gz MacOSX10.9.sdk
5469

55-
###Optional: Seed the Gitian sources cache
70+
###Optional: Seed the Gitian sources cache and offline git repositories
5671

57-
By default, gitian will fetch source files as needed. For offline builds, they can be fetched ahead of time:
72+
By default, gitian will fetch source files as needed. To cache them ahead of time:
5873

5974
make -C ../bitcoin/depends download SOURCES_PATH=`pwd`/cache/common
6075

61-
Only missing files will be fetched, so this is safe to re-run for each build.
76+
Only missing files will be fetched, so this is safe to re-run for each build.
77+
78+
Clone the detached-sigs repository:
79+
80+
popd
81+
git clone https://github.com/bitcoin/bitcoin-detached-sigs.git
82+
pushd ./bitcoin-builder
83+
84+
NOTE: Offline builds must use the --url flag to ensure gitian fetches only from local URLs.
85+
For example: ./bin/bguild --url bitcoin=/path/to/bitcoin,signature=/path/to/sigs {rest of arguments}
86+
The following gbuild invocations DO NOT DO THIS by default.
6287

63-
###Build Bitcoin Core for Linux, Windows, and OS X:
88+
###Build (and optionally verify) Bitcoin Core for Linux, Windows, and OS X:
6489

6590
./bin/gbuild --commit bitcoin=v${VERSION} ../bitcoin/contrib/gitian-descriptors/gitian-linux.yml
6691
./bin/gsign --signer $SIGNER --release ${VERSION}-linux --destination ../gitian.sigs/ ../bitcoin/contrib/gitian-descriptors/gitian-linux.yml
92+
./bin/gverify -v -d ../gitian.sigs/ -r ${VERSION}-linux ../bitcoin/contrib/gitian-descriptors/gitian-linux.yml
6793
mv build/out/bitcoin-*.tar.gz build/out/src/bitcoin-*.tar.gz ../
94+
6895
./bin/gbuild --commit bitcoin=v${VERSION} ../bitcoin/contrib/gitian-descriptors/gitian-win.yml
6996
./bin/gsign --signer $SIGNER --release ${VERSION}-win-unsigned --destination ../gitian.sigs/ ../bitcoin/contrib/gitian-descriptors/gitian-win.yml
97+
./bin/gverify -v -d ../gitian.sigs/ -r ${VERSION}-win-unsigned ../bitcoin/contrib/gitian-descriptors/gitian-win.yml
7098
mv build/out/bitcoin-*-win-unsigned.tar.gz inputs/bitcoin-win-unsigned.tar.gz
7199
mv build/out/bitcoin-*.zip build/out/bitcoin-*.exe ../
100+
72101
./bin/gbuild --commit bitcoin=v${VERSION} ../bitcoin/contrib/gitian-descriptors/gitian-osx.yml
73102
./bin/gsign --signer $SIGNER --release ${VERSION}-osx-unsigned --destination ../gitian.sigs/ ../bitcoin/contrib/gitian-descriptors/gitian-osx.yml
103+
./bin/gverify -v -d ../gitian.sigs/ -r ${VERSION}-osx-unsigned ../bitcoin/contrib/gitian-descriptors/gitian-osx.yml
74104
mv build/out/bitcoin-*-osx-unsigned.tar.gz inputs/bitcoin-osx-unsigned.tar.gz
75105
mv build/out/bitcoin-*.tar.gz build/out/bitcoin-*.dmg ../
76106
popd
107+
77108
Build output expected:
78109

79110
1. source tarball (bitcoin-${VERSION}.tar.gz)
@@ -98,19 +129,21 @@ Commit your signature to gitian.sigs:
98129
Once the Windows/OSX builds each have 3 matching signatures, they will be signed with their respective release keys.
99130
Detached signatures will then be committed to the bitcoin-detached-sigs repository, which can be combined with the unsigned apps to create signed binaries.
100131

101-
Create the signed OSX binary:
132+
Create (and optionally verify) the signed OSX binary:
102133

103134
pushd ./gitian-builder
104135
./bin/gbuild -i --commit signature=v${VERSION} ../bitcoin/contrib/gitian-descriptors/gitian-osx-signer.yml
105136
./bin/gsign --signer $SIGNER --release ${VERSION}-osx-signed --destination ../gitian.sigs/ ../bitcoin/contrib/gitian-descriptors/gitian-osx-signer.yml
137+
./bin/gverify -v -d ../gitian.sigs/ -r ${VERSION}-osx-signed ../bitcoin/contrib/gitian-descriptors/gitian-osx-signer.yml
106138
mv build/out/bitcoin-osx-signed.dmg ../bitcoin-${VERSION}-osx.dmg
107139
popd
108140

109-
Create the signed Windows binaries:
141+
Create (and optionally verify) the signed Windows binaries:
110142

111143
pushd ./gitian-builder
112144
./bin/gbuild -i --commit signature=v${VERSION} ../bitcoin/contrib/gitian-descriptors/gitian-win-signer.yml
113145
./bin/gsign --signer $SIGNER --release ${VERSION}-win-signed --destination ../gitian.sigs/ ../bitcoin/contrib/gitian-descriptors/gitian-win-signer.yml
146+
./bin/gverify -v -d ../gitian.sigs/ -r ${VERSION}-win-signed ../bitcoin/contrib/gitian-descriptors/gitian-win-signer.yml
114147
mv build/out/bitcoin-*win64-setup.exe ../bitcoin-${VERSION}-win64-setup.exe
115148
mv build/out/bitcoin-*win32-setup.exe ../bitcoin-${VERSION}-win32-setup.exe
116149
popd

0 commit comments

Comments
 (0)