Skip to contentSkip to conversation

cooker: Sort task graph (dot) file output

PATCH New Richard Purdie 1 participant 2 messages Jan 28, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 cooker: Sort task graph (dot) file output

This means two different graph files can easily be compared, currently you'd have to sort them as the output is randomized.

---
 lib/bb/cooker.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
lib/bb/cooker.py +6 -6
index 28717f4..cd365f7 100644
@@ -856,12 +856,12 @@ class BBCooker:
 
         with open('task-depends.dot', 'w') as f:
             f.write("digraph depends {\n")
-            for task in depgraph["tdepends"]:
+            for task in sorted(depgraph["tdepends"]):
                 (pn, taskname) = task.rsplit(".", 1)
                 fn = depgraph["pn"][pn]["filename"]
                 version = depgraph["pn"][pn]["version"]
                 f.write('"%s.%s" [label="%s %s\\n%s\\n%s"]\n' % (pn, taskname, pn, taskname, version, fn))
-                for dep in depgraph["tdepends"][task]:
+                for dep in sorted(depgraph["tdepends"][task]):
                     f.write('"%s" -> "%s"\n' % (task, dep))
             f.write("}\n")
         logger.info("Task dependencies saved to 'task-depends.dot'")
@@ -869,18 +869,18 @@ class BBCooker:
         with open('recipe-depends.dot', 'w') as f:
             f.write("digraph depends {\n")
             pndeps = {}
-            for task in depgraph["tdepends"]:
+            for task in sorted(depgraph["tdepends"]):
                 (pn, taskname) = task.rsplit(".", 1)
                 if pn not in pndeps:
                     pndeps[pn] = set()
-                for dep in depgraph["tdepends"][task]:
+                for dep in sorted(depgraph["tdepends"][task]):
                     (deppn, deptaskname) = dep.rsplit(".", 1)
                     pndeps[pn].add(deppn)
-            for pn in pndeps:
+            for pn in sorted(pndeps):
                 fn = depgraph["pn"][pn]["filename"]
                 version = depgraph["pn"][pn]["version"]
                 f.write('"%s" [label="%s\\n%s\\n%s"]\n' % (pn, pn, version, fn))
-                for dep in pndeps[pn]:
+                for dep in sorted(pndeps[pn]):
                     if dep == pn:
                         continue
                     f.write('"%s" -> "%s"\n' % (pn, dep))
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/2 fetch/git: Add pack-refs command to mirror handling code

We've noticed issues on our infrastucture iterating over the many tag/branch/head reference files that some git repositories may contain.

By issuing the pack-refs command, we move these all to a single file which speeds up operations with the mirror repos in the downloads directory in general.

---
 lib/bb/fetch2/git.py | 1 +
 1 file changed, 1 insertion(+)
lib/bb/fetch2/git.py +1 -0
index 5ef8cd6..d34ea1d 100644
@@ -363,6 +363,7 @@ class Git(FetchMethod):
             progresshandler = GitProgressHandler(d)
             runfetchcmd(fetch_cmd, d, log=progresshandler, workdir=ud.clonedir)
             runfetchcmd("%s prune-packed" % ud.basecmd, d, workdir=ud.clonedir)
+            runfetchcmd("%s pack-refs --all" % ud.basecmd, d, workdir=ud.clonedir)
             runfetchcmd("%s pack-redundant --all | xargs -r rm" % ud.basecmd, d, workdir=ud.clonedir)
             try:
                 os.unlink(ud.fullmirror)
Signature · 1 line
2.7.4