From: Michael Tremer Date: Tue, 5 Oct 2021 14:39:20 +0000 (+0000) Subject: util: Add simple function to convert dependencies into strings X-Git-Tag: 0.9.28~899 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=72e05cd7cf94325d42e686cb9e9f25257094aa1f;p=pakfire.git util: Add simple function to convert dependencies into strings Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/include/pakfire/util.h b/src/libpakfire/include/pakfire/util.h index 46e49715c..6f6d5cbb0 100644 --- a/src/libpakfire/include/pakfire/util.h +++ b/src/libpakfire/include/pakfire/util.h @@ -31,6 +31,7 @@ #include +const char* pakfire_dep2str(struct pakfire* pakfire, Id id); Id pakfire_parse_dep(struct pakfire* pakfire, const char* s); void pakfire_parse_deps(struct pakfire* pakfire, struct pakfire_package* pkg, void (*func)(struct pakfire_package* pkg, const char* dep), const char* deps); diff --git a/src/libpakfire/util.c b/src/libpakfire/util.c index d6529585e..a470221b5 100644 --- a/src/libpakfire/util.c +++ b/src/libpakfire/util.c @@ -47,6 +47,14 @@ #define NSEC_PER_SEC 1000000000 +const char* pakfire_dep2str(struct pakfire* pakfire, Id id) { + Pool* pool = pakfire_get_solv_pool(pakfire); + if (!pool) + return NULL; + + return pool_dep2str(pool, id); +} + static Id pakfire_parse_namespace(Pool* pool, const char* s) { const char* p = strchr(s, '('); if (!p)