guilt: add git commit level versioning
Subsystems (2)
PATCH 1/1 guilt: add git commit level versioning
Shamelessly steal the dynamic versioning goodies from git itself. Now when you do "guilt --version" you can expect to see things like:
Guilt version 0.31.2.14.gece1.dirty
assuming you've 14 commits since 0.31.2 and also some changes that you've not committed yet.
--- .gitignore | 2 ++ Documentation/Makefile | 4 ++-- GUILT-VERSION-GEN | 42 ++++++++++++++++++++++++++++++++++++++++++ Makefile | 21 ++++++++++++++++----- guilt | 4 +++- 5 files changed, 65 insertions(+), 8 deletions(-) create mode 100755 GUILT-VERSION-GEN
.gitignore +2 -0
@@ -7,3 +7,5 @@ # *~ *.swp +guilt.bin +GUILT-VERSION-FILE
Documentation/Makefile +2 -2
@@ -7,7 +7,7 @@ DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT)) DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT)) USAGE=$(patsubst %.txt,usage-%.txt,$(MAN1_TXT)) -VERSION=$(shell git describe 2> /dev/null || sed -n -e '/^GUILT_VERSION=/ { s/^GUILT_VERSION="/v/; s/"//; p; q; }' ../guilt) +include ../GUILT-VERSION-FILE prefix?=$(PREFIX) bindir?=$(prefix)/bin
@@ -51,7 +51,7 @@ doc.dep : $(wildcard *.txt) build-docdep.perl -include doc.dep version.txt: - echo "(Generated for Guilt $(VERSION))" > version.txt + echo "(Generated for Guilt $(GUILT_VERSION))" > version.txt cmds.txt: cmd-list.sh $(MAN1_TXT) sh ./cmd-list.sh
GUILT-VERSION-GEN new file +42 -0
42 lines not on this page · raw message
Makefile +16 -5
@@ -1,25 +1,35 @@ PREFIX=/usr/local DESTDIR= -SCRIPTS = guilt \ - $(filter-out $(wildcard *~),$(wildcard guilt-*)) +SCRIPTS = $(filter-out $(wildcard *~),$(wildcard guilt-*)) -.PHONY: all -all: doc +all:: + +.PHONY: .FORCE-GUILT-VERSION-FILE +GUILT-VERSION-FILE: .FORCE-GUILT-VERSION-FILE + @$(SHELL_PATH) ./GUILT-VERSION-GEN +-include GUILT-VERSION-FILE + +.PHONY: all +all:: doc guilt.bin @echo "Nothing to build, it is all bash :)" @echo "Try make install" +guilt.bin: GUILT-VERSION-FILE + @sed 's/^GUILT_VERSION=$$/GUILT_VERSION="$(GUILT_VERSION)"/' < guilt > guilt.bin + .PHONY: install install: install -d $(DESTDIR)$(PREFIX)/bin/ install -m 755 $(SCRIPTS) $(DESTDIR)$(PREFIX)/bin/ + install -m 755 guilt.bin $(DESTDIR)$(PREFIX)/bin/guilt .PHONY: uninstall uninstall: ./uninstall $(DESTDIR)$(PREFIX)/bin/ $(SCRIPTS) .PHONY: doc -doc: +doc: GUILT-VERSION-FILE $(MAKE) -C Documentation all .PHONY: install-doc
@@ -33,3 +43,4 @@ test: .PHONY: clean clean: $(MAKE) -C Documentation clean + $(RM) GUILT-VERSION-FILE guilt.bin
guilt +3 -1
@@ -3,7 +3,9 @@ # Copyright (c) Josef "Jeff" Sipek, 2006-2008 # -GUILT_VERSION="0.31.2" +# Version replaced at build time. Could have in separate file, but why +# do a "source version_file" on every guilt operation? +GUILT_VERSION= GUILT_NAME="Ciuleandra" # If the first argument is one of the below, display the man page instead of
Signature · 1 line
1.6.0
Quoted 8 lines · Paul Gortmaker
Shamelessly steal the dynamic versioning goodies from git itself. Now when you do "guilt --version" you can expect to see things like:
Guilt version 0.31.2.14.gece1.dirtyassuming you've 14 commits since 0.31.2 and also some changes that you've not committed yet.
Good idea. I've been pondering how to do this a while back, but never got around to actually do it.
One comment: Why not keep the default version in guilt? You're running sed on it anyway. This makes releasing identical to what it was before the patch:
<edit guilt to reflect new version, commit>
git tag -u abcdef v0.xy
git archive --tar v0.xy | gzip -9 > guilt-0.xy.tar.gz
Additionally, things won't "break" for folks running right out of the git repo - I just add the git repo dir to my $PATH.
Josef 'Jeff' Sipek.
Signature · 2 lines
Keyboard not found! Press F1 to enter Setup
Quoted 22 lines · Josef 'Jeff' Sipek
Quoted 9 lines · Paul Gortmaker
Shamelessly steal the dynamic versioning goodies from git itself. Now when you do "guilt --version" you can expect to see things like:
Guilt version 0.31.2.14.gece1.dirtyassuming you've 14 commits since 0.31.2 and also some changes that you've not committed yet.
Good idea. I've been pondering how to do this a while back, but never got around to actually do it.
One comment: Why not keep the default version in guilt? You're running sed on it anyway. This makes releasing identical to what it was before the patch:
<edit guilt to reflect new version, commit>
git tag -u abcdef v0.xy
git archive --tar v0.xy | gzip -9 > guilt-0.xy.tar.gz
Quoted 3 lines
Additionally, things won't "break" for folks running right out of the git repo - I just add the git repo dir to my $PATH.
Sounds reasonable to me. I'm about to disappear for a 4 day weekend (Cdn Thanksgiving) so I won't be able to do that until next Tuesday at the earliest though.
P.
Quoted 3 lines
Josef 'Jeff' Sipek.