1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-13 14:40:22 +00:00

Permit the use of relative paths for the prefix argument.

Remove an unnecessary cwd from created plists when -p is specified

PR:		bin/145000
Submitted by:	gcooper
Approved by:	portmgr (flo)
MFC after:	1 month
This commit is contained in:
Eitan Adler 2012-02-09 20:51:03 +00:00
parent 7c88c0d0e1
commit 839a18b056
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=231300

View File

@ -214,8 +214,12 @@ pkg_perform(char **pkgs)
read_plist(&plist, pkg_in);
/* Prefix should add an @cwd to the packing list */
if (Prefix)
add_plist_top(&plist, PLIST_CWD, Prefix);
if (Prefix) {
char resolved_prefix[PATH_MAX];
if (realpath(Prefix, resolved_prefix) != 0)
err(EXIT_FAILURE, "couldn't resolve path for prefix: %s", Prefix);
add_plist_top(&plist, PLIST_CWD, resolved_prefix);
}
/* Add the origin if asked, at the top */
if (Origin)
@ -260,7 +264,9 @@ pkg_perform(char **pkgs)
/* mark_plist(&plist); */
/* Now put the release specific items in */
add_plist(&plist, PLIST_CWD, ".");
if (!Prefix) {
add_plist(&plist, PLIST_CWD, ".");
}
write_file(COMMENT_FNAME, Comment);
add_plist(&plist, PLIST_IGNORE, NULL);
add_plist(&plist, PLIST_FILE, COMMENT_FNAME);