From: Stefan Bund Date: Mon, 16 Aug 2010 07:45:17 +0000 (+0200) Subject: initial commit X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=dbd5fd61f0881f7ecb030753af71598fd14210d1;p=gitdeb.git initial commit --- dbd5fd61f0881f7ecb030753af71598fd14210d1 diff --git a/Makefile.gitdeb b/Makefile.gitdeb new file mode 100644 index 0000000..47de83c --- /dev/null +++ b/Makefile.gitdeb @@ -0,0 +1,61 @@ +# -*- makefile -*- + +clean:: + fakeroot debian/rules clean +.PHONY: clean + +prepare:: +.PHONY: prepare + +deb: prepare + dpkg-buildpackage -us -uc -rfakeroot -I.git -I.gitignore -I.gitmodules +.PHONY: deb + +########################################################################### +# Generate debian/changelog from git log + +NAME := $(shell awk '/^Source:/{print $$2}' debian/control) +CLOGDIR := .git/changelogs +CHANGELOGS := $(shell lasttag=HEAD; \ + (git tag -l 'v*'; echo) \ + | while read tag; do \ + echo $(CLOGDIR)/$${tag}$${tag:+-}$$lasttag; \ + lasttag=$$tag; \ + done) + +# Author/Date formating could be as simple as git log --format=' -- %an <%ae> %cD' +# however, we want the tagger not the author and git log doesn't show tags, only commits ... +$(CHANGELOGS): %: + @echo "generating $@" + @mkdir -p "$(CLOGDIR)" + @( \ + version="$@"; version="$${version#$(CLOGDIR)/}"; \ + from="$${version%-*}"; version="$${version#*-}"; to="$$version"; \ + if [ "$$from" = "$$to" ]; then from=""; fi; \ + release="unstable"; \ + if [ "$$version" = "HEAD" ]; then \ + version="`git describe --tag --match='v*' | sed -e 's/-/~/' -e 's/-/./g'`"; \ + release="UNRELEASED"; \ + fi; \ + version="$${version#v}"; \ + echo "$(NAME) ($$version) $$release; urgency=low"; \ + echo; \ + git log --format=' * [%h] %s' $$from$${from:+..}$$to; \ + date="`echo $$to | git cat-file --batch \ + | sed -n \ + -e 's/^\(tagger\|committer\) \(.*\)00$$/\2/' \ + -eT -e 'y/+-/-+/' -ep`"; \ + author="$${date% * *}"; date="$${date#$$author }"; zone="$${date#* }"; \ + date="`TZ="UTC$$zone" date -d "1/1/1970 0:0 UTC + $${date% *} seconds" --rfc-2822`"; \ + echo; echo " -- $$author $$date"; echo; \ + ) >$@ || (rm -f $@; false) +.PHONY: $(word 1,$(CHANGELOGS)) # The first changelog entry must be recreated on each call + +debian/changelog: $(CHANGELOGS) + cat $^ > $@ || (rm -f $@; false) + +clean:: + rm -f debian/changelog + rm -rf $(CLOGDIR) + +prepare:: debian/changelog