From d3f390389c53b065d98a03e537a0e7869ef24781 Mon Sep 17 00:00:00 2001 From: Keve Date: Thu, 14 Nov 2024 10:31:18 +0100 Subject: [PATCH] Add runtime library version information to verbose pkg -vv With pkg using external library dependencies, exact runtime information of these libraries is needed for efficient support. Add pkg_libversion to libpkg to report its own version. Report libpkg, libcurl, libarchive, sqlite and openssl runtime versions in verbose show_version_info. --- libpkg/pkg.h.in | 1 + libpkg/pkg_config.c | 6 ++++++ src/main.c | 11 +++++++++++ 3 files changed, 18 insertions(+) diff --git a/libpkg/pkg.h.in b/libpkg/pkg.h.in index ccf3644ba..2742af096 100644 --- a/libpkg/pkg.h.in +++ b/libpkg/pkg.h.in @@ -1484,6 +1484,7 @@ void pkg_event_register(pkg_event_cb cb, void *data); bool pkg_compiled_for_same_os_major(void); int pkg_ini(const char *, const char *, pkg_init_flags); int pkg_init(const char *, const char *); +const char *pkg_libversion(void); int pkg_initialized(void); void pkg_shutdown(void); diff --git a/libpkg/pkg_config.c b/libpkg/pkg_config.c index 596449eec..889c1c3ac 100644 --- a/libpkg/pkg_config.c +++ b/libpkg/pkg_config.c @@ -593,6 +593,12 @@ connect_evpipe(const char *evpipe) { } +const char * +pkg_libversion(void) +{ + return PKGVERSION; +} + int pkg_initialized(void) { diff --git a/src/main.c b/src/main.c index 68e9cb1b2..993219006 100644 --- a/src/main.c +++ b/src/main.c @@ -58,6 +58,11 @@ #include #include #include +#include + +#include +#include +#include #include "pkgcli.h" @@ -374,6 +379,12 @@ show_version_info(int version) if (version == 1) exit(EXIT_SUCCESS); + printf("%-24s: %s\n", "libpkg", pkg_libversion()); + printf("%-24s: %s\n", "libcurl", curl_version()); + printf("%-24s: %s\n", "libarchive", archive_version_string()); + printf("%-24s: %s\n", "sqlite", sqlite3_libversion()); + printf("%-24s: %s\n", "openssl", OpenSSL_version(OPENSSL_VERSION)); + config = pkg_config_dump(); printf("%s\n", config); free(config);