summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2012-02-28 14:36:03 +0200
committerTimo Teräs <timo.teras@iki.fi>2012-02-28 14:36:03 +0200
commitfd812dc722cad1bcdbf98799a036e94c88b1b9b0 (patch)
tree7565564bde784a1725356c7acc18c8f03ca505b5 /src
parentef53dd52c54e1b8ff52a5bd2373f31c1709cbbee (diff)
downloadapk-tools-fd812dc722cad1bcdbf98799a036e94c88b1b9b0.tar.gz
apk-tools-fd812dc722cad1bcdbf98799a036e94c88b1b9b0.tar.bz2
apk-tools-fd812dc722cad1bcdbf98799a036e94c88b1b9b0.tar.xz
apk-tools-fd812dc722cad1bcdbf98799a036e94c88b1b9b0.zip
lua: fix bindings, and build by default
Diffstat (limited to 'src')
-rw-r--r--src/Makefile1
-rw-r--r--src/lua-apk.c13
2 files changed, 4 insertions, 10 deletions
diff --git a/src/Makefile b/src/Makefile
index 9ec554f..253c251 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,5 +1,6 @@
PKGDEPS := openssl zlib
PKG_CONFIG ?= pkg-config
+LUAAPK ?= yes
# lua module
ifneq ($(LUAAPK),)
diff --git a/src/lua-apk.c b/src/lua-apk.c
index 45488c2..8e68c0f 100644
--- a/src/lua-apk.c
+++ b/src/lua-apk.c
@@ -202,25 +202,18 @@ static int Papk_exists(lua_State *L)
struct apk_database *db = checkdb(L, 1);
const char *depstr = luaL_checkstring(L, 2);
struct apk_dependency dep;
- struct apk_name *name;
struct apk_package *pkg;
- int i;
apk_blob_t blob = APK_BLOB_STR(depstr);
apk_blob_pull_dep(&blob, db, &dep);
if (APK_BLOB_IS_NULL(blob) || blob.len > 0)
goto ret_nil;
- name = dep.name;
- for (i = 0; i < name->pkgs->num; i++) {
- pkg = name->pkgs->item[i];
- if (pkg->ipkg != NULL)
- break;
- }
- if (i >= name->pkgs->num)
+ pkg = apk_pkg_get_installed(dep.name);
+ if (pkg == NULL)
goto ret_nil;
- if (!apk_dep_is_satisfied(&dep, pkg))
+ if (!apk_dep_is_materialized_or_provided(&dep, pkg))
goto ret_nil;
return push_package(L, pkg);