Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
pkg_external_libs_version: new function
Baptiste Daroussin committed 1 year ago
commit 740f5c13a1468c114a756c46cb2f825b6d41d411
parent a9eccd9
4 files changed +30 -9
modified external/libcurl/Makefile.autosetup
@@ -11,6 +11,7 @@ VPATH+= $(top_srcdir)/external/curl/lib/vauth
VPATH+=	$(top_srcdir)/external/curl/lib/vquic

SRCS=	\
+
	version.c \
	asyn-thread.c \
	base64.c \
	bufref.c \
modified libpkg/pkg.h.in
@@ -136,6 +136,8 @@ struct pkg_kv {
	char *value;
};

+
typedef pkgvec_t(struct pkg_kv *) pkg_kvl_t;
+

/**
 * The system-wide pkg(8) status: ie. is it a) installed or otherwise
 * available on the sysem, b) database (local.sqlite) initialised and
@@ -1734,6 +1736,7 @@ struct pkg_kv *pkg_kvlist_next(struct pkg_kvlist_iterator *it);
struct pkg_stringlist_iterator *pkg_stringlist_iterator(struct pkg_stringlist *l);
const char *pkg_stringlist_next(struct pkg_stringlist_iterator *it);
struct pkg_el *pkg_get_element(struct pkg *p, pkg_attr a);
+
pkg_kvl_t *pkg_external_libs_version(void);

static inline void
pkg_get_s(struct pkg *p, pkg_attr a, const char **val)
modified libpkg/pkg_config.c
@@ -42,6 +42,12 @@
#endif
#include <ucl.h>

+
#include <curl/curl.h>
+

+
#include <archive.h>
+
#include <sqlite3.h>
+
#include <openssl/crypto.h>
+

#include "pkg.h"
#include "private/pkg.h"
#include "private/event.h"
@@ -599,6 +605,20 @@ pkg_libversion(void)
	return PKGVERSION;
}

+
pkg_kvl_t *
+
pkg_external_libs_version(void)
+
{
+
	pkg_kvl_t *kvl = xcalloc(1, sizeof(*kvl));
+

+
	pkgvec_push(kvl, pkg_kv_new("libcurl", curl_version()));
+
	pkgvec_push(kvl, pkg_kv_new("libarchive", archive_version_string()));
+
	pkgvec_push(kvl, pkg_kv_new("sqlite", sqlite3_libversion()));
+
	pkgvec_push(kvl, pkg_kv_new("openssl", OpenSSL_version(OPENSSL_VERSION)));
+

+
	return (kvl);
+
}
+

+

int
pkg_initialized(void)
{
modified src/main.c
@@ -58,11 +58,6 @@
#include <pkg.h>
#include <tllist.h>
#include <xmalloc.h>
-
#include <curl/curl.h>
-

-
#include <archive.h>
-
#include <sqlite3.h>
-
#include <openssl/crypto.h>

#include "pkgcli.h"

@@ -371,6 +366,8 @@ static void
show_version_info(int version)
{
	char *config;
+
	pkg_kvl_t *lib;
+

	if (version > 1)
		printf("%-24s: ", "Version");

@@ -380,10 +377,10 @@ show_version_info(int version)
		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));
+

+
	lib = pkg_external_lib_version();
+
	for (size_t i = 0; i < lib->len; i++)
+
		printf("%-24s: %s\n", lib->d[i]->key, lib->d[i]->value);

	config = pkg_config_dump();
	printf("%s\n", config);