Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Joshua Watt <jpewhacker@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH v2] perl: Set build date to SOURCE_DATE_EPOCH
Date: Fri, 31 May 2019 08:59:53 -0500	[thread overview]
Message-ID: <20190531135953.18064-1-JPEWhacker@gmail.com> (raw)
In-Reply-To: <20190530184954.2188-1-JPEWhacker@gmail.com>

Perl uses an internal #define called PERL_BUILD_DATE as the string for
the date when perl was built. If undefined, it defaults to using
__DATE__ and __TIME__, which is not reproducible. If SOURCE_DATE_EPOCH
is set at do_configure time, use it to generate a reproducible string
for PERL_BUILD_DATE.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 meta/recipes-devtools/perl-sanity/perl_5.28.2.bb | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/meta/recipes-devtools/perl-sanity/perl_5.28.2.bb b/meta/recipes-devtools/perl-sanity/perl_5.28.2.bb
index f175e87a12e..540b9f2df3b 100644
--- a/meta/recipes-devtools/perl-sanity/perl_5.28.2.bb
+++ b/meta/recipes-devtools/perl-sanity/perl_5.28.2.bb
@@ -90,6 +90,16 @@ do_configure_class-native() {
     -Ui_xlocale
 }
 
+do_configure_append() {
+    if [ -n "$SOURCE_DATE_EPOCH" ]; then
+        PERL_BUILD_DATE="$(${PYTHON} -c "\
+from datetime import datetime, timezone; \
+print(datetime.fromtimestamp($SOURCE_DATE_EPOCH, timezone.utc).strftime('%a %b %d %H:%M:%S %Y')) \
+            ")"
+        echo "#define PERL_BUILD_DATE \"$PERL_BUILD_DATE\"" >> config.h
+    fi
+}
+
 do_compile() {
     oe_runmake
 }
-- 
2.21.0



      parent reply	other threads:[~2019-05-31 14:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-30 18:49 [PATCH] perl: Set build date to SOURCE_DATE_EPOCH Joshua Watt
2019-05-31  8:05 ` Richard Purdie
2019-05-31 13:59 ` Joshua Watt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190531135953.18064-1-JPEWhacker@gmail.com \
    --to=jpewhacker@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox