d/rules: use default.mk instead of manually parse changelog

Signed-off-by: Shengjing Zhu <i@zhsj.me>
master
Shengjing Zhu 2018-04-03 11:42:28 +08:00
parent b1db207734
commit aa06b3a97b
1 changed files with 6 additions and 8 deletions

14
debian/rules vendored
View File

@ -1,12 +1,10 @@
#!/usr/bin/make -f
include /usr/share/dpkg/default.mk
UPSTREAM_GIT ?= http://lab.jerasure.org/jerasure/gf-complete.git
DEBVERS ?= $(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p')
VERSION ?= $(shell echo '$(DEBVERS)' | sed -e 's/^[[:digit:]]*://' -e 's/[-].*//')
DEBFLAVOR ?= $(shell dpkg-parsechangelog | grep -E ^Distribution: | cut -d" " -f2)
DEBPKGNAME ?= $(shell dpkg-parsechangelog | grep -E ^Source: | cut -d" " -f2)
GIT_TAG ?= $(shell echo '$(VERSION)' | sed -e 's/~/_/')
GIT_TAG ?= $(shell echo '$(DEB_VERSION_UPSTREAM)' | sed -e 's/~/_/')
%:
dh $@ --with autoreconf --parallel
@ -18,11 +16,11 @@ override_dh_install:
gen-orig-xz:
git tag -v $(GIT_TAG) || true
if [ ! -f ../$(DEBPKGNAME)_$(VERSION).orig.tar.xz ] ; then \
git archive --prefix=$(DEBPKGNAME)-$(VERSION)/ $(GIT_TAG) | xz >../$(DEBPKGNAME)_$(VERSION).orig.tar.xz ; \
if [ ! -f ../$(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM).orig.tar.xz ] ; then \
git archive --prefix=$(DEB_SOURCE)-$(DEB_VERSION_UPSTREAM)/ $(GIT_TAG) | xz >../$(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM).orig.tar.xz ; \
fi
[ ! -e ../build-area ] && mkdir ../build-area || true
[ ! -e ../build-area/$(DEBPKGNAME)_$(VERSION).orig.tar.xz ] && cp ../$(DEBPKGNAME)_$(VERSION).orig.tar.xz ../build-area
[ ! -e ../build-area/$(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM).orig.tar.xz ] && cp ../$(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM).orig.tar.xz ../build-area
fetch-upstream-remote:
git remote add upstream $(UPSTREAM_GIT) || true