From: Tobias Ulmer Date: Tue, 28 Feb 2017 19:40:57 +0000 (+0100) Subject: ls-project: only show chroot groups for listed results X-Git-Tag: e2factory-2.3.17~12 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=b114372bad170357da00ced62b9835fa4efc37ac;p=e2factory.git ls-project: only show chroot groups for listed results Signed-off-by: Tobias Ulmer --- diff --git a/Changelog b/Changelog index 48ef83c..f6856dc 100644 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ NEXT: + * ls-project only shows chroot groups used by listed results * ls-project 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 diff --git a/local/e2-ls-project.lua b/local/e2-ls-project.lua index 9267011..91f147d 100644 --- a/local/e2-ls-project.lua +++ b/local/e2-ls-project.lua @@ -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