Skip to content

Commit e411bc1

Browse files
committed
Merge branch 'fix_gitdir_again' into rm_minisketch-28+k
2 parents 99d981f + dc42010 commit e411bc1

File tree

3 files changed

+52
-5
lines changed

3 files changed

+52
-5
lines changed

contrib/guix/libexec/build.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ GIT_ARCHIVE="${DIST_ARCHIVE_BASE}/${DISTNAME}.tar.gz"
196196
# Create the source tarball if not already there
197197
if [ ! -e "$GIT_ARCHIVE" ]; then
198198
mkdir -p "$(dirname "$GIT_ARCHIVE")"
199-
git archive --prefix="${DISTNAME}/" --output="$GIT_ARCHIVE" HEAD
199+
CONFIG_SITE="${BASEPREFIX}/${HOST}/share/config.site" \
200+
contrib/guix/libexec/make_release_tarball.sh "${GIT_ARCHIVE}" "${DISTNAME}"
200201
fi
201202

202203
mkdir -p "$OUTDIR"
@@ -239,8 +240,6 @@ mkdir -p "$DISTSRC"
239240
# Extract the source tarball
240241
tar --strip-components=1 -xf "${GIT_ARCHIVE}"
241242

242-
./autogen.sh
243-
244243
# Configure this DISTSRC for $HOST
245244
# shellcheck disable=SC2086
246245
env CONFIG_SITE="${BASEPREFIX}/${HOST}/share/config.site" \
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/sh
2+
# Copyright (c) 2020 The Bitcoin Core developers
3+
# Distributed under the MIT software license, see the accompanying
4+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
5+
#
6+
# A helper script to generate source release tarball
7+
8+
export LC_ALL=C
9+
set -ex
10+
11+
[ "$#" -ge 2 ]
12+
13+
GIT_ARCHIVE="$1"
14+
DISTNAME="$2"
15+
16+
git archive --prefix="${DISTNAME}/" HEAD | tar -xp
17+
18+
# Generate correct build info file from git, before we lose git
19+
GIT_BUILD_INFO="$(share/genbuild.sh /dev/stdout)"
20+
sed 's/\/\/ No build information available/'"${GIT_BUILD_INFO}"'/' -i "${DISTNAME}/share/genbuild.sh"
21+
22+
cd "${DISTNAME}"
23+
24+
./autogen.sh
25+
./configure --prefix=/ --disable-ccache --disable-maintainer-mode --disable-dependency-tracking
26+
make distclean
27+
28+
cd ..
29+
tar \
30+
--format=ustar \
31+
--exclude autom4te.cache \
32+
--exclude .deps \
33+
--exclude .git \
34+
--sort=name \
35+
--mode='u+rw,go+r-w,a+X' --owner=0 --group=0 \
36+
--mtime="${REFERENCE_DATETIME}" \
37+
-c "${DISTNAME}" | \
38+
gzip -9n \
39+
>"${GIT_ARCHIVE}"
40+
41+
rm -rf "${DISTNAME}"

share/genbuild.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,14 @@ else
1818
exit 1
1919
fi
2020

21+
# This checks that we are actually part of the intended git repository, and not just getting info about some unrelated git repository that the code happens to be in a directory under
22+
git_check_in_repo() {
23+
! { git status --porcelain -uall --ignored "$@" 2>/dev/null || echo '??'; } | grep -q '?'
24+
}
25+
2126
GIT_TAG=""
2227
GIT_COMMIT=""
23-
if [ "${BITCOIN_GENBUILD_NO_GIT}" != "1" ] && [ -e "$(command -v git)" ] && [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]; then
28+
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
2429
# clean 'dirty' status of touched files that haven't been modified
2530
git diff >/dev/null 2>/dev/null
2631

@@ -40,7 +45,9 @@ if [ -n "$GIT_TAG" ]; then
4045
elif [ -n "$GIT_COMMIT" ]; then
4146
NEWINFO="#define BUILD_GIT_COMMIT \"$GIT_COMMIT\""
4247
else
43-
NEWINFO="// No build information available"
48+
# NOTE: The NEWINFO line below this comment gets replaced by a string-match in contrib/guix/libexec/make_release_tarball.sh
49+
# If changing it, update the script too!
50+
NEWINFO='// No build information available'
4451
fi
4552

4653
# only update build.h if necessary

0 commit comments

Comments
 (0)