diff options
Diffstat (limited to 'aports/abuild.lua')
| -rw-r--r-- | aports/abuild.lua | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/aports/abuild.lua b/aports/abuild.lua index 50f0d3d..805bdb9 100644 --- a/aports/abuild.lua +++ b/aports/abuild.lua @@ -23,19 +23,29 @@ function M.get_conf(var) return abuild_conf[var] end -function M.get_arch() - if abuild_conf.CARCH then - return abuild_conf.CARCH +local function get_cached_var(var) + if abuild_conf[var] then + return abuild_conf[var] end - local f = io.popen(" . "..M.functions..' ; echo -n "$CARCH"') - abuild_conf.CARCH = f:read("*all") + local f = io.popen((' . %s ; echo -n "$%s"'):format(M.functions, var)) + abuild_conf[var] = f:read("*all") f:close() - return abuild_conf.CARCH + return abuild_conf[var] +end + +function M.get_arch() + return get_cached_var("CARCH") +end + +function M.get_libc() + return get_cached_var("CLIBC") end M.arch = M.get_arch() +M.libc = M.get_libc() M.repodest = M.get_conf("REPODEST") M.pkgdest = M.get_conf("PKGDEST") M.chost = M.get_conf("CHOST") + return M |
