Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
register conflicts while opening a file package
Baptiste Daroussin committed 15 years ago
commit 9757b8567d59c47660423f81cda9b77be0c7a447
parent dca7e2d
2 files changed +14 -5
modified libpkg/pkg.c
@@ -93,6 +93,8 @@ pkg_open(const char *path, struct pkg **pkg, int query_flags)
	(*pkg)->type = PKG_FILE;

	array_init(&(*pkg)->deps, 5);
+
	array_init(&(*pkg)->conflicts, 5);
+
	array_init(&(*pkg)->files, 10);

	while ((ret = archive_read_next_header(a, &ae)) == ARCHIVE_OK) {
		if (!strcmp(archive_entry_pathname(ae),"+DESC")) {
@@ -118,10 +120,7 @@ pkg_open(const char *path, struct pkg **pkg, int query_flags)
		}


-
		if (file == NULL)
-
			pkg_file_new(&file);
-
		else
-
			pkg_file_reset(file);
+
		pkg_file_new(&file);

		strlcpy(file->path, archive_entry_pathname(ae), sizeof(file->path));

modified libpkg/pkg_manifest.c
@@ -192,7 +192,17 @@ m_parse_dep(struct pkg *pkg, char *buf)
static int
m_parse_conflict(struct pkg *pkg, char *buf)
{
-
	/* TODO */
+
	struct pkg_conflict *conflict;
+

+
	while (isspace(*buf))
+
		buf++;
+

+
	pkg_conflict_new(&conflict);
+
	sbuf_cat(conflict->glob, buf);
+
	sbuf_finish(conflict->glob);
+

+
	array_append(&pkg->conflicts, conflict);
+

	return (0);
}