From 8472efdaf400483d905198c53ba21b7759e76d8a Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Wed, 1 Jan 2014 13:03:06 +0000 Subject: db: pass aportsdir and a list repos to new() --- aports/db.lua | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'aports/db.lua') diff --git a/aports/db.lua b/aports/db.lua index a13c8b2..b59f1cb 100644 --- a/aports/db.lua +++ b/aports/db.lua @@ -43,15 +43,15 @@ local function split_apkbuild(line) end -- parse the APKBUILDs and return an iterator -local function parse_apkbuilds(dirs) +local function parse_apkbuilds(aportsdir, repos) local i,v, p local str="" - if dirs == nil then + if repos == nil then return nil end --expand repos - for i,v in ipairs(dirs) do - str = str..v.."/*/APKBUILD " + for _,repo in pairs(repos) do + str = ("%s %s/%s/*/APKBUILD"):format(str, aportsdir, repo) end local p = io.popen(". "..abuild.functions..";"..[[ @@ -82,11 +82,11 @@ local function parse_apkbuilds(dirs) end end -local function init_apkdb(repodirs) +local function init_apkdb(aportsdir, repos) local pkgdb = {} local revdeps = {} local a - for a in parse_apkbuilds(repodirs) do + for a in parse_apkbuilds(aportsdir, repos) do -- io.write(a.pkgname.." "..a.pkgver.."\t"..a.dir.."\n") if pkgdb[a.pkgname] == nil then pkgdb[a.pkgname] = {} @@ -194,10 +194,11 @@ function Aports:each_aport() end) end -function M.new(repodirs) +function M.new(aportsdir, ...) local h = Aports - h.repodirs = repodirs - h.apks, h.revdeps = init_apkdb(repodirs) + h.aportsdir = aportsdir + h.repos = {...} + h.apks, h.revdeps = init_apkdb(aportsdir, h.repos) return h end -- cgit v1.2.3