4 fakeroot debian/rules clean
11 dpkg-buildpackage -us -uc -rfakeroot -I.git -I.gitignore -I.gitmodules
14 ###########################################################################
15 # Generate debian/changelog from git log
17 NAME := $(shell awk '/^Source:/{print $$2}' debian/control)
18 CLOGDIR := .git/changelogs
19 CHANGELOGS := $(shell lasttag=HEAD; \
20 (git tag -l 'v*'; echo) \
21 | while read tag; do \
22 echo $(CLOGDIR)/$${tag}$${tag:+-}$$lasttag; \
26 # Author/Date formating could be as simple as git log --format=' -- %an <%ae> %cD'
27 # however, we want the tagger not the author and git log doesn't show tags, only commits ...
30 @mkdir -p "$(CLOGDIR)"
32 version="$@"; version="$${version#$(CLOGDIR)/}"; \
33 from="$${version%-*}"; version="$${version#*-}"; to="$$version"; \
34 if [ "$$from" = "$$to" ]; then from=""; fi; \
36 if [ "$$version" = "HEAD" ]; then \
37 version="`git describe --tag --match='v*' | sed -e 's/-/~/' -e 's/-/./g'`"; \
38 release="UNRELEASED"; \
40 version="$${version#v}"; \
41 echo "$(NAME) ($$version) $$release; urgency=low"; \
43 git log --format=' * [%h] %s' $$from$${from:+..}$$to; \
44 date="`echo $$to | git cat-file --batch \
46 -e 's/^\(tagger\|committer\) \(.*\)00$$/\2/' \
47 -eT -e 'y/+-/-+/' -ep`"; \
48 author="$${date% * *}"; date="$${date#$$author }"; zone="$${date#* }"; \
49 date="`TZ="UTC$$zone" date -d "1/1/1970 0:0 UTC + $${date% *} seconds" --rfc-2822`"; \
50 echo; echo " -- $$author $$date"; echo; \
51 ) >$@ || (rm -f $@; false)
52 .PHONY: $(word 1,$(CHANGELOGS)) # The first changelog entry must be recreated on each call
54 debian/changelog: $(CHANGELOGS)
55 cat $^ > $@ || (rm -f $@; false)
58 rm -f debian/changelog
61 prepare:: debian/changelog