Skip to content

Commit 65fb3df

Browse files
committed
Merge #18556: build: Drop make dist in gitian builds
2aa48ed refactor: Drop unused ${WRAP_DIR}/${HOST} directory (Hennadii Stepanov) 1362be0 build: Drop make dist in gitian builds (Hennadii Stepanov) Pull request description: After the merge of #18331, the packaged source tarball is created by `git archive`, but the binaries are built from another one which is made by `make dist`. With this PR the only source tarball, created by `git archive`, is used both for binaries building and for packaging to users. Close #16588. Close #18547. As a good side-effect, #18349 becomes redundant. **Change in behavior** The following variables https://github.com/bitcoin/bitcoin/blob/1b151e3ffce7c1a2ee46bf280cc1d96775d1f91e/configure.ac#L2-L6 are no longer used for naming of directories and tarballs. Instead of them the gitian descriptors use a git tag (if available) or a commit hash. --- Also a small refactor commit picked from #18404. ACKs for top commit: dongcarl: ACK 2aa48ed MarcoFalke: ACK 2aa48ed fanquake: ACK 2aa48ed - I've had a quick look over this, and don't want to block merging if this actually gets as closer to finally having this all sorted out. Obviously we've still got #18741, and after speaking to Carl this morning, there will likely be even more changes after that (not Guix specific). Tree-SHA512: d3b16f87e48d1790a3264940c28acd5d881bfd10f3ce94fb0c8a6af76d8039289d01e0cd4972adac49ae24362857251f6c1e5e09e3e9fbf636c10708b4015a7c
2 parents ac21090 + 2aa48ed commit 65fb3df

File tree

6 files changed

+48
-71
lines changed

6 files changed

+48
-71
lines changed

contrib/gitian-descriptors/gitian-linux.yml

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -140,18 +140,12 @@ script: |
140140
create_per-host_faketime_wrappers "${REFERENCE_DATETIME}"
141141
export PATH=${WRAP_DIR}:${PATH}
142142
143-
# Create the release tarball using (arbitrarily) the first host
144-
./autogen.sh
145-
CONFIG_SITE=${BASEPREFIX}/$(echo "${HOSTS}" | awk '{print $1;}')/share/config.site ./configure --prefix=/
146-
make dist
147-
SOURCEDIST=$(echo bitcoin-*.tar.gz)
148-
DISTNAME=${SOURCEDIST/%.tar.gz}
149-
150-
# Workaround for tarball not building with the bare tag version (prep)
151-
make -C src obj/build.h
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
152146
153147
ORIGPATH="$PATH"
154-
# Extract the release tarball into a dir for each host and build
148+
# Extract the git archive into a dir for each host and build
155149
for i in ${HOSTS}; do
156150
export PATH=${BASEPREFIX}/${i}/native/bin:${ORIGPATH}
157151
if [ "${i}" = "riscv64-linux-gnu" ]; then
@@ -165,13 +159,9 @@ script: |
165159
cd distsrc-${i}
166160
INSTALLPATH="${PWD}/installed/${DISTNAME}"
167161
mkdir -p ${INSTALLPATH}
168-
tar --strip-components=1 -xf ../$SOURCEDIST
169-
170-
# Workaround for tarball not building with the bare tag version
171-
echo '#!/bin/true' >share/genbuild.sh
172-
mkdir src/obj
173-
cp ../src/obj/build.h src/obj/
162+
tar -xf $GIT_ARCHIVE
174163
164+
./autogen.sh
175165
CONFIG_SITE=${BASEPREFIX}/${i}/share/config.site ./configure --prefix=/ --disable-ccache --disable-maintainer-mode --disable-dependency-tracking ${CONFIGFLAGS} CFLAGS="${HOST_CFLAGS}" CXXFLAGS="${HOST_CXXFLAGS}" LDFLAGS="${HOST_LDFLAGS}"
176166
make ${MAKEOPTS}
177167
make ${MAKEOPTS} -C src check-security
@@ -183,12 +173,9 @@ script: |
183173
rm -rf ${DISTNAME}/lib/pkgconfig
184174
find ${DISTNAME}/bin -type f -executable -print0 | xargs -0 -n1 -I{} ../contrib/devtools/split-debug.sh {} {} {}.dbg
185175
find ${DISTNAME}/lib -type f -print0 | xargs -0 -n1 -I{} ../contrib/devtools/split-debug.sh {} {} {}.dbg
186-
cp ../../README.md ${DISTNAME}/
176+
cp ../README.md ${DISTNAME}/
187177
find ${DISTNAME} -not -name "*.dbg" | sort | tar --mtime="$REFERENCE_DATETIME" --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}-${i}.tar.gz
188178
find ${DISTNAME} -name "*.dbg" | sort | tar --mtime="$REFERENCE_DATETIME" --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}-${i}-debug.tar.gz
189179
cd ../../
190180
rm -rf distsrc-${i}
191181
done
192-
193-
mkdir -p ${OUTDIR}/src
194-
git archive --output=${OUTDIR}/src/${DISTNAME}.tar.gz HEAD

contrib/gitian-descriptors/gitian-osx.yml

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -103,31 +103,21 @@ script: |
103103
create_per-host_faketime_wrappers "${REFERENCE_DATETIME}"
104104
export PATH=${WRAP_DIR}:${PATH}
105105
106-
# Create the release tarball using (arbitrarily) the first host
107-
./autogen.sh
108-
CONFIG_SITE=${BASEPREFIX}/$(echo "${HOSTS}" | awk '{print $1;}')/share/config.site ./configure --prefix=/
109-
make dist
110-
SOURCEDIST=$(echo bitcoin-*.tar.gz)
111-
DISTNAME=${SOURCEDIST/%.tar.gz}
112-
113-
# Workaround for tarball not building with the bare tag version (prep)
114-
make -C src obj/build.h
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
115109
116110
ORIGPATH="$PATH"
117-
# Extract the release tarball into a dir for each host and build
111+
# Extract the git archive into a dir for each host and build
118112
for i in ${HOSTS}; do
119113
export PATH=${BASEPREFIX}/${i}/native/bin:${ORIGPATH}
120114
mkdir -p distsrc-${i}
121115
cd distsrc-${i}
122116
INSTALLPATH="${PWD}/installed/${DISTNAME}"
123117
mkdir -p ${INSTALLPATH}
124-
tar --strip-components=1 -xf ../$SOURCEDIST
125-
126-
# Workaround for tarball not building with the bare tag version
127-
echo '#!/bin/true' >share/genbuild.sh
128-
mkdir src/obj
129-
cp ../src/obj/build.h src/obj/
118+
tar -xf $GIT_ARCHIVE
130119
120+
./autogen.sh
131121
CONFIG_SITE=${BASEPREFIX}/${i}/share/config.site ./configure --prefix=/ --disable-ccache --disable-maintainer-mode --disable-dependency-tracking ${CONFIGFLAGS}
132122
make ${MAKEOPTS}
133123
make ${MAKEOPTS} -C src check-security
@@ -160,7 +150,4 @@ script: |
160150
cd ../../
161151
done
162152
163-
mkdir -p ${OUTDIR}/src
164-
git archive --output=${OUTDIR}/src/${DISTNAME}.tar.gz HEAD
165-
166153
mv ${OUTDIR}/${DISTNAME}-x86_64-*.tar.gz ${OUTDIR}/${DISTNAME}-osx64.tar.gz

contrib/gitian-descriptors/gitian-win.yml

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,11 @@ script: |
7676
function create_per-host_compiler_wrapper {
7777
# -posix variant is required for c++11 threading.
7878
for i in $HOSTS; do
79-
mkdir -p ${WRAP_DIR}/${i}
8079
for prog in gcc g++; do
8180
echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${i}-${prog}
8281
echo "REAL=\`which -a ${i}-${prog}-posix | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog}
8382
echo "export LD_PRELOAD='/usr/\$LIB/faketime/libfaketime.so.1'" >> ${WRAP_DIR}/${i}-${prog}
8483
echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${i}-${prog}
85-
echo "export COMPILER_PATH=${WRAP_DIR}/${i}" >> ${WRAP_DIR}/${i}-${prog}
8684
echo "\$REAL \$@" >> $WRAP_DIR/${i}-${prog}
8785
chmod +x ${WRAP_DIR}/${i}-${prog}
8886
done
@@ -110,38 +108,28 @@ script: |
110108
create_per-host_compiler_wrapper "${REFERENCE_DATETIME}"
111109
export PATH=${WRAP_DIR}:${PATH}
112110
113-
# Create the release tarball using (arbitrarily) the first host
114-
./autogen.sh
115-
CONFIG_SITE=${BASEPREFIX}/$(echo "${HOSTS}" | awk '{print $1;}')/share/config.site ./configure --prefix=/
116-
make dist
117-
SOURCEDIST=$(echo bitcoin-*.tar.gz)
118-
DISTNAME=${SOURCEDIST/%.tar.gz}
119-
120-
# Workaround for tarball not building with the bare tag version (prep)
121-
make -C src obj/build.h
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
122114
123115
ORIGPATH="$PATH"
124-
# Extract the release tarball into a dir for each host and build
116+
# Extract the git archive into a dir for each host and build
125117
for i in ${HOSTS}; do
126118
export PATH=${BASEPREFIX}/${i}/native/bin:${ORIGPATH}
127119
mkdir -p distsrc-${i}
128120
cd distsrc-${i}
129121
INSTALLPATH="${PWD}/installed/${DISTNAME}"
130122
mkdir -p ${INSTALLPATH}
131-
tar --strip-components=1 -xf ../$SOURCEDIST
132-
133-
# Workaround for tarball not building with the bare tag version
134-
echo '#!/bin/true' >share/genbuild.sh
135-
mkdir src/obj
136-
cp ../src/obj/build.h src/obj/
123+
tar -xf $GIT_ARCHIVE
137124
125+
./autogen.sh
138126
CONFIG_SITE=${BASEPREFIX}/${i}/share/config.site ./configure --prefix=/ --disable-ccache --disable-maintainer-mode --disable-dependency-tracking ${CONFIGFLAGS} CFLAGS="${HOST_CFLAGS}" CXXFLAGS="${HOST_CXXFLAGS}"
139127
make ${MAKEOPTS}
140128
make ${MAKEOPTS} -C src check-security
141129
make ${MAKEOPTS} -C src check-symbols
142130
make deploy
143131
make install DESTDIR=${INSTALLPATH}
144-
cp -f --target-directory="${OUTDIR}" ./bitcoin-*-setup-unsigned.exe
132+
cp -f ./bitcoin-*-win64-setup-unsigned.exe ${OUTDIR}/${DISTNAME}-win64-setup-unsigned.exe
145133
cd installed
146134
mv ${DISTNAME}/bin/*.dll ${DISTNAME}/lib/
147135
find . -name "lib*.la" -delete
@@ -156,11 +144,8 @@ script: |
156144
rm -rf distsrc-${i}
157145
done
158146
159-
mkdir -p ${OUTDIR}/src
160-
git archive --output=${OUTDIR}/src/${DISTNAME}.tar.gz HEAD
161-
162147
cp -rf contrib/windeploy $BUILD_DIR
163148
cd $BUILD_DIR/windeploy
164149
mkdir unsigned
165-
cp $OUTDIR/bitcoin-*setup-unsigned.exe unsigned/
150+
cp ${OUTDIR}/${DISTNAME}-win64-setup-unsigned.exe unsigned/
166151
find . | sort | tar --mtime="$REFERENCE_DATETIME" --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}-win-unsigned.tar.gz
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
mkdir -p ${OUTDIR}/src
8+
RECENT_TAG=$(git describe --abbrev=0 HEAD)
9+
if [ $RECENT_TAG = $(git describe HEAD) ]; then
10+
if [[ $RECENT_TAG == v* ]]; then
11+
VERSION=${RECENT_TAG:1}
12+
else
13+
VERSION=$RECENT_TAG
14+
fi
15+
else
16+
VERSION=$(git rev-parse --short HEAD)
17+
fi
18+
DISTNAME=bitcoin-${VERSION}
19+
GIT_ARCHIVE="${OUTDIR}/src/${DISTNAME}.tar.gz"
20+
git archive --output=$GIT_ARCHIVE HEAD

share/genbuild.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,9 @@ else
1818
exit 1
1919
fi
2020

21-
git_check_in_repo() {
22-
! { git status --porcelain -uall --ignored "$@" 2>/dev/null || echo '??'; } | grep -q '?'
23-
}
24-
2521
DESC=""
2622
SUFFIX=""
27-
if [ "${BITCOIN_GENBUILD_NO_GIT}" != "1" ] && [ -e "$(command -v git)" ] && [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ] && git_check_in_repo share/genbuild.sh; then
23+
if [ "${BITCOIN_GENBUILD_NO_GIT}" != "1" ] && [ -e "$(command -v git)" ] && [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]; then
2824
# clean 'dirty' status of touched files that haven't been modified
2925
git diff >/dev/null 2>/dev/null
3026

test/lint/lint-shell.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,17 @@ if ! command -v yq > /dev/null; then
4646
fi
4747

4848
EXCLUDE_GITIAN=${EXCLUDE}",$(IFS=','; echo "${disabled_gitian[*]}")"
49+
SHELLCHECK_CMD="shellcheck --external-sources --check-sourced $EXCLUDE_GITIAN"
4950
for descriptor in $(git ls-files -- 'contrib/gitian-descriptors/*.yml')
5051
do
51-
echo
52-
echo "$descriptor"
52+
script=$(basename "$descriptor")
5353
# Use #!/bin/bash as gitian-builder/bin/gbuild does to complete a script.
54-
SCRIPT=$'#!/bin/bash\n'$(yq -r .script "$descriptor")
55-
if ! echo "$SCRIPT" | shellcheck "$EXCLUDE_GITIAN" -; then
54+
echo "#!/bin/bash" > $script
55+
yq -r .script "$descriptor" >> $script
56+
if ! $SHELLCHECK_CMD $script; then
5657
EXIT_CODE=1
5758
fi
59+
rm $script
5860
done
5961

6062
exit $EXIT_CODE

0 commit comments

Comments
 (0)