All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gperf: Add a patch to work around reproducibility issues
@ 2022-07-04 13:25 Richard Purdie
  2022-07-05  4:36 ` [OE-core] " Jacob Kroon
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Purdie @ 2022-07-04 13:25 UTC (permalink / raw)
  To: openembedded-core

Add a patch to avoid writing the full pathname to gperf into source
files which leads to reproducibility issues.

This fixes issues with systemd reproducibility in particular.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 .../gperf/gperf/reproducibility.patch         | 26 +++++++++++++++++++
 meta/recipes-extended/gperf/gperf_3.1.bb      |  2 ++
 2 files changed, 28 insertions(+)
 create mode 100644 meta/recipes-extended/gperf/gperf/reproducibility.patch

diff --git a/meta/recipes-extended/gperf/gperf/reproducibility.patch b/meta/recipes-extended/gperf/gperf/reproducibility.patch
new file mode 100644
index 00000000000..9f80828dbd7
--- /dev/null
+++ b/meta/recipes-extended/gperf/gperf/reproducibility.patch
@@ -0,0 +1,26 @@
+By default gperf puts a header into generated files with the full path to
+the tool along with the commandline used. This patch removes the path to
+the binary, allowing reproducible source files (which can be included in
+debug source packages).
+
+Upstream-Status: Pending
+Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
+
+Index: gperf-3.1/src/options.cc
+===================================================================
+--- gperf-3.1.orig/src/options.cc
++++ gperf-3.1/src/options.cc
+@@ -280,6 +280,13 @@ Options::print_options () const
+     {
+       const char *arg = _argument_vector[i];
+ 
++      if (i == 0) {
++          const char *shortarg = strrchr(arg, '/');
++          if (shortarg) {
++              arg = shortarg + 1;
++          }
++      }
++
+       /* Escape arg if it contains shell metacharacters.  */
+       if (*arg == '-')
+         {
diff --git a/meta/recipes-extended/gperf/gperf_3.1.bb b/meta/recipes-extended/gperf/gperf_3.1.bb
index 82750fca05c..3564ac0805b 100644
--- a/meta/recipes-extended/gperf/gperf_3.1.bb
+++ b/meta/recipes-extended/gperf/gperf_3.1.bb
@@ -9,6 +9,8 @@ SRC_URI  = "${GNU_MIRROR}/${BPN}/${BP}.tar.gz"
 SRC_URI[md5sum] = "9e251c0a618ad0824b51117d5d9db87e"
 SRC_URI[sha256sum] = "588546b945bba4b70b6a3a616e80b4ab466e3f33024a352fc2198112cdbb3ae2"
 
+SRC_URI:append = " file://reproducibility.patch"
+
 inherit autotools
 
 # The nested configures don't find the parent aclocal.m4 out of the box, so tell
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [OE-core] [PATCH] gperf: Add a patch to work around reproducibility issues
  2022-07-04 13:25 [PATCH] gperf: Add a patch to work around reproducibility issues Richard Purdie
@ 2022-07-05  4:36 ` Jacob Kroon
  2022-07-05 11:00   ` Richard Purdie
  0 siblings, 1 reply; 3+ messages in thread
From: Jacob Kroon @ 2022-07-05  4:36 UTC (permalink / raw)
  To: Richard Purdie, openembedded-core

On 7/4/22 15:25, Richard Purdie wrote:
> Add a patch to avoid writing the full pathname to gperf into source
> files which leads to reproducibility issues.
> 
> This fixes issues with systemd reproducibility in particular.
> 
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
>   .../gperf/gperf/reproducibility.patch         | 26 +++++++++++++++++++
>   meta/recipes-extended/gperf/gperf_3.1.bb      |  2 ++
>   2 files changed, 28 insertions(+)
>   create mode 100644 meta/recipes-extended/gperf/gperf/reproducibility.patch
> 
> diff --git a/meta/recipes-extended/gperf/gperf/reproducibility.patch b/meta/recipes-extended/gperf/gperf/reproducibility.patch
> new file mode 100644
> index 00000000000..9f80828dbd7
> --- /dev/null
> +++ b/meta/recipes-extended/gperf/gperf/reproducibility.patch
> @@ -0,0 +1,26 @@
> +By default gperf puts a header into generated files with the full path to
> +the tool along with the commandline used. This patch removes the path to
> +the binary, allowing reproducible source files (which can be included in
> +debug source packages).
> +
> +Upstream-Status: Pending
> +Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> +
> +Index: gperf-3.1/src/options.cc
> +===================================================================
> +--- gperf-3.1.orig/src/options.cc
> ++++ gperf-3.1/src/options.cc
> +@@ -280,6 +280,13 @@ Options::print_options () const
> +     {
> +       const char *arg = _argument_vector[i];
> +
> ++      if (i == 0) {
> ++          const char *shortarg = strrchr(arg, '/');
> ++          if (shortarg) {
> ++              arg = shortarg + 1;
> ++          }
> ++      }
> ++
> +       /* Escape arg if it contains shell metacharacters.  */
> +       if (*arg == '-')
> +         {
> diff --git a/meta/recipes-extended/gperf/gperf_3.1.bb b/meta/recipes-extended/gperf/gperf_3.1.bb
> index 82750fca05c..3564ac0805b 100644
> --- a/meta/recipes-extended/gperf/gperf_3.1.bb
> +++ b/meta/recipes-extended/gperf/gperf_3.1.bb
> @@ -9,6 +9,8 @@ SRC_URI  = "${GNU_MIRROR}/${BPN}/${BP}.tar.gz"
>   SRC_URI[md5sum] = "9e251c0a618ad0824b51117d5d9db87e"
>   SRC_URI[sha256sum] = "588546b945bba4b70b6a3a616e80b4ab466e3f33024a352fc2198112cdbb3ae2"
>   
> +SRC_URI:append = " file://reproducibility.patch"
> +

Can I ask if :append was really necessary here, couldn't we just have 
used += ? I'm a little saddened with all these :append/:prepend/:remove 
creeping in to OE-Core.

Jacob


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [OE-core] [PATCH] gperf: Add a patch to work around reproducibility issues
  2022-07-05  4:36 ` [OE-core] " Jacob Kroon
@ 2022-07-05 11:00   ` Richard Purdie
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Purdie @ 2022-07-05 11:00 UTC (permalink / raw)
  To: Jacob Kroon, openembedded-core

On Tue, 2022-07-05 at 06:36 +0200, Jacob Kroon wrote:
> On 7/4/22 15:25, Richard Purdie wrote:
> > Add a patch to avoid writing the full pathname to gperf into source
> > files which leads to reproducibility issues.
> > 
> > This fixes issues with systemd reproducibility in particular.
> > 
> > Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> > ---
> >   .../gperf/gperf/reproducibility.patch         | 26 +++++++++++++++++++
> >   meta/recipes-extended/gperf/gperf_3.1.bb      |  2 ++
> >   2 files changed, 28 insertions(+)
> >   create mode 100644 meta/recipes-extended/gperf/gperf/reproducibility.patch
> > 
> > diff --git a/meta/recipes-extended/gperf/gperf/reproducibility.patch b/meta/recipes-extended/gperf/gperf/reproducibility.patch
> > new file mode 100644
> > index 00000000000..9f80828dbd7
> > --- /dev/null
> > +++ b/meta/recipes-extended/gperf/gperf/reproducibility.patch
> > @@ -0,0 +1,26 @@
> > +By default gperf puts a header into generated files with the full path to
> > +the tool along with the commandline used. This patch removes the path to
> > +the binary, allowing reproducible source files (which can be included in
> > +debug source packages).
> > +
> > +Upstream-Status: Pending
> > +Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> > +
> > +Index: gperf-3.1/src/options.cc
> > +===================================================================
> > +--- gperf-3.1.orig/src/options.cc
> > ++++ gperf-3.1/src/options.cc
> > +@@ -280,6 +280,13 @@ Options::print_options () const
> > +     {
> > +       const char *arg = _argument_vector[i];
> > +
> > ++      if (i == 0) {
> > ++          const char *shortarg = strrchr(arg, '/');
> > ++          if (shortarg) {
> > ++              arg = shortarg + 1;
> > ++          }
> > ++      }
> > ++
> > +       /* Escape arg if it contains shell metacharacters.  */
> > +       if (*arg == '-')
> > +         {
> > diff --git a/meta/recipes-extended/gperf/gperf_3.1.bb b/meta/recipes-extended/gperf/gperf_3.1.bb
> > index 82750fca05c..3564ac0805b 100644
> > --- a/meta/recipes-extended/gperf/gperf_3.1.bb
> > +++ b/meta/recipes-extended/gperf/gperf_3.1.bb
> > @@ -9,6 +9,8 @@ SRC_URI  = "${GNU_MIRROR}/${BPN}/${BP}.tar.gz"
> >   SRC_URI[md5sum] = "9e251c0a618ad0824b51117d5d9db87e"
> >   SRC_URI[sha256sum] = "588546b945bba4b70b6a3a616e80b4ab466e3f33024a352fc2198112cdbb3ae2"
> >   
> > +SRC_URI:append = " file://reproducibility.patch"
> > +
> 
> Can I ask if :append was really necessary here, couldn't we just have 
> used += ? I'm a little saddened with all these :append/:prepend/:remove 
> creeping in to OE-Core.

I agree, I should and usually do better. I'll take a patch to fix it.

Cheers,

Richard



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-05 11:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-04 13:25 [PATCH] gperf: Add a patch to work around reproducibility issues Richard Purdie
2022-07-05  4:36 ` [OE-core] " Jacob Kroon
2022-07-05 11:00   ` Richard Purdie

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.