From f1c4dc81692ede69698f058b10ac4f7b77c3de47d1a02c75a456c442983bb88a Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Tue, 28 Mar 2017 15:31:48 +0000 Subject: [PATCH 1/2] Accepting request 483122 from home:pgajdos If I should help with upstreaming somehow, please let me know. OBS-URL: https://build.opensuse.org/request/show/483122 OBS-URL: https://build.opensuse.org/package/show/devel:tools:building/cmake?expand=0&rev=283 --- cmake-ImageMagick7.patch | 43 ++++++++++++++++++++++++++++++++++++++++ cmake.changes | 6 ++++++ cmake.spec | 3 +++ 3 files changed, 52 insertions(+) create mode 100644 cmake-ImageMagick7.patch diff --git a/cmake-ImageMagick7.patch b/cmake-ImageMagick7.patch new file mode 100644 index 0000000..6f193b0 --- /dev/null +++ b/cmake-ImageMagick7.patch @@ -0,0 +1,43 @@ +Index: cmake-3.7.2/Modules/FindImageMagick.cmake +=================================================================== +--- cmake-3.7.2.orig/Modules/FindImageMagick.cmake 2017-01-13 15:05:41.000000000 +0100 ++++ cmake-3.7.2/Modules/FindImageMagick.cmake 2017-03-28 11:00:23.197144625 +0200 +@@ -88,13 +88,13 @@ find_package(PkgConfig QUIET) + #--------------------------------------------------------------------- + # Helper functions + #--------------------------------------------------------------------- +-function(FIND_IMAGEMAGICK_API component header) ++function(FIND_IMAGEMAGICK_API component header6 header7) + set(ImageMagick_${component}_FOUND FALSE PARENT_SCOPE) + + pkg_check_modules(PC_${component} QUIET ${component}) + + find_path(ImageMagick_${component}_INCLUDE_DIR +- NAMES ${header} ++ NAMES ${header6} ${header7} + HINTS + ${PC_${component}_INCLUDEDIR} + ${PC_${component}_INCLUDE_DIRS} +@@ -195,17 +195,17 @@ foreach(component ${ImageMagick_FIND_COM + ) + if(component STREQUAL "Magick++") + FIND_IMAGEMAGICK_API(Magick++ Magick++.h +- Magick++ CORE_RL_Magick++_ Magick++-6.Q16 Magick++-Q16 Magick++-6.Q8 Magick++-Q8 Magick++-6.Q16HDRI Magick++-Q16HDRI Magick++-6.Q8HDRI Magick++-Q8HDRI ++ Magick++ CORE_RL_Magick++_ Magick++-6.Q16 Magick++-7.Q16 Magick++-Q16 Magick++-6.Q8 Magick++-7.Q8 Magick++-Q8 Magick++-6.Q16HDRI Magick++-7.Q16HDRI Magick++-Q16HDRI Magick++-6.Q8HDRI Magick++-7.Q8HDRI Magick++-Q8HDRI + ) + list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_Magick++_LIBRARY) + elseif(component STREQUAL "MagickWand") +- FIND_IMAGEMAGICK_API(MagickWand wand/MagickWand.h +- Wand MagickWand CORE_RL_wand_ MagickWand-6.Q16 MagickWand-Q16 MagickWand-6.Q8 MagickWand-Q8 MagickWand-6.Q16HDRI MagickWand-Q16HDRI MagickWand-6.Q8HDRI MagickWand-Q8HDRI ++ FIND_IMAGEMAGICK_API(MagickWand wand/MagickWand.h MagickWand/MagickWand.h ++ Wand MagickWand CORE_RL_wand_ MagickWand-6.Q16 MagickWand-7.Q16 MagickWand-Q16 MagickWand-6.Q8 MagickWand-7.Q8 MagickWand-Q8 MagickWand-6.Q16HDRI MagickWand-7.Q16HDRI MagickWand-Q16HDRI MagickWand-6.Q8HDRI MagickWand-7.Q8HDRI MagickWand-Q8HDRI + ) + list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickWand_LIBRARY) + elseif(component STREQUAL "MagickCore") +- FIND_IMAGEMAGICK_API(MagickCore magick/MagickCore.h +- Magick MagickCore CORE_RL_magick_ MagickCore-6.Q16 MagickCore-Q16 MagickCore-6.Q8 MagickCore-Q8 MagickCore-6.Q16HDRI MagickCore-Q16HDRI MagickCore-6.Q8HDRI MagickCore-Q8HDRI ++ FIND_IMAGEMAGICK_API(MagickCore magick/MagickCore.h MagickCore/MagickCore.h ++ Magick MagickCore CORE_RL_magick_ MagickCore-6.Q16 MagickCore-7.Q16 MagickCore-Q16 MagickCore-6.Q8 MagickCore-7.Q8 MagickCore-Q8 MagickCore-6.Q16HDRI MagickCore-7.Q16HDRI MagickCore-Q16HDRI MagickCore-6.Q8HDRI MagickCore-7.Q8HDRI MagickCore-Q8HDRI + ) + list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickCore_LIBRARY) + else() diff --git a/cmake.changes b/cmake.changes index 5f658cb..b5dfc31 100644 --- a/cmake.changes +++ b/cmake.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Mar 28 09:14:23 UTC 2017 - pgajdos@suse.com + +- find ImageMagick 7 + + cmake-ImageMagick7.patch + ------------------------------------------------------------------- Sun Jan 15 14:11:33 UTC 2017 - astieger@suse.com diff --git a/cmake.spec b/cmake.spec index b870e3c..65160ec 100644 --- a/cmake.spec +++ b/cmake.spec @@ -36,6 +36,8 @@ Patch2: cmake-fix-ruby-test.patch Patch4: form.patch # PATCH-FIX-UPSTREAM system-libs.patch -- allow choosing between bundled and system jsoncpp & form libs Patch5: system-libs.patch +# PATCH-FIX-UPSTREAM cmake-ImageMagick7.patch -- find also ImageMagick 7 +Patch6: cmake-ImageMagick7.patch BuildRequires: curl-devel BuildRequires: fdupes BuildRequires: gcc-c++ @@ -75,6 +77,7 @@ echo "`grep %{name}-%{version}.tar.gz %{SOURCE5} | grep -Eo '^[0-9a-f]+'` %{SOU %patch2 -p1 %patch4 -p1 %patch5 -p1 +%patch6 -p1 %build export CFLAGS="%{optflags}" From 1a73e46376cf07c930dc4a92f9cd83f50167befff25a767d56b751badd50969b Mon Sep 17 00:00:00 2001 From: Simon Lees Date: Wed, 29 Mar 2017 22:29:38 +0000 Subject: [PATCH 2/2] Accepting request 483399 from home:bmwiedemann:reproducible Add reproducible.patch and reproducible2.patch to allow for reproducible builds of freerdp and other packages OBS-URL: https://build.opensuse.org/request/show/483399 OBS-URL: https://build.opensuse.org/package/show/devel:tools:building/cmake?expand=0&rev=284 --- cmake.changes | 6 ++ cmake.spec | 6 ++ reproducible.patch | 167 ++++++++++++++++++++++++++++++++++++++++++++ reproducible2.patch | 37 ++++++++++ 4 files changed, 216 insertions(+) create mode 100644 reproducible.patch create mode 100644 reproducible2.patch diff --git a/cmake.changes b/cmake.changes index b5dfc31..3a955a5 100644 --- a/cmake.changes +++ b/cmake.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Mar 29 14:59:26 UTC 2017 - bwiedemann@suse.com + +- Add reproducible.patch and reproducible2.patch + to allow for reproducible builds of freerdp and other packages + ------------------------------------------------------------------- Tue Mar 28 09:14:23 UTC 2017 - pgajdos@suse.com diff --git a/cmake.spec b/cmake.spec index 65160ec..876e5d2 100644 --- a/cmake.spec +++ b/cmake.spec @@ -38,6 +38,10 @@ Patch4: form.patch Patch5: system-libs.patch # PATCH-FIX-UPSTREAM cmake-ImageMagick7.patch -- find also ImageMagick 7 Patch6: cmake-ImageMagick7.patch +# PATCH-FIX-UPSTREAM reproducible.patch -- https://gitlab.kitware.com/cmake/cmake/merge_requests/432 +Patch7: reproducible.patch +# PATCH-FIX-UPSTREAM reproducible2.patch -- https://gitlab.kitware.com/cmake/cmake/merge_requests/446 +Patch8: reproducible2.patch BuildRequires: curl-devel BuildRequires: fdupes BuildRequires: gcc-c++ @@ -78,6 +82,8 @@ echo "`grep %{name}-%{version}.tar.gz %{SOURCE5} | grep -Eo '^[0-9a-f]+'` %{SOU %patch4 -p1 %patch5 -p1 %patch6 -p1 +%patch7 -p1 +%patch8 -p1 %build export CFLAGS="%{optflags}" diff --git a/reproducible.patch b/reproducible.patch new file mode 100644 index 0000000..32ecf14 --- /dev/null +++ b/reproducible.patch @@ -0,0 +1,167 @@ +commit 243aed525a2fd8e5fe32139fd0f8d0cc0e40cc33 +Author: Bernhard M. Wiedemann +Date: Wed Jan 25 07:15:40 2017 +0100 + + cmTimestamp: Support SOURCE_DATE_EPOCH to override current time + + See https://reproducible-builds.org/ for why this is good and + https://reproducible-builds.org/specs/source-date-epoch/ for the + definition of this variable. + +diff --git a/Help/command/string.rst b/Help/command/string.rst +index 77538f6..2c7847a 100644 +--- a/Help/command/string.rst ++++ b/Help/command/string.rst +@@ -329,6 +329,12 @@ If no explicit ```` is given it will default to: + + Write a string which can be used as an identifier in C. + ++.. note:: ++ ++ If the ``SOURCE_DATE_EPOCH`` environment variable is set, ++ its value will be used instead of the current time. ++ See https://reproducible-builds.org/specs/source-date-epoch/ for details. ++ + UUID + """" + +diff --git a/Help/release/dev/SOURCE_DATE_EPOCH.rst b/Help/release/dev/SOURCE_DATE_EPOCH.rst +new file mode 100644 +index 0000000..576e1da +--- /dev/null ++++ b/Help/release/dev/SOURCE_DATE_EPOCH.rst +@@ -0,0 +1,5 @@ ++SOURCE_DATE_EPOCH ++----------------- ++ ++* The :command:`string(TIMESTAMP)` will now honor the ``SOURCE_DATE_EPOCH`` ++ environment variable and use its value instead of the current time. +diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx +index 4a97114..1e5ac5b 100644 +--- a/Source/cmTimestamp.cxx ++++ b/Source/cmTimestamp.cxx +@@ -12,6 +13,16 @@ std::string cmTimestamp::CurrentTime(const std::string& formatString, + bool utcFlag) + { + time_t currentTimeT = time(CM_NULLPTR); ++ std::string source_date_epoch; ++ cmSystemTools::GetEnv("SOURCE_DATE_EPOCH", source_date_epoch); ++ if (!source_date_epoch.empty()) { ++ std::istringstream iss(source_date_epoch); ++ iss >> currentTimeT; ++ if (iss.fail() || !iss.eof()) { ++ cmSystemTools::Error("Cannot parse SOURCE_DATE_EPOCH as integer"); ++ exit(27); ++ } ++ } + if (currentTimeT == time_t(-1)) { + return std::string(); + } +diff --git a/Tests/RunCMake/string/RunCMakeTest.cmake b/Tests/RunCMake/string/RunCMakeTest.cmake +index 8067d9d..38a77b0 100644 +--- a/Tests/RunCMake/string/RunCMakeTest.cmake ++++ b/Tests/RunCMake/string/RunCMakeTest.cmake +@@ -6,6 +6,11 @@ run_cmake(AppendNoArgs) + run_cmake(Concat) + run_cmake(ConcatNoArgs) + ++run_cmake(Timestamp) ++run_cmake(TimestampEmpty) ++run_cmake(TimestampInvalid) ++run_cmake(TimestampInvalid2) ++ + run_cmake(Uuid) + run_cmake(UuidMissingNamespace) + run_cmake(UuidMissingNamespaceValue) +diff --git a/Tests/RunCMake/string/Timestamp-result.txt b/Tests/RunCMake/string/Timestamp-result.txt +new file mode 100644 +index 0000000..573541a +--- /dev/null ++++ b/Tests/RunCMake/string/Timestamp-result.txt +@@ -0,0 +1 @@ ++0 +diff --git a/Tests/RunCMake/string/Timestamp-stderr.txt b/Tests/RunCMake/string/Timestamp-stderr.txt +new file mode 100644 +index 0000000..c12b070 +--- /dev/null ++++ b/Tests/RunCMake/string/Timestamp-stderr.txt +@@ -0,0 +1 @@ ++RESULT=2005-08-07 23:19:49 Sun Aug 05 day=219 wd=0 week=32 %%I=11 +diff --git a/Tests/RunCMake/string/Timestamp.cmake b/Tests/RunCMake/string/Timestamp.cmake +new file mode 100644 +index 0000000..1232300 +--- /dev/null ++++ b/Tests/RunCMake/string/Timestamp.cmake +@@ -0,0 +1,3 @@ ++set(ENV{SOURCE_DATE_EPOCH} "1123456789") ++string(TIMESTAMP RESULT "%Y-%m-%d %H:%M:%S %a %b %y day=%j wd=%w week=%U %%I=%I" UTC) ++message("RESULT=${RESULT}") +diff --git a/Tests/RunCMake/string/TimestampEmpty-result.txt b/Tests/RunCMake/string/TimestampEmpty-result.txt +new file mode 100644 +index 0000000..573541a +--- /dev/null ++++ b/Tests/RunCMake/string/TimestampEmpty-result.txt +@@ -0,0 +1 @@ ++0 +diff --git a/Tests/RunCMake/string/TimestampEmpty-stderr.txt b/Tests/RunCMake/string/TimestampEmpty-stderr.txt +new file mode 100644 +index 0000000..35cbd3c +--- /dev/null ++++ b/Tests/RunCMake/string/TimestampEmpty-stderr.txt +@@ -0,0 +1 @@ ++RESULT=2 +diff --git a/Tests/RunCMake/string/TimestampEmpty.cmake b/Tests/RunCMake/string/TimestampEmpty.cmake +new file mode 100644 +index 0000000..21b770f +--- /dev/null ++++ b/Tests/RunCMake/string/TimestampEmpty.cmake +@@ -0,0 +1,3 @@ ++set(ENV{SOURCE_DATE_EPOCH} "") ++string(TIMESTAMP RESULT "%Y-%m-%d %H:%M:%S" UTC) ++message("RESULT=${RESULT}") +diff --git a/Tests/RunCMake/string/TimestampInvalid-result.txt b/Tests/RunCMake/string/TimestampInvalid-result.txt +new file mode 100644 +index 0000000..f64f5d8 +--- /dev/null ++++ b/Tests/RunCMake/string/TimestampInvalid-result.txt +@@ -0,0 +1 @@ ++27 +diff --git a/Tests/RunCMake/string/TimestampInvalid-stderr.txt b/Tests/RunCMake/string/TimestampInvalid-stderr.txt +new file mode 100644 +index 0000000..75566da +--- /dev/null ++++ b/Tests/RunCMake/string/TimestampInvalid-stderr.txt +@@ -0,0 +1 @@ ++CMake Error: Cannot parse SOURCE_DATE_EPOCH as integer +diff --git a/Tests/RunCMake/string/TimestampInvalid.cmake b/Tests/RunCMake/string/TimestampInvalid.cmake +new file mode 100644 +index 0000000..ab36270 +--- /dev/null ++++ b/Tests/RunCMake/string/TimestampInvalid.cmake +@@ -0,0 +1,3 @@ ++set(ENV{SOURCE_DATE_EPOCH} "invalid-integer") ++string(TIMESTAMP RESULT "%Y-%m-%d %H:%M:%S" UTC) ++message("RESULT=${RESULT}") +diff --git a/Tests/RunCMake/string/TimestampInvalid2-result.txt b/Tests/RunCMake/string/TimestampInvalid2-result.txt +new file mode 100644 +index 0000000..f64f5d8 +--- /dev/null ++++ b/Tests/RunCMake/string/TimestampInvalid2-result.txt +@@ -0,0 +1 @@ ++27 +diff --git a/Tests/RunCMake/string/TimestampInvalid2-stderr.txt b/Tests/RunCMake/string/TimestampInvalid2-stderr.txt +new file mode 100644 +index 0000000..75566da +--- /dev/null ++++ b/Tests/RunCMake/string/TimestampInvalid2-stderr.txt +@@ -0,0 +1 @@ ++CMake Error: Cannot parse SOURCE_DATE_EPOCH as integer +diff --git a/Tests/RunCMake/string/TimestampInvalid2.cmake b/Tests/RunCMake/string/TimestampInvalid2.cmake +new file mode 100644 +index 0000000..5cc61b8 +--- /dev/null ++++ b/Tests/RunCMake/string/TimestampInvalid2.cmake +@@ -0,0 +1,3 @@ ++set(ENV{SOURCE_DATE_EPOCH} "123trailing-garbage") ++string(TIMESTAMP RESULT "%Y-%m-%d %H:%M:%S" UTC) ++message("RESULT=${RESULT}") diff --git a/reproducible2.patch b/reproducible2.patch new file mode 100644 index 0000000..0c661c0 --- /dev/null +++ b/reproducible2.patch @@ -0,0 +1,37 @@ +commit 5181f1f86a4d4c2ac09a540285c938fe2c2fa262 +Author: Bernhard M. Wiedemann +Date: Sun Jan 29 11:52:55 2017 +0100 + + Tests: make tests pass with SOURCE_DATE_EPOCH set + + Fix tests to account for commit 243aed52 (cmTimestamp: Support + SOURCE_DATE_EPOCH to override current time, 2017-01-25). + + In openSUSE we are running the test-suite as part of the build and that + failed in these two places when building everything with + `SOURCE_DATE_EPOCH` set. + +diff --git a/Tests/CMakeTests/File-TIMESTAMP-NotBogus.cmake b/Tests/CMakeTests/File-TIMESTAMP-NotBogus.cmake +index d0e5fe3..f1aa390 100644 +--- a/Tests/CMakeTests/File-TIMESTAMP-NotBogus.cmake ++++ b/Tests/CMakeTests/File-TIMESTAMP-NotBogus.cmake +@@ -1,6 +1,7 @@ + set(STAMP_FILENAME "${CMAKE_CURRENT_BINARY_DIR}/FileTimestamp-Stamp") + set(STAMP_FORMAT "%Y-%m-%d") + ++unset(ENV{SOURCE_DATE_EPOCH}) + string(TIMESTAMP timestamp1 "${STAMP_FORMAT}") + + file(WRITE "${STAMP_FILENAME}" "foo") +diff --git a/Tests/CTestTestStopTime/GetDate.cmake b/Tests/CTestTestStopTime/GetDate.cmake +index 1f4cb24..46ab2fb 100644 +--- a/Tests/CTestTestStopTime/GetDate.cmake ++++ b/Tests/CTestTestStopTime/GetDate.cmake +@@ -49,6 +49,7 @@ macro(GET_DATE) + # 01/12/2006 08:55:12 + # mm/dd/YYYY HH:MM:SS + # ++ unset(ENV{SOURCE_DATE_EPOCH}) + string(TIMESTAMP "${GD_PREFIX}OV" "%m/%d/%Y %H:%M:%S") + + if(${GD_PREFIX}VERBOSE)