]> git.e2factory.org Git - e2factory.git/commitdiff
ls-project: only show chroot groups for listed results
authorTobias Ulmer <tu@emlix.com>
Tue, 28 Feb 2017 19:40:57 +0000 (20:40 +0100)
committerTobias Ulmer <tu@emlix.com>
Tue, 28 Feb 2017 19:41:16 +0000 (20:41 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
Changelog
local/e2-ls-project.lua

index 48ef83caf6107574d41f87a5c726d0b86c49caad..f6856dc4e8ff2a50c442823660a48f99d1c49d6c 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,5 @@
 NEXT:
+ * ls-project <result> only shows chroot groups used by listed results
  * ls-project <result> only shows licences used by the listed sources
  * Add new source type "licence", providing licence info to build environment
  * Removed lazytag build mode, it was deprecated for a long time
index 92670112a58ea9708036c26b745619de76723f18..91f147d3059174ba9cfebe81dd027682c3b2720e 100644 (file)
@@ -93,6 +93,26 @@ local function e2_ls_project(arg)
     end
     table.sort(results)
 
+    local chrootgroups = {}
+    if opts.all then
+        for chrootgroup,_ in pairs(chroot.groups_byname) do
+            table.insert(chrootgroups, chrootgroup)
+        end
+    else
+        local seen = {}
+        for _,resultname in ipairs(results) do
+            local res = result.results[resultname]
+
+            for chrootgroup in res:chroot_list():iter() do
+                if not seen[chrootgroup] then
+                    table.insert(chrootgroups, chrootgroup)
+                    seen[chrootgroup] = true
+                end
+            end
+        end
+    end
+    table.sort(chrootgroups)
+
     local sources = {}
     if opts.all then
         for sourcename, _ in pairs(source.sources) do
@@ -333,9 +353,9 @@ local function e2_ls_project(arg)
     p1(s1, s2, "chroot groups")
     local s1 = " "
     local s2 = "|"
-    local len = #chroot.groups_sorted
-    for _,g in ipairs(chroot.groups_sorted) do
-        local grp = chroot.groups_byname[g]
+    local len = #chrootgroups
+    for _,chrootgroup in ipairs(chrootgroups) do
+        local grp = chroot.groups_byname[chrootgroup]
         len = len - 1
         if len == 0 then
             s2 = " "
@@ -344,9 +364,6 @@ local function e2_ls_project(arg)
         for file in grp:file_iter() do
             p3(s1, s2, "file", file:servloc())
         end
-        --[[if grp.groupid then
-            p3(s1, s2, "groupid", grp.groupid)
-        end]]
     end
 
     return true