Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
New config file management
Baptiste Daroussin committed 15 years ago
commit f0413dd52617c012e92778b9033d5a758af54c9c
parent 5c96d96
2 files changed +34 -0
modified libpkg/pkg_add.c
@@ -4,6 +4,8 @@
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
+
#include <fnmatch.h>
+
#include <errno.h>

#include "pkg.h"
#include "pkg_error.h"
@@ -18,8 +20,22 @@ do_extract(struct archive *a, struct archive_entry *ae)
{
	int retcode = EPKG_OK;
	int ret = 0;
+
	char path[MAXPATHLEN];
+
	char *tmp;
+
	struct stat st;

	do {
+
		strlcpy(path, archive_entry_pathname(ae), MAXPATHLEN);
+
		if (fnmatch("*.pkgconf", path, 0) != FNM_NOMATCH) {
+
			tmp = strrchr(path, '.');
+
			tmp[0] = '\0';
+

+
			if (lstat(path, &st) != ENOENT)
+
				strlcat(path, ".pkgnew", MAXPATHLEN);
+

+
			archive_entry_set_pathname(ae, path);
+
		}
+

		if (archive_read_extract(a, ae, EXTRACT_ARCHIVE_FLAGS) != ARCHIVE_OK) {
			retcode = pkg_error_set(EPKG_FATAL, "%s", archive_error_string(a));
			break;
modified libpkg/pkg_ports.c
@@ -98,6 +98,24 @@ ports_parse_plist(struct pkg *pkg, char *plist)

				ret += pkg_addfile(pkg, path, NULL);

+
			} else if (STARTS_WITH(plist_p, "@conf ")) {
+
				buf = plist_p;
+

+
				while (!isspace(buf[0]))
+
					buf++;
+

+
				while (isspace(buf[0]))
+
					buf++;
+

+
				if (prefix[strlen(prefix) -1 ] == '/')
+
					snprintf(path, MAXPATHLEN, "%s%s.pkgconf", prefix, buf);
+
				else
+
					snprintf(path, MAXPATHLEN, "%s/%s.pkgconf", prefix, buf);
+

+
				if (lstat(path, &st) > 0)
+
					flatsize += st.st_size;
+

+
				ret += pkg_addfile(pkg, path, NULL);
			}else {
				warnx("%s is deprecated, ignoring", plist_p);
			}