From 0d5f0d79da08e1e2bd17db2aa2ca8addd4150993 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 11 Jan 2019 15:26:30 +1030 Subject: [PATCH] build: allow building from source zip file. Changes both how we construct it and how we deal with not having git. Signed-off-by: Rusty Russell --- Makefile | 5 +++-- tools/build-release.sh | 8 +++++++- tools/refresh-submodules.sh | 3 +++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 3457301e8ae8..a80efbb2e988 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ #! /usr/bin/make -VERSION_NAME=Principled Opposition to SegWit -VERSION=$(shell git describe --always --dirty=-modded --abbrev=7) + +# Extract version from git, or if we're from a zipfile, use dirname +VERSION=$(shell git describe --always --dirty=-modded --abbrev=7 2>/dev/null || pwd | sed -n 's,.*/clightning-\(v[0-9.rc]*\)$$,\1,p') ifeq ($(VERSION),) $(error "ERROR: git is required for generating version information") diff --git a/tools/build-release.sh b/tools/build-release.sh index 6147fc113e6f..4e29d35f3caa 100755 --- a/tools/build-release.sh +++ b/tools/build-release.sh @@ -49,7 +49,13 @@ for platform in Fedora-28-amd64 Ubuntu-16.04-amd64 Ubuntu-16.04-i386; do docker run --rm=true -w /build $TAG rm -rf /"$VERSION-$platform" /build done -git archive --format=zip -o release/clightning-"$VERSION".zip --prefix=lightning-master/ master +# git archive won't go into submodules :( +ln -sf .. "release/clightning-$VERSION" +FILES=$(git ls-files --recurse-submodules | sed "s,^,clightning-$VERSION/,") +# shellcheck disable=SC2086 +(cd release && zip "clightning-$VERSION.zip" $FILES) +rm "release/clightning-$VERSION" +exit 0 sha256sum release/clightning-"$VERSION"* > release/SHA256SUMS gpg -sb --armor -o release/SHA256SUMS.asc-"$(gpgconf --list-options gpg | awk -F: '$1 == "default-key" {print $10}' | tr -d '"')" release/SHA256SUMS diff --git a/tools/refresh-submodules.sh b/tools/refresh-submodules.sh index 82e583c24167..1f5964666b59 100755 --- a/tools/refresh-submodules.sh +++ b/tools/refresh-submodules.sh @@ -5,6 +5,9 @@ if [ $# = 0 ]; then exit 1 fi +# If no git dir, forget it. +[ -d .git ] || exit 0 + # git submodule can't run in parallel. Really. if ! mkdir .refresh-submodules 2>/dev/null ; then exit 0