Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Plist need stage
Baptiste Daroussin committed 11 years ago
commit f1772d8377f8090e20afb37189b8d2830b961d0a
parent 2c98893
3 files changed +5 -4
modified libpkg/pkg_ports.c
@@ -1047,7 +1047,7 @@ plist_parse_line(struct pkg *pkg, struct plist *plist, char *line)
}

struct plist *
-
plist_new(struct pkg *pkg)
+
plist_new(struct pkg *pkg, const char *stage)
{
	struct plist *p;
	const char *prefix;
@@ -1060,6 +1060,7 @@ plist_new(struct pkg *pkg)
	pkg_get(pkg, PKG_PREFIX, &prefix);
	strlcpy(p->prefix, prefix, sizeof(p->prefix));
	p->slash = p->prefix[strlen(p->prefix) - 1] == '/' ? "" : "/";
+
	p->stage = stage;
	p->uname = strdup("root");
	p->gname = strdup("wheel");

@@ -1114,7 +1115,7 @@ ports_parse_plist(struct pkg *pkg, const char *plist, const char *stage)
	assert(pkg != NULL);
	assert(plist != NULL);

-
	if ((pplist = plist_new(pkg)) == NULL)
+
	if ((pplist = plist_new(pkg, stage)) == NULL)
		return (EPKG_FATAL);

	if ((plist_f = fopen(plist, "r")) == NULL) {
modified libpkg/private/pkg.h
@@ -576,7 +576,7 @@ void pkg_delete_dir(struct pkg *pkg, struct pkg_dir *dir);
void pkg_delete_file(struct pkg *pkg, struct pkg_file *file, unsigned force);
int pkg_open_root_fd(struct pkg *pkg);
void pkg_add_dir_to_del(struct pkg *pkg, const char *file, const char *dir);
-
struct plist *plist_new(struct pkg *p);
+
struct plist *plist_new(struct pkg *p, const char *stage);
int plist_parse_line(struct pkg *pkg, struct plist *p, char *line);
void plist_free(struct plist *);

modified tests/lib/plist.c
@@ -75,7 +75,7 @@ ATF_TC_BODY(parse_plist, tc)

	pkg_set(p, PKG_PREFIX, "/myprefix");

-
	plist = plist_new(p);
+
	plist = plist_new(p, NULL);
	ATF_REQUIRE(plist != NULL);
	ATF_REQUIRE(plist->pkg == p);
	ATF_REQUIRE_STREQ(plist->prefix, "/myprefix");