All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bb.build.addtask: add simple check for circular dependency
@ 2019-01-17 18:15 Ulf Samuelsson
  2019-01-17 21:05 ` Richard Purdie
  0 siblings, 1 reply; 12+ messages in thread
From: Ulf Samuelsson @ 2019-01-17 18:15 UTC (permalink / raw)
  To: yocto, richard.purdie

 From 864e49bedbdab480c5ada9588ce8f980f23919dd Mon Sep 17 00:00:00 2001
From: Ulf Samuelsson <ulf@emagii.com>
Date: Thu, 17 Jan 2019 19:07:17 +0100
Subject: [PATCH] bb.build.addtask: add simple check for circular dependency

Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
---
  bitbake/lib/bb/build.py | 48 
++++++++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 48 insertions(+)

diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
index 3e2a94e..887ced1 100644
--- a/bitbake/lib/bb/build.py
+++ b/bitbake/lib/bb/build.py
@@ -43,6 +43,25 @@ logger = logging.getLogger('BitBake.Build')

  __mtime_cache = {}

+KNOWN_TASKS = {
+    'do_fetch' :           1 ,
+    'do_unpack' :          2 ,
+    'do_patch' :           3 ,
+    'do_configure' :       4 ,
+    'do_compile' :         5 ,
+    'do_install' :         6 ,
+    'do_package' :         7 ,
+    'do_package_data' :    8 ,
+    'do_rootfs' :          9 ,
+    'do_image_qa' :       10 ,
+    'do_image' :          11 ,
+    'do_image_tar' :      12 ,
+    'do_image_ubifs' :    12 ,
+    'do_image_jffs2' :    12 ,
+    'do_image_complete' : 13 ,
+    'do_build' :          14
+}
+
  def cached_mtime_noerror(f):
      if f not in __mtime_cache:
          try:
@@ -820,7 +839,34 @@ def add_tasks(tasklist, d):
      # don't assume holding a reference
      d.setVar('_task_deps', task_deps)

+def circular(after, before):
+    if after == None:
+        return False
+    if before == None:
+        return False
+    for a in after.split():
+        if a in KNOWN_TASKS:
+            for b in before.split():
+                if a == b:
+                    return True
+                if b in KNOWN_TASKS:
+                    if KNOWN_TASKS[b] < KNOWN_TASKS[a]:
+                        return True
+                    else:
+                        # tasks OK
+                        pass
+                else:
+                    # b is unknown
+                    pass
+        else:
+            # a is unknown
+            pass
+
  def addtask(task, before, after, d):
+    if circular(after, before):
+        logger.error("addtask: %s cannot be after %s and before %s" % 
(task, after, before))
+        raise
+
      if task[:3] != "do_":
          task = "do_" + task

@@ -909,3 +955,5 @@ def tasksbetween(task_start, task_end, d):
          chain.pop()
      follow_chain(task_start, task_end)
      return outtasks
+
+
-- 
2.7.4


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

end of thread, other threads:[~2019-01-18 16:07 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-17 18:15 [PATCH] bb.build.addtask: add simple check for circular dependency Ulf Samuelsson
2019-01-17 21:05 ` Richard Purdie
2019-01-17 22:50   ` Ulf Samuelsson
2019-01-17 23:17     ` Burton, Ross
2019-01-18  4:30       ` Ulf Samuelsson
2019-01-18 11:29         ` Richard Purdie
2019-01-18 14:16           ` Ulf Samuelsson
2019-01-18 14:40             ` Richard Purdie
2019-01-18 15:07               ` Ulf Samuelsson
2019-01-18 15:34                 ` Burton, Ross
2019-01-18 15:56                   ` Alexander Kanavin
2019-01-18 16:07                     ` Ulf Samuelsson

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.