Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 1/2] base: improve PACKAGECONFIG handling logic
@ 2013-09-11 18:17 Ross Burton
  2013-09-11 18:17 ` [PATCH 2/2] base: add RRECOMMENDS to PACKAGECONFIG Ross Burton
  2013-09-12  3:30 ` [PATCH 1/2] base: improve PACKAGECONFIG handling logic Saul Wold
  0 siblings, 2 replies; 6+ messages in thread
From: Ross Burton @ 2013-09-11 18:17 UTC (permalink / raw)
  To: openembedded-core

The existing code for handling PACKAGECONFIG lists wasn't the cleanest Python
around.  Instead of diving into the list directly using indices and lengths, use
pop() to iterate through the list.

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 meta/classes/base.bbclass |   23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index dfa580c..37dc790 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -420,7 +420,7 @@ python () {
         def appendVar(varname, appends):
             if not appends:
                 return
-            if varname.find("DEPENDS") != -1:
+            if "DEPENDS_" in varname:
                 if pn.startswith("nativesdk-"):
                     appends = expandFilter(appends, "", "nativesdk-")
                 if pn.endswith("-native"):
@@ -442,12 +442,21 @@ python () {
                 bb.error("Only enable,disable,depend,rdepend can be specified!")
 
             if flag in pkgconfig:
-                if num >= 3 and items[2]:
-                    extradeps.append(items[2])
-                if num >= 4 and items[3]:
-                    extrardeps.append(items[3])
-                if num >= 1 and items[0]:
-                    extraconf.append(items[0])
+                if items:
+                    item = items.pop(0)
+                    if item:
+                        extraconf.append(item)
+                # Skip over disable
+                if items:
+                    items.pop(0)
+                if items:
+                    item = items.pop(0)
+                    if item:
+                        extradeps.append(item)
+                if items:
+                    item = items.pop(0)
+                    if item:
+                        extrardeps.append(item)
             elif num >= 2 and items[1]:
                     extraconf.append(items[1])
         appendVar('DEPENDS', extradeps)
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [PATCH 1/2] base: improve PACKAGECONFIG handling logic
@ 2013-09-10 17:15 Ross Burton
  2013-09-10 17:17 ` Burton, Ross
  0 siblings, 1 reply; 6+ messages in thread
From: Ross Burton @ 2013-09-10 17:15 UTC (permalink / raw)
  To: openembedded-core

The existing code for handling PACKAGECONFIG lists wasn't the cleanest Python
around.  Instead of diving into the list directly using indices and lengths, use
pop() to iterate through the list.

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 meta/classes/base.bbclass |   17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index dfa580c..12c8741 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -420,7 +420,7 @@ python () {
         def appendVar(varname, appends):
             if not appends:
                 return
-            if varname.find("DEPENDS") != -1:
+            if "DEPENDS_" in varname:
                 if pn.startswith("nativesdk-"):
                     appends = expandFilter(appends, "", "nativesdk-")
                 if pn.endswith("-native"):
@@ -442,12 +442,15 @@ python () {
                 bb.error("Only enable,disable,depend,rdepend can be specified!")
 
             if flag in pkgconfig:
-                if num >= 3 and items[2]:
-                    extradeps.append(items[2])
-                if num >= 4 and items[3]:
-                    extrardeps.append(items[3])
-                if num >= 1 and items[0]:
-                    extraconf.append(items[0])
+                if items:
+                    extraconf.append(items.pop(0))
+                # Skip over disable
+                if items:
+                    items.pop(0)
+                if items:
+                    extradeps.append(items.pop(0))
+                if items:
+                    extrardeps.append(items.pop(0))
             elif num >= 2 and items[1]:
                     extraconf.append(items[1])
         appendVar('DEPENDS', extradeps)
-- 
1.7.10.4



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

end of thread, other threads:[~2013-09-12  3:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-11 18:17 [PATCH 1/2] base: improve PACKAGECONFIG handling logic Ross Burton
2013-09-11 18:17 ` [PATCH 2/2] base: add RRECOMMENDS to PACKAGECONFIG Ross Burton
2013-09-12  3:30 ` [PATCH 1/2] base: improve PACKAGECONFIG handling logic Saul Wold
  -- strict thread matches above, loose matches on Subject: below --
2013-09-10 17:15 Ross Burton
2013-09-10 17:17 ` Burton, Ross
2013-09-10 18:49   ` Martin Jansa

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