diff options
author | joerg <joerg> | 2008-04-23 20:54:39 +0000 |
---|---|---|
committer | joerg <joerg> | 2008-04-23 20:54:39 +0000 |
commit | 1b89261a1ff3a6ddab41375f3dfaa6ade0e3b827 (patch) | |
tree | ceb8416588fc9985a9d6112881929e7c28494c9e /pkgtools | |
parent | 1569d393c3bcf62b4c9967586ad88f1a83f625de (diff) | |
download | pkgsrc-1b89261a1ff3a6ddab41375f3dfaa6ade0e3b827.tar.gz |
Make pkg_delete with -p actually work. Prepending the prefix doesn't
work as it will still use the one in the package. Use the approach from
pkg_add to override it instead.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pkg_install/files/delete/perform.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/pkgtools/pkg_install/files/delete/perform.c b/pkgtools/pkg_install/files/delete/perform.c index 729291c8a80..95cf9d34146 100644 --- a/pkgtools/pkg_install/files/delete/perform.c +++ b/pkgtools/pkg_install/files/delete/perform.c @@ -1,4 +1,4 @@ -/* $NetBSD: perform.c,v 1.22 2008/02/04 14:03:10 joerg Exp $ */ +/* $NetBSD: perform.c,v 1.23 2008/04/23 20:54:39 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -11,7 +11,7 @@ #if 0 static const char *rcsid = "from FreeBSD Id: perform.c,v 1.15 1997/10/13 15:03:52 jkh Exp"; #else -__RCSID("$NetBSD: perform.c,v 1.22 2008/02/04 14:03:10 joerg Exp $"); +__RCSID("$NetBSD: perform.c,v 1.23 2008/04/23 20:54:39 joerg Exp $"); #endif #endif @@ -531,11 +531,13 @@ require_find_recursive_down(lpkg_t *thislpp, package_t *plist) fail = 1; goto fail; } - /* If we have a prefix, add it now */ - if (Prefix) - add_plist(&rPlist, PLIST_CWD, Prefix); read_plist(&rPlist, cfile); fclose(cfile); + /* If we have a prefix, replace the first @cwd. */ + if (Prefix) { + delete_plist(&Plist, FALSE, PLIST_CWD, NULL); + add_plist_top(&Plist, PLIST_CWD, Prefix); + } p = find_plist(&rPlist, PLIST_CWD); if (!p) { warnx("package '%s' doesn't have a prefix", lpp->lp_name); @@ -739,12 +741,14 @@ pkg_do(char *pkg) warnx("unable to open '%s' file", CONTENTS_FNAME); return 1; } - /* If we have a prefix, add it now */ - if (Prefix) - add_plist(&Plist, PLIST_CWD, Prefix); read_plist(&Plist, cfile); fclose(cfile); p = find_plist(&Plist, PLIST_CWD); + /* If we have a prefix, replace the first @cwd. */ + if (Prefix) { + delete_plist(&Plist, FALSE, PLIST_CWD, NULL); + add_plist_top(&Plist, PLIST_CWD, Prefix); + } if (!p) { warnx("package '%s' doesn't have a prefix", pkg); return 1; |