Skip to content

Commit

Permalink
Use git information in debian package build process
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas374b committed Jul 18, 2020
1 parent 9507bef commit e9a3072
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ DEBUG = -ggdb -DDEBUG
CODE = -fpic # -fpcc-struct-return

MAJOR = 0
MINOR = 1
PATCHLEVEL = 0
MINOR = 2
PATCHLEVEL = 2
VERSION = $(MAJOR).$(MINOR).$(PATCHLEVEL)

ifeq (_${MK_DEBPKG}_,__)
Expand Down Expand Up @@ -1013,6 +1013,7 @@ srcs: .rmsrcs $(OPA)/.objects .headers forcedep


HAVESVN = $(shell if svn log >/dev/null 2>&1 && test -d .svn; then echo -n yes; else echo -n no; fi)
HAVEGIT = $(shell if git log >/dev/null 2>&1 && test -d .git; then echo -n yes; else echo -n no; fi)
SVNENTRIES =

ifeq (_$(HAVESVN)_,_yes_)
Expand Down
19 changes: 16 additions & 3 deletions debian.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ else
endif
endif

ifeq (_$(HAVEGIT)_,_yes_)
DEBBUILD = $(shell git rev-list HEAD --count)
else
ifeq (_S(HAVESVN)_,_yes_)
DEBBUILD = $(shell svn list -v |sort -n|tail -1|awk '{print $$1}')
else
DEBBUILD = $(shell date +%y%m%d)
endif
endif

DEBUSR = $(DEBRT)/usr
DEBETC = $(DEBRT)/etc
Expand Down Expand Up @@ -96,18 +100,27 @@ debutils: contrib/DEBIAN
mkDeb.sh -p $(DEBPKG) -t $(DEBSECTION)

contrib/DEBIAN/changelog: contrib/DEBIAN
ifeq (_$(HAVEGIT)_,_yes_)
@git log --pretty=format:"- %cd : %s" | awk '{ T = ""; for (i=9; i<NF; i++) {T = T " " $$i}; printf(" - %s %d.%s %d +%s\n", $$2, $$4, $$3, $$6, T) }' >contrib/DEBIAN/changelog
else
ifeq (_$(HAVESVN)_,_yes_)
@svn log -v >contrib/DEBIAN/changelog
else
echo please generate a changelog >contrib/DEBIAN/changelog
endif

contrib/DEBIAN/changelog.Debian: contrib/DEBIAN
endif

ifeq (_$(HAVEGIT)_,_yes_)
contrib/DEBIAN/changelog.Debian: contrib/DEBIAN/changelog
cp contrib/DEBIAN/changelog contrib/DEBIAN/changelog.Debian
else
contrib/DEBIAN/changelog.Debian: contrib/DEBIAN
ifeq (_$(HAVESVN)_,_yes_)
@(echo "created by template Makefile";\
svn ls -v Makefile) >contrib/DEBIAN/changelog.Debian
else
echo please generate a changelog.Debian.Debian >contrib/DEBIAN/changelog.Debian
echo please generate a changelog.Debian >contrib/DEBIAN/changelog.Debian
endif
endif

$(DEBCTRL)/p%: debutils $(DEBCTRL)
Expand Down

0 comments on commit e9a3072

Please sign in to comment.