summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2013-06-15 19:47:01 +0300
committerTimo Teräs <timo.teras@iki.fi>2013-06-15 19:48:30 +0300
commit5b02400b268e4e867a30cd76821ff7139502089e (patch)
treef48ed66e9bf5239419cf997564e5f4c94fbf4148
parentac0c7457c26dd4424ec6282293f3ebbcc1e63886 (diff)
downloadapk-tools-5b02400b268e4e867a30cd76821ff7139502089e.tar.gz
apk-tools-5b02400b268e4e867a30cd76821ff7139502089e.tar.bz2
apk-tools-5b02400b268e4e867a30cd76821ff7139502089e.tar.xz
apk-tools-5b02400b268e4e867a30cd76821ff7139502089e.zip
lua: use apk_dep_analyze
and remove the now unused apk_dep_is_materialized_or_provided which was superceded by apk_dep_analyze.
-rw-r--r--src/apk_package.h1
-rw-r--r--src/lua-apk.c5
-rw-r--r--src/package.c22
3 files changed, 2 insertions, 26 deletions
diff --git a/src/apk_package.h b/src/apk_package.h
index 3d6ee29..b04bd79 100644
--- a/src/apk_package.h
+++ b/src/apk_package.h
@@ -138,7 +138,6 @@ int apk_sign_ctx_mpart_cb(void *ctx, int part, apk_blob_t blob);
void apk_dep_from_pkg(struct apk_dependency *dep, struct apk_database *db,
struct apk_package *pkg);
int apk_dep_is_materialized(struct apk_dependency *dep, struct apk_package *pkg);
-int apk_dep_is_materialized_or_provided(struct apk_dependency *dep, struct apk_package *pkg);
int apk_dep_is_provided(struct apk_dependency *dep, struct apk_provider *p);
int apk_dep_analyze(struct apk_dependency *dep, struct apk_package *pkg);
char *apk_dep_snprintf(char *buf, size_t n, struct apk_dependency *dep);
diff --git a/src/lua-apk.c b/src/lua-apk.c
index 16bd734..28eee61 100644
--- a/src/lua-apk.c
+++ b/src/lua-apk.c
@@ -226,10 +226,9 @@ static int Papk_exists(lua_State *L)
if (pkg == NULL)
goto ret_nil;
- if (!apk_dep_is_materialized_or_provided(&dep, pkg))
- goto ret_nil;
+ if (apk_dep_analyze(&dep, pkg) & APK_DEP_SATISFIES)
+ return push_package(L, pkg);
- return push_package(L, pkg);
ret_nil:
lua_pushnil(L);
return 1;
diff --git a/src/package.c b/src/package.c
index 0bbaead..31321e7 100644
--- a/src/package.c
+++ b/src/package.c
@@ -377,28 +377,6 @@ int apk_dep_is_materialized(struct apk_dependency *dep, struct apk_package *pkg)
return dep->conflict;
}
-int apk_dep_is_materialized_or_provided(struct apk_dependency *dep, struct apk_package *pkg)
-{
- int i;
-
- if (pkg == NULL)
- return dep->conflict;
-
- if (dep->name == pkg->name)
- return apk_dep_is_materialized(dep, pkg);
-
- for (i = 0; i < pkg->provides->num; i++) {
- struct apk_provider p;
-
- if (pkg->provides->item[i].name != dep->name)
- continue;
- p = APK_PROVIDER_FROM_PROVIDES(pkg, &pkg->provides->item[i]);
- return apk_dep_is_provided(dep, &p);
- }
-
- return dep->conflict;
-}
-
int apk_dep_analyze(struct apk_dependency *dep, struct apk_package *pkg)
{
struct apk_dependency *p;