Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Add a DISABLE_MTREE option, which just disables processing +MTREE data on package installation.
Matthew Seaman committed 12 years ago
commit ea492660ff4507931ed2fe36062e6d1bb6c5eb19
parent 41278e3
4 files changed +41 -5
modified libpkg/pkg.h.in
@@ -345,6 +345,7 @@ typedef enum _pkg_config_key {
	PKG_CONFIG_UNSET_TIMESTAMP,
	PKG_CONFIG_SSH_RESTRICT_DIR,
	PKG_CONFIG_ENV,
+
	PKG_CONFIG_DISABLE_MTREE,
} pkg_config_key;

typedef enum {
modified libpkg/pkg_add.c
@@ -162,6 +162,7 @@ pkg_add(struct pkgdb *db, const char *path, unsigned flags, struct pkg_manifest_
	struct pkg      *pkg_inst = NULL;
	bool		 extract = true;
	bool		 handle_rc = false;
+
	bool		 disable_mtree;
	char		 dpath[MAXPATHLEN + 1];
	const char	*basedir;
	const char	*ext;
@@ -274,9 +275,19 @@ pkg_add(struct pkgdb *db, const char *path, unsigned flags, struct pkg_manifest_
	if (retcode != EPKG_OK)
		goto cleanup;

-
	pkg_get(pkg, PKG_PREFIX, &prefix, PKG_MTREE, &mtree);
-
	if ((retcode = do_extract_mtree(mtree, prefix)) != EPKG_OK)
-
		goto cleanup_reg;
+
	/* MTREE replicates much of the standard functionality
+
	 * inplicit in the way pkg works.  It has to remain available
+
	 * in the ports for compatibility with the old pkg_tools, but
+
	 * ultimately, MTREE should be made redundant.  Use this for
+
	 * experimantal purposes and to develop MTREE-free versions of
+
	 * packages. */
+

+
	pkg_config_bool(PKG_CONFIG_DISABLE_MTREE, &disable_mtree);
+
	if (!disable_mtree) {
+
		pkg_get(pkg, PKG_PREFIX, &prefix, PKG_MTREE, &mtree);
+
		if ((retcode = do_extract_mtree(mtree, prefix)) != EPKG_OK)
+
			goto cleanup_reg;
+
	}

	/*
	 * Execute pre-install scripts
modified libpkg/pkg_config.c
@@ -266,8 +266,14 @@ static struct config_entry c[] = {
		PKG_CONFIG_KVLIST,
		"ENV",
		NULL,
-
		"Environement variable pkg will use",
-
	}
+
		"Environment variables pkg will use",
+
	},
+
	[PKG_CONFIG_DISABLE_MTREE] = {
+
		PKG_CONFIG_BOOL,
+
		"DISABLE_MTREE",
+
		"NO",
+
		"Experimental: disable MTREE processing on pkg installation",
+
	},
};

static bool parsed = false;
modified pkg/pkg.conf.5
@@ -165,6 +165,24 @@ Send all events to the specified fifo or Unix socket, events will be formatted
in JSON.
.It Cm SSH_RESTRICT_DIR: string
Directory where the ssh subsystem will be restricted to
+
.It Cm DISABLE_MTREE: boolean
+
For experimental purposes only. 
+
Not for use on production systems.
+
All this option does is prevent processing of
+
.Cm +MTREE
+
data when installing a package.
+
.Cm +MTREE
+
files are a legacy feature of the ports tree, which provide functionality
+
necessary for
+
.Xr pkg-install 8 
+
as it cannot handle creating arbitrary directory heirarcies otherwise.
+
.Xr pkg 8
+
can create such directory structures natively, but currently still uses the
+
.Cm +MTREE
+
data.
+
This option exists to facilitate developing 
+
.Cm +MTREE
+
free package sets. 
.El
.Sh MULTIPLE REPOSITORIES
To use multiple repositories, specify the primary repository as shown above.