All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 1/2] podfix: class to remove Pod::Man versions from manpages
@ 2019-12-13 23:21 Ross Burton
  2019-12-13 23:21 ` [RFC PATCH 2/2] reproducible_build_simple: inherit podfix Ross Burton
  2019-12-16  4:39 ` [RFC PATCH 1/2] podfix: class to remove Pod::Man versions from manpages Khem Raj
  0 siblings, 2 replies; 5+ messages in thread
From: Ross Burton @ 2019-12-13 23:21 UTC (permalink / raw)
  To: openembedded-core

Manpages generated by Pod::Man contain the version number, which isn't
reproducible if we're using the host Perl to generate manpage.

One option is to always depend on perl-native when generating manpages
but this is a heavy dependency, so instead strip out the versions in
do_install().

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 meta/classes/podfix.bbclass | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 meta/classes/podfix.bbclass

diff --git a/meta/classes/podfix.bbclass b/meta/classes/podfix.bbclass
new file mode 100644
index 00000000000..54fff6a0a23
--- /dev/null
+++ b/meta/classes/podfix.bbclass
@@ -0,0 +1,32 @@
+python pod_strip_version() {
+    import re
+
+    def opener(filename, mode):
+        if filename.endswith(".gz"):
+            import gzip
+            return gzip.open(filename, mode)
+        elif filename.endswith(".bz2"):
+            import bz2
+            return bz2.open(filename, mode)
+        else:
+            return open(filename, mode)
+
+    bad_re = re.compile(rb"Automatically generated by Pod::Man( [0-9]+.+)")
+
+    for root, dirs, files in os.walk(d.expand("${D}${mandir}")):
+        for filename in files:
+            filename = os.path.join(root, filename)
+            with opener(filename, "rb") as manfile:
+                manpage = manfile.read()
+                m = bad_re.search(manpage)
+                if not m:
+                    continue
+
+            bb.note("podfix: stripping version from %s" % filename)
+            os.unlink(filename)
+            with opener(filename, "wb") as manfile:
+                manfile.write(manpage[:m.start(1)])
+                manfile.write(manpage[m.end(1):])
+}
+
+do_install[postfuncs] += "pod_strip_version"
-- 
2.20.1



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

* [RFC PATCH 2/2] reproducible_build_simple: inherit podfix
  2019-12-13 23:21 [RFC PATCH 1/2] podfix: class to remove Pod::Man versions from manpages Ross Burton
@ 2019-12-13 23:21 ` Ross Burton
  2019-12-16  4:39 ` [RFC PATCH 1/2] podfix: class to remove Pod::Man versions from manpages Khem Raj
  1 sibling, 0 replies; 5+ messages in thread
From: Ross Burton @ 2019-12-13 23:21 UTC (permalink / raw)
  To: openembedded-core

When doing reproducible builds inherit podfix to remove the possibility
of differing Perl versions causing manpages to change.

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 meta/classes/reproducible_build_simple.bbclass | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/classes/reproducible_build_simple.bbclass b/meta/classes/reproducible_build_simple.bbclass
index 8a60deef3d6..d0842f0f902 100644
--- a/meta/classes/reproducible_build_simple.bbclass
+++ b/meta/classes/reproducible_build_simple.bbclass
@@ -8,3 +8,4 @@ export SOURCE_DATE_EPOCH ??= "1520598896"
 
 REPRODUCIBLE_TIMESTAMP_ROOTFS ??= "1520598896"
 
+inherit podfix
-- 
2.20.1



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

* Re: [RFC PATCH 1/2] podfix: class to remove Pod::Man versions from manpages
  2019-12-13 23:21 [RFC PATCH 1/2] podfix: class to remove Pod::Man versions from manpages Ross Burton
  2019-12-13 23:21 ` [RFC PATCH 2/2] reproducible_build_simple: inherit podfix Ross Burton
@ 2019-12-16  4:39 ` Khem Raj
  2019-12-16 11:20   ` Ross Burton
  1 sibling, 1 reply; 5+ messages in thread
From: Khem Raj @ 2019-12-16  4:39 UTC (permalink / raw)
  To: Ross Burton; +Cc: Patches and discussions about the oe-core layer

On Fri, Dec 13, 2019 at 3:22 PM Ross Burton <ross.burton@intel.com> wrote:
>
> Manpages generated by Pod::Man contain the version number, which isn't
> reproducible if we're using the host Perl to generate manpage.
>
> One option is to always depend on perl-native when generating manpages
> but this is a heavy dependency, so instead strip out the versions in
> do_install().
>

seeing this error

https://errors.yoctoproject.org/Errors/Details/297478/


> Signed-off-by: Ross Burton <ross.burton@intel.com>
> ---
>  meta/classes/podfix.bbclass | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
>  create mode 100644 meta/classes/podfix.bbclass
>
> diff --git a/meta/classes/podfix.bbclass b/meta/classes/podfix.bbclass
> new file mode 100644
> index 00000000000..54fff6a0a23
> --- /dev/null
> +++ b/meta/classes/podfix.bbclass
> @@ -0,0 +1,32 @@
> +python pod_strip_version() {
> +    import re
> +
> +    def opener(filename, mode):
> +        if filename.endswith(".gz"):
> +            import gzip
> +            return gzip.open(filename, mode)
> +        elif filename.endswith(".bz2"):
> +            import bz2
> +            return bz2.open(filename, mode)
> +        else:
> +            return open(filename, mode)
> +
> +    bad_re = re.compile(rb"Automatically generated by Pod::Man( [0-9]+.+)")
> +
> +    for root, dirs, files in os.walk(d.expand("${D}${mandir}")):
> +        for filename in files:
> +            filename = os.path.join(root, filename)
> +            with opener(filename, "rb") as manfile:
> +                manpage = manfile.read()
> +                m = bad_re.search(manpage)
> +                if not m:
> +                    continue
> +
> +            bb.note("podfix: stripping version from %s" % filename)
> +            os.unlink(filename)
> +            with opener(filename, "wb") as manfile:
> +                manfile.write(manpage[:m.start(1)])
> +                manfile.write(manpage[m.end(1):])
> +}
> +
> +do_install[postfuncs] += "pod_strip_version"
> --
> 2.20.1
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


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

* Re: [RFC PATCH 1/2] podfix: class to remove Pod::Man versions from manpages
  2019-12-16  4:39 ` [RFC PATCH 1/2] podfix: class to remove Pod::Man versions from manpages Khem Raj
@ 2019-12-16 11:20   ` Ross Burton
  2019-12-16 15:17     ` Khem Raj
  0 siblings, 1 reply; 5+ messages in thread
From: Ross Burton @ 2019-12-16 11:20 UTC (permalink / raw)
  To: Khem Raj; +Cc: Patches and discussions about the oe-core layer

On 16/12/2019 04:39, Khem Raj wrote:
> On Fri, Dec 13, 2019 at 3:22 PM Ross Burton <ross.burton@intel.com> wrote:
>>
>> Manpages generated by Pod::Man contain the version number, which isn't
>> reproducible if we're using the host Perl to generate manpage.
>>
>> One option is to always depend on perl-native when generating manpages
>> but this is a heavy dependency, so instead strip out the versions in
>> do_install().
>>
> 
> seeing this error
> 
> https://errors.yoctoproject.org/Errors/Details/297478/

Exception: FileNotFoundError: [Errno 2] No such file or directory: 
'TOPDIR/build/tmp/work/core2-32-yoe-linux/fvwm/2.6.8-r0/image/usr/share/man/man1/fvwm2.1'

Is that actually a broken symlink?

Ross


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

* Re: [RFC PATCH 1/2] podfix: class to remove Pod::Man versions from manpages
  2019-12-16 11:20   ` Ross Burton
@ 2019-12-16 15:17     ` Khem Raj
  0 siblings, 0 replies; 5+ messages in thread
From: Khem Raj @ 2019-12-16 15:17 UTC (permalink / raw)
  To: Ross Burton; +Cc: Patches and discussions about the oe-core layer

On Mon, Dec 16, 2019 at 3:21 AM Ross Burton <ross.burton@intel.com> wrote:
>
> On 16/12/2019 04:39, Khem Raj wrote:
> > On Fri, Dec 13, 2019 at 3:22 PM Ross Burton <ross.burton@intel.com> wrote:
> >>
> >> Manpages generated by Pod::Man contain the version number, which isn't
> >> reproducible if we're using the host Perl to generate manpage.
> >>
> >> One option is to always depend on perl-native when generating manpages
> >> but this is a heavy dependency, so instead strip out the versions in
> >> do_install().
> >>
> >
> > seeing this error
> >
> > https://errors.yoctoproject.org/Errors/Details/297478/
>
> Exception: FileNotFoundError: [Errno 2] No such file or directory:
> 'TOPDIR/build/tmp/work/core2-32-yoe-linux/fvwm/2.6.8-r0/image/usr/share/man/man1/fvwm2.1'
>
> Is that actually a broken symlink?
>

it is perhaps I have to rebuilt and check but I think it would be good
if this class did not crash
like that. maybe just report a useful warning of some sort or just ignore it.


> Ross


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

end of thread, other threads:[~2019-12-16 15:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-13 23:21 [RFC PATCH 1/2] podfix: class to remove Pod::Man versions from manpages Ross Burton
2019-12-13 23:21 ` [RFC PATCH 2/2] reproducible_build_simple: inherit podfix Ross Burton
2019-12-16  4:39 ` [RFC PATCH 1/2] podfix: class to remove Pod::Man versions from manpages Khem Raj
2019-12-16 11:20   ` Ross Burton
2019-12-16 15:17     ` Khem Raj

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.