Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
abi can now be configured
Baptiste Daroussin committed 14 years ago
commit b86b7695af9eeb841d5b644ef814cc66acd002b6
parent 41907b1
6 files changed +21 -6
modified libpkg/pkg.h
@@ -239,7 +239,8 @@ typedef enum _pkg_config_key {
	PKG_CONFIG_SYSLOG = 10,
	PKG_CONFIG_SHLIBS = 11,
	PKG_CONFIG_AUTODEPS = 12,
-
	PKG_CONFIG_SIGNED_REPOS = 13
+
	PKG_CONFIG_SIGNED_REPOS = 13,
+
	PKG_CONFIG_ABI = 14,
} pkg_config_key;

typedef enum {
modified libpkg/pkg_add.c
@@ -117,12 +117,12 @@ int
pkg_add(struct pkgdb *db, const char *path, int flags)
{
	const char *arch;
+
	const char *myarch;
	const char *origin;
	struct archive *a;
	struct archive_entry *ae;
	struct pkg *pkg = NULL;
	struct pkg_dep *dep = NULL;
-
	char myarch[BUFSIZ];
	bool extract = true;
	bool handle_rc = false;
	char dpath[MAXPATHLEN + 1];
@@ -160,7 +160,7 @@ pkg_add(struct pkgdb *db, const char *path, int flags)
	 * Check the architecture
	 */

-
	pkg_get_myarch(myarch, BUFSIZ);
+
	pkg_config_string(PKG_CONFIG_ABI, &myarch);
	pkg_get(pkg, PKG_ARCH, &arch, PKG_ORIGIN, &origin);

	if (fnmatch(myarch, arch, FNM_CASEFOLD) == FNM_NOMATCH) {
modified libpkg/pkg_config.c
@@ -59,6 +59,8 @@ struct config_entry {
	};
};

+
static char myabi[BUFSIZ];
+

static struct config_entry c[] = {
	[PKG_CONFIG_REPO] = {
		STRING,
@@ -143,6 +145,12 @@ static struct config_entry c[] = {
		"SIGNED_REPOS",
		"NO",
		{ NULL }
+
	},
+
	[PKG_CONFIG_ABI] = {
+
		STRING,
+
		"ABI",
+
		myabi,
+
		{ NULL }
	}
};

@@ -316,6 +324,7 @@ pkg_init(const char *path)
	size_t i;
	const char *val = NULL;

+
	pkg_get_myarch(myabi, BUFSIZ);
	if (parsed != false) {
		pkg_emit_error("pkg_init() must only be called once");
		return (EPKG_FATAL);
modified pkg/main.c
@@ -160,7 +160,6 @@ main(int argc, char **argv)
	int debug = 0;
	int version = 0;
	int ret = EXIT_SUCCESS;
-
	char myarch[BUFSIZ];
	const char *buf = NULL;
	bool b;
	struct pkg_config_kv *kv = NULL;
@@ -229,8 +228,8 @@ main(int argc, char **argv)

	if (version > 1) {
		printf("version: "PKGVERSION""GITHASH"\n");
-
		pkg_get_myarch(myarch, BUFSIZ);
-
		printf("abi: %s\n", myarch);
+
		pkg_config_string(PKG_CONFIG_ABI, &buf);
+
		printf("abi: %s\n", buf);
		pkg_config_string(PKG_CONFIG_DBDIR, &buf);
		printf("db dir: %s\n", buf);
		pkg_config_string(PKG_CONFIG_CACHEDIR, &buf);
modified pkg/pkg.conf.5
@@ -101,6 +101,8 @@ Analyse the elf to add dependencies (share libraries) that may have been
forgotten by the maintainer. default: off
.It Cm SIGNED_REPOS(boolean)
All the remote repositories should be signed. default: off
+
.It Cm ABI(string)
+
the abi of the package you want to install, by default the /bin/sh abi is used
.El
.Sh ENVIRONMENT
An environment variable with the same name as the option in the configuration 
modified pkg/register.c
@@ -139,6 +139,10 @@ exec_register(int argc, char **argv)
		errx(EX_USAGE, "missing -f flag");

	if (arch == NULL) {
+
		/*
+
		 * do not take the one from configuration on purpose
+
		 * but the real abi of the package
+
		 */
		pkg_get_myarch(myarch, BUFSIZ);
		pkg_set(pkg, PKG_ARCH, myarch);
	} else {