Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Add an option off by default to allow plist to accept regular directory without prepending with a keyword
Baptiste Daroussin committed 11 years ago
commit 0b7aa4a6f14314ecfdd131279d7de7dd41be3422
parent 19e7447
3 files changed +14 -0
modified docs/pkg.conf.5
@@ -197,6 +197,8 @@ Default: not set.
.It Cm PLIST_KEYWORDS_DIR: string
Directory containing definitions of plist keywords.
Default: not set.
+
.It Cm PLIST_ACCEPT_DIRECTORIES: boolean
+
Accept directories listed like plain files in plist (default: NO)
.It Cm PLUGINS: array
List of plugins that 
.Xr pkg 8
modified libpkg/pkg_config.c
@@ -317,6 +317,12 @@ static struct config_entry c[] = {
		"NO",
		"Use read locking for query database"
	},
+
	{
+
		PKG_BOOL,
+
		"PLIST_ACCEPT_DIRECTORIES",
+
		"NO",
+
		"Accept directories listed like plain files in plist"
+
	}
};

static bool parsed = false;
modified libpkg/pkg_ports.c
@@ -408,6 +408,12 @@ file(struct plist *p, char *line, struct file_attr *a)
				sha256_file(testpath, sha256);
			buf = sha256;
		}
+
		if (S_ISDIR(st.st_mode) &&
+
		    !pkg_object_bool(pkg_config_get("PLIST_ACCEPT_DIRECTORIES"))) {
+
			pkg_emit_error("Plist error, directory listed as a file: %s", line);
+
			free_file_attr(a);
+
			return (EPKG_FATAL);
+
		}
		if (S_ISDIR(st.st_mode)) {
			if (a != NULL)
				ret = pkg_adddir_attr(p->pkg, path,