Skip to content

Commit 1362be0

Browse files
committed
build: Drop make dist in gitian builds
1 parent 1b151e3 commit 1362be0

File tree

6 files changed

+48
-69
lines changed

6 files changed

+48
-69
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 & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -110,38 +110,28 @@ script: |
110110
create_per-host_compiler_wrapper "${REFERENCE_DATETIME}"
111111
export PATH=${WRAP_DIR}:${PATH}
112112
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
113+
# Create the git archive, and define DISTNAME and GIT_ARCHIVE variables.
114+
# shellcheck source=contrib/gitian-descriptors/make_git_archive
115+
source contrib/gitian-descriptors/make_git_archive
122116
123117
ORIGPATH="$PATH"
124-
# Extract the release tarball into a dir for each host and build
118+
# Extract the git archive into a dir for each host and build
125119
for i in ${HOSTS}; do
126120
export PATH=${BASEPREFIX}/${i}/native/bin:${ORIGPATH}
127121
mkdir -p distsrc-${i}
128122
cd distsrc-${i}
129123
INSTALLPATH="${PWD}/installed/${DISTNAME}"
130124
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/
125+
tar -xf $GIT_ARCHIVE
137126
127+
./autogen.sh
138128
CONFIG_SITE=${BASEPREFIX}/${i}/share/config.site ./configure --prefix=/ --disable-ccache --disable-maintainer-mode --disable-dependency-tracking ${CONFIGFLAGS} CFLAGS="${HOST_CFLAGS}" CXXFLAGS="${HOST_CXXFLAGS}"
139129
make ${MAKEOPTS}
140130
make ${MAKEOPTS} -C src check-security
141131
make ${MAKEOPTS} -C src check-symbols
142132
make deploy
143133
make install DESTDIR=${INSTALLPATH}
144-
cp -f --target-directory="${OUTDIR}" ./bitcoin-*-setup-unsigned.exe
134+
cp -f ./bitcoin-*-win64-setup-unsigned.exe ${OUTDIR}/${DISTNAME}-win64-setup-unsigned.exe
145135
cd installed
146136
mv ${DISTNAME}/bin/*.dll ${DISTNAME}/lib/
147137
find . -name "lib*.la" -delete
@@ -156,11 +146,8 @@ script: |
156146
rm -rf distsrc-${i}
157147
done
158148
159-
mkdir -p ${OUTDIR}/src
160-
git archive --output=${OUTDIR}/src/${DISTNAME}.tar.gz HEAD
161-
162149
cp -rf contrib/windeploy $BUILD_DIR
163150
cd $BUILD_DIR/windeploy
164151
mkdir unsigned
165-
cp $OUTDIR/bitcoin-*setup-unsigned.exe unsigned/
152+
cp ${OUTDIR}/${DISTNAME}-win64-setup-unsigned.exe unsigned/
166153
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)