* [PATCH] perl: Set build date to SOURCE_DATE_EPOCH
@ 2019-05-30 18:49 Joshua Watt
2019-05-31 8:05 ` Richard Purdie
2019-05-31 13:59 ` [PATCH v2] " Joshua Watt
0 siblings, 2 replies; 3+ messages in thread
From: Joshua Watt @ 2019-05-30 18:49 UTC (permalink / raw)
To: openembedded-core
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 | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
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..b74acfbbc4d 100644
--- a/meta/recipes-devtools/perl-sanity/perl_5.28.2.bb
+++ b/meta/recipes-devtools/perl-sanity/perl_5.28.2.bb
@@ -34,7 +34,7 @@ S = "${WORKDIR}/perl-${PV}"
inherit upstream-version-is-even
-DEPENDS += "db gdbm zlib virtual/crypt"
+DEPENDS += "db gdbm zlib virtual/crypt coreutils-native"
PERL_LIB_VER = "${@'.'.join(d.getVar('PV').split('.')[0:2])}.0"
@@ -90,6 +90,12 @@ do_configure_class-native() {
-Ui_xlocale
}
+do_configure_append() {
+ if [ -n "$SOURCE_DATE_EPOCH" ]; then
+ echo "#define PERL_BUILD_DATE \"$(date --utc --date="@$SOURCE_DATE_EPOCH")\"" >> config.h
+ fi
+}
+
do_compile() {
oe_runmake
}
--
2.21.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] perl: Set build date to SOURCE_DATE_EPOCH
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 ` [PATCH v2] " Joshua Watt
1 sibling, 0 replies; 3+ messages in thread
From: Richard Purdie @ 2019-05-31 8:05 UTC (permalink / raw)
To: Joshua Watt, openembedded-core
On Thu, 2019-05-30 at 13:49 -0500, Joshua Watt wrote:
> 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 | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> 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..b74acfbbc4d 100644
> --- a/meta/recipes-devtools/perl-sanity/perl_5.28.2.bb
> +++ b/meta/recipes-devtools/perl-sanity/perl_5.28.2.bb
> @@ -34,7 +34,7 @@ S = "${WORKDIR}/perl-${PV}"
>
> inherit upstream-version-is-even
>
> -DEPENDS += "db gdbm zlib virtual/crypt"
> +DEPENDS += "db gdbm zlib virtual/crypt coreutils-native"
>
> PERL_LIB_VER = "${@'.'.join(d.getVar('PV').split('.')[0:2])}.0"
>
> @@ -90,6 +90,12 @@ do_configure_class-native() {
> -Ui_xlocale
> }
>
> +do_configure_append() {
> + if [ -n "$SOURCE_DATE_EPOCH" ]; then
> + echo "#define PERL_BUILD_DATE \"$(date --utc --date="@$SOURCE_DATE_EPOCH")\"" >> config.h
> + fi
> +}
> +
As discussed on irc, lets see if we can avoid a coreutils-native
dependency and use python to do the conversion (or similar).
Cheers,
Richard
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] perl: Set build date to SOURCE_DATE_EPOCH
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
1 sibling, 0 replies; 3+ messages in thread
From: Joshua Watt @ 2019-05-31 13:59 UTC (permalink / raw)
To: openembedded-core
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-05-31 14:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH v2] " Joshua Watt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox