summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2014-09-30 15:32:08 +0200
committerJulian Andres Klode <jak@debian.org>2014-09-30 15:33:55 +0200
commit515204913c9168e8db77c96fdd7c29feba5bb6f4 (patch)
tree41b02f720856aad7346d4db0f71f3159977a3d59
parent43f539bd0cd3d8fc00c865d1b7e818e0b77119be (diff)
downloadpython-apt-515204913c9168e8db77c96fdd7c29feba5bb6f4.tar.gz
Embed changelog entry date and time instead of build date and time
This makes reproducible builds possible. For non-package builds, simply use the start of the Unix time. Also make sure that all time values are in the UTC timezone. Closes: #762674
-rwxr-xr-xdebian/rules8
-rw-r--r--python/apt_pkgmodule.cc9
2 files changed, 14 insertions, 3 deletions
diff --git a/debian/rules b/debian/rules
index 3ceeb205..20a3fa25 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,7 +1,13 @@
#!/usr/bin/make -f
# Should be include-links, but that somehow fails.
export DEBVER=$(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p')
-export DEB_CFLAGS_MAINT_APPEND=-Wno-write-strings
+export DATETIME:=$(shell dpkg-parsechangelog | sed -n -e 's/^Date: //p')
+export DATE_CMD:=env TZ=UTC LC_ALL=C.UTF-8 date
+export DATE:=$(shell $(DATE_CMD) --date="$(DATETIME)" "+%b %_d %Y")
+export TIME:=$(shell $(DATE_CMD) --date="$(DATETIME)" "+%H:%M:%S")
+export DEB_CFLAGS_MAINT_APPEND=-Wno-write-strings \
+ -DDATE=\""$(DATE)"\" \
+ -DTIME=\""$(TIME)"\"
export PATH := $(CURDIR)/utils:$(PATH)
export pyversions := $(CURDIR)/utils/pyversions
diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc
index 5f211b3e..ca20ef18 100644
--- a/python/apt_pkgmodule.cc
+++ b/python/apt_pkgmodule.cc
@@ -880,8 +880,13 @@ extern "C" void initapt_pkg()
// Version..
PyModule_AddStringConstant(Module,"VERSION",(char *)pkgVersion);
PyModule_AddStringConstant(Module,"LIB_VERSION",(char *)pkgLibVersion);
- PyModule_AddStringConstant(Module,"DATE",__DATE__);
- PyModule_AddStringConstant(Module,"TIME",__TIME__);
+#ifdef DATE
+ PyModule_AddStringConstant(Module,"DATE",DATE);
+ PyModule_AddStringConstant(Module,"TIME",TIME);
+#else
+ PyModule_AddStringConstant(Module,"DATE", "Jan 1 1970");
+ PyModule_AddStringConstant(Module,"TIME", "00:00:00");
+#endif
// My constants
PyModule_AddIntConstant(Module,"PRI_IMPORTANT",pkgCache::State::Important);