podfix: class to remove Pod::Man versions from manpages
RFC PATCH 1/2 podfix: class to remove Pod::Man versions from manpages
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().
--- meta/classes/podfix.bbclass | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 meta/classes/podfix.bbclass
meta/classes/podfix.bbclass new file +32 -0
@@ -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"
Signature · 1 line
2.20.1
RFC PATCH 2/2 reproducible_build_simple: inherit podfix
When doing reproducible builds inherit podfix to remove the possibility of differing Perl versions causing manpages to change.
--- meta/classes/reproducible_build_simple.bbclass | 1 + 1 file changed, 1 insertion(+)
meta/classes/reproducible_build_simple.bbclass +1 -0
@@ -8,3 +8,4 @@ export SOURCE_DATE_EPOCH ??= "1520598896" REPRODUCIBLE_TIMESTAMP_ROOTFS ??= "1520598896" +inherit podfix
Signature · 1 line
2.20.1
Quoted 8 lines · Ross Burton
Manpages generated by
Pod::Mancontain 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/
Quoted 52 lines
Signed-off-by Ross Burton <[email protected]>--- meta/classes/podfix.bbclass | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 meta/classes/podfix.bbclassmeta/classes/podfix.bbclass new file +32
-1@@ -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
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Quoted 5 lines · Khem Raj
Quoted 4 lines · Ross Burton
Manpages generated by
Pod::Mancontain the version number, which isn't reproducible if we're using the host Perl to generate manpage.
Quoted 8 lines
Quoted 4 lines
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
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
Quoted 12 lines · Ross Burton
Quoted 10 lines · Khem Raj
Quoted 8 lines · Ross Burton
Manpages generated by
Pod::Mancontain 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().
Quoted 9 lines
Quoted 3 lines
seeing this error
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.
Quoted 1 line
Ross