All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] BitBake support for accessing world targets list
@ 2016-01-22 11:52 Paul Eggleton
  2016-01-22 11:52 ` [PATCH 1/1] taskdata: add the ability to access " Paul Eggleton
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Eggleton @ 2016-01-22 11:52 UTC (permalink / raw)
  To: bitbake-devel

The following changes since commit 4eb15605a1436631b3673bdba39af14bcb3a0e6d:

  tests/codeparser.py: Add filename/lineno flags to test variable (2016-01-19 17:42:20 +0000)

are available in the git repository at:

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

Paul Eggleton (1):
  taskdata: add the ability to access world targets list

 lib/bb/cache.py     |  5 ++++-
 lib/bb/cooker.py    | 24 +-----------------------
 lib/bb/providers.py | 26 ++++++++++++++++++++++++++
 lib/bb/taskdata.py  | 17 +++++++++++++++++
 4 files changed, 48 insertions(+), 24 deletions(-)

-- 
2.5.0



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

* [PATCH 1/1] taskdata: add the ability to access world targets list
  2016-01-22 11:52 [PATCH 0/1] BitBake support for accessing world targets list Paul Eggleton
@ 2016-01-22 11:52 ` Paul Eggleton
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Eggleton @ 2016-01-22 11:52 UTC (permalink / raw)
  To: bitbake-devel

In certain circumstances it can be useful to get access to the world
targets list from a recipe in order to add dependencies on some or all
of the items in it. If a special function, 'calculate_extra_depends' is
defined in the recipe, and the recipe is to be built, then call it at
the right point before we calculate which tasks should be run. The
function can append items to the "deps" list in order to add
dependencies. This is not as tidy a solution as I would have liked, but
it does at least do the job.

As part of this change, the buildWorldTargets function was moved to
bb.providers to make it possible to call from taskdata.

Part of the implementation of [YOCTO #8600].

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 lib/bb/cache.py     |  5 ++++-
 lib/bb/cooker.py    | 24 +-----------------------
 lib/bb/providers.py | 26 ++++++++++++++++++++++++++
 lib/bb/taskdata.py  | 17 +++++++++++++++++
 4 files changed, 48 insertions(+), 24 deletions(-)

diff --git a/lib/bb/cache.py b/lib/bb/cache.py
index 10b0853..c70b82e 100644
--- a/lib/bb/cache.py
+++ b/lib/bb/cache.py
@@ -43,7 +43,7 @@ except ImportError:
     logger.info("Importing cPickle failed. "
                 "Falling back to a very slow implementation.")
 
-__cache_version__ = "148"
+__cache_version__ = "149"
 
 def getCacheFile(path, filename, data_hash):
     return os.path.join(path, filename + "." + data_hash)
@@ -144,6 +144,7 @@ class CoreRecipeInfo(RecipeInfoCommon):
         self.fakerootenv      = self.getvar('FAKEROOTENV', metadata)
         self.fakerootdirs     = self.getvar('FAKEROOTDIRS', metadata)
         self.fakerootnoenv    = self.getvar('FAKEROOTNOENV', metadata)
+        self.extradepsfunc    = self.getvar('calculate_extra_depends', metadata)
 
     @classmethod
     def init_cacheData(cls, cachedata):
@@ -179,6 +180,7 @@ class CoreRecipeInfo(RecipeInfoCommon):
         cachedata.fakerootenv = {}
         cachedata.fakerootnoenv = {}
         cachedata.fakerootdirs = {}
+        cachedata.extradepsfunc = {}
 
     def add_cacheData(self, cachedata, fn):
         cachedata.task_deps[fn] = self.task_deps
@@ -245,6 +247,7 @@ class CoreRecipeInfo(RecipeInfoCommon):
         cachedata.fakerootenv[fn] = self.fakerootenv
         cachedata.fakerootnoenv[fn] = self.fakerootnoenv
         cachedata.fakerootdirs[fn] = self.fakerootdirs
+        cachedata.extradepsfunc[fn] = self.extradepsfunc
 
 
 
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index 74190ec..9c58d95 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -1109,28 +1109,6 @@ class BBCooker:
         tree = self.generatePkgDepTreeData(pkgs, 'build')
         bb.event.fire(bb.event.TargetsTreeGenerated(tree), self.data)
 
-    def buildWorldTargetList(self):
-        """
-         Build package list for "bitbake world"
-        """
-        parselog.debug(1, "collating packages for \"world\"")
-        for f in self.recipecache.possible_world:
-            terminal = True
-            pn = self.recipecache.pkg_fn[f]
-
-            for p in self.recipecache.pn_provides[pn]:
-                if p.startswith('virtual/'):
-                    parselog.debug(2, "World build skipping %s due to %s provider starting with virtual/", f, p)
-                    terminal = False
-                    break
-                for pf in self.recipecache.providers[p]:
-                    if self.recipecache.pkg_fn[pf] != pn:
-                        parselog.debug(2, "World build skipping %s due to both us and %s providing %s", f, pf, p)
-                        terminal = False
-                        break
-            if terminal:
-                self.recipecache.world_target.add(pn)
-
     def interactiveMode( self ):
         """Drop off into a shell"""
         try:
@@ -1591,7 +1569,7 @@ class BBCooker:
                 parselog.warn("Explicit target \"%s\" is in ASSUME_PROVIDED, ignoring" % pkg)
 
         if 'world' in pkgs_to_build:
-            self.buildWorldTargetList()
+            bb.providers.buildWorldTargetList(self.recipecache)
             pkgs_to_build.remove('world')
             for t in self.recipecache.world_target:
                 pkgs_to_build.append(t)
diff --git a/lib/bb/providers.py b/lib/bb/providers.py
index 637e1fa..68c8d59 100644
--- a/lib/bb/providers.py
+++ b/lib/bb/providers.py
@@ -379,3 +379,29 @@ def getRuntimeProviders(dataCache, rdepend):
             logger.debug(1, "Assuming %s is a dynamic package, but it may not exist" % rdepend)
 
     return rproviders
+
+
+def buildWorldTargetList(dataCache):
+    """
+    Build package list for "bitbake world"
+    """
+    if dataCache.world_target:
+        return
+
+    logger.debug(1, "collating packages for \"world\"")
+    for f in dataCache.possible_world:
+        terminal = True
+        pn = dataCache.pkg_fn[f]
+
+        for p in dataCache.pn_provides[pn]:
+            if p.startswith('virtual/'):
+                logger.debug(2, "World build skipping %s due to %s provider starting with virtual/", f, p)
+                terminal = False
+                break
+            for pf in dataCache.providers[p]:
+                if dataCache.pkg_fn[pf] != pn:
+                    logger.debug(2, "World build skipping %s due to both us and %s providing %s", f, pf, p)
+                    terminal = False
+                    break
+        if terminal:
+            dataCache.world_target.add(pn)
diff --git a/lib/bb/taskdata.py b/lib/bb/taskdata.py
index b083870..12e8caf 100644
--- a/lib/bb/taskdata.py
+++ b/lib/bb/taskdata.py
@@ -172,6 +172,8 @@ class TaskData:
         if fnid in self.tasks_fnid:
             return
 
+        self.add_extra_deps(fn, dataCache)
+
         for task in task_deps['tasks']:
 
             # Work out task dependencies
@@ -242,6 +244,21 @@ class TaskData:
                 self.fail_fnid(fnid)
                 return
 
+    def add_extra_deps(self, fn, dataCache):
+        func = dataCache.extradepsfunc.get(fn, None)
+        if func:
+            bb.providers.buildWorldTargetList(dataCache)
+            pn = dataCache.pkg_fn[fn]
+            params = {'deps': dataCache.deps[fn],
+                      'world_target': dataCache.world_target,
+                      'pkg_pn': dataCache.pkg_pn,
+                      'self_pn': pn}
+            funcname = '_%s_calculate_extra_depends' % pn.replace('-', '_')
+            paramlist = ','.join(params.keys())
+            func = 'def %s(%s):\n%s\n\n%s(%s)' % (funcname, paramlist, func, funcname, paramlist)
+            bb.utils.better_exec(func, params)
+
+
     def have_build_target(self, target):
         """
         Have we a build target matching this name?
-- 
2.5.0



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

end of thread, other threads:[~2016-01-22 11:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-22 11:52 [PATCH 0/1] BitBake support for accessing world targets list Paul Eggleton
2016-01-22 11:52 ` [PATCH 1/1] taskdata: add the ability to access " Paul Eggleton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.