diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2016-04-07 08:47:52 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2016-04-07 08:48:44 +0200 |
commit | 4de3a72e08487d44b2d4a57e7334d97cdebb8770 (patch) | |
tree | afcd6fc01633fb6d874e1c434560013860846a79 /aports | |
parent | 1c45eb6b334e404ad0d38fad9c87918dc3c1db91 (diff) | |
download | lua-aports-4de3a72e08487d44b2d4a57e7334d97cdebb8770.tar.bz2 lua-aports-4de3a72e08487d44b2d4a57e7334d97cdebb8770.tar.xz |
buildrepo: fix bug when repodest is set with buildrepo -d
we need to use the specified repodest when checking if package is built
or not
Diffstat (limited to 'aports')
-rw-r--r-- | aports/db.lua | 14 | ||||
-rw-r--r-- | aports/pkg.lua | 13 |
2 files changed, 18 insertions, 9 deletions
diff --git a/aports/db.lua b/aports/db.lua index 45e394e..09afaeb 100644 --- a/aports/db.lua +++ b/aports/db.lua @@ -116,7 +116,7 @@ local function apkbuilds_open(aportsdir, repos) return obj end -local function init_apkdb(aportsdir, repos) +local function init_apkdb(aportsdir, repos, repodest) local pkgdb = {} local revdeps = {} local apkbuilds = apkbuilds_open(aportsdir, repos) @@ -125,7 +125,7 @@ local function init_apkdb(aportsdir, repos) if pkgdb[a.pkgname] == nil then pkgdb[a.pkgname] = {} end - pkg.init(a) + pkg.init(a, repodest) table.insert(pkgdb[a.pkgname], a) -- add subpackages to package db local k,v @@ -296,11 +296,15 @@ function Aports:known_deps_exists(pkg) return true end -function M.new(aportsdir, ...) +function M.new(aportsdir, repos, repodest) local h = Aports h.aportsdir = aportsdir - h.repos = {...} - h.apks, h.revdeps = init_apkdb(aportsdir, h.repos) + if type(repos) == "table" then + h.repos = repos + else + h.repos = { repos } + end + h.apks, h.revdeps = init_apkdb(aportsdir, h.repos, repodest) if h.apks == nil then return nil, h.revdeps end diff --git a/aports/pkg.lua b/aports/pkg.lua index 9689ecf..b99bf68 100644 --- a/aports/pkg.lua +++ b/aports/pkg.lua @@ -59,11 +59,12 @@ function M.get_apk_file_name(pkg, name) end function M.get_apk_file_path(pkg, name) - if abuild.pkgdest ~= nil and abuild.pkgdest ~= "" then + local repodest = pkg.repodest or abuild.repodest + if pkg.repodest == nil and abuild.pkgdest ~= nil and abuild.pkgdest ~= "" then return abuild.pkgdest.."/"..M.get_apk_file_name(pkg, name) end - if abuild.repodest ~= nil and abuild.repodest ~= "" then - return abuild.repodest.."/"..M.get_repo_name(pkg).."/"..abuild.arch.."/"..M.get_apk_file_name(pkg, name) + if repodest ~= nil and repodest ~= "" then + return repodest.."/"..M.get_repo_name(pkg).."/"..abuild.arch.."/"..M.get_apk_file_name(pkg, name) end return pkg.dir.."/"..M.get_apk_file_name(pkg, name) end @@ -71,6 +72,9 @@ end function M.apk_file_exists(pkg, name) -- technically we check if it is readable... local filepath = M.get_apk_file_path(pkg, name) + if lfs.attributes(filepath) == nil then + io.stderr:write(("DEBUG: path=%s\n"):format(filepath)) + end return lfs.attributes(filepath) ~= nil end @@ -110,10 +114,11 @@ function M.each_dependency(pkg) end -function M.init(pkg) +function M.init(pkg, repodest) for k,v in pairs(M) do pkg[k] = v end + pkg.repodest = repodest end return M |