build: Allow for signing releases without building a zip.

Adds a `--without-zip` parameter default `false` which optionally
skips the archive, to allow for signing releases from CI.
This commit is contained in:
Se7enZ 2024-12-02 14:38:25 +10:30 committed by Rusty Russell
parent b9b81c6918
commit f789f9cb21

View file

@ -20,6 +20,7 @@ fi
FORCE_UNCLEAN=false FORCE_UNCLEAN=false
VERIFY_RELEASE=false VERIFY_RELEASE=false
WITHOUT_ZIP=false
ALL_TARGETS="bin-Fedora-28-amd64 bin-Ubuntu docker sign" ALL_TARGETS="bin-Fedora-28-amd64 bin-Ubuntu docker sign"
# ALL_TARGETS="bin-Fedora-28-amd64 bin-Ubuntu tarball deb docker sign" # ALL_TARGETS="bin-Fedora-28-amd64 bin-Ubuntu tarball deb docker sign"
@ -38,6 +39,9 @@ for arg; do
--verify) --verify)
VERIFY_RELEASE=true VERIFY_RELEASE=true
;; ;;
--without-zip)
WITHOUT_ZIP=true
;;
--help) --help)
echo "Usage: [--force-version=<ver>] [--force-unclean] [--force-mtime=YYYY-MM-DD] [--verify] [TARGETS]" echo "Usage: [--force-version=<ver>] [--force-unclean] [--force-mtime=YYYY-MM-DD] [--verify] [TARGETS]"
echo Known targets: "$ALL_TARGETS" echo Known targets: "$ALL_TARGETS"
@ -113,32 +117,35 @@ echo "Release Directory: $RELEASEDIR"
echo "Tarball File: $TARBALL" echo "Tarball File: $TARBALL"
echo "Current Timestamp: $DATE" echo "Current Timestamp: $DATE"
# submodcheck needs to know if we have lowdown
./configure --reconfigure
# If it's a completely clean directory, we need submodules!
make submodcheck
mkdir -p "$RELEASEDIR" mkdir -p "$RELEASEDIR"
echo "Creating Zip File" if [ "$WITHOUT_ZIP" = "false" ]; then
# delete zipfile if exists # submodcheck needs to know if we have lowdown
[ -f "$RELEASEDIR/clightning-$VERSION.zip" ] && rm "$RELEASEDIR/clightning-$VERSION.zip" ./configure --reconfigure
mkdir "$RELEASEDIR/clightning-$VERSION" # If it's a completely clean directory, we need submodules!
# git archive won't go into submodules :(; We use tar to copy make submodcheck
git ls-files -z --recurse-submodules | tar --null --files-from=- -c -f - | (cd "$RELEASEDIR/clightning-$VERSION" && tar xf -)
# tar can set dates on files, but zip cares about dates in directories! echo "Creating Zip File"
# We set to local time (not "$MTIME 00:00Z") because zip uses local time! # delete zipfile if exists
find "$RELEASEDIR/clightning-$VERSION" -print0 | xargs -0r touch --no-dereference --date="$MTIME" [ -f "$RELEASEDIR/clightning-$VERSION.zip" ] && rm "$RELEASEDIR/clightning-$VERSION.zip"
# Seriously, we can have differing permissions, too. Normalize. mkdir "$RELEASEDIR/clightning-$VERSION"
# Directories become drwxr-xr-x # git archive won't go into submodules :(; We use tar to copy
find "$RELEASEDIR/clightning-$VERSION" -type d -print0 | xargs -0r chmod 755 git ls-files -z --recurse-submodules | tar --null --files-from=- -c -f - | (cd "$RELEASEDIR/clightning-$VERSION" && tar xf -)
# Executables become -rwxr-xr-x # tar can set dates on files, but zip cares about dates in directories!
find "$RELEASEDIR/clightning-$VERSION" -type f -perm -100 -print0 | xargs -0r chmod 755 # We set to local time (not "$MTIME 00:00Z") because zip uses local time!
# Non-executables become -rw-r--r-- find "$RELEASEDIR/clightning-$VERSION" -print0 | xargs -0r touch --no-dereference --date="$MTIME"
find "$RELEASEDIR/clightning-$VERSION" -type f ! -perm -100 -print0 | xargs -0r chmod 644 # Seriously, we can have differing permissions, too. Normalize.
# zip -r doesn't have a deterministic order, and git ls-files does. # Directories become drwxr-xr-x
LANG=C git ls-files --recurse-submodules | sed "s@^@clightning-$VERSION/@" | (cd release && zip -@ -X "clightning-$VERSION.zip") find "$RELEASEDIR/clightning-$VERSION" -type d -print0 | xargs -0r chmod 755
rm -r "$RELEASEDIR/clightning-$VERSION" # Executables become -rwxr-xr-x
echo "Zip File Created" find "$RELEASEDIR/clightning-$VERSION" -type f -perm -100 -print0 | xargs -0r chmod 755
# Non-executables become -rw-r--r--
find "$RELEASEDIR/clightning-$VERSION" -type f ! -perm -100 -print0 | xargs -0r chmod 644
# zip -r doesn't have a deterministic order, and git ls-files does.
LANG=C git ls-files --recurse-submodules | sed "s@^@clightning-$VERSION/@" | (cd release && zip -@ -X "clightning-$VERSION.zip")
rm -r "$RELEASEDIR/clightning-$VERSION"
echo "Zip File Created"
fi
for target in $TARGETS; do for target in $TARGETS; do
platform=${target#bin-} platform=${target#bin-}