From 8bc5eacc3a88fac94f4a3cac2b93d940d9ca3df7 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Fri, 1 May 2015 21:49:17 +0200 Subject: [PATCH] Make builds reproducible. * Make builds reproducible. - Add custom-sphinx-flags.patch, cherry-picked from upstream. - Pass the date from d/changelog to sphinx. --- debian/changelog | 3 + debian/patches/custom-sphinx-flags.patch | 79 ++++++++++++++++++++++++ debian/patches/series | 1 + debian/rules | 5 +- 4 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 debian/patches/custom-sphinx-flags.patch diff --git a/debian/changelog b/debian/changelog index d15777b70..37e344f60 100644 --- a/debian/changelog +++ b/debian/changelog @@ -24,6 +24,9 @@ cmake (3.2.2-1) UNRELEASED; urgency=low * Build cmake-qt-gui against Qt 5 again. * Add protect-tests-from-makeflags.patch, cherry-picked from upstream. - Fixes running the test suite in parallel from dh_auto_test. + * Make builds reproducible. + - Add custom-sphinx-flags.patch, cherry-picked from upstream. + - Pass the date from d/changelog to sphinx. -- Mario Lang Mon, 27 Apr 2015 22:31:13 +0200 diff --git a/debian/patches/custom-sphinx-flags.patch b/debian/patches/custom-sphinx-flags.patch new file mode 100644 index 000000000..ad9cf635a --- /dev/null +++ b/debian/patches/custom-sphinx-flags.patch @@ -0,0 +1,79 @@ +From dd107b30d26b2cdaa5b1766f733428f3c4c7cd42 Mon Sep 17 00:00:00 2001 +From: Brad King +Date: Thu, 30 Apr 2015 09:30:14 -0400 +Subject: [PATCH] Add option to pass custom flags to sphinx-build (#15545) + +Create a SPHINX_FLAGS cache entry that users can populate with +command-line flags for sphinx-build. Add an option to the +bootstrap script to populate it up front. + +Suggested-by: Felix Geyer +--- + Utilities/Sphinx/CMakeLists.txt | 4 ++++ + bootstrap | 8 ++++++++ + 2 files changed, 12 insertions(+) + +diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt +index da81752..a755ca1 100644 +--- a/Utilities/Sphinx/CMakeLists.txt ++++ b/Utilities/Sphinx/CMakeLists.txt +@@ -31,8 +31,11 @@ find_program(SPHINX_EXECUTABLE + NAMES sphinx-build + DOC "Sphinx Documentation Builder (sphinx-doc.org)" + ) ++set(SPHINX_FLAGS "" CACHE STRING "Flags to pass to sphinx-build") ++separate_arguments(sphinx_flags UNIX_COMMAND "${SPHINX_FLAGS}") + + mark_as_advanced(SPHINX_TEXT) ++mark_as_advanced(SPHINX_FLAGS) + + if(NOT SPHINX_MAN AND NOT SPHINX_HTML AND NOT SPHINX_SINGLEHTML AND NOT SPHINX_QTHELP AND NOT SPHINX_TEXT) + return() +@@ -114,6 +117,7 @@ foreach(format ${doc_formats}) + -c ${CMAKE_CURRENT_BINARY_DIR} + -d ${CMAKE_CURRENT_BINARY_DIR}/doctrees + -b ${format} ++ ${sphinx_flags} + ${CMake_SOURCE_DIR}/Help + ${CMAKE_CURRENT_BINARY_DIR}/${format} + > ${doc_format_log} # log stdout, pass stderr +diff --git a/bootstrap b/bootstrap +index 00b51b5..14046ee 100755 +--- a/bootstrap ++++ b/bootstrap +@@ -74,6 +74,7 @@ cmake_sphinx_man="" + cmake_sphinx_html="" + cmake_sphinx_qthelp="" + cmake_sphinx_build="" ++cmake_sphinx_flags="" + + # Determine whether this is a Cygwin environment. + if echo "${cmake_system}" | grep CYGWIN >/dev/null 2>&1; then +@@ -423,6 +424,7 @@ Configuration: + --sphinx-html build html help with Sphinx + --sphinx-qthelp build qch help with Sphinx + --sphinx-build= use as the sphinx-build executable ++ --sphinx-flags= pass to sphinx-build executable + + Directory and file names: + --prefix=PREFIX install files in tree rooted at PREFIX +@@ -660,6 +662,7 @@ while test $# != 0; do + --sphinx-html) cmake_sphinx_html="1" ;; + --sphinx-qthelp) cmake_sphinx_qthelp="1" ;; + --sphinx-build=*) cmake_sphinx_build=`cmake_arg "$1"` ;; ++ --sphinx-flags=*) cmake_sphinx_flags=`cmake_arg "$1"` ;; + --help) cmake_usage ;; + --version) cmake_version_display ; exit 2 ;; + --verbose) cmake_verbose=TRUE ;; +@@ -1684,6 +1687,11 @@ if [ "x${cmake_sphinx_build}" != "x" ]; then + set (SPHINX_EXECUTABLE "'"${cmake_sphinx_build}"'" CACHE FILEPATH "Location of Qt sphinx-build" FORCE) + ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" + fi ++if [ "x${cmake_sphinx_flags}" != "x" ]; then ++ echo ' ++set (SPHINX_FLAGS [==['"${cmake_sphinx_flags}"']==] CACHE STRING "Flags to pass to sphinx-build" FORCE) ++' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" ++fi + + # Add user-specified settings. Handle relative-path case for + # specification of cmake_init_file. diff --git a/debian/patches/series b/debian/patches/series index ad02e6871..80ae51782 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -5,3 +5,4 @@ FindJNI.cmake.mips.patch fix-hdf5-hl.patch cpack-doc-typo.patch protect-tests-from-makeflags.patch +custom-sphinx-flags.patch diff --git a/debian/rules b/debian/rules index c92d6df89..17418728b 100755 --- a/debian/rules +++ b/debian/rules @@ -9,6 +9,9 @@ ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) BOOTSTRAP_PARALLEL = --parallel=$(NUMJOBS) endif +LAST_CHANGE = $(shell dpkg-parsechangelog -S Date) +BUILD_DATE = $(shell LC_ALL=C date -u "+%B %d, %Y" -d "$(LAST_CHANGE)") + BUILD_FLAGS_FILE = build-flags.cmake set_build_flag = echo 'set($(1) $(2) CACHE \ @@ -37,7 +40,7 @@ override_dh_auto_configure: $(BUILD_FLAGS_FILE) rm -rf Build && mkdir -p Build cd Build && ../bootstrap --prefix=/usr --docdir=/share/doc/cmake --mandir=/share/man \ --init=../$(BUILD_FLAGS_FILE) --system-libs \ - --sphinx-man --sphinx-html \ + --sphinx-man --sphinx-html --sphinx-flags="-D today=\"$(BUILD_DATE)\"" \ $(BOOTSTRAP_PARALLEL) --verbose override_dh_auto_test: