Skip to content

Commit

Permalink
mkrelease: generate a release tarball
Browse files Browse the repository at this point in the history
The tarball contains a trurl.1, the nroff/manpage version of trurl.md,
generated with cd2nroff from curl/scripts
  • Loading branch information
bagder committed Aug 28, 2024
1 parent 7b06ecf commit d74a3e4
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions mkrelease
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
##########################################################################
# _ _ ____ _
# Project ___| | | | _ \| |
Expand Down Expand Up @@ -34,5 +35,51 @@ if [ -z "$version" ]; then
exit
fi

rel="trurl-$version"

mkdir $rel

# update title in markdown manpage
sed -ie "s/^Title: trurl \([0-9.]*\)/Title: trurl $version/" trurl.md

# update version number in header file
sed -ie "s/\"[\.0-9]*\"/\"$version\"/" version.h

# render the manpage into nroff
./curl/scripts/cd2nroff trurl.md > $rel/trurl.1

# create a release directory tree
cp -p --parents $(git ls-files | grep -vE '^(.github/|.reuse/|.gitignore|LICENSES/)') $rel

# create tarball from the tree
targz="$rel.tar.gz"
tar cfz "$targz" "$rel"

timestamp=${SOURCE_DATE_EPOCH:-$(date +"%s")}
filestamp=$(date -d "@$timestamp" +"%Y%m%d%H%M.%S")

retar() {
tempdir=$1
rm -rf "$tempdir"
mkdir "$tempdir"
cd "$tempdir"
gzip -dc "../$targz" | tar -xf -
find trurl-* -depth -exec touch -c -t "$filestamp" '{}' +
tar --create --format=ustar --owner=0 --group=0 --numeric-owner --sort=name trurl-* | gzip --best --no-name > out.tar.gz
mv out.tar.gz ../
cd ..
rm -rf "$tempdir"
}

# make it reproducible
retar ".tarbuild"
mv out.tar.gz "$targz"

# remove the temporary directory
rm -rf $rel

# Set deterministic timestamp
touch -c -t "$filestamp" "$targz"

echo "Now sign the release:"
echo "gpg -b -a '$targz'"

0 comments on commit d74a3e4

Please sign in to comment.