partial merge #18741: guix: Make source tarball using git-archive

bfe1ba2f5b36056e0c41edf8206b93d3d83098df rel-builds: Specify core.abbrev for git-rev-parse (Carl Dong)
27e63e01cce368d67092de8f0c736927d6f6aa69 build: Accomodate makensis v2.x (Carl Dong)
1f2c39a30e0f82046c7aecddfda3eb99cb536816 guix: Remove logical cores requirement (Carl Dong)
a4f6ffa71e335d4b2a6bf525b7f416968f9cd9f7 lint: Also enable source statements for non-gitian (Carl Dong)
d256f91cb1b0d6ff5170106b99b0266cbe51f5a2 rel-builds: Directly deploy win installer to OUTDIR (Carl Dong)
fa791da02f9684e3fd554b687fb692ae6a23d65a nsis: Specify OutFile path only once (Carl Dong)
14701604d0904bc5bbf1c67de08f8ee6d3215523 guix: Expose GIT_COMMON_DIR in container as readonly (Carl Dong)
f5a6ac4f48b18f93050d77bcb23f9cf45ec34647 guix: Make source tarball using git-archive (Carl Dong)
395c1137f630dc495ffb2752a23bc1dfd470ee53 gitian: Limit sourced script to just assignments (Carl Dong)

Pull request description:

  Based on: #18556
  Related: https://github.com/bitcoin/bitcoin/pull/17595#discussion_r399728721

ACKs for top commit:
  fanquake:
    ACK bfe1ba2f5b36056e0c41edf8206b93d3d83098df - 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
This commit is contained in:
fanquake 2020-05-06 12:51:18 +08:00 committed by UdjinM6
parent 4786fb0f71
commit c0572028e3
No known key found for this signature in database
GPG Key ID: 83592BD1400D58D9
8 changed files with 44 additions and 36 deletions

View File

@ -84,7 +84,7 @@ $(BITCOIN_WIN_INSTALLER): all-recursive
STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_CLI_BIN) $(top_builddir)/release STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_CLI_BIN) $(top_builddir)/release
STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_TX_BIN) $(top_builddir)/release STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_TX_BIN) $(top_builddir)/release
STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_WALLET_BIN) $(top_builddir)/release STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_WALLET_BIN) $(top_builddir)/release
@test -f $(MAKENSIS) && $(MAKENSIS) -V2 $(top_builddir)/share/setup.nsi || \ @test -f $(MAKENSIS) && echo 'OutFile "$@"' | cat $(top_builddir)/share/setup.nsi - | $(MAKENSIS) -V2 - || \
echo error: could not build $@ echo error: could not build $@
@echo built $@ @echo built $@

View File

@ -0,0 +1,12 @@
# Copyright (c) 2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# A helper script to be sourced into the gitian descriptors
if RECENT_TAG="$(git describe --exact-match HEAD)"; then
VERSION="${RECENT_TAG#v}"
else
VERSION="$(git rev-parse --short=12 HEAD)"
fi
DISTNAME="dashcore-${VERSION}"

View File

@ -168,9 +168,15 @@ script: |
create_per-host_faketime_wrappers "${REFERENCE_DATETIME}" create_per-host_faketime_wrappers "${REFERENCE_DATETIME}"
export PATH=${WRAP_DIR}:${PATH} export PATH=${WRAP_DIR}:${PATH}
# Create the git archive, and define DISTNAME and GIT_ARCHIVE variables. # Define DISTNAME variable.
# shellcheck source=contrib/gitian-descriptors/make_git_archive # shellcheck source=contrib/gitian-descriptors/assign_DISTNAME
source contrib/gitian-descriptors/make_git_archive source contrib/gitian-descriptors/assign_DISTNAME
GIT_ARCHIVE="${OUTDIR}/src/${DISTNAME}.tar.gz"
# Create the source tarball
mkdir -p "$(dirname "$GIT_ARCHIVE")"
git archive --output="$GIT_ARCHIVE" HEAD
ORIGPATH="$PATH" ORIGPATH="$PATH"
# Extract the git archive into a dir for each host and build # Extract the git archive into a dir for each host and build

View File

@ -122,9 +122,15 @@ script: |
create_per-host_faketime_wrappers "${REFERENCE_DATETIME}" create_per-host_faketime_wrappers "${REFERENCE_DATETIME}"
export PATH=${WRAP_DIR}:${PATH} export PATH=${WRAP_DIR}:${PATH}
# Create the git archive, and define DISTNAME and GIT_ARCHIVE variables. # Define DISTNAME variable.
# shellcheck source=contrib/gitian-descriptors/make_git_archive # shellcheck source=contrib/gitian-descriptors/assign_DISTNAME
source contrib/gitian-descriptors/make_git_archive source contrib/gitian-descriptors/assign_DISTNAME
GIT_ARCHIVE="${OUTDIR}/src/${DISTNAME}.tar.gz"
# Create the source tarball
mkdir -p "$(dirname "$GIT_ARCHIVE")"
git archive --output="$GIT_ARCHIVE" HEAD
ORIGPATH="$PATH" ORIGPATH="$PATH"
# Extract the git archive into a dir for each host and build # Extract the git archive into a dir for each host and build

View File

@ -137,9 +137,15 @@ script: |
create_per-host_compiler_wrapper "${REFERENCE_DATETIME}" create_per-host_compiler_wrapper "${REFERENCE_DATETIME}"
export PATH=${WRAP_DIR}:${PATH} export PATH=${WRAP_DIR}:${PATH}
# Create the git archive, and define DISTNAME and GIT_ARCHIVE variables. # Define DISTNAME variable.
# shellcheck source=contrib/gitian-descriptors/make_git_archive # shellcheck source=contrib/gitian-descriptors/assign_DISTNAME
source contrib/gitian-descriptors/make_git_archive source contrib/gitian-descriptors/assign_DISTNAME
GIT_ARCHIVE="${OUTDIR}/src/${DISTNAME}.tar.gz"
# Create the source tarball
mkdir -p "$(dirname "$GIT_ARCHIVE")"
git archive --output="$GIT_ARCHIVE" HEAD
ORIGPATH="$PATH" ORIGPATH="$PATH"
# Extract the git archive into a dir for each host and build # Extract the git archive into a dir for each host and build
@ -155,9 +161,8 @@ script: |
CONFIG_SITE=${BASEPREFIX}/${i}/share/config.site ./configure --prefix=/ --disable-maintainer-mode --disable-dependency-tracking ${CONFIGFLAGS} CFLAGS="${HOST_CFLAGS}" CXXFLAGS="${HOST_CXXFLAGS}" CONFIG_SITE=${BASEPREFIX}/${i}/share/config.site ./configure --prefix=/ --disable-maintainer-mode --disable-dependency-tracking ${CONFIGFLAGS} CFLAGS="${HOST_CFLAGS}" CXXFLAGS="${HOST_CXXFLAGS}"
make ${MAKEOPTS} make ${MAKEOPTS}
make ${MAKEOPTS} -C src check-security make ${MAKEOPTS} -C src check-security
make deploy make deploy BITCOIN_WIN_INSTALLER="${OUTDIR}/${DISTNAME}-win64-setup-unsigned.exe"
make install DESTDIR=${INSTALLPATH} make install DESTDIR=${INSTALLPATH}
cp -f ./bitcoin-*-win64-setup-unsigned.exe ${OUTDIR}/${DISTNAME}-win64-setup-unsigned.exe
cd installed cd installed
mv ${DISTNAME}/bin/*.dll ${DISTNAME}/lib/ mv ${DISTNAME}/bin/*.dll ${DISTNAME}/lib/
find . -name "lib*.la" -delete find . -name "lib*.la" -delete

View File

@ -1,20 +0,0 @@
# Copyright (c) 2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# A helper script to be sourced into the gitian descriptors
mkdir -p ${OUTDIR}/src
RECENT_TAG=$(git describe --abbrev=0 HEAD)
if [ $RECENT_TAG = $(git describe HEAD) ]; then
if [[ $RECENT_TAG == v* ]]; then
VERSION=${RECENT_TAG:1}
else
VERSION=$RECENT_TAG
fi
else
VERSION=$(git rev-parse --short HEAD)
fi
DISTNAME=bitcoin-${VERSION}
GIT_ARCHIVE="${OUTDIR}/src/${DISTNAME}.tar.gz"
git archive --output=$GIT_ARCHIVE HEAD

View File

@ -46,7 +46,6 @@ Var StartMenuGroup
!insertmacro MUI_LANGUAGE English !insertmacro MUI_LANGUAGE English
# Installer attributes # Installer attributes
OutFile @abs_top_srcdir@/@PACKAGE_TARNAME@-@PACKAGE_VERSION@-win64-setup-unsigned.exe
InstallDir $PROGRAMFILES64\DashCore InstallDir $PROGRAMFILES64\DashCore
CRCCheck on CRCCheck on
XPStyle on XPStyle on

View File

@ -39,9 +39,10 @@ if ! command -v gawk > /dev/null; then
exit $EXIT_CODE exit $EXIT_CODE
fi fi
SHELLCHECK_CMD=(shellcheck --external-sources --check-sourced)
EXCLUDE="--exclude=$(IFS=','; echo "${disabled[*]}")" EXCLUDE="--exclude=$(IFS=','; echo "${disabled[*]}")"
SOURCED_FILES=$(git ls-files | xargs gawk '/^# shellcheck shell=/ {print FILENAME} {nextfile}') # Check shellcheck directive used for sourced files SOURCED_FILES=$(git ls-files | xargs gawk '/^# shellcheck shell=/ {print FILENAME} {nextfile}') # Check shellcheck directive used for sourced files
if ! shellcheck "$EXCLUDE" $SOURCED_FILES $(git ls-files -- '*.sh' | grep -vE 'src/(leveldb|secp256k1|univalue)/'); then if ! "${SHELLCHECK_CMD[@]}" "$EXCLUDE" $SOURCED_FILES $(git ls-files -- '*.sh' | grep -vE 'src/(leveldb|secp256k1|univalue)/'); then
EXIT_CODE=1 EXIT_CODE=1
fi fi
@ -56,14 +57,13 @@ if ! command -v jq > /dev/null; then
fi fi
EXCLUDE_GITIAN=${EXCLUDE}",$(IFS=','; echo "${disabled_gitian[*]}")" EXCLUDE_GITIAN=${EXCLUDE}",$(IFS=','; echo "${disabled_gitian[*]}")"
SHELLCHECK_CMD="shellcheck --external-sources --check-sourced $EXCLUDE_GITIAN"
for descriptor in $(git ls-files -- 'contrib/gitian-descriptors/*.yml') for descriptor in $(git ls-files -- 'contrib/gitian-descriptors/*.yml')
do do
script=$(basename "$descriptor") script=$(basename "$descriptor")
# Use #!/bin/bash as gitian-builder/bin/gbuild does to complete a script. # Use #!/bin/bash as gitian-builder/bin/gbuild does to complete a script.
echo "#!/bin/bash" > $script echo "#!/bin/bash" > $script
yq -r .script "$descriptor" >> $script yq -r .script "$descriptor" >> $script
if ! $SHELLCHECK_CMD $script; then if ! "${SHELLCHECK_CMD[@]}" "$EXCLUDE_GITIAN" $script; then
EXIT_CODE=1 EXIT_CODE=1
fi fi
rm $script rm $script