Skip to content

Commit 395c113

Browse files
committed
gitian: Limit sourced script to just assignments
Previously, the sourced script would create the source tarball. Now, it only assigns variables and the source-ing script has more flexibility in determining what to do with these variables. See later commit showing how this flexibility is useful in our Guix builds.
1 parent 6e3fc74 commit 395c113

File tree

5 files changed

+39
-29
lines changed

5 files changed

+39
-29
lines changed
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 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: 9 additions & 3 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

contrib/gitian-descriptors/make_git_archive

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

0 commit comments

Comments
 (0)