diff options
author | Hongxu Jia <hongxu.jia@windriver.com> | 2014-11-08 17:04:38 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-12-31 10:18:54 +0000 |
commit | 8d0600569b025d2dbc990118105ad9b59a7bb839 (patch) | |
tree | 82a8ee7ef82392a29aadae8debd9124d1df664ba /meta/classes | |
parent | dfd5bbdfa9d87a806e6a5fcdf1561dd7ddebdf50 (diff) | |
download | poky-8d0600569b025d2dbc990118105ad9b59a7bb839.tar.gz |
compress_doc.bbclass: support update-alternatives
While doc file make use of update-alternatives to fix confliction,
we should reconfigure update-alternatives for doc compression.
Such as util-linux-doc:
...
update-alternatives --install /usr/share/man/man1/last.1 last.1
/usr/share/man/man1/last.1.util-linux 100
...
was updated by doc_compress to
...
update-alternatives --install /usr/share/man/man1/last.1.bz2 last.1.bz2
/usr/share/man/man1/last.1.util-linux.bz2 100
...
(From OE-Core rev: ba4dd1afc2476259eff52f8a68fba1344e0f0474)
(From OE-Core rev: 972b8a14e65c544082806d8bcc38195b27345a89)
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/compress_doc.bbclass | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/meta/classes/compress_doc.bbclass b/meta/classes/compress_doc.bbclass index 6a4e635982..6edbaf531f 100644 --- a/meta/classes/compress_doc.bbclass +++ b/meta/classes/compress_doc.bbclass | |||
@@ -29,7 +29,7 @@ DOC_DECOMPRESS_CMD[gz] ?= 'gunzip -v' | |||
29 | DOC_DECOMPRESS_CMD[bz2] ?= "bunzip2 -v" | 29 | DOC_DECOMPRESS_CMD[bz2] ?= "bunzip2 -v" |
30 | DOC_DECOMPRESS_CMD[xz] ?= "unxz -v" | 30 | DOC_DECOMPRESS_CMD[xz] ?= "unxz -v" |
31 | 31 | ||
32 | PACKAGE_PREPROCESS_FUNCS += "package_do_compress_doc" | 32 | PACKAGE_PREPROCESS_FUNCS += "package_do_compress_doc compress_doc_updatealternatives" |
33 | python package_do_compress_doc() { | 33 | python package_do_compress_doc() { |
34 | compress_mode = d.getVar('DOC_COMPRESS', True) | 34 | compress_mode = d.getVar('DOC_COMPRESS', True) |
35 | compress_list = (d.getVar('DOC_COMPRESS_LIST', True) or '').split() | 35 | compress_list = (d.getVar('DOC_COMPRESS_LIST', True) or '').split() |
@@ -211,3 +211,46 @@ def decompress_doc(topdir, compress_mode, decompress_cmds): | |||
211 | 211 | ||
212 | _process_hardlink(hardlink_dict, compress_mode, decompress_cmds, decompress) | 212 | _process_hardlink(hardlink_dict, compress_mode, decompress_cmds, decompress) |
213 | 213 | ||
214 | python compress_doc_updatealternatives () { | ||
215 | if not bb.data.inherits_class('update-alternatives', d): | ||
216 | return | ||
217 | |||
218 | mandir = d.getVar("mandir", True) | ||
219 | infodir = d.getVar("infodir", True) | ||
220 | compress_mode = d.getVar('DOC_COMPRESS', True) | ||
221 | for pkg in (d.getVar('PACKAGES', True) or "").split(): | ||
222 | old_names = (d.getVar('ALTERNATIVE_%s' % pkg, True) or "").split() | ||
223 | new_names = [] | ||
224 | for old_name in old_names: | ||
225 | old_link = d.getVarFlag('ALTERNATIVE_LINK_NAME', old_name, True) | ||
226 | old_target = d.getVarFlag('ALTERNATIVE_TARGET_%s' % pkg, old_name, True) or \ | ||
227 | d.getVarFlag('ALTERNATIVE_TARGET', old_name, True) or \ | ||
228 | d.getVar('ALTERNATIVE_TARGET_%s' % pkg, True) or \ | ||
229 | d.getVar('ALTERNATIVE_TARGET', True) or \ | ||
230 | old_link | ||
231 | # Sometimes old_target is specified as relative to the link name. | ||
232 | old_target = os.path.join(os.path.dirname(old_link), old_target) | ||
233 | |||
234 | # The updatealternatives used for compress doc | ||
235 | if mandir in old_target or infodir in old_target: | ||
236 | new_name = old_name + '.' + compress_mode | ||
237 | new_link = old_link + '.' + compress_mode | ||
238 | new_target = old_target + '.' + compress_mode | ||
239 | d.delVarFlag('ALTERNATIVE_LINK_NAME', old_name) | ||
240 | d.setVarFlag('ALTERNATIVE_LINK_NAME', new_name, new_link) | ||
241 | if d.getVarFlag('ALTERNATIVE_TARGET_%s' % pkg, old_name, True): | ||
242 | d.delVarFlag('ALTERNATIVE_TARGET_%s' % pkg, old_name) | ||
243 | d.setVarFlag('ALTERNATIVE_TARGET_%s' % pkg, new_name, new_target) | ||
244 | elif d.getVarFlag('ALTERNATIVE_TARGET', old_name, True): | ||
245 | d.delVarFlag('ALTERNATIVE_TARGET', old_name) | ||
246 | d.setVarFlag('ALTERNATIVE_TARGET', new_name, new_target) | ||
247 | elif d.getVar('ALTERNATIVE_TARGET_%s' % pkg, True): | ||
248 | d.setVar('ALTERNATIVE_TARGET_%s' % pkg, new_target) | ||
249 | elif d.getVar('ALTERNATIVE_TARGET', old_name, True): | ||
250 | d.setVar('ALTERNATIVE_TARGET', new_target) | ||
251 | |||
252 | new_names.append(new_name) | ||
253 | |||
254 | if new_names: | ||
255 | d.setVar('ALTERNATIVE_%s' % pkg, ' '.join(new_names)) | ||
256 | } | ||