From 8080299d7d3ee1e96191b17524a1ba1fbb86672e Mon Sep 17 00:00:00 2001 From: ngn Date: Thu, 8 Aug 2024 16:32:56 +0300 Subject: [PATCH] new: add resolve_depends option to resolve function --- include/ctx.h | 8 ++++---- locale/tr/LC_MESSAGES/libmp.po | 2 +- src/ctx/resolve.c | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/ctx.h b/include/ctx.h index 4661082..be71e03 100644 --- a/include/ctx.h +++ b/include/ctx.h @@ -74,10 +74,10 @@ 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_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 +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 lm_ctx_update_list_t *lm_ctx_update_list(lm_ctx_t *ctx); // get a list of entries to update lm_entry_t *lm_ctx_update_list_next(lm_ctx_update_list_t *list); // get the next entry in the update list diff --git a/locale/tr/LC_MESSAGES/libmp.po b/locale/tr/LC_MESSAGES/libmp.po index 28b1f50..7358ada 100644 --- a/locale/tr/LC_MESSAGES/libmp.po +++ b/locale/tr/LC_MESSAGES/libmp.po @@ -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 \n" "Language-Team: LANGUAGE \n" diff --git a/src/ctx/resolve.c b/src/ctx/resolve.c index 3b5ba24..69b1b4f 100644 --- a/src/ctx/resolve.c +++ b/src/ctx/resolve.c @@ -7,11 +7,11 @@ #include #include -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);