]> code.ossystems Code Review - openembedded-core.git/commitdiff
perl: Set build date to SOURCE_DATE_EPOCH
authorJoshua Watt <jpewhacker@gmail.com>
Fri, 31 May 2019 13:59:53 +0000 (08:59 -0500)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 31 May 2019 21:12:38 +0000 (22:12 +0100)
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>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-devtools/perl-sanity/perl_5.28.2.bb

index f175e87a12eadd462c7fee58b3a972723674e9ae..540b9f2df3b65c555846c0cc0aa758a6326aee09 100644 (file)
@@ -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
 }