From 33f4b090c6d2fffa3235221028407122b45f5703 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Wed, 22 Nov 2023 01:26:43 +0100 Subject: [PATCH 1/4] MISC: version.sh: support git repos without tags Signed-off-by: Tim Janik --- misc/version.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/misc/version.sh b/misc/version.sh index 0f78e095..5c636be4 100755 --- a/misc/version.sh +++ b/misc/version.sh @@ -17,14 +17,14 @@ if ! [[ "$HASH" =~ ^[0-9a-f]+$ ]] ; then # checks proper hash DESCRIBE= if test -e "${ABSPATHSCRIPT%/*}"/../.git ; then # fetch version from live git HASH=$(git log -1 --pretty="tformat:%H") - DESCRIBE=$(git describe --tags --match='v[0-9]*.[0-9]*.[0-9]*' --exact-match 2>/dev/null || git describe --match='v[0-9]*.[0-9]*.[0-9]*') + DESCRIBE=$(git describe --tags --match='v[0-9]*.[0-9]*.[0-9]*' --exact-match 2>/dev/null || git describe --match='v[0-9]*.[0-9]*.[0-9]*' 2>/dev/null) || DESCRIBE="" VDATE=$(git log -1 --pretty="tformat:%ci") fi fi # == Fallback version == -if test -z "$DESCRIBE" ; then - HASH=0000000000000000000000000000000000000000 +if test -z "$DESCRIBE" ; then # triggered by e.g. forks + HASH=$(git log -1 --pretty="tformat:%H" 2>/dev/null) || HASH=0000000000000000000000000000000000000000 DESCRIBE=v0.0.0-snapshot0 VDATE="2001-01-01 01:01:01 +0000" fi From 3d38585cfdbbf829104117d1750f5d1867137caf Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Wed, 22 Nov 2023 11:23:34 +0100 Subject: [PATCH 2/4] MISC: mkassets.sh: fallback to building in /tmp/anklang.tmp/ Signed-off-by: Tim Janik --- misc/mkassets.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/misc/mkassets.sh b/misc/mkassets.sh index b5f09a8a..9b3e5e23 100755 --- a/misc/mkassets.sh +++ b/misc/mkassets.sh @@ -4,9 +4,9 @@ set -Eeuo pipefail -x && SCRIPTNAME=${0##*/} && die() { [ -z "$*" ] || echo "$SC grep ' Anklang ' ./README.md || die 'failed to find Anklang project' -# Usage: mkrelease.sh [RELEASE_BUILDDIR] +# Usage: mkassets.sh [BUILDDIR] # Make dist tarball and build release assets from it. -BUILDDIR="${1:-/tmp/anklang/}" +BUILDDIR="${1:-/tmp/anklang.tmp/}" # Clear assets and builddir rm -rf assets $BUILDDIR @@ -38,5 +38,5 @@ test ! -r config-defaults.mk || # Fetch release assets and cleanup cp $BUILDDIR/assets/* ./assets/ -test "$BUILDDIR" == /tmp/anklang/ && rm -rf /tmp/anklang/ +test "$BUILDDIR" == /tmp/anklang.tmp/ && rm -rf /tmp/anklang.tmp/ ls -l assets/* From 6ec97c35493eb2e049b9541d3373912cb7507127 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Wed, 22 Nov 2023 11:45:48 +0100 Subject: [PATCH 3/4] MISC: mknews.sh: handle repos without tags Signed-off-by: Tim Janik --- misc/mknews.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/misc/mknews.sh b/misc/mknews.sh index 51c5ff39..0d019c3a 100755 --- a/misc/mknews.sh +++ b/misc/mknews.sh @@ -23,6 +23,9 @@ fetch_news_version() # fetch_news_version {1|2} } NEWS_TAG="v$(fetch_news_version 1)" +# Work around repos without tags +git rev-parse --verify "$NEWS_TAG" 2>/dev/null || NEWS_TAG=`git log --reverse --format=%H | sed -n '1p' ` + # Just print topmost NEWS.md version test " ${1:-}" == " --version" && { echo "$NEWS_TAG" From f7deff5a77eab2d4576b5400b97b03289c274b3a Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Wed, 22 Nov 2023 11:46:17 +0100 Subject: [PATCH 4/4] MISC: mknews.sh: create NEWS in forward order Signed-off-by: Tim Janik --- misc/mknews.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/misc/mknews.sh b/misc/mknews.sh index 0d019c3a..ac4775d0 100755 --- a/misc/mknews.sh +++ b/misc/mknews.sh @@ -50,7 +50,6 @@ else echo echo '``````````````````````````````````````````````````````````````````````````````````````' git log --pretty='%s # %cd %an %h%n%w(0,4,4)%b' \ - --reverse \ --first-parent --date=short "$NEWS_TAG..HEAD" | sed -e '/^\s*Signed-off-by:.*<.*@.*>/d' | sed '/^\s*$/{ N; /^\s*\n\s*$/D }'