From 827b1b61c97ecc6d058fdbd23fb403be54e20f11 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Wed, 6 May 2020 13:37:02 +0000 Subject: [PATCH 1/2] build: Abstract release tarball generation to a utility script make_release_tarball --- contrib/gitian-descriptors/gitian-linux.yml | 2 +- contrib/gitian-descriptors/gitian-osx.yml | 2 +- contrib/gitian-descriptors/gitian-win.yml | 2 +- contrib/gitian-descriptors/make_release_tarball | 10 ++++++++++ contrib/guix/libexec/build.sh | 2 +- 5 files changed, 14 insertions(+), 4 deletions(-) create mode 100755 contrib/gitian-descriptors/make_release_tarball diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml index ec716cf2f3fcd..adda286fea750 100644 --- a/contrib/gitian-descriptors/gitian-linux.yml +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -112,7 +112,7 @@ script: | # Create the source tarball mkdir -p "$(dirname "$GIT_ARCHIVE")" - git archive --prefix="${DISTNAME}/" --output="$GIT_ARCHIVE" HEAD + contrib/gitian-descriptors/make_release_tarball "${GIT_ARCHIVE}" ORIGPATH="$PATH" # Extract the git archive into a dir for each host and build diff --git a/contrib/gitian-descriptors/gitian-osx.yml b/contrib/gitian-descriptors/gitian-osx.yml index df50f45188551..6493fb7f16f8b 100644 --- a/contrib/gitian-descriptors/gitian-osx.yml +++ b/contrib/gitian-descriptors/gitian-osx.yml @@ -111,7 +111,7 @@ script: | # Create the source tarball mkdir -p "$(dirname "$GIT_ARCHIVE")" - git archive --prefix="${DISTNAME}/" --output="$GIT_ARCHIVE" HEAD + contrib/gitian-descriptors/make_release_tarball "${GIT_ARCHIVE}" ORIGPATH="$PATH" # Extract the git archive into a dir for each host and build diff --git a/contrib/gitian-descriptors/gitian-win.yml b/contrib/gitian-descriptors/gitian-win.yml index 4d61cded7483e..c82a4a8c9a85a 100644 --- a/contrib/gitian-descriptors/gitian-win.yml +++ b/contrib/gitian-descriptors/gitian-win.yml @@ -116,7 +116,7 @@ script: | # Create the source tarball mkdir -p "$(dirname "$GIT_ARCHIVE")" - git archive --prefix="${DISTNAME}/" --output="$GIT_ARCHIVE" HEAD + contrib/gitian-descriptors/make_release_tarball "${GIT_ARCHIVE}" ORIGPATH="$PATH" # Extract the git archive into a dir for each host and build diff --git a/contrib/gitian-descriptors/make_release_tarball b/contrib/gitian-descriptors/make_release_tarball new file mode 100755 index 0000000000000..e06836dfa736e --- /dev/null +++ b/contrib/gitian-descriptors/make_release_tarball @@ -0,0 +1,10 @@ +#!/bin/sh +# 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 generate source release tarball + +GIT_ARCHIVE="$1" +. "`dirname "$0"`/assign_DISTNAME" +git archive --prefix="${DISTNAME}/" --output="${GIT_ARCHIVE}" HEAD diff --git a/contrib/guix/libexec/build.sh b/contrib/guix/libexec/build.sh index d658c4f6a67d3..2464da3b1bdb6 100644 --- a/contrib/guix/libexec/build.sh +++ b/contrib/guix/libexec/build.sh @@ -158,7 +158,7 @@ GIT_ARCHIVE="${OUTDIR}/src/${DISTNAME}.tar.gz" # Create the source tarball if not already there if [ ! -e "$GIT_ARCHIVE" ]; then mkdir -p "$(dirname "$GIT_ARCHIVE")" - git archive --prefix="${DISTNAME}/" --output="$GIT_ARCHIVE" HEAD + contrib/gitian-descriptors/make_release_tarball "${GIT_ARCHIVE}" fi ########################### From 1a606ef885fd0701a7f2b8a0040723826fd2876a Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Wed, 29 Apr 2020 00:23:13 +0000 Subject: [PATCH 2/2] build: Run autogen & distclean when generating source tarball --- contrib/gitian-descriptors/gitian-linux.yml | 5 ++-- contrib/gitian-descriptors/gitian-osx.yml | 5 ++-- contrib/gitian-descriptors/gitian-win.yml | 5 ++-- .../gitian-descriptors/make_release_tarball | 25 ++++++++++++++++++- contrib/guix/libexec/build.sh | 3 +-- 5 files changed, 34 insertions(+), 9 deletions(-) diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml index adda286fea750..3ac7bcddad2ce 100644 --- a/contrib/gitian-descriptors/gitian-linux.yml +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -110,8 +110,10 @@ script: | GIT_ARCHIVE="${OUTDIR}/src/${DISTNAME}.tar.gz" - # Create the source tarball + # Create the release tarball using (arbitrarily) the first host mkdir -p "$(dirname "$GIT_ARCHIVE")" + CONFIG_SITE="${BASEPREFIX}/${HOSTS/ */}/share/config.site" \ + REFERENCE_DATETIME="${REFERENCE_DATETIME}" \ contrib/gitian-descriptors/make_release_tarball "${GIT_ARCHIVE}" ORIGPATH="$PATH" @@ -131,7 +133,6 @@ script: | mkdir -p ${INSTALLPATH} tar --strip-components=1 -xf "${GIT_ARCHIVE}" - ./autogen.sh 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}" make ${MAKEOPTS} make ${MAKEOPTS} -C src check-security diff --git a/contrib/gitian-descriptors/gitian-osx.yml b/contrib/gitian-descriptors/gitian-osx.yml index 6493fb7f16f8b..60c01eb8df84b 100644 --- a/contrib/gitian-descriptors/gitian-osx.yml +++ b/contrib/gitian-descriptors/gitian-osx.yml @@ -109,8 +109,10 @@ script: | GIT_ARCHIVE="${OUTDIR}/src/${DISTNAME}.tar.gz" - # Create the source tarball + # Create the release tarball using (arbitrarily) the first host mkdir -p "$(dirname "$GIT_ARCHIVE")" + CONFIG_SITE="${BASEPREFIX}/${HOSTS/ */}/share/config.site" \ + REFERENCE_DATETIME="${REFERENCE_DATETIME}" \ contrib/gitian-descriptors/make_release_tarball "${GIT_ARCHIVE}" ORIGPATH="$PATH" @@ -123,7 +125,6 @@ script: | mkdir -p ${INSTALLPATH} tar --strip-components=1 -xf "${GIT_ARCHIVE}" - ./autogen.sh CONFIG_SITE=${BASEPREFIX}/${i}/share/config.site ./configure --prefix=/ --disable-ccache --disable-maintainer-mode --disable-dependency-tracking ${CONFIGFLAGS} make ${MAKEOPTS} make ${MAKEOPTS} -C src check-security diff --git a/contrib/gitian-descriptors/gitian-win.yml b/contrib/gitian-descriptors/gitian-win.yml index c82a4a8c9a85a..75533975b0922 100644 --- a/contrib/gitian-descriptors/gitian-win.yml +++ b/contrib/gitian-descriptors/gitian-win.yml @@ -114,8 +114,10 @@ script: | GIT_ARCHIVE="${OUTDIR}/src/${DISTNAME}.tar.gz" - # Create the source tarball + # Create the release tarball using (arbitrarily) the first host mkdir -p "$(dirname "$GIT_ARCHIVE")" + CONFIG_SITE="${BASEPREFIX}/${HOSTS/ */}/share/config.site" \ + REFERENCE_DATETIME="${REFERENCE_DATETIME}" \ contrib/gitian-descriptors/make_release_tarball "${GIT_ARCHIVE}" ORIGPATH="$PATH" @@ -128,7 +130,6 @@ script: | mkdir -p ${INSTALLPATH} tar --strip-components=1 -xf "${GIT_ARCHIVE}" - ./autogen.sh CONFIG_SITE=${BASEPREFIX}/${i}/share/config.site ./configure --prefix=/ --disable-ccache --disable-maintainer-mode --disable-dependency-tracking ${CONFIGFLAGS} CFLAGS="${HOST_CFLAGS}" CXXFLAGS="${HOST_CXXFLAGS}" make ${MAKEOPTS} make ${MAKEOPTS} -C src check-security diff --git a/contrib/gitian-descriptors/make_release_tarball b/contrib/gitian-descriptors/make_release_tarball index e06836dfa736e..a3c4e824e756e 100755 --- a/contrib/gitian-descriptors/make_release_tarball +++ b/contrib/gitian-descriptors/make_release_tarball @@ -5,6 +5,29 @@ # # A helper script to generate source release tarball +set -e + GIT_ARCHIVE="$1" . "`dirname "$0"`/assign_DISTNAME" -git archive --prefix="${DISTNAME}/" --output="${GIT_ARCHIVE}" HEAD + +git archive --prefix="${DISTNAME}/" HEAD | tar -xp +cd "${DISTNAME}" + +./autogen.sh +./configure --prefix=/ --disable-ccache --disable-maintainer-mode --disable-dependency-tracking +make distclean + +cd .. +tar \ + --format=ustar \ + --exclude autom4te.cache \ + --exclude .deps \ + --exclude .git \ + --sort=name \ + --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 \ + --mtime="${REFERENCE_DATETIME}" \ + -c "${DISTNAME}" | \ + gzip -9n \ + >"${GIT_ARCHIVE}" + +rm -r "${DISTNAME}" diff --git a/contrib/guix/libexec/build.sh b/contrib/guix/libexec/build.sh index 2464da3b1bdb6..cc4cea6b47a3f 100644 --- a/contrib/guix/libexec/build.sh +++ b/contrib/guix/libexec/build.sh @@ -158,6 +158,7 @@ GIT_ARCHIVE="${OUTDIR}/src/${DISTNAME}.tar.gz" # Create the source tarball if not already there if [ ! -e "$GIT_ARCHIVE" ]; then mkdir -p "$(dirname "$GIT_ARCHIVE")" + CONFIG_SITE="${BASEPREFIX}/${HOST}/share/config.site" \ contrib/gitian-descriptors/make_release_tarball "${GIT_ARCHIVE}" fi @@ -195,8 +196,6 @@ export PATH="${BASEPREFIX}/${HOST}/native/bin:${PATH}" # Extract the source tarball tar --strip-components=1 -xf "${GIT_ARCHIVE}" - ./autogen.sh - # Configure this DISTSRC for $HOST # shellcheck disable=SC2086 env CONFIG_SITE="${BASEPREFIX}/${HOST}/share/config.site" \