summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2014-01-01 15:49:25 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2014-01-01 15:49:25 +0000
commit33b1d8e9747ac4712a7a703d823110fcae7f749b (patch)
tree8e0e7fc92e93878c78f2831ab34f57190cdb1c2e
parentac9fd56075cccbdff9e27ecc3eb959713da6dc72 (diff)
downloadlua-aports-33b1d8e9747ac4712a7a703d823110fcae7f749b.tar.bz2
lua-aports-33b1d8e9747ac4712a7a703d823110fcae7f749b.tar.xz
db: add each_in_build_order()
-rw-r--r--aports/db.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/aports/db.lua b/aports/db.lua
index 3f85920..a4ebd58 100644
--- a/aports/db.lua
+++ b/aports/db.lua
@@ -204,6 +204,28 @@ function Aports:each_need_build()
end)
end
+function Aports:each_in_build_order(namelist)
+ local pkgs = {}
+ for _,name in pairs(namelist) do
+ for pkg in self:each_pkg_with_name(name) do
+ pkgs[pkg.dir] = true
+ end
+ end
+
+ return coroutine.wrap(function()
+ for _,name in pairs(namelist) do
+ for dep in self:recursive_dependencies(name) do
+ for pkg in self:each_pkg_with_name(dep) do
+ if pkgs[pkg.dir] then
+ coroutine.yield(pkg)
+ pkgs[pkg.dir] = nil
+ end
+ end
+ end
+ end
+ end)
+end
+
function M.new(aportsdir, ...)
local h = Aports
h.aportsdir = aportsdir