From bb1353cfb34ba45ea1ce02f69c899f1e21076275 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Mon, 9 Nov 2026 13:17:00 +0100 Subject: [PATCH] pkg.sh: Use tags instead of RELEASES file If a release on a platform is due is decided by checking if the version / platform / architecture combination is recorded in RELEASES. This commit moves that bookkeeping from RELEASES to Git tag. Create a git tag per release, named after the version and the platform of the RELEASES entry, so "kali-rolling/amd64: 1.0.0-288" becomes the tag v1.0.0-288@kali-rolling/amd64, and push the branch commit and the tag. The tag message keeps the previous commit message, "Release @". Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.5.0 Signed-off-by: Jan Lindemann --- scripts/pkg.sh | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/scripts/pkg.sh b/scripts/pkg.sh index 7ae7911d..dda435eb 100644 --- a/scripts/pkg.sh +++ b/scripts/pkg.sh @@ -85,6 +85,13 @@ write_map() cmd_version -p `platform` $1 write $2 } +release_tags() +{ + # a release of a version on a platform is tagged + # v@ + git tag -l "v*@`platform`" +} + find_path() { local p @@ -177,12 +184,6 @@ increase_build_no() check_next_version() { local v=`read_map $TOPDIR/VERSION | sed 's/-dev//'` - local n=`read_map -n $TOPDIR/RELEASES | sed 's/-dev//'` - if [ "$n" != "$v" ]; then - echo "+ $PKG_PROJECT version is already at $v, no need to increase for release" >&2 - echo $v - return - fi local h=`calculate_hash` [ -n "$h" ] || fatal "failed to calculate source hash" if [ ! -f $TOPDIR/HASH ]; then @@ -190,7 +191,7 @@ check_next_version() echo $v return fi - if ! read_map $TOPDIR/HASH | grep -q $h; then + if ! grep -q $h $TOPDIR/HASH; then echo "+ $PKG_PROJECT has no matching HASH value, needs release" >&2 increase_build_no $v return @@ -274,8 +275,8 @@ check_release_is_current() done shift - if ! read_map -n $TOPDIR/RELEASES | grep -Fq $next; then - echo "next version $next is not in RELEASES, needs release" >&2 + if ! release_tags | grep -qF "v$next@"; then + echo "next version $next is not released on `platform`, needs release" >&2 return 1 fi @@ -311,8 +312,12 @@ check_update_version() local next=`check_next_version` [ "$next" ] || fatal "Failed to get next version." if [ "$next" != "$v" ]; then + local h=`calculate_hash` + [ -n "$h" ] || fatal "failed to calculate source hash" echo "$next-dev" > VERSION - scm_commit -m "$comment $next" VERSION + write_map $TOPDIR/HASH $h + $SCM add $TOPDIR/HASH || true + scm_commit -m "$comment $next" VERSION $TOPDIR/HASH return 0 fi return 1 @@ -373,6 +378,7 @@ cmd_version() case $cmd in read) + [ -f "$file" ] || return 0 local p=`echo $platform | sed 's%/%\\\/%g'` local v=`sed "/$p:/ !d; s/$p: *//" $file` [ "$v" ] && { @@ -609,8 +615,6 @@ upload_pkg() set -e local p local v=`read_map $TOPDIR/VERSION | sed 's/-dev//'` - local h=`calculate_hash` - [ -n "$h" ] || fatal "failed to calculate source hash" case $PKG_FORMAT in rpm) server=pkg.janware.com @@ -657,17 +661,12 @@ upload_pkg() ;; esac - write_map $TOPDIR/RELEASES $v - $SCM add $TOPDIR/RELEASES || true - write_map $TOPDIR/HASH $h - $SCM add $TOPDIR/HASH || true echo "+ scheduling rebuild" $SSH -l root $server /opt/packager-server/bin/packager-server schedule-rebuild - scm_commit -m "Release $v@`platform`" $TOPDIR/RELEASES $TOPDIR/HASH - if [ "$SCM" = git ]; then - # Don't use extra options, they might contain -l - JW_PKG_SSH_EXTRA_OPTS="" git push || fatal "Failed to push changes to RELEASES and HASH" - fi + local tag="v$v@`platform`" + git tag -m "Release $v@`platform`" "$tag" || fatal "Failed to tag the release as $tag" + # Don't use extra options, they might contain -l + JW_PKG_SSH_EXTRA_OPTS="" git push origin HEAD "$tag" || fatal "Failed to push the release commit and tag $tag" } install_exe_wrapper()