Commit 5b02400b authored by Timo Teräs's avatar Timo Teräs

lua: use apk_dep_analyze

and remove the now unused apk_dep_is_materialized_or_provided
which was superceded by apk_dep_analyze.
parent ac0c7457
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment