~sourcemage/sorcery

bca927a6c1b11b0ca3ae102627f88710fa618d69 — Ismael Luceno 2 months ago c860116
Fix version bumping

- Revert back to parsing tags, but match version tags only
- Add timestamp (from commit date) to snapshots

Fixes: 468486f77bb3 ("Makefile: version bumping for devel")
2 files changed, 11 insertions(+), 5 deletions(-)

M Makefile
M bump.awk
M Makefile => Makefile +3 -1
@@ 27,7 27,9 @@ release: $(release)
#HELP:	bump      - Bump version
.PHONY: bump
bump:
	git log -1 --format=%cs | tr -d '-' >etc/sorcery/version
	git describe --always --tags  --match=v\* | \
		${AWK} -f bump.awk | \
		tee etc/sorcery/version

devinst: bump install


M bump.awk => bump.awk +8 -4
@@ 9,12 9,16 @@ BEGIN {
	for (i = 1; i < NF; i++)
		$i = $(i+1)
	--NF
	print
	exit
}

# bump snapshot
# add placeholder for unknown predecessor
!/^v/ { sub(/^/, "0-0-g") }

# add timestamp to snapshot
{
	sub(/.*-g/, strftime("%Y%m%d-g", systime(), 1))
	print
	"git log -1 --format=%ct" | getline  t
	sub(/-/, strftime("+%Y%m%d-", t, 1))
}

END { print }