lua: fix bindings, and build by default

cute-signatures
Timo Teräs 2012-02-28 14:36:03 +02:00
parent ef53dd52c5
commit fd812dc722
2 changed files with 4 additions and 10 deletions

View File

@ -1,5 +1,6 @@
PKGDEPS := openssl zlib PKGDEPS := openssl zlib
PKG_CONFIG ?= pkg-config PKG_CONFIG ?= pkg-config
LUAAPK ?= yes
# lua module # lua module
ifneq ($(LUAAPK),) ifneq ($(LUAAPK),)

View File

@ -202,25 +202,18 @@ static int Papk_exists(lua_State *L)
struct apk_database *db = checkdb(L, 1); struct apk_database *db = checkdb(L, 1);
const char *depstr = luaL_checkstring(L, 2); const char *depstr = luaL_checkstring(L, 2);
struct apk_dependency dep; struct apk_dependency dep;
struct apk_name *name;
struct apk_package *pkg; struct apk_package *pkg;
int i;
apk_blob_t blob = APK_BLOB_STR(depstr); apk_blob_t blob = APK_BLOB_STR(depstr);
apk_blob_pull_dep(&blob, db, &dep); apk_blob_pull_dep(&blob, db, &dep);
if (APK_BLOB_IS_NULL(blob) || blob.len > 0) if (APK_BLOB_IS_NULL(blob) || blob.len > 0)
goto ret_nil; goto ret_nil;
name = dep.name; pkg = apk_pkg_get_installed(dep.name);
for (i = 0; i < name->pkgs->num; i++) { if (pkg == NULL)
pkg = name->pkgs->item[i];
if (pkg->ipkg != NULL)
break;
}
if (i >= name->pkgs->num)
goto ret_nil; goto ret_nil;
if (!apk_dep_is_satisfied(&dep, pkg)) if (!apk_dep_is_materialized_or_provided(&dep, pkg))
goto ret_nil; goto ret_nil;
return push_package(L, pkg); return push_package(L, pkg);