diff options
| author | Ross Burton <ross.burton@intel.com> | 2019-12-13 23:21:55 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-01-11 11:06:22 +0000 |
| commit | 9a294101b6118e090d84c53d37e9810b89efc6fd (patch) | |
| tree | b06133b51319b8ad305d7b607b55513f038a5cb6 | |
| parent | f5dc7d9f69069d89ca4fa063314975677bd3d2b1 (diff) | |
| download | poky-9a294101b6118e090d84c53d37e9810b89efc6fd.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: 88255abe6bb4d10d50a660022ab3f9a1c2954ec7)
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 18d8e5ac689d6eb6098f68ac785f43e9d5f5938a)
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/classes/podfix.bbclass | 32 |
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 @@ | |||
| 1 | python 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 | |||
| 32 | do_install[postfuncs] += "pod_strip_version" | ||
