new: add resolve_depends option to resolve function

This commit is contained in:
ngn 2024-08-08 16:32:56 +03:00
parent ae83552e96
commit 8080299d7d
3 changed files with 10 additions and 10 deletions

View File

@ -74,8 +74,8 @@ lm_ctx_list_t *lm_ctx_list(lm_ctx_t *ctx, lm_ctx_list_t *list); // returns the s
lm_pkg_t *lm_ctx_list_next(lm_ctx_list_t *list); // returns the next package in the list
void lm_ctx_list_free(lm_ctx_list_t *list); // frees the package list state
lm_ctx_resolve_list_t *lm_ctx_resolve(
lm_ctx_t *ctx, lm_pkg_t *pkg, lm_ctx_resolve_list_t *list); // resolves a package and returns a list of packages
lm_ctx_resolve_list_t *lm_ctx_resolve(lm_ctx_t *ctx, lm_pkg_t *pkg, bool resolve_depends,
lm_ctx_resolve_list_t *list); // resolves a package and returns a list of packages
lm_pkg_t *lm_ctx_resolve_next(lm_ctx_resolve_list_t *list); // returns the next package in the list
void lm_ctx_resolve_free(lm_ctx_resolve_list_t *list); // frees the resolved list returned by lm_ctx_resolve

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-08 16:08+0300\n"
"POT-Creation-Date: 2024-08-08 16:32+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"

View File

@ -7,11 +7,11 @@
#include <stdlib.h>
#include <string.h>
bool __lm_ctx_resolve(lm_ctx_t *ctx, lm_ctx_resolve_list_t *list, lm_pkg_t *pkg){
bool __lm_ctx_resolve(lm_ctx_t *ctx, lm_ctx_resolve_list_t *list, lm_pkg_t *pkg, bool resolve_depends){
if(pkglist_contains(list->packages, pkg))
return true;
if(NULL == pkg->data.depends)
if(!resolve_depends || NULL == pkg->data.depends)
goto end;
list->resolving = pkglist_add_top(list->resolving, pkg);
@ -34,7 +34,7 @@ bool __lm_ctx_resolve(lm_ctx_t *ctx, lm_ctx_resolve_list_t *list, lm_pkg_t *pkg)
return false;
}
if(!__lm_ctx_resolve(ctx, list, depend))
if(!__lm_ctx_resolve(ctx, list, depend, resolve_depends))
return false;
}
@ -45,7 +45,7 @@ end:
return true;
}
lm_ctx_resolve_list_t *lm_ctx_resolve(lm_ctx_t *ctx, lm_pkg_t *pkg, lm_ctx_resolve_list_t *list){
lm_ctx_resolve_list_t *lm_ctx_resolve(lm_ctx_t *ctx, lm_pkg_t *pkg, bool resolve_depends, lm_ctx_resolve_list_t *list){
if(NULL == ctx || NULL == pkg){
lm_error_set(LM_ERR_ArgNULL);
return NULL;
@ -56,7 +56,7 @@ lm_ctx_resolve_list_t *lm_ctx_resolve(lm_ctx_t *ctx, lm_pkg_t *pkg, lm_ctx_resol
bzero(list, sizeof(lm_ctx_resolve_list_t));
}
if(!__lm_ctx_resolve(ctx, list, pkg)){
if(!__lm_ctx_resolve(ctx, list, pkg, resolve_depends)){
pkglist_free(list->resolving);
pkglist_free(list->packages);
free(list);