Skip to content

Commit d96fdc2

Browse files
committed
Merge #18741: guix: Make source tarball using git-archive
bfe1ba2 rel-builds: Specify core.abbrev for git-rev-parse (Carl Dong) 27e63e0 build: Accomodate makensis v2.x (Carl Dong) 1f2c39a guix: Remove logical cores requirement (Carl Dong) a4f6ffa lint: Also enable source statements for non-gitian (Carl Dong) d256f91 rel-builds: Directly deploy win installer to OUTDIR (Carl Dong) fa791da nsis: Specify OutFile path only once (Carl Dong) 1470160 guix: Expose GIT_COMMON_DIR in container as readonly (Carl Dong) f5a6ac4 guix: Make source tarball using git-archive (Carl Dong) 395c113 gitian: Limit sourced script to just assignments (Carl Dong) Pull request description: Based on: #18556 Related: bitcoin/bitcoin#17595 (comment) ACKs for top commit: fanquake: ACK bfe1ba2 - I agree with Carl, and am going to merge this. I'd like for Linux Guix builds to be working again, and we can rebase #18818. Tree-SHA512: c87ada7e3de17ca0b692a91029b86573442ded5780fc081c214773f6b374a0cdbeaf6f6898c36669c2e247ee32aa7f82defb1180f8decac52c65f0c140f18674
2 parents 60091d2 + bfe1ba2 commit d96fdc2

File tree

12 files changed

+64
-58
lines changed

12 files changed

+64
-58
lines changed

Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ $(BITCOIN_WIN_INSTALLER): all-recursive
8080
STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_CLI_BIN) $(top_builddir)/release
8181
STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_TX_BIN) $(top_builddir)/release
8282
STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_WALLET_BIN) $(top_builddir)/release
83-
@test -f $(MAKENSIS) && $(MAKENSIS) -V2 $(top_builddir)/share/setup.nsi || \
83+
@test -f $(MAKENSIS) && echo 'OutFile "$@"' | cat $(top_builddir)/share/setup.nsi - | $(MAKENSIS) -V2 - || \
8484
echo error: could not build $@
8585
@echo built $@
8686

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright (c) 2020 The Bitcoin Core developers
2+
# Distributed under the MIT software license, see the accompanying
3+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
#
5+
# A helper script to be sourced into the gitian descriptors
6+
7+
if RECENT_TAG="$(git describe --exact-match HEAD)"; then
8+
VERSION="${RECENT_TAG#v}"
9+
else
10+
VERSION="$(git rev-parse --short=12 HEAD)"
11+
fi
12+
DISTNAME="bitcoin-${VERSION}"

contrib/gitian-descriptors/gitian-linux.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,15 @@ script: |
140140
create_per-host_faketime_wrappers "${REFERENCE_DATETIME}"
141141
export PATH=${WRAP_DIR}:${PATH}
142142
143-
# Create the git archive, and define DISTNAME and GIT_ARCHIVE variables.
144-
# shellcheck source=contrib/gitian-descriptors/make_git_archive
145-
source contrib/gitian-descriptors/make_git_archive
143+
# Define DISTNAME variable.
144+
# shellcheck source=contrib/gitian-descriptors/assign_DISTNAME
145+
source contrib/gitian-descriptors/assign_DISTNAME
146+
147+
GIT_ARCHIVE="${OUTDIR}/src/${DISTNAME}.tar.gz"
148+
149+
# Create the source tarball
150+
mkdir -p "$(dirname "$GIT_ARCHIVE")"
151+
git archive --output="$GIT_ARCHIVE" HEAD
146152
147153
ORIGPATH="$PATH"
148154
# Extract the git archive into a dir for each host and build

contrib/gitian-descriptors/gitian-osx.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,15 @@ script: |
103103
create_per-host_faketime_wrappers "${REFERENCE_DATETIME}"
104104
export PATH=${WRAP_DIR}:${PATH}
105105
106-
# Create the git archive, and define DISTNAME and GIT_ARCHIVE variables.
107-
# shellcheck source=contrib/gitian-descriptors/make_git_archive
108-
source contrib/gitian-descriptors/make_git_archive
106+
# Define DISTNAME variable.
107+
# shellcheck source=contrib/gitian-descriptors/assign_DISTNAME
108+
source contrib/gitian-descriptors/assign_DISTNAME
109+
110+
GIT_ARCHIVE="${OUTDIR}/src/${DISTNAME}.tar.gz"
111+
112+
# Create the source tarball
113+
mkdir -p "$(dirname "$GIT_ARCHIVE")"
114+
git archive --output="$GIT_ARCHIVE" HEAD
109115
110116
ORIGPATH="$PATH"
111117
# Extract the git archive into a dir for each host and build

contrib/gitian-descriptors/gitian-win.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,15 @@ script: |
108108
create_per-host_compiler_wrapper "${REFERENCE_DATETIME}"
109109
export PATH=${WRAP_DIR}:${PATH}
110110
111-
# Create the git archive, and define DISTNAME and GIT_ARCHIVE variables.
112-
# shellcheck source=contrib/gitian-descriptors/make_git_archive
113-
source contrib/gitian-descriptors/make_git_archive
111+
# Define DISTNAME variable.
112+
# shellcheck source=contrib/gitian-descriptors/assign_DISTNAME
113+
source contrib/gitian-descriptors/assign_DISTNAME
114+
115+
GIT_ARCHIVE="${OUTDIR}/src/${DISTNAME}.tar.gz"
116+
117+
# Create the source tarball
118+
mkdir -p "$(dirname "$GIT_ARCHIVE")"
119+
git archive --output="$GIT_ARCHIVE" HEAD
114120
115121
ORIGPATH="$PATH"
116122
# Extract the git archive into a dir for each host and build
@@ -127,9 +133,8 @@ script: |
127133
make ${MAKEOPTS}
128134
make ${MAKEOPTS} -C src check-security
129135
make ${MAKEOPTS} -C src check-symbols
130-
make deploy
136+
make deploy BITCOIN_WIN_INSTALLER="${OUTDIR}/${DISTNAME}-win64-setup-unsigned.exe"
131137
make install DESTDIR=${INSTALLPATH}
132-
cp -f ./bitcoin-*-win64-setup-unsigned.exe ${OUTDIR}/${DISTNAME}-win64-setup-unsigned.exe
133138
cd installed
134139
mv ${DISTNAME}/bin/*.dll ${DISTNAME}/lib/
135140
find . -name "lib*.la" -delete

contrib/gitian-descriptors/make_git_archive

Lines changed: 0 additions & 20 deletions
This file was deleted.

contrib/guix/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ We achieve bootstrappability by using Guix as a functional package manager.
1313

1414
Conservatively, a x86_64 machine with:
1515

16-
- 2 or more logical cores
1716
- 4GB of free disk space on the partition that /gnu/store will reside in
1817
- 24GB of free disk space on the partition that the Bitcoin Core git repository
1918
resides in

contrib/guix/guix-build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ for host in ${HOSTS=x86_64-linux-gnu arm-linux-gnueabihf aarch64-linux-gnu riscv
105105
--pure \
106106
--no-cwd \
107107
--share="$PWD"=/bitcoin \
108+
--expose="$(git rev-parse --git-common-dir)" \
108109
${SOURCES_PATH:+--share="$SOURCES_PATH"} \
109110
${ADDITIONAL_GUIX_ENVIRONMENT_FLAGS} \
110111
-- env HOST="$host" \

contrib/guix/libexec/build.sh

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -141,19 +141,17 @@ make -C depends --jobs="$MAX_JOBS" HOST="$HOST" \
141141
# Source Tarball Building #
142142
###########################
143143

144-
# Create the source tarball and move it to "${OUTDIR}/src" if not already there
145-
if [ -z "$(find "${OUTDIR}/src" -name 'bitcoin-*.tar.gz')" ]; then
146-
./autogen.sh
147-
env CONFIG_SITE="${BASEPREFIX}/${HOST}/share/config.site" ./configure --prefix=/
148-
make dist GZIP_ENV='-9n' ${V:+V=1}
149-
mkdir -p "${OUTDIR}/src"
150-
mv "$(find "${PWD}" -name 'bitcoin-*.tar.gz')" "${OUTDIR}/src/"
151-
fi
144+
# Define DISTNAME variable.
145+
# shellcheck source=contrib/gitian-descriptors/assign_DISTNAME
146+
source contrib/gitian-descriptors/assign_DISTNAME
152147

153-
# Determine the full path to our source tarball
154-
SOURCEDIST="$(find "${OUTDIR}/src" -name 'bitcoin-*.tar.gz')"
155-
# Determine our distribution name (e.g. bitcoin-0.18.0)
156-
DISTNAME="$(basename "$SOURCEDIST" '.tar.gz')"
148+
GIT_ARCHIVE="${OUTDIR}/src/${DISTNAME}.tar.gz"
149+
150+
# Create the source tarball if not already there
151+
if [ ! -e "$GIT_ARCHIVE" ]; then
152+
mkdir -p "$(dirname "$GIT_ARCHIVE")"
153+
git archive --output="$GIT_ARCHIVE" HEAD
154+
fi
157155

158156
###########################
159157
# Binary Tarball Building #
@@ -187,7 +185,9 @@ export PATH="${BASEPREFIX}/${HOST}/native/bin:${PATH}"
187185
cd "$DISTSRC"
188186

189187
# Extract the source tarball
190-
tar --strip-components=1 -xf "${SOURCEDIST}"
188+
tar -xf "${GIT_ARCHIVE}"
189+
190+
./autogen.sh
191191

192192
# Configure this DISTSRC for $HOST
193193
# shellcheck disable=SC2086
@@ -220,7 +220,7 @@ export PATH="${BASEPREFIX}/${HOST}/native/bin:${PATH}"
220220
# Make the os-specific installers
221221
case "$HOST" in
222222
*mingw*)
223-
make deploy ${V:+V=1}
223+
make deploy ${V:+V=1} BITCOIN_WIN_INSTALLER="${OUTDIR}/${DISTNAME}-win64-setup-unsigned.exe"
224224
;;
225225
esac
226226

@@ -232,11 +232,6 @@ export PATH="${BASEPREFIX}/${HOST}/native/bin:${PATH}"
232232
# Install built Bitcoin Core to $INSTALLPATH
233233
make install DESTDIR="${INSTALLPATH}" ${V:+V=1}
234234

235-
case "$HOST" in
236-
*mingw*)
237-
cp -f --target-directory="$OUTDIR" ./*-setup-unsigned.exe
238-
;;
239-
esac
240235
(
241236
cd installed
242237

@@ -264,7 +259,7 @@ export PATH="${BASEPREFIX}/${HOST}/native/bin:${PATH}"
264259
cp "${DISTSRC}/doc/README_windows.txt" "${DISTNAME}/readme.txt"
265260
;;
266261
*linux*)
267-
cp "${DISTSRC}/doc/README.md" "${DISTNAME}/"
262+
cp "${DISTSRC}/README.md" "${DISTNAME}/"
268263
;;
269264
esac
270265

@@ -307,7 +302,7 @@ case "$HOST" in
307302
(
308303
cd ./windeploy
309304
mkdir unsigned
310-
cp --target-directory=unsigned/ "$OUTDIR"/bitcoin-*-setup-unsigned.exe
305+
cp --target-directory=unsigned/ "${OUTDIR}/${DISTNAME}-win64-setup-unsigned.exe"
311306
find . -print0 \
312307
| sort --zero-terminated \
313308
| tar --create --no-recursion --mode='u+rw,go+r-w,a+X' --null --files-from=- \

contrib/guix/manifest.scm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
(gnu packages pkg-config)
1818
(gnu packages python)
1919
(gnu packages shells)
20+
(gnu packages version-control)
2021
(guix build-system gnu)
2122
(guix build-system trivial)
2223
(guix gexp)
@@ -181,6 +182,8 @@ chain for " target " development."))
181182
;; Scripting
182183
perl
183184
python-3.7
185+
;; Git
186+
git
184187
;; Native gcc 9 toolchain targeting glibc 2.27
185188
(make-gcc-toolchain gcc-9 glibc-2.27))
186189
(let ((target (getenv "HOST")))

0 commit comments

Comments
 (0)