Skip to content
Snippets Groups Projects
Unverified Commit 6e0a3002 authored by Maxim Cournoyer's avatar Maxim Cournoyer
Browse files

build: Improvements to the generation of the release tarballs.

The phony tarball-producing targets will now always clear the
tarballs.manifest file before generating a new release tarball,
ensuring it doesn't contain stale information.

A new 'portable-release-tarball' target is also added to offer an easy
to use target that was previously implemented ad-hoc in the CI.  Move
this logic here as a portable release tarball is useful for packagers
wanting to test locally with the various supported platforms.  The
Jenkinsfile now makes use of it.

* Makefile (daemon/contrib/native/Makefile): New target.
(tarballs.manifest): Add the above target as a prerequisite and remove
invocation to bootstrap script.  Invoke make with --no-print-directory
to prevent entering/leaving directory messages from appearing in the
output (it's supposed to be on when using --silent, but when the make
invocation is nested, it doesn't seem to be the case).
(release-tarball): Also clear the tarballs.manifest when invoked.
(purge-release-tarballs, portable-release-tarball): New targets.
* guix/minimal-manifest.scm: New file.
* Jenkinsfile ('Generate release tarball): Use it to spawn the
container used to build the release tarball.  Also expose /usr/bin/env
in the container.  Use the new 'portable-release-tarball' target to
simplify things.  Fix the shebang line; it needs to be the first line
of the script.

GitLab: jami-packaging#98
Change-Id: I3b55e25933108ae9930bc9fcc867f9fa51d796f2
parent 7e29582b
No related branches found
No related tags found
No related merge requests found
......@@ -35,30 +35,11 @@ See https://wiki.savoirfairelinux.com/wiki/Jenkins.jami.net#Configuration"
stage('Generate release tarball') {
steps {
// The bundled tarballs included in the release
// tarball depend on what is available on the host.
// To ensure it can be shared across all different
// GNU/Linux distributions, generate it in a minimal
// container. Wget uses GnuTLS, which looks up its
// certs from /etc/ssl/certs.
sh '''
#!/usr/bin/env bash
// Note: sourcing .bashrc is necessary to setup the
// environment variables used by Guix.
sh '''#!/usr/bin/env bash
test -f $HOME/.bashrc && . $HOME/.bashrc
guix environment --container --network -E TARBALLS --share=$TARBALLS \
--expose=$SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt --ad-hoc \
coreutils \
gcc-toolchain \
git-minimal \
grep \
gzip \
make \
nss-certs \
pkg-config \
python \
sed \
tar \
wget \
xz -- make release-tarball
make portable-release-tarball
'''
}
}
......
......@@ -57,28 +57,47 @@ CURRENT_GID:=$(shell id -g)
#############################
## Release tarball targets ##
#############################
.PHONY: release-tarball
release-tarball: $(RELEASE_TARBALL_FILENAME)
.PHONY: release-tarball purge-release-tarballs portable-release-tarball
purge-release-tarballs:
rm -f jami_*.tar.* tarballs.manifest
release-tarball:
rm -f "$(RELEASE_TARBALL_FILENAME)" tarballs.manifest
$(MAKE) "$(RELEASE_TARBALL_FILENAME)"
# The bundled tarballs included in the release tarball depend on what
# is available on the host. To ensure it can be shared across all
# different GNU/Linux distributions, generate it in a minimal
# container. Wget uses GnuTLS, which looks up its certs from
# /etc/ssl/certs.
guix-share-tarball-arg = $${TARBALLS:+"--share=$$TARBALLS"}
portable-release-tarball:
command -v guix > /dev/null 2>&1 || \
(echo 'guix' is required to build the '$@' target && exit 1) && \
guix environment --container --network \
--preserve=TARBALLS $(guix-share-tarball-arg) \
--expose=/usr/bin/env \
--expose=$$SSL_CERT_FILE \
--manifest=$(CURDIR)/guix/minimal-manifest.scm \
-- $(MAKE) release-tarball
daemon/contrib/native/Makefile:
mkdir -p daemon/contrib/native && \
cd daemon/contrib/native && \
../bootstrap
# Fetch the required contrib sources and copy them to
# daemon/contrib/tarballs. To use a custom tarballs cache directory,
# export the TARBALLS environment variable.
tarballs.manifest:
rm -rf daemon/contrib/native
mkdir -p daemon/contrib/native && \
tarballs.manifest: daemon/contrib/native/Makefile
cd daemon/contrib/native && \
../bootstrap && \
$(MAKE) list && \
$(MAKE) fetch -j && \
$(MAKE) --silent list-tarballs > $(CURDIR)/$@
rm -rf daemon/contrib/native
# Generate the release tarball. Note: to avoid building 1+ GiB
# tarball containing all the bundled libraries, only the required
# tarballs are included. This means the resulting release tarball
# content depends on what libraries the host has installed. To build
# a single release tarball that can be used for any GNU/Linux machine,
# it should be built in a minimal container.)
$(MAKE) list && \
$(MAKE) fetch -j && \
$(MAKE) --no-print-directory --silent list-tarballs > "$(CURDIR)/$@"
# Generate the release tarball. To regenerate a fresh tarball
# manually clear the tarballs.manifest file.
$(RELEASE_TARBALL_FILENAME): tarballs.manifest
# Prepare the sources of the top repository and relevant submodules.
rm -f "$@"
......
;;; To use with the GNU Guix package manager.
;;; Available at https://guix.gnu.org/.
;;;
;;; Commentary:
;;;
;;; This Guix manifest can be used to create an environment that
;;; satisfies the minimal requirements of the the contrib build system
;;; of the daemon. For example, it is used by the CI to build the
;;; source release tarball in a controlled environment.
(specifications->manifest
(list
"coreutils"
"gcc-toolchain"
"git-minimal"
"grep"
"gzip"
"make"
"nss-certs"
"pkg-config"
"python"
"sed"
"tar"
"wget"
"xz"))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment