summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2019-12-13 23:21:55 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-12-15 09:10:46 +0000
commit6576c85e438079f7b10240073ac6ac78a3be6cf4 (patch)
treed358d2ade2415a35f1aab3b9065fdd1d8160d310 /meta/classes
parentc64c5e0eda98e667de22074d6ea606c655519dc0 (diff)
downloadpoky-6576c85e438079f7b10240073ac6ac78a3be6cf4.tar.gz
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(). (From OE-Core rev: 18d8e5ac689d6eb6098f68ac785f43e9d5f5938a) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/podfix.bbclass32
1 files changed, 32 insertions, 0 deletions
diff --git a/meta/classes/podfix.bbclass b/meta/classes/podfix.bbclass
new file mode 100644
index 0000000000..54fff6a0a2
--- /dev/null
+++ b/meta/classes/podfix.bbclass
@@ -0,0 +1,32 @@
1python pod_strip_version() {
2 import re
3
4 def opener(filename, mode):
5 if filename.endswith(".gz"):
6 import gzip
7 return gzip.open(filename, mode)
8 elif filename.endswith(".bz2"):
9 import bz2
10 return bz2.open(filename, mode)
11 else:
12 return open(filename, mode)
13
14 bad_re = re.compile(rb"Automatically generated by Pod::Man( [0-9]+.+)")
15
16 for root, dirs, files in os.walk(d.expand("${D}${mandir}")):
17 for filename in files:
18 filename = os.path.join(root, filename)
19 with opener(filename, "rb") as manfile:
20 manpage = manfile.read()
21 m = bad_re.search(manpage)
22 if not m:
23 continue
24
25 bb.note("podfix: stripping version from %s" % filename)
26 os.unlink(filename)
27 with opener(filename, "wb") as manfile:
28 manfile.write(manpage[:m.start(1)])
29 manfile.write(manpage[m.end(1):])
30}
31
32do_install[postfuncs] += "pod_strip_version"