diff options
author | Oleksiy Obitotskyy <oobitots@cisco.com> | 2021-02-22 08:40:07 -0800 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2021-02-22 09:29:35 -0800 |
commit | 70f352c90cbb63497cc02847240b2d039083fd40 (patch) | |
tree | 1a9903831408a0fabf3b28482733d6fcbaed3827 /meta-oe/recipes-extended/smartmontools/files | |
parent | 1b4da9f2ad20536d9524397589d4e29179958972 (diff) | |
download | meta-openembedded-70f352c90cbb63497cc02847240b2d039083fd40.tar.gz |
smartmontools: Improve reproducibility
Backport changes added to master smartmontools.
https://github.com/smartmontools/smartmontools/commit/24838916b4c0e91f5c897d44fcdeedb22848f684
Signed-off-by: Oleksiy Obitotskyy <oobitots@cisco.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe/recipes-extended/smartmontools/files')
-rw-r--r-- | meta-oe/recipes-extended/smartmontools/files/0001-configure.ac-Define-SOURCE_DATE_EPOCH-in-CPPFLAGS.patch | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/meta-oe/recipes-extended/smartmontools/files/0001-configure.ac-Define-SOURCE_DATE_EPOCH-in-CPPFLAGS.patch b/meta-oe/recipes-extended/smartmontools/files/0001-configure.ac-Define-SOURCE_DATE_EPOCH-in-CPPFLAGS.patch new file mode 100644 index 000000000..87c0e1458 --- /dev/null +++ b/meta-oe/recipes-extended/smartmontools/files/0001-configure.ac-Define-SOURCE_DATE_EPOCH-in-CPPFLAGS.patch | |||
@@ -0,0 +1,84 @@ | |||
1 | From b621a313e0bc67803abfba18e1ae15e7a8b9b59f Mon Sep 17 00:00:00 2001 | ||
2 | From: Oleksiy Obitotskyy <oobitots@cisco.com> | ||
3 | Date: Mon, 22 Feb 2021 17:21:33 +0200 | ||
4 | Subject: [PATCH] smartmontools: Improve reproducibility | ||
5 | |||
6 | Backport changes added to master smartmontools. | ||
7 | https://github.com/smartmontools/smartmontools/commit/24838916b4c0e91f5c897d44fcdeedb22848f684 | ||
8 | |||
9 | Upstream-Status: Backported | ||
10 | Signed-off-by: Oleksiy Obitotskyy <oobitots@cisco.com> | ||
11 | --- | ||
12 | ChangeLog | 8 ++++++++ | ||
13 | configure.ac | 12 ++++++++++++ | ||
14 | utility.cpp | 10 ++++++++++ | ||
15 | 3 files changed, 30 insertions(+) | ||
16 | |||
17 | diff --git a/ChangeLog b/ChangeLog | ||
18 | index 39eac2d..6a3b4ee 100644 | ||
19 | --- a/ChangeLog | ||
20 | +++ b/ChangeLog | ||
21 | @@ -1,5 +1,13 @@ | ||
22 | $Id: ChangeLog 5155 2020-12-30 16:49:18Z chrfranke $ | ||
23 | |||
24 | +2021-02-07 Christian Franke <franke@computer.org> | ||
25 | + | ||
26 | + Improve reproducibility if SOURCE_DATE_EPOCH if set (GH pull/89). | ||
27 | + configure.ac: Define SOURCE_DATE_EPOCH in CPPFLAGS. | ||
28 | + utility.cpp: Print SOURCE_DATE_EPOCH value if specified. | ||
29 | + Don't include configure arguments then. | ||
30 | + cppcheck.sh: Silence related 'ConfigurationNotChecked' message. | ||
31 | + | ||
32 | 2020-12-30 Christian Franke <franke@computer.org> | ||
33 | |||
34 | smartmontools 7.2 | ||
35 | diff --git a/configure.ac b/configure.ac | ||
36 | index ee6f0e5..c37c9bc 100644 | ||
37 | --- a/configure.ac | ||
38 | +++ b/configure.ac | ||
39 | @@ -61,6 +61,18 @@ case "${host}" in | ||
40 | ;; | ||
41 | esac | ||
42 | |||
43 | +AC_MSG_CHECKING([whether reproducible build is selected (SOURCE_DATE_EPOCH)]) | ||
44 | +res=no | ||
45 | +if test -n "$SOURCE_DATE_EPOCH"; then | ||
46 | + res=yes | ||
47 | + test -z "`echo "$SOURCE_DATE_EPOCH" | sed 's,[[0-9]]*,,'`" || res=error | ||
48 | +fi | ||
49 | +AC_MSG_RESULT([$res]) | ||
50 | +case $res in | ||
51 | + error) AC_MSG_ERROR([Malformed SOURCE_DATE_EPOCH]) ;; | ||
52 | + yes) CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-DSOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH" ;; | ||
53 | +esac | ||
54 | + | ||
55 | # Check for SVN. | ||
56 | AC_MSG_CHECKING([whether this is a build from SVN]) | ||
57 | is_svn_build=no | ||
58 | diff --git a/utility.cpp b/utility.cpp | ||
59 | index 0483c6f..8ab38c9 100644 | ||
60 | --- a/utility.cpp | ||
61 | +++ b/utility.cpp | ||
62 | @@ -134,9 +134,19 @@ std::string format_version_info(const char * prog_name, bool full /*= false*/) | ||
63 | #endif | ||
64 | "\n" | ||
65 | "smartmontools configure arguments:" | ||
66 | +#ifdef SOURCE_DATE_EPOCH | ||
67 | + " [hidden in reproducible builds]\n" | ||
68 | + "reproducible build SOURCE_DATE_EPOCH: " | ||
69 | +#endif | ||
70 | ; | ||
71 | +#ifdef SOURCE_DATE_EPOCH | ||
72 | + char ts[32]; struct tm tmbuf; | ||
73 | + strftime(ts, sizeof(ts), "%Y-%m-%d %H:%M:%S", time_to_tm_local(&tmbuf, SOURCE_DATE_EPOCH)); | ||
74 | + info += strprintf("%u (%s)", (unsigned)SOURCE_DATE_EPOCH, ts); | ||
75 | +#else | ||
76 | info += (sizeof(SMARTMONTOOLS_CONFIGURE_ARGS) > 1 ? | ||
77 | SMARTMONTOOLS_CONFIGURE_ARGS : " [no arguments given]"); | ||
78 | +#endif | ||
79 | info += '\n'; | ||
80 | |||
81 | return info; | ||
82 | -- | ||
83 | 2.25.1 | ||
84 | |||