[oe-commits] [openembedded-core] 19/28: podfix: class to remove Pod::Man versions from manpages

git at git.openembedded.org git at git.openembedded.org
Sat Jan 11 11:07:01 UTC 2020


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch zeus
in repository openembedded-core.

commit 88255abe6bb4d10d50a660022ab3f9a1c2954ec7
Author: Ross Burton <ross.burton at intel.com>
AuthorDate: Fri Dec 13 23:21:55 2019 +0000

    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().
    
    Signed-off-by: Ross Burton <ross.burton at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
    (cherry picked from commit 18d8e5ac689d6eb6098f68ac785f43e9d5f5938a)
    Signed-off-by: Armin Kuster <akuster808 at gmail.com>
---
 meta/classes/podfix.bbclass | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/meta/classes/podfix.bbclass b/meta/classes/podfix.bbclass
new file mode 100644
index 0000000..54fff6a
--- /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"

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list