Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/1] compress_doc.bbclass: support update-alternatives
@ 2014-11-08  9:04 Hongxu Jia
  2014-11-08  9:04 ` [PATCH 1/1] " Hongxu Jia
  2014-11-25  6:46 ` [PATCH 0/1] " Hongxu Jia
  0 siblings, 2 replies; 3+ messages in thread
From: Hongxu Jia @ 2014-11-08  9:04 UTC (permalink / raw)
  To: openembedded-core, ross.burton, mark.hatle

The following changes since commit 7bd03ac24114b2c6015144a37e0c3fb4037baea6:

  bitbake: toastergui: fix invalid build url usage (2014-11-06 16:45:23 +0000)

are available in the git repository at:

  git://git.pokylinux.org/poky-contrib hongxu/fix-doc-2
  http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=hongxu/fix-doc-2

Hongxu Jia (1):
  compress_doc.bbclass: support update-alternatives

 meta/classes/compress_doc.bbclass | 46 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 45 insertions(+), 1 deletion(-)

-- 
1.9.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] compress_doc.bbclass: support update-alternatives
  2014-11-08  9:04 [PATCH 0/1] compress_doc.bbclass: support update-alternatives Hongxu Jia
@ 2014-11-08  9:04 ` Hongxu Jia
  2014-11-25  6:46 ` [PATCH 0/1] " Hongxu Jia
  1 sibling, 0 replies; 3+ messages in thread
From: Hongxu Jia @ 2014-11-08  9:04 UTC (permalink / raw)
  To: openembedded-core, ross.burton, mark.hatle

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
...

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 meta/classes/compress_doc.bbclass | 46 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 45 insertions(+), 1 deletion(-)

diff --git a/meta/classes/compress_doc.bbclass b/meta/classes/compress_doc.bbclass
index 6a4e635..b84fef6 100644
--- a/meta/classes/compress_doc.bbclass
+++ b/meta/classes/compress_doc.bbclass
@@ -29,7 +29,7 @@ DOC_DECOMPRESS_CMD[gz] ?= 'gunzip -v'
 DOC_DECOMPRESS_CMD[bz2] ?= "bunzip2 -v"
 DOC_DECOMPRESS_CMD[xz] ?= "unxz -v"
 
-PACKAGE_PREPROCESS_FUNCS += "package_do_compress_doc"
+PACKAGE_PREPROCESS_FUNCS += "package_do_compress_doc compress_doc_updatealternatives"
 python package_do_compress_doc() {
     compress_mode = d.getVar('DOC_COMPRESS', True)
     compress_list = (d.getVar('DOC_COMPRESS_LIST', True) or '').split()
@@ -211,3 +211,47 @@ def decompress_doc(topdir, compress_mode, decompress_cmds):
 
     _process_hardlink(hardlink_dict, compress_mode, decompress_cmds, decompress)
 
+python compress_doc_updatealternatives () {
+    if not bb.data.inherits_class('update-alternatives', d):
+        return
+
+    mandir = d.getVar("mandir", True)
+    infodir = d.getVar("infodir", True)
+    compress_mode = d.getVar('DOC_COMPRESS', True)
+    for pkg in (d.getVar('PACKAGES', True) or "").split():
+        old_names = (d.getVar('ALTERNATIVE_%s' % pkg, True) or "").split()
+        new_names = []
+        for old_name in old_names:
+            old_link     = d.getVarFlag('ALTERNATIVE_LINK_NAME', old_name, True)
+            old_target   = d.getVarFlag('ALTERNATIVE_TARGET_%s' % pkg, old_name, True) or \
+                d.getVarFlag('ALTERNATIVE_TARGET', old_name, True) or \
+                d.getVar('ALTERNATIVE_TARGET_%s' % pkg, True) or \
+                d.getVar('ALTERNATIVE_TARGET', True) or \
+                old_link
+            # Sometimes old_target is specified as relative to the link name.
+            old_target   = os.path.join(os.path.dirname(old_link), old_target)
+
+            # The updatealternatives used for compress doc
+            if mandir in old_target or infodir in old_target:
+                new_name = old_name + '.' + compress_mode
+                new_link = old_link + '.' + compress_mode
+                new_target = old_target + '.' + compress_mode
+                d.delVarFlag('ALTERNATIVE_LINK_NAME', old_name)
+                d.setVarFlag('ALTERNATIVE_LINK_NAME', new_name, new_link)
+                if d.getVarFlag('ALTERNATIVE_TARGET_%s' % pkg, old_name, True):
+                    d.delVarFlag('ALTERNATIVE_TARGET_%s' % pkg, old_name)
+                    d.setVarFlag('ALTERNATIVE_TARGET_%s' % pkg, new_name, new_target)
+                elif d.getVarFlag('ALTERNATIVE_TARGET', old_name, True):
+                    d.delVarFlag('ALTERNATIVE_TARGET', old_name)
+                    d.setVarFlag('ALTERNATIVE_TARGET', new_name, new_target)
+                elif d.getVar('ALTERNATIVE_TARGET_%s' % pkg, True):
+                    d.setVar('ALTERNATIVE_TARGET_%s' % pkg, new_target)
+                elif d.getVar('ALTERNATIVE_TARGET', old_name, True):
+                    d.setVar('ALTERNATIVE_TARGET', new_target)
+
+                new_names.append(new_name)
+
+        if new_names:
+            d.setVar('ALTERNATIVE_%s' % pkg, ' '.join(new_names))
+}
+
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 0/1] compress_doc.bbclass: support update-alternatives
  2014-11-08  9:04 [PATCH 0/1] compress_doc.bbclass: support update-alternatives Hongxu Jia
  2014-11-08  9:04 ` [PATCH 1/1] " Hongxu Jia
@ 2014-11-25  6:46 ` Hongxu Jia
  1 sibling, 0 replies; 3+ messages in thread
From: Hongxu Jia @ 2014-11-25  6:46 UTC (permalink / raw)
  To: openembedded-core, ross.burton, mark.hatle

On 11/08/2014 05:04 PM, Hongxu Jia wrote:
> The following changes since commit 7bd03ac24114b2c6015144a37e0c3fb4037baea6:
>
>    bitbake: toastergui: fix invalid build url usage (2014-11-06 16:45:23 +0000)
>
> are available in the git repository at:
>
>    git://git.pokylinux.org/poky-contrib hongxu/fix-doc-2
>    http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=hongxu/fix-doc-2

Ping

//Hongxu

> Hongxu Jia (1):
>    compress_doc.bbclass: support update-alternatives
>
>   meta/classes/compress_doc.bbclass | 46 ++++++++++++++++++++++++++++++++++++++-
>   1 file changed, 45 insertions(+), 1 deletion(-)
>



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-11-25  6:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-08  9:04 [PATCH 0/1] compress_doc.bbclass: support update-alternatives Hongxu Jia
2014-11-08  9:04 ` [PATCH 1/1] " Hongxu Jia
2014-11-25  6:46 ` [PATCH 0/1] " Hongxu Jia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox