Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Joshua Watt <jpewhacker@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH] perl: Reproducible build fixes
Date: Fri, 21 Jun 2019 08:30:30 -0500	[thread overview]
Message-ID: <20190621133030.10720-1-JPEWhacker@gmail.com> (raw)

Applies two patches that are required to improve the reproducibility of
builds.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 ...onment-variable-to-suppress-comments.patch | 30 +++++++++++++++++
 .../files/0002-Constant-Fix-up-shebang.patch  | 32 +++++++++++++++++++
 meta/recipes-devtools/perl/perl_5.30.0.bb     |  5 +++
 3 files changed, 67 insertions(+)
 create mode 100644 meta/recipes-devtools/perl/files/0001-enc2xs-Add-environment-variable-to-suppress-comments.patch
 create mode 100644 meta/recipes-devtools/perl/files/0002-Constant-Fix-up-shebang.patch

diff --git a/meta/recipes-devtools/perl/files/0001-enc2xs-Add-environment-variable-to-suppress-comments.patch b/meta/recipes-devtools/perl/files/0001-enc2xs-Add-environment-variable-to-suppress-comments.patch
new file mode 100644
index 00000000000..07f153162b0
--- /dev/null
+++ b/meta/recipes-devtools/perl/files/0001-enc2xs-Add-environment-variable-to-suppress-comments.patch
@@ -0,0 +1,30 @@
+From 31a2c5555f9ef32f35d7d5ce1fd09a010ba5f5c6 Mon Sep 17 00:00:00 2001
+From: Joshua Watt <JPEWhacker@gmail.com>
+Date: Mon, 17 Jun 2019 10:47:15 -0500
+Subject: [PATCH 1/2] enc2xs: Add environment variable to suppress comments
+
+Comment generation in enc2xs can now be suppressed by setting the
+ENC2XS_NO_COMMENTS environment variable. This allows enc2xs to produce
+reproducible output by omitting the name of the generating program.
+
+Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
+Upstream-status: Accepted [https://github.com/dankogai/p5-encode/pull/145]
+---
+ cpan/Encode/bin/enc2xs | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/cpan/Encode/bin/enc2xs b/cpan/Encode/bin/enc2xs
+index 619b64b757..bfce9ee735 100644
+--- a/cpan/Encode/bin/enc2xs
++++ b/cpan/Encode/bin/enc2xs
+@@ -144,6 +144,7 @@ getopts('CM:SQqOo:f:n:v',\%opt);
+ $opt{M} and make_makefile_pl($opt{M}, @ARGV);
+ $opt{C} and make_configlocal_pm($opt{C}, @ARGV);
+ $opt{v} ||= $ENV{ENC2XS_VERBOSE};
++$opt{q} ||= $ENV{ENC2XS_NO_COMMENTS};
+ 
+ sub verbose {
+     print STDERR @_ if $opt{v};
+-- 
+2.21.0
+
diff --git a/meta/recipes-devtools/perl/files/0002-Constant-Fix-up-shebang.patch b/meta/recipes-devtools/perl/files/0002-Constant-Fix-up-shebang.patch
new file mode 100644
index 00000000000..e70ff67f726
--- /dev/null
+++ b/meta/recipes-devtools/perl/files/0002-Constant-Fix-up-shebang.patch
@@ -0,0 +1,32 @@
+From 260ebd15e16cd86b9b58e5c5f3a496b3853ca46d Mon Sep 17 00:00:00 2001
+From: Joshua Watt <JPEWhacker@gmail.com>
+Date: Mon, 17 Jun 2019 10:47:23 -0500
+Subject: [PATCH 2/2] Constant: Fix up shebang
+
+The instructions indicate that the script should be explicitly passed to
+"perl -x", so automatically setting the #! to be ^X is unnecessary and
+makes the file non-reproducible when building because ^X could be the
+absolute path to miniperl.
+
+Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
+Upstream-status: Submitted [https://rt.cpan.org/Public/Bug/Display.html?id=129866]
+---
+ cpan/ExtUtils-Constant/lib/ExtUtils/Constant/XS.pm | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cpan/ExtUtils-Constant/lib/ExtUtils/Constant/XS.pm b/cpan/ExtUtils-Constant/lib/ExtUtils/Constant/XS.pm
+index 14eb809714..d4d074e121 100644
+--- a/cpan/ExtUtils-Constant/lib/ExtUtils/Constant/XS.pm
++++ b/cpan/ExtUtils-Constant/lib/ExtUtils/Constant/XS.pm
+@@ -219,7 +219,7 @@ sub dogfood {
+      Regenerate these constant functions by feeding this entire source file to
+      perl -x
+ 
+-#!$^X -w
++#!/usr/bin/env perl -x -w
+ use ExtUtils::Constant qw (constant_types C_constant XS_constant);
+ 
+ EOT
+-- 
+2.21.0
+
diff --git a/meta/recipes-devtools/perl/perl_5.30.0.bb b/meta/recipes-devtools/perl/perl_5.30.0.bb
index b18a6b69131..e3664290e30 100644
--- a/meta/recipes-devtools/perl/perl_5.30.0.bb
+++ b/meta/recipes-devtools/perl/perl_5.30.0.bb
@@ -19,6 +19,8 @@ SRC_URI = "https://www.cpan.org/src/5.0/perl-${PV}.tar.gz;name=perl \
            file://perl-dynloader.patch \
            file://0001-configure_path.sh-do-not-hardcode-prefix-lib-as-libr.patch \
            file://fix-setgroup.patch \
+           file://0001-enc2xs-Add-environment-variable-to-suppress-comments.patch \
+           file://0002-Constant-Fix-up-shebang.patch \
            "
 SRC_URI_append_class-native = " \
            file://perl-configpm-switch.patch \
@@ -37,6 +39,9 @@ DEPENDS += "db gdbm zlib virtual/crypt"
 
 PERL_LIB_VER = "${@'.'.join(d.getVar('PV').split('.')[0:2])}.0"
 
+# Don't generate comments in enc2xs output files. They are not reproducible
+export ENC2XS_NO_COMMENTS = "1"
+
 do_unpack_append() {
     bb.build.exec_func('do_copy_perlcross', d)
 }
-- 
2.21.0



             reply	other threads:[~2019-06-21 13:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-21 13:30 Joshua Watt [this message]
2019-06-21 14:01 ` ✗ patchtest: failure for perl: Reproducible build fixes Patchwork

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=20190621133030.10720-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