Skip to contentSkip to conversation

base.bbclass: Don't warn about "invalid" PACKAGECONFIGs by default

PATCH In review Olof Johansson 3 participants 6 messages Jul 30, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 base.bbclass: Don't warn about "invalid" PACKAGECONFIGs by default

The recently added warnings for recipes that try to use undefined packageconfigs isn't compatible with the PACKAGECONFIG approach of exporting a common set of configs and letting the recipe look only at the configs they care about.

This change introduces a STRICT_PACKAGECONFIG variable that one can enable to get the warnings.

---
 meta/classes/base.bbclass | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
meta/classes/base.bbclass +6 -3
index e0f1053..6f652d8 100644
@@ -340,9 +340,12 @@ python () {
         pkgconfig = (d.getVar('PACKAGECONFIG', True) or "").split()
         pn = d.getVar("PN", True)
 
-        for pconfig in pkgconfig:
-            if pconfig not in pkgconfigflags:
-                bb.warn("%s: invalid PACKAGECONFIG: %s" % (pn, pconfig))
+        # If STRICT_PACKAGECONFIG is set, warn about recipes that sets undefined
+        # PACKAGECONFIGs.
+        if bb.utils.to_boolean(d.getVar("STRICT_PACKAGECONFIG", True)):
+            for pconfig in pkgconfig:
+                if pconfig not in pkgconfigflags:
+                    bb.warn("%s: invalid PACKAGECONFIG: %s" % (pn, pconfig))
 
         mlprefix = d.getVar("MLPREFIX", True)
 
Signature · 1 line
2.1.4
#1 lore raw
Quoted 5 lines · Olof Johansson

The recently added warnings for recipes that try to use undefined packageconfigs isn't compatible with the PACKAGECONFIG approach of exporting a common set of configs and letting the recipe look only at the configs they care about.

Can you elaborate on what this approach you refer to is?

Ross

#3 lore raw
In reply to Olof Johansson

Hello,

I have a new patch for this, it will be moved into insane.bbclass, and the recipe can set INSANE_SKIP:
+

+    # Check invalid PACKAGECONFIG
+    pkgconfig = (d.getVar("PACKAGECONFIG", True) or "").split()
+    if pkgconfig:
+        pkgconfigflags = d.getVarFlags("PACKAGECONFIG") or {}
+        for pconfig in pkgconfig:
+            if pconfig not in pkgconfigflags:
+                pn = d.getVar('PN', True)
+                error_msg = "%s: invalid PACKAGECONFIG: %s" % (pn, pconfig)
+                package_qa_handle_error("invalid-pkgconfig", error_msg, d)

I'm testing it, and will send it out sooner.

// Robert

Quoted 34 lines · Olof Johansson

The recently added warnings for recipes that try to use undefined packageconfigs isn't compatible with the PACKAGECONFIG approach of exporting a common set of configs and letting the recipe look only at the configs they care about.

This change introduces a STRICT_PACKAGECONFIG variable that one can enable to get the warnings.

---
  meta/classes/base.bbclass | 9 ++++++---
  1 file changed, 6 insertions(+), 3 deletions(-)
meta/classes/base.bbclass +6 -3
index e0f1053..6f652d8 100644
@@ -340,9 +340,12 @@ python () {
          pkgconfig = (d.getVar('PACKAGECONFIG', True) or "").split()
          pn = d.getVar("PN", True)
 
-        for pconfig in pkgconfig:
-            if pconfig not in pkgconfigflags:
-                bb.warn("%s: invalid PACKAGECONFIG: %s" % (pn, pconfig))
+        # If STRICT_PACKAGECONFIG is set, warn about recipes that sets undefined
+        # PACKAGECONFIGs.
+        if bb.utils.to_boolean(d.getVar("STRICT_PACKAGECONFIG", True)):
+            for pconfig in pkgconfig:
+                if pconfig not in pkgconfigflags:
+                    bb.warn("%s: invalid PACKAGECONFIG: %s" % (pn, pconfig))
 
          mlprefix = d.getVar("MLPREFIX", True)
 
#2 lore raw
In reply to Burton, Ross

Excerpts from Burton, Ross's message of 2015-07-30 11:53:39 +0200:

Quoted 1 line

Can you elaborate on what this approach you refer to is?

For some of our internal recipes, we export a list of PACKAGECONFIGs regardless of their use in the recipe. This is to make sure the list is synchronized over all the affected recipes.

Signature · 1 line
olof johansson
#4 lore raw
In reply to Robert Yang

Excerpts from Robert Yang's message of 2015-07-30 12:08:37 +0200:

Quoted 13 lines

I have a new patch for this, it will be moved into insane.bbclass, and the recipe can set INSANE_SKIP:

(quoted diff) +10 -0
+
+    # Check invalid PACKAGECONFIG
+    pkgconfig = (d.getVar("PACKAGECONFIG", True) or "").split()
+    if pkgconfig:
+        pkgconfigflags = d.getVarFlags("PACKAGECONFIG") or {}
+        for pconfig in pkgconfig:
+            if pconfig not in pkgconfigflags:
+                pn = d.getVar('PN', True)
+                error_msg = "%s: invalid PACKAGECONFIG: %s" % (pn, pconfig)
+                package_qa_handle_error("invalid-pkgconfig", error_msg, d)
Quoted 1 line

I'm testing it, and will send it out sooner.

Thanks, such a patch would work nicely with my use case!

Signature · 1 line
olof johansson
#5 lore raw
Quoted 14 lines · Olof Johansson

Excerpts from Robert Yang's message of 2015-07-30 12:08:37 +0200:

Quoted 13 lines

I have a new patch for this, it will be moved into insane.bbclass, and the recipe can set INSANE_SKIP:

(quoted diff) +10 -0
+
+    # Check invalid PACKAGECONFIG
+    pkgconfig = (d.getVar("PACKAGECONFIG", True) or "").split()
+    if pkgconfig:
+        pkgconfigflags = d.getVarFlags("PACKAGECONFIG") or {}
+        for pconfig in pkgconfig:
+            if pconfig not in pkgconfigflags:
+                pn = d.getVar('PN', True)
+                error_msg = "%s: invalid PACKAGECONFIG: %s" % (pn, pconfig)
+                package_qa_handle_error("invalid-pkgconfig", error_msg, d)
Quoted 3 lines
Quoted 1 line

I'm testing it, and will send it out sooner.

Thanks, such a patch would work nicely with my use case!

You're welcome, sent:

http://lists.openembedded.org/pipermail/openembedded-core/2015-July/108119.html

// Robert

Quoted 1 line