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

@ -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);