diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2011-09-30 11:50:28 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2013-12-16 13:39:17 +0000 |
commit | 6154adbc888a9912a434dc50bfeb5d9ecc3889cb (patch) | |
tree | 0580ca87697f577a6d70ba56afa1dfeb98cd9a79 | |
parent | fa045b965a62653adf357a8b958aec93e70a6a1d (diff) | |
download | lua-aports-6154adbc888a9912a434dc50bfeb5d9ecc3889cb.tar.bz2 lua-aports-6154adbc888a9912a434dc50bfeb5d9ecc3889cb.tar.xz |
aports.lua: add helper functions to find out the file paths
-rwxr-xr-x | aports.lua | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -154,6 +154,31 @@ function get_maintainer(pkg) return nil end +function get_repo_name(pkg) + if pkg == nil or pkg.dir == nil then + return nil + end + return string.match(pkg.dir, ".*/(.*)/.*") +end + +function get_apk_filename(pkg) + return pkg.pkgname.."-"..pkg.pkgver.."-r"..pkg.pkgrel..".apk" +end + +function get_apk_file_path(pkg) + local pkgdest = get_abuild_conf("PKGDEST") + if pkgdest ~= nil and pkgdest ~= "" then + return pkgdest.."/"..get_apk_filename(pkg) + end + local repodest = get_abuild_conf("REPODEST") + if repodest ~= nil and repodest ~= "" then + local arch = get_abuild_conf("CARCH") + return repodest.."/"..get_repo_name(pkg).."/"..arch.."/"..get_apk_filename(pkg) + end + return pkg.dir.."/"..get_apk_filename(pkg) +end + + local function init_apkdb(repodirs) local pkgdb = {} local revdeps = {} |