summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-03-30 11:40:47 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2011-03-30 11:40:47 +0000
commit876e4f7a67c5281eef9cbfe0a7ec70b9005b594f (patch)
treeca9bcfe79288937c496c302cfd6c1f8c74b5aced
parent486959e2dbd516f9d7bce8493a1a55b9d890066e (diff)
downloadabuild-876e4f7a67c5281eef9cbfe0a7ec70b9005b594f.tar.bz2
abuild-876e4f7a67c5281eef9cbfe0a7ec70b9005b594f.tar.xz
ap: let builddirs use aports.recurs_until()
-rwxr-xr-xap.in34
1 files changed, 11 insertions, 23 deletions
diff --git a/ap.in b/ap.in
index b0b973e..7b69e05 100755
--- a/ap.in
+++ b/ap.in
@@ -51,35 +51,23 @@ subcmd.builddirs = {
run = function(opts)
local i, p, _
local visited = {}
- local apkdb, rev = aports.init_apkdb(repodirs)
+ local db, rev = aports.init_apkdb(repodirs)
local to_print = {}
- function recursdir(pn)
- if pn == nil or visited[pn] or apkdb[pn] == nil then
- return
- end
- visited[pn] = true
- local i, p
- for i,p in pairs(apkdb[pn]) do
- local _, d
- for _, d in pairs(p.depends) do
- recursdir(d)
- end
- for _, d in pairs(p.makedepends) do
- recursdir(d)
- end
- if to_print[p.dir] then
- print(p.dir)
- to_print[p.dir] = nil
- end
- end
- end
for i = 2, #opts do
- for _,p in pairs(apkdb[opts[i]]) do
+ for _,p in pairs(db[opts[i]]) do
to_print[p.dir] = true
end
end
for i = 2, #opts do
- recursdir(opts[i])
+ aports.recurs_until(db, opts[i], function(pn)
+ local j,p
+ for j, p in pairs(db[pn]) do
+ if to_print[p.dir] then
+ print(p.dir)
+ to_print[p.dir] = nil
+ end
+ end
+ end)
end
end
}