diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2011-07-06 06:30:42 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2011-07-06 06:30:42 +0000 |
commit | 781a4537341035238ae6b6f5e63ca1e991b9642c (patch) | |
tree | d98f6b1177240c9cd7a95d6b8db2f882f4711c94 | |
parent | 66501a24b419d6bc3c2506a42b639bde5e42d4e5 (diff) | |
download | abuild-781a4537341035238ae6b6f5e63ca1e991b9642c.tar.gz abuild-781a4537341035238ae6b6f5e63ca1e991b9642c.tar.bz2 abuild-781a4537341035238ae6b6f5e63ca1e991b9642c.tar.xz abuild-781a4537341035238ae6b6f5e63ca1e991b9642c.zip |
ap: set default repodir
if there are an APKBUILD in current dir, then use ../ as repodir.
Otherwise, use cwd as repodir.
Introduces requirement of lua-filesystem
-rwxr-xr-x | ap.in | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -1,6 +1,7 @@ #!/usr/bin/lua require("aports") +require("lfs") local db @@ -105,6 +106,14 @@ if cmd == nil then return end +if #repodirs == 0 then + if lfs.attributes("APKBUILD") then + repodirs[1] = string.gsub(lfs.currentdir(), "(.*)/.*", "%1") + else + repodirs[1] = lfs.currentdir() + end +end + if subcmd[cmd] and type(subcmd[cmd].run) == "function" then db = aports.new(repodirs) subcmd[cmd].run(opts) |