diff options
| -rw-r--r-- | meta/classes/compress_doc.bbclass | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/meta/classes/compress_doc.bbclass b/meta/classes/compress_doc.bbclass index afa9cd614a..9b58d82ce5 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() |
| @@ -214,3 +214,47 @@ def decompress_doc(topdir, compress_mode, decompress_cmds): | |||
| 214 | 214 | ||
| 215 | _process_hardlink(hardlink_dict, compress_mode, decompress_cmds, decompress) | 215 | _process_hardlink(hardlink_dict, compress_mode, decompress_cmds, decompress) |
| 216 | 216 | ||
| 217 | python compress_doc_updatealternatives () { | ||
| 218 | if not bb.data.inherits_class('update-alternatives', d): | ||
| 219 | return | ||
| 220 | |||
| 221 | mandir = d.getVar("mandir", True) | ||
| 222 | infodir = d.getVar("infodir", True) | ||
| 223 | compress_mode = d.getVar('DOC_COMPRESS', True) | ||
| 224 | for pkg in (d.getVar('PACKAGES', True) or "").split(): | ||
| 225 | old_names = (d.getVar('ALTERNATIVE_%s' % pkg, True) or "").split() | ||
| 226 | new_names = [] | ||
| 227 | for old_name in old_names: | ||
| 228 | old_link = d.getVarFlag('ALTERNATIVE_LINK_NAME', old_name, True) | ||
| 229 | old_target = d.getVarFlag('ALTERNATIVE_TARGET_%s' % pkg, old_name, True) or \ | ||
| 230 | d.getVarFlag('ALTERNATIVE_TARGET', old_name, True) or \ | ||
| 231 | d.getVar('ALTERNATIVE_TARGET_%s' % pkg, True) or \ | ||
| 232 | d.getVar('ALTERNATIVE_TARGET', True) or \ | ||
| 233 | old_link | ||
| 234 | # Sometimes old_target is specified as relative to the link name. | ||
| 235 | old_target = os.path.join(os.path.dirname(old_link), old_target) | ||
| 236 | |||
| 237 | # The updatealternatives used for compress doc | ||
| 238 | if mandir in old_target or infodir in old_target: | ||
| 239 | new_name = old_name + '.' + compress_mode | ||
| 240 | new_link = old_link + '.' + compress_mode | ||
| 241 | new_target = old_target + '.' + compress_mode | ||
| 242 | d.delVarFlag('ALTERNATIVE_LINK_NAME', old_name) | ||
| 243 | d.setVarFlag('ALTERNATIVE_LINK_NAME', new_name, new_link) | ||
| 244 | if d.getVarFlag('ALTERNATIVE_TARGET_%s' % pkg, old_name, True): | ||
| 245 | d.delVarFlag('ALTERNATIVE_TARGET_%s' % pkg, old_name) | ||
| 246 | d.setVarFlag('ALTERNATIVE_TARGET_%s' % pkg, new_name, new_target) | ||
| 247 | elif d.getVarFlag('ALTERNATIVE_TARGET', old_name, True): | ||
| 248 | d.delVarFlag('ALTERNATIVE_TARGET', old_name) | ||
| 249 | d.setVarFlag('ALTERNATIVE_TARGET', new_name, new_target) | ||
| 250 | elif d.getVar('ALTERNATIVE_TARGET_%s' % pkg, True): | ||
| 251 | d.setVar('ALTERNATIVE_TARGET_%s' % pkg, new_target) | ||
| 252 | elif d.getVar('ALTERNATIVE_TARGET', old_name, True): | ||
| 253 | d.setVar('ALTERNATIVE_TARGET', new_target) | ||
| 254 | |||
| 255 | new_names.append(new_name) | ||
| 256 | |||
| 257 | if new_names: | ||
| 258 | d.setVar('ALTERNATIVE_%s' % pkg, ' '.join(new_names)) | ||
| 259 | } | ||
| 260 | |||
