diff options
author | Antoine Beaupré <anarcat@koumbit.org> | 2013-11-29 11:40:04 -0500 |
---|---|---|
committer | Antoine Beaupré <anarcat@koumbit.org> | 2013-11-29 12:11:23 -0500 |
commit | fd66a9c786b5e15b914e432d5300c58972a07495 (patch) | |
tree | 253dd12367658b63882ac09208fe6eb12da6f82a | |
parent | 0177099ff165e38367da403374df698341e05aae (diff) |
use upstream workaround for build-time git repo dependency
instead of generating the version file during the build using git, we
generate it statically using the debian metadata
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | debian/control | 1 | ||||
-rwxr-xr-x | debian/rules | 35 | ||||
-rw-r--r-- | libbe/_version.py | 6 |
4 files changed, 27 insertions, 18 deletions
@@ -55,7 +55,7 @@ MAN_DIR := ${DOC_DIR}/man MANPAGES = be.1 LIBBE_VERSION := libbe/_version.py -GENERATED_FILES := build +GENERATED_FILES := build $(LIBBE_VERSION) MANPAGE_FILES = $(patsubst %,${MAN_DIR}/%,${MANPAGES}) MANPAGE_HTML = $(patsubst %,${MAN_DIR}/%.html,${MANPAGES}) @@ -86,6 +86,7 @@ clean: $(MAKE) -C ${DOC_DIR} clean +.PHONY: libbe/_version.py libbe/_version.py: echo "# -*- coding: utf-8 -*-" > $@ git log -1 --encoding=UTF-8 --date=short --pretty='format:"Autogenerated by make libbe/_version.py"%nversion_info = {%n "date":"%cd",%n "revision":"%H",%n "committer":"%cn"}%n' >> $@ diff --git a/debian/control b/debian/control index 822c577..e691fbd 100644 --- a/debian/control +++ b/debian/control @@ -8,6 +8,7 @@ VCS-git: git://git.debian.org/git/dgit-repos/repos/bugs-everywhere.git VCS-Browser: http://git.debian.org/git/dgit-repos/repos/bugs-everywhere.git Build-Depends-Indep: debhelper (>= 9), + libparse-debianchangelog-perl, docbook-to-man, xsltproc, python-sphinx, diff --git a/debian/rules b/debian/rules index 52d341b..fe27551 100755 --- a/debian/rules +++ b/debian/rules @@ -14,24 +14,37 @@ dh $@ --with=python2 override_dh_auto_install: - dh_auto_install -- LAYOUT=deb + dh_auto_install -- LAYOUT=deb LIBBE_VERSION= -override_dh_auto_test: +# this mess is to automatically generate the _version.py file that contains git commit metadata +# since we usually build in a clean export of the git repository, the upstream build system fails +# so we disable that build and build it ourselves +# generate metadata that willbe included in the file +version=$(shell parsechangelog --format=rfc822 | grep Version: | cut -d' ' -f2-) +date=$(shell date +%Y-%m-%d) +LIBBE_VERSION:=libbe/_version.py -override_dh_installchangelogs: - dh_installchangelogs -k NEWS +show-version: $(LIBBE_VERSION) + cat $(LIBBE_VERSION) + +# disable generation of the metadata, hook our generation in there +override_dh_auto_build: $(LIBBE_VERSION) + dh_auto_build -- LIBBE_VERSION= -version=$(shell parsechangelog --format=rfc822 | grep Version: | cut -d' ' -f2- | cut -d- -f1) +# generate version file based on our generated metadata +$(LIBBE_VERSION): + printf "# -*- coding: utf-8 -*-\n# Autogenerated by debian/rules libbe/_version.py\nversion_info = {\n 'date': '$(date)',\n 'revision': '$(version)',\n 'committer': 'Debian build scripts'}\n" > $@ -.PHONY: new-version -new-version: libbe/_version.py +override_dh_auto_clean: + dh_auto_clean + rm -f $(LIBBE_VERSION) + +override_dh_auto_test: -.PHONY: libbe/_version.py -libbe/_version.py: - git log -1 --encoding=UTF-8 --date=short --pretty='format:# -*- coding: utf-8 -*-%n# Autogenerated by debian/rules libbe/_version.py"%nversion_info = {%n "date":"%cd",%n "revision":"%H",%n "committer":"%cn"}%n' $(version) > $@ - git commit -m"generate new metadata file for version $(version)" -a +override_dh_installchangelogs: + dh_installchangelogs -k NEWS # Local Variables: diff --git a/libbe/_version.py b/libbe/_version.py deleted file mode 100644 index d96646c..0000000 --- a/libbe/_version.py +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# Autogenerated by make libbe/_version.py" -version_info = { - "date":"2012-11-17", - "revision":"31b3f442f200c2c0d2e6b39e596c8f2793034d87", - "committer":"W. Trevor King"} |