Openembedded Core Discussions
 help / color / mirror / Atom feed
* base.bbclass: Ensure PREFERRED_PROVIDER and PREFERRED_VERSION values are set for multilibs
@ 2011-08-05 15:41 Richard Purdie
  2011-08-08  8:57 ` Lu, Lianhao
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Purdie @ 2011-08-05 15:41 UTC (permalink / raw)
  To: openembedded-core

When running multilib builds its not intuitive for the specificed
versions/providers to be build in one case and the higher version in the
other. This patch mirrors the options unless they're already set.

There shouldn't be any effect if the MULTILIBS variable isn't set.

[YOCTO #1339]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index ff960cd..4aee847 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -139,6 +139,46 @@ def pkgarch_mapping(d):
         if d.getVar("TUNE_PKGARCH", True) == "armv7a-vfp-neon":
             d.setVar("TUNE_PKGARCH", "armv7a")
 
+def preferred_ml_updates(d):
+    # If any PREFERRED_PROVIDER or PREFERRED_VERSIONS are set,
+    # we need to mirror these variables in the multilib case
+    multilibs = d.getVar('MULTILIBS', True) or ""
+    if not multilibs:
+        return
+
+    prefixes = []
+    for ext in multilibs.split():
+        eext = ext.split(':')
+        if len(eext) > 1 and eext[0] == 'multilib':
+            prefixes.append(eext[1])
+
+    versions = []
+    providers = []
+    for v in d.keys():
+        if v.startswith("PREFERRED_VERSION_"):
+            versions.append(v)
+        if v.startswith("PREFERRED_PROVIDER_"):
+            providers.append(v)
+
+    for v in versions:
+        val = d.getVar(v, False)
+        pkg = v.replace("PREFERRED_VERSION_", "")
+        for p in prefixes:
+            newname = "PREFERRED_VERSION_" + p + "-" + pkg
+            if not d.getVar(newname, False):
+                d.setVar(newname, val)
+
+    for prov in providers:
+        val = d.getVar(prov, False)
+        pkg = prov.replace("PREFERRED_PROVIDER_", "")
+        virt = ""
+        if pkg.startswith("virtual/"):
+             pkg = pkg.replace("virtual/", "")
+             virt = "virtual/"
+        for p in prefixes:
+            newname = "PREFERRED_PROVIDER_" + virt + p + "-" + pkg
+            if not d.getVar(newname, False):
+                d.setVar(newname, p + "-" + val)
 
 addhandler base_eventhandler
 python base_eventhandler() {
@@ -211,6 +251,7 @@ python base_eventhandler() {
         if name == "ConfigParsed":
                 generate_git_config(e)
                 pkgarch_mapping(e.data)
+                preferred_ml_updates(e.data)
 
 	if not data in e.__dict__:
 		return





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

* Re: base.bbclass: Ensure PREFERRED_PROVIDER and PREFERRED_VERSION values are set for multilibs
  2011-08-05 15:41 base.bbclass: Ensure PREFERRED_PROVIDER and PREFERRED_VERSION values are set for multilibs Richard Purdie
@ 2011-08-08  8:57 ` Lu, Lianhao
  2011-08-09 14:17   ` Richard Purdie
  0 siblings, 1 reply; 3+ messages in thread
From: Lu, Lianhao @ 2011-08-08  8:57 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

Richard Purdie wrote on 2011-08-05:
> When running multilib builds its not intuitive for the specificed
> versions/providers to be build in one case and the higher version in the other.
> This patch mirrors the options unless they're already set.
> 
> There shouldn't be any effect if the MULTILIBS variable isn't set.
> 
> [YOCTO #1339]
> 
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> ---
> diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass index
> ff960cd..4aee847 100644 --- a/meta/classes/base.bbclass +++
> b/meta/classes/base.bbclass @@ -139,6 +139,46 @@ def pkgarch_mapping(d):
>          if d.getVar("TUNE_PKGARCH", True) == "armv7a-vfp-neon":
>              d.setVar("TUNE_PKGARCH", "armv7a")
> +def preferred_ml_updates(d):
> +    # If any PREFERRED_PROVIDER or PREFERRED_VERSIONS are set,
> +    # we need to mirror these variables in the multilib case
> +    multilibs = d.getVar('MULTILIBS', True) or ""
> +    if not multilibs:
> +        return
> +
> +    prefixes = []
> +    for ext in multilibs.split():
> +        eext = ext.split(':')
> +        if len(eext) > 1 and eext[0] == 'multilib':
> +            prefixes.append(eext[1])
> +
> +    versions = []
> +    providers = []
> +    for v in d.keys():
> +        if v.startswith("PREFERRED_VERSION_"):
> +            versions.append(v)
> +        if v.startswith("PREFERRED_PROVIDER_"):
> +            providers.append(v)
> +
> +    for v in versions:
> +        val = d.getVar(v, False)
> +        pkg = v.replace("PREFERRED_VERSION_", "")
> +        for p in prefixes:
> +            newname = "PREFERRED_VERSION_" + p + "-" + pkg
> +            if not d.getVar(newname, False):
> +                d.setVar(newname, val)
> +
> +    for prov in providers:
> +        val = d.getVar(prov, False)
> +        pkg = prov.replace("PREFERRED_PROVIDER_", "")
> +        virt = ""
> +        if pkg.startswith("virtual/"):
> +             pkg = pkg.replace("virtual/", "")
> +             virt = "virtual/"
> +        for p in prefixes:
> +            newname = "PREFERRED_PROVIDER_" + virt + p + "-" + pkg
> +            if not d.getVar(newname, False):
> +                d.setVar(newname, p + "-" + val)

How about the native and nativesdk packages? I think they should not be prefixed.

>  addhandler base_eventhandler
>  python base_eventhandler() {
> @@ -211,6 +251,7 @@ python base_eventhandler() {
>          if name == "ConfigParsed":
>                  generate_git_config(e)
>                  pkgarch_mapping(e.data)
> +                preferred_ml_updates(e.data)
> 
>  	if not data in e.__dict__:
>  		return
> 

Best Regards,
Lianhao




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

* Re: base.bbclass: Ensure PREFERRED_PROVIDER and PREFERRED_VERSION values are set for multilibs
  2011-08-08  8:57 ` Lu, Lianhao
@ 2011-08-09 14:17   ` Richard Purdie
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Purdie @ 2011-08-09 14:17 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On Mon, 2011-08-08 at 16:57 +0800, Lu, Lianhao wrote:
> Richard Purdie wrote on 2011-08-05:
> > When running multilib builds its not intuitive for the specificed
> > versions/providers to be build in one case and the higher version in the other.
> > This patch mirrors the options unless they're already set.
> > 
> > There shouldn't be any effect if the MULTILIBS variable isn't set.
> > 
> > [YOCTO #1339]
> > 
> > Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> ---
> > diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass index
> > ff960cd..4aee847 100644 --- a/meta/classes/base.bbclass +++
> > b/meta/classes/base.bbclass @@ -139,6 +139,46 @@ def pkgarch_mapping(d):
> >          if d.getVar("TUNE_PKGARCH", True) == "armv7a-vfp-neon":
> >              d.setVar("TUNE_PKGARCH", "armv7a")
> > +def preferred_ml_updates(d):
> > +    # If any PREFERRED_PROVIDER or PREFERRED_VERSIONS are set,
> > +    # we need to mirror these variables in the multilib case
> > +    multilibs = d.getVar('MULTILIBS', True) or ""
> > +    if not multilibs:
> > +        return
> > +
> > +    prefixes = []
> > +    for ext in multilibs.split():
> > +        eext = ext.split(':')
> > +        if len(eext) > 1 and eext[0] == 'multilib':
> > +            prefixes.append(eext[1])
> > +
> > +    versions = []
> > +    providers = []
> > +    for v in d.keys():
> > +        if v.startswith("PREFERRED_VERSION_"):
> > +            versions.append(v)
> > +        if v.startswith("PREFERRED_PROVIDER_"):
> > +            providers.append(v)
> > +
> > +    for v in versions:
> > +        val = d.getVar(v, False)
> > +        pkg = v.replace("PREFERRED_VERSION_", "")
> > +        for p in prefixes:
> > +            newname = "PREFERRED_VERSION_" + p + "-" + pkg
> > +            if not d.getVar(newname, False):
> > +                d.setVar(newname, val)
> > +
> > +    for prov in providers:
> > +        val = d.getVar(prov, False)
> > +        pkg = prov.replace("PREFERRED_PROVIDER_", "")
> > +        virt = ""
> > +        if pkg.startswith("virtual/"):
> > +             pkg = pkg.replace("virtual/", "")
> > +             virt = "virtual/"
> > +        for p in prefixes:
> > +            newname = "PREFERRED_PROVIDER_" + virt + p + "-" + pkg
> > +            if not d.getVar(newname, False):
> > +                d.setVar(newname, p + "-" + val)
> 
> How about the native and nativesdk packages? I think they should not be prefixed.

Agreed. I've merged this with a tweak to stop the preferred
version/provider code taking effect for native/nativesdk packages.

Cheers,

Richard




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

end of thread, other threads:[~2011-08-09 14:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-05 15:41 base.bbclass: Ensure PREFERRED_PROVIDER and PREFERRED_VERSION values are set for multilibs Richard Purdie
2011-08-08  8:57 ` Lu, Lianhao
2011-08-09 14:17   ` Richard Purdie

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