Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Register the FreeBSD version and use it
Baptiste Daroussin committed 8 years ago
commit f48e4f25fd00cebe5e307721c2094217e772c7a5
parent 1bbe636
2 files changed +8 -1
modified libpkg/pkg_create.c
@@ -46,6 +46,8 @@ static void counter_init(const char *what, int64_t max);
static void counter_count(void);
static void counter_end(void);

+
extern struct pkg_ctx ctx;
+

static int
pkg_create_from_dir(struct pkg *pkg, const char *root,
    struct packing *pkg_archive)
@@ -346,6 +348,11 @@ pkg_load_metadata(struct pkg *pkg, const char *mfile, const char *md_dir,

	/* if no arch autodetermine it */
	if (pkg->abi == NULL) {
+
#ifdef __FreeBSD__
+
		char *osversion;
+
		xasprintf(&osversion, "%d", ctx.osversion);
+
		pkg_kv_add(&pkg->annotations, "FreeBSD_version", osversion, "annotation");
+
#endif
		arch = pkg_object_string(pkg_config_get("ABI"));
		pkg->abi = xstrdup(arch);
		defaultarch = true;
modified libpkg/utils.c
@@ -354,7 +354,7 @@ is_valid_os_version(struct pkg *pkg)
	const char *errstr = NULL;
	int fbsdver;

-
	if ((fbsd_version = pkg_kv_get(&pkg->annotations, "freebsd_version")) != NULL) {
+
	if ((fbsd_version = pkg_kv_get(&pkg->annotations, "FreeBSD_version")) != NULL) {
		fbsdver = strtonum(fbsd_version, 1, INT_MAX, &errstr);
		if (errstr != NULL) {
			pkg_emit_error("Invalid FreeBSD version %s for package %s",