Make build reproducible (patch by Juan Picca) (closes #789997)
authorJoel Rosdahl <joel@debian.org>
Sat, 27 Jun 2015 18:11:27 +0000 (20:11 +0200)
committerJoel Rosdahl <joel@debian.org>
Sat, 27 Jun 2015 18:19:43 +0000 (20:19 +0200)
debian/patches/reproducible_build.patch [new file with mode: 0644]
debian/patches/series
debian/rules
setup.py

diff --git a/debian/patches/reproducible_build.patch b/debian/patches/reproducible_build.patch
new file mode 100644 (file)
index 0000000..a4b47bf
--- /dev/null
@@ -0,0 +1,30 @@
+Description: Make it possible to make build reproducible
+ Modify DocBuilder command to use "sphinxopts" command line option for add
+ parameters in the call to sphinx-build.
+Author: Juan Picca <jumapico@gmail.com>
+Last-Update: 2015-06-25
+---
+--- a/setup.py
++++ b/setup.py
+@@ -65,10 +65,10 @@ else:
+ class DocBuilder(Command):
+     description = "Builds the documentation"
+-    user_options = []
++    user_options = [("sphinxopts=", None, "sphinx options")]
+     def initialize_options(self):
+-        pass
++        self.sphinxopts = ""
+     def finalize_options(self):
+         pass
+@@ -80,7 +80,7 @@ class DocBuilder(Command):
+         except OSError:
+             pass
+         os.makedirs("build/doc")
+-        rc = os.system("sphinx-build doc/sphinx build/doc")
++        rc = os.system("sphinx-build %s doc/sphinx build/doc" % self.sphinxopts)
+         if rc != 0:
+             print "Is sphinx installed? If not, try 'sudo easy_install sphinx'."
index 7a3b054..f2a79f8 100644 (file)
@@ -1 +1,2 @@
 enable_load_extension.patch
+reproducible_build.patch
index 19629ff..5d77b19 100755 (executable)
@@ -8,6 +8,10 @@ include /usr/share/dpkg/buildflags.mk
 
 PYVERS = $(shell pyversions -r)
 
+LAST_CHANGE = $(shell dpkg-parsechangelog -S Date)
+BUILD_DATE  = $(shell LC_ALL=C date -u "+%B %d, %Y" -d "$(LAST_CHANGE)")
+SPHINXOPTS := -D html_last_updated_fmt=\"$(BUILD_DATE)\"
+
 build: build-arch build-indep
 build-arch: build-stamp
 build-indep: build-stamp
@@ -60,7 +64,7 @@ binary-indep:
        dh_prep
        dh_installdirs -i usr/share/doc/python-pysqlite2-doc/html
 
-       python setup.py build_docs
+       python setup.py build_docs --sphinxopts="$(SPHINXOPTS)"
        dh_installdocs -i build/doc/*
        cd debian/python-pysqlite2-doc/usr/share/doc/python-pysqlite2-doc && \
                mv *.html *.js *.inv _static _sources html && \
index 4e9ad3d..71edf3c 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -65,10 +65,10 @@ else:
 
 class DocBuilder(Command):
     description = "Builds the documentation"
-    user_options = []
+    user_options = [("sphinxopts=", None, "sphinx options")]
 
     def initialize_options(self):
-        pass
+        self.sphinxopts = ""
 
     def finalize_options(self):
         pass
@@ -80,7 +80,7 @@ class DocBuilder(Command):
         except OSError:
             pass
         os.makedirs("build/doc")
-        rc = os.system("sphinx-build doc/sphinx build/doc")
+        rc = os.system("sphinx-build %s doc/sphinx build/doc" % self.sphinxopts)
         if rc != 0:
             print "Is sphinx installed? If not, try 'sudo easy_install sphinx'."