* [PATCH] kbuild: Add support for SOURCE_DATE_EPOCH environment variable
@ 2015-10-01 23:15 Ben Hutchings
2015-10-26 21:03 ` Michal Marek
0 siblings, 1 reply; 4+ messages in thread
From: Ben Hutchings @ 2015-10-01 23:15 UTC (permalink / raw)
To: Michal Marek; +Cc: linux-kbuild, reproducible-builds
[-- Attachment #1: Type: text/plain, Size: 2788 bytes --]
As part of the reproducible builds project, the SOURCE_DATE_EPOCH
environment variable has been specified as a project- and
distribution-independent means to specify a timestamp at build
time: https://reproducible-builds.org/specs/source-date-epoch/
Add support for this by converting it to KBUILD_BUILD_TIMESTAMP
if they aren't both set.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
Documentation/kbuild/kbuild.txt | 15 +++++++++------
Makefile | 10 ++++++++++
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/Documentation/kbuild/kbuild.txt b/Documentation/kbuild/kbuild.txt
index 0ff6a46..9f95228 100644
--- a/Documentation/kbuild/kbuild.txt
+++ b/Documentation/kbuild/kbuild.txt
@@ -211,12 +211,15 @@ KBUILD_ENABLE_EXTRA_GCC_CHECKS
If enabled over the make command line with "W=1", it turns on additional
gcc -W... options for more extensive build-time checking.
-KBUILD_BUILD_TIMESTAMP
---------------------------------------------------
-Setting this to a date string overrides the timestamp used in the
-UTS_VERSION definition (uname -v in the running kernel). The value has to
-be a string that can be passed to date -d. The default value
-is the output of the date command at one point during build.
+KBUILD_BUILD_TIMESTAMP, SOURCE_DATE_EPOCH
+--------------------------------------------------
+Setting KBUILD_BUILD_TIMESTAMP to a date string overrides the
+timestamp used in the UTS_VERSION definition (uname -v in the running
+kernel). The value has to be a string that can be passed to date -d.
+The default value is the output of the date command at one point
+during build. Alternately, the timestamp may be specified in
+SOURCE_DATE_EPOCH as the number of whole non-leap seconds since the
+epoch.
KBUILD_BUILD_USER, KBUILD_BUILD_HOST
--------------------------------------------------
diff --git a/Makefile b/Makefile
index 1d341eb..bfb0243 100644
--- a/Makefile
+++ b/Makefile
@@ -417,6 +417,16 @@ export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
export KBUILD_ARFLAGS
+ifndef KBUILD_BUILD_TIMESTAMP
+ # If SOURCE_DATE_EPOCH is set in the environment (only), then
+ # generate a timestamp string based on that, independent of the
+ # current time zone and locale.
+ ifeq ("$(origin SOURCE_DATE_EPOCH)", "environment")
+ KBUILD_BUILD_TIMESTAMP := $(shell LC_TIME=C date -u -d@$(SOURCE_DATE_EPOCH))
+ export KBUILD_BUILD_TIMESTAMP
+ endif
+endif
+
# When compiling out-of-tree modules, put MODVERDIR in the module
# tree rather than in the kernel tree. The kernel tree might
# even be read-only.
--
Ben Hutchings
When in doubt, use brute force. - Ken Thompson
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] kbuild: Add support for SOURCE_DATE_EPOCH environment variable
2015-10-01 23:15 [PATCH] kbuild: Add support for SOURCE_DATE_EPOCH environment variable Ben Hutchings
@ 2015-10-26 21:03 ` Michal Marek
2015-10-27 0:49 ` Ben Hutchings
0 siblings, 1 reply; 4+ messages in thread
From: Michal Marek @ 2015-10-26 21:03 UTC (permalink / raw)
To: Ben Hutchings; +Cc: linux-kbuild, reproducible-builds
Dne 2.10.2015 v 01:15 Ben Hutchings napsal(a):
> As part of the reproducible builds project, the SOURCE_DATE_EPOCH
> environment variable has been specified as a project- and
> distribution-independent means to specify a timestamp at build
> time: https://reproducible-builds.org/specs/source-date-epoch/
>
> Add support for this by converting it to KBUILD_BUILD_TIMESTAMP
> if they aren't both set.
At which projects besides the kernel is this aimed? If there are
multiple projects willing to support this, I'll happily apply it. But if
it's just a synonym for KBUILD_BUILD_TIMESTAMP that nobody else is going
to support, then it looks a bit redundant.
Michal
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kbuild: Add support for SOURCE_DATE_EPOCH environment variable
2015-10-26 21:03 ` Michal Marek
@ 2015-10-27 0:49 ` Ben Hutchings
2015-10-27 1:31 ` [Reproducible-builds] " Holger Levsen
0 siblings, 1 reply; 4+ messages in thread
From: Ben Hutchings @ 2015-10-27 0:49 UTC (permalink / raw)
To: Michal Marek; +Cc: linux-kbuild, reproducible-builds
[-- Attachment #1: Type: text/plain, Size: 1111 bytes --]
On Mon, 2015-10-26 at 22:03 +0100, Michal Marek wrote:
> Dne 2.10.2015 v 01:15 Ben Hutchings napsal(a):
> > As part of the reproducible builds project, the SOURCE_DATE_EPOCH
> > environment variable has been specified as a project- and
> > distribution-independent means to specify a timestamp at build
> > time: https://reproducible-builds.org/specs/source-date-epoch/
> >
> > Add support for this by converting it to KBUILD_BUILD_TIMESTAMP
> > if they aren't both set.
>
> At which projects besides the kernel is this aimed? If there are
> multiple projects willing to support this, I'll happily apply it. But if
> it's just a synonym for KBUILD_BUILD_TIMESTAMP that nobody else is going
> to support, then it looks a bit redundant.
It's aimed at all build tools. For examples, see:
https://codesearch.debian.net/results/%5C%24SOURCE_DATE_EPOCH%20-path%3Adebian%2F/page_0
https://codesearch.debian.net/results/getenv%5C%28%22SOURCE_DATE_EPOCH%22%5C%29%20-path%3Adebian%2F/page_0
Ben.
--
Ben Hutchings
Never attribute to conspiracy what can adequately be explained by stupidity.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Reproducible-builds] [PATCH] kbuild: Add support for SOURCE_DATE_EPOCH environment variable
2015-10-27 0:49 ` Ben Hutchings
@ 2015-10-27 1:31 ` Holger Levsen
0 siblings, 0 replies; 4+ messages in thread
From: Holger Levsen @ 2015-10-27 1:31 UTC (permalink / raw)
To: reproducible-builds; +Cc: Ben Hutchings, Michal Marek, linux-kbuild
[-- Attachment #1: Type: Text/Plain, Size: 984 bytes --]
Hi,
On Montag, 26. Oktober 2015, Ben Hutchings wrote:
> It's aimed at all build tools. For examples, see:
>
> https://codesearch.debian.net/results/%5C%24SOURCE_DATE_EPOCH%20-path%3Adeb
> ian%2F/page_0
> https://codesearch.debian.net/results/getenv%5C%28%22SOURCE_DATE_EPOCH%22%
> 5C%29%20-path%3Adebian%2F/page_0
https://reproducible-builds.org/specs/source-date-epoch/ has a spec for
SOURCE_DATE_EPOCH.
According to
https://wiki.debian.org/ReproducibleBuilds/TimestampsProposal#Reading_the_variable
the following Debian packages support it already:
debhelper (>= 9.20151004)
epydoc (>= 3.0.1+dfsg-8)
ghostscript (>= 9.16~dfsg-1)
help2man (>= 1.47.1)
sphinx (>= 1.3.1-3)
texi2html (>= 1.82+dfsg1-4)
plus we have patches for doxygen, docbook-utils, gcc, gettext, libxslt,
ocamldoc, qt4-x11, texlive-bin and txt2man.
(We are only tracking adoption in Debian packages but of course we aim for
upstream inclusion of this.)
cheers,
Holger
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-10-27 1:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-01 23:15 [PATCH] kbuild: Add support for SOURCE_DATE_EPOCH environment variable Ben Hutchings
2015-10-26 21:03 ` Michal Marek
2015-10-27 0:49 ` Ben Hutchings
2015-10-27 1:31 ` [Reproducible-builds] " Holger Levsen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.