From c6040e954530fdaef48a9d2be9a556b29b037dd4 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Fri, 24 Jan 2014 10:41:30 +0000 Subject: pkg: implement all_apks_exists() function to check if all the apk files exists for given package --- aports/pkg.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 -- cgit v1.2.3