diff options
author | Ismael Luceno | 2021-09-08 21:52:07 +0200 |
---|---|---|
committer | Ismael Luceno | 2021-09-08 21:55:44 +0200 |
commit | c60a4b6e1138d2bc8833ee50dc135aa5c4b67773 (patch) | |
tree | 6c51f05b7be92ad267cc0fecd6fdd3770657686c | |
parent | 91ffd11cd6587442817de56fdfb45e1d561f9955 (diff) |
Makefile: Unify version-bump targets
Just detect from the output of git-describe if it's at a version tag and
update accordingly.
Use the new target on devinst.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | Makefile | 22 | ||||
-rw-r--r-- | bump.awk | 20 |
3 files changed, 31 insertions, 14 deletions
@@ -1,3 +1,6 @@ +2021-09-08 Ismael Luceno <ismael@sourcemage.org> + * Makefile: unified version bump target + make devinst dep on it + 2021-02-26 Thomas Orgis <sobukus@sourcemage.org> * Makefile: added devinst target to mark installs from git checkout @@ -1,3 +1,5 @@ +AWK ?= awk + .PHONY: help help: @awk 'sub(/^#HELP: ?/, "")' $(MAKEFILE_LIST) $(.MAKE.MAKEFILES) @@ -19,24 +21,16 @@ $(release): $(ts-scm) release: $(release) #HELP: bump - Bump version -.PHONY: bump bump-stable bump-devel -bump-stable: - git describe --tags | >etc/sorcery/version \ - awk -F'[^0-9]' -vOFS=. '{++$$NF;for(i=1;i<NF;i++)$$i=$$(i+1)}NF--' - -bump-devel: - date -u +%Y%m%d > etc/sorcery/version - -bump: bump-$(BRANCH) +.PHONY: bump +bump: + git describe --tags | >etc/sorcery/version ${AWK} -f bump.awk -devinst: install - date +%Y%m%d | tr '\n' - > /etc/sorcery/version - git show --oneline | head -n 1 | cut -f 1 -d ' ' >> /etc/sorcery/version +devinst: bump install #HELP: install - Install sorcery -#HELP: devinst - Install with version vom active branch +#HELP: devinst - Install with version from active branch #HELP: uninstall - Uninstall sorcery #HELP: convert - Convert from Pre 0.8.x grimoire to new codex format -script-targets = install uninstall convert +script-targets = install devinst uninstall convert .PHONY: $(script-targets) $(script-targets):; ./$@ diff --git a/bump.awk b/bump.awk new file mode 100644 index 00000000..ad04bdec --- /dev/null +++ b/bump.awk @@ -0,0 +1,20 @@ +BEGIN { + FS="[^0-9]" + OFS="." +} + +# bump stable +/^v/ && !/-[1-9][0-9]*-g[0-9a-f]+$/ { + ++$NF + for (i = 1; i < NF; i++) + $i = $(i+1) + --NF + print + exit +} + +# bump snapshot +{ + sub(/.*-g/, strftime("%Y%m%d-g", systime(), 1)) + print +} |