libgocryptfs/package-source.bash
Jakob Unterwurzacher 025f33e366 package-source.bash: archive HEAD instead of master
To be able to check out an older version and create
a tarball from it, let `git archive` operate on HEAD.

This used to be broken in a bad way: we use `git describe`
which operates on HEAD to name the tarball, but always archived
HEAD.
2018-01-07 22:29:02 +01:00

35 lines
935 B
Bash
Executable File

#!/bin/bash -eu
# git_archive_extra PREFIX EXTRA1 [EXTRA2 ...]
# Call git-archive and add additional files to the tarball.
git_archive_extra() {
local PREFIX=$1
shift
# Add files tracked in git
git archive --prefix "$PREFIX/" -o $PREFIX.tar HEAD
# Add "extra" files
tar --transform "s!^!$PREFIX/!" --append -f $PREFIX.tar "$@"
# Compress
gzip -f $PREFIX.tar
}
cd "$(dirname "$0")"
GITVERSION=$(git describe --tags --dirty)
echo $GITVERSION > VERSION
# gocryptfs source tarball
PREFIX_SRC_ONLY=gocryptfs_${GITVERSION}_src
git_archive_extra $PREFIX_SRC_ONLY VERSION
# gocryptfs source + dependencies tarball
dep ensure
PREFIX_SRC_DEPS=gocryptfs_${GITVERSION}_src-deps
git_archive_extra $PREFIX_SRC_DEPS VERSION vendor
rm VERSION
echo "Tars created."
echo "Hint for signing: gpg -u 23A02740 --armor --detach-sig $PREFIX_SRC_ONLY.tar.gz"
echo " gpg -u 23A02740 --armor --detach-sig $PREFIX_SRC_DEPS.tar.gz"