summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
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"