diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2014-01-24 10:41:30 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2014-01-24 10:41:30 +0000 |
commit | c6040e954530fdaef48a9d2be9a556b29b037dd4 (patch) | |
tree | 478d5138748215ba3f80255f81f87b1d2e4afd78 /aports | |
parent | 0818187fcf1c9edfc43244b3acbde74d0d2b6dba (diff) | |
download | lua-aports-c6040e954530fdaef48a9d2be9a556b29b037dd4.tar.bz2 lua-aports-c6040e954530fdaef48a9d2be9a556b29b037dd4.tar.xz |
pkg: implement all_apks_exists()
function to check if all the apk files exists for given package
Diffstat (limited to 'aports')
-rw-r--r-- | aports/pkg.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/aports/pkg.lua b/aports/pkg.lua index 01d8502..0614ec6 100644 --- a/aports/pkg.lua +++ b/aports/pkg.lua @@ -94,6 +94,18 @@ function M.apk_file_exists(pkg, name) return lfs.attributes(filepath) ~= nil end +function M.all_apks_exists(pkg) + if not pkg:apk_file_exists() then + return false + end + for _, subpkgname in pairs(pkg.subpackages) do + if not pkg:apk_file_exists(subpkgname) then + return false + end + end + return true +end + function M.arch_enabled(pkg) return pkg.arch.all or pkg.arch.noarch or pkg.arch[abuild.arch] end @@ -106,6 +118,7 @@ function M.init(pkg) pkg.get_apk_file_name = M.get_apk_file_name pkg.get_apk_file_path = M.get_apk_file_path pkg.apk_file_exists = M.apk_file_exists + pkg.all_apks_exists = M.all_apks_exists pkg.arch_enabled = M.arch_enabled end return M |