Skip to contentSkip to conversation

OE eSDK related fixes

PATCH New Paul Eggleton 1 participant 4 messages Feb 6, 2017

lore
Share & tools
lore
#0 lore raw

cover OE eSDK related fixes

One fix directly relating to the extensible SDK in OE and two for the npm fetcher.

The following changes since commit 2a309cd20cddf3d2258bd00ad06b26452e6cc043:

bitbake: Bump version to 1.33.0 (develoment version) (2017-01-27 10:40:53 +0000)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib paule/bb-esdk-fixes
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=paule/bb-esdk-fixes

Paul Eggleton (3):
lib/bb/build: add tasksbetween() function fetch2/npm: handle items only in optionalDependencies fetch2/npm: fix handling of os field

 lib/bb/build.py      | 27 +++++++++++++++++++++++++++
 lib/bb/fetch2/npm.py |  8 +++++++-
 2 files changed, 34 insertions(+), 1 deletion(-)
Signature · 1 line
2.9.3
#1 lore raw

PATCH 1/3 lib/bb/build: add tasksbetween() function

Add a utility function that gives the list of dependent tasks between two specified tasks (just within the same recipe). This is intended to be able to be executed from recipe context so it uses the datastore rather than having access to the runqueue.

This will be used in OpenEmbedded-Core's populate_sdk_ext.bbclass to get the list of tasks between do_image_complete and do_build.

---
 lib/bb/build.py | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
lib/bb/build.py +27 -0
index c08ef89..0d0100a 100644
@@ -878,3 +878,30 @@ def preceedtask(task, with_recrdeptasks, d):
         if recrdeptask:
             preceed.update(recrdeptask.split())
     return preceed
+
+def tasksbetween(task_start, task_end, d):
+    """
+    Return the list of tasks between two tasks in the current recipe,
+    where task_start is to start at and task_end is the task to end at
+    (and task_end has a dependency chain back to task_start).
+    """
+    outtasks = []
+    tasks = list(filter(lambda k: d.getVarFlag(k, "task"), d.keys()))
+    def follow_chain(task, endtask, chain=None):
+        if not chain:
+            chain = []
+        chain.append(task)
+        for othertask in tasks:
+            if othertask == task:
+                continue
+            if task == endtask:
+                for ctask in chain:
+                    if ctask not in outtasks:
+                        outtasks.append(ctask)
+            else:
+                deps = d.getVarFlag(othertask, 'deps', False)
+                if task in deps:
+                    follow_chain(othertask, endtask, chain)
+        chain.pop()
+    follow_chain(task_start, task_end)
+    return outtasks
Signature · 1 line
2.9.3
#2 lore raw

PATCH 2/3 fetch2/npm: handle items only in optionalDependencies

In reply to Paul Eggleton

An npm package.json file has two dependency fields: dependencies and optionalDependencies. An item in optionalDependencies *may* also be listed in dependencies, but this is not required (and not necessary since if it's in optionalDependencies it will be optional, adding it to dependencies won't do anything). The code here was assuming that an optional dependency would always be in both, that's probably because that was true of the examples I was looking at at the time. To fix it, just add the optional ones to the list we're iterating over.

---
 lib/bb/fetch2/npm.py | 1 +
 1 file changed, 1 insertion(+)
lib/bb/fetch2/npm.py +1 -0
index 3e35292..8c32f81 100644
@@ -195,6 +195,7 @@ class Npm(FetchMethod):
 
         dependencies = pdata.get('dependencies', {})
         optionalDependencies = pdata.get('optionalDependencies', {})
+        dependencies.update(optionalDependencies)
         depsfound = {}
         optdepsfound = {}
         data[pkg]['deps'] = {}
Signature · 1 line
2.9.3
#3 lore raw

PATCH 3/3 fetch2/npm: fix handling of os field

In reply to Paul Eggleton

When I originally added this check I didn't quite understand how the values in this field should be expressed - it seems from reading the documentation if there is an entry starting with '!' then the list is a blacklist and we shouldn't expect "linux" to be in the list, or we'll end up skipping important dependencies.

This fixes fetching the "statsd" npm package.

Fixes [YOCTO #10760].

---
 lib/bb/fetch2/npm.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
lib/bb/fetch2/npm.py +6 -1
index 8c32f81..15b281f 100644
@@ -182,7 +182,12 @@ class Npm(FetchMethod):
             if pkg_os:
                 if not isinstance(pkg_os, list):
                     pkg_os = [pkg_os]
-                if 'linux' not in pkg_os or '!linux' in pkg_os:
+                blacklist = False
+                for item in pkg_os:
+                    if item.startswith('!'):
+                        blacklist = True
+                        break
+                if (not blacklist and 'linux' not in pkg_os) or '!linux' in pkg_os:
                     logger.debug(2, "Skipping %s since it's incompatible with Linux" % pkg)
                     return
         #logger.debug(2, "Output URL is %s - %s - %s" % (ud.basepath, ud.basename, ud.localfile))
Signature · 1 line
2.9.3