pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/pkg_install-renovation]: pkgsrc/pkgtools/pkg_install/files Restore ol...
details: https://anonhg.NetBSD.org/pkgsrc/rev/204662bbc12e
branches: pkg_install-renovation
changeset: 541544:204662bbc12e
user: joerg <joerg%pkgsrc.org@localhost>
date: Tue May 20 15:00:44 2008 +0000
description:
Restore older (and somewhat bogus) behaviour of modifying the +CONTENTS
file when -p is given to pkg_add.
diffstat:
pkgtools/pkg_install/files/add/perform.c | 43 +++++++++++++++++++------------
pkgtools/pkg_install/files/lib/lib.h | 4 +-
pkgtools/pkg_install/files/lib/plist.c | 7 ++--
3 files changed, 32 insertions(+), 22 deletions(-)
diffs (173 lines):
diff -r 73e975413f83 -r 204662bbc12e pkgtools/pkg_install/files/add/perform.c
--- a/pkgtools/pkg_install/files/add/perform.c Mon May 19 16:25:24 2008 +0000
+++ b/pkgtools/pkg_install/files/add/perform.c Tue May 20 15:00:44 2008 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.70.4.5 2008/05/19 10:42:41 joerg Exp $ */
+/* $NetBSD: perform.c,v 1.70.4.6 2008/05/20 15:00:44 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
#endif
@@ -6,7 +6,7 @@
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
-__RCSID("$NetBSD: perform.c,v 1.70.4.5 2008/05/19 10:42:41 joerg Exp $");
+__RCSID("$NetBSD: perform.c,v 1.70.4.6 2008/05/20 15:00:44 joerg Exp $");
/*-
* Copyright (c) 2003 Grant Beattie <grant%NetBSD.org@localhost>
@@ -77,7 +77,6 @@
char *pkgname;
const char *prefix;
- const char *install_prefix;
char *logdir;
char *other_version;
@@ -245,9 +244,19 @@
warnx("Invalid PLIST: missing @cwd");
return -1;
}
- /* XXX change first @cwd in PLIST? */
- pkg->prefix = p->name;
- pkg->install_prefix = Prefix != NULL ? Prefix : pkg->prefix;
+
+ if (Prefix != NULL &&
+ strcmp(p->name, Prefix) != 0) {
+ size_t len;
+
+ delete_plist(&pkg->plist, FALSE, PLIST_CWD, NULL);
+ add_plist_top(&pkg->plist, PLIST_CWD, Prefix);
+ free(pkg->meta_data.meta_contents);
+ stringify_plist(&pkg->plist, &pkg->meta_data.meta_contents, &len,
+ Prefix);
+ pkg->prefix = Prefix;
+ } else
+ pkg->prefix = p->name;
return 0;
}
@@ -563,13 +572,13 @@
if (Fake)
return 0;
- if (mkdir_p(pkg->install_prefix)) {
- warn("Can't create prefix: %s", pkg->install_prefix);
+ if (mkdir_p(pkg->prefix)) {
+ warn("Can't create prefix: %s", pkg->prefix);
return -1;
}
- if (chdir(pkg->install_prefix) == -1) {
- warn("Can't change into prefix: %s", pkg->install_prefix);
+ if (chdir(pkg->prefix) == -1) {
+ warn("Can't change into prefix: %s", pkg->prefix);
return -1;
}
@@ -603,7 +612,7 @@
p->name, archive_entry_pathname(pkg->entry));
goto out;
}
- if (asprintf(&fullpath, "%s/%s", pkg->install_prefix, p->name) == -1) {
+ if (asprintf(&fullpath, "%s/%s", pkg->prefix, p->name) == -1) {
warnx("asprintf failed");
goto out;
}
@@ -614,7 +623,7 @@
break;
case PLIST_CMD:
- if (format_cmd(cmd, sizeof(cmd), p->name, pkg->install_prefix, last_file))
+ if (format_cmd(cmd, sizeof(cmd), p->name, pkg->prefix, last_file))
return -1;
printf("Executing '%s'\n", cmd);
if (!Fake && system(cmd))
@@ -812,7 +821,7 @@
if (pkg->meta_data.meta_install == NULL || NoInstall)
return 0;
- setenv(PKG_PREFIX_VNAME, pkg->install_prefix, 1); /* XXX or prefix? */
+ setenv(PKG_PREFIX_VNAME, pkg->prefix, 1);
setenv(PKG_METADATA_DIR_VNAME, pkg->logdir, 1);
setenv(PKG_REFCOUNT_DBDIR_VNAME, pkgdb_refcount_dir(), 1);
@@ -905,7 +914,7 @@
} else if (p->type != PLIST_FILE)
continue;
- if (asprintf(&fullpath, "%s/%s", pkg->install_prefix, p->name) == -1) {
+ if (asprintf(&fullpath, "%s/%s", pkg->prefix, p->name) == -1) {
warnx("asprintf failed");
status = -1;
break;
@@ -1052,12 +1061,12 @@
if (Verbose || Fake) {
printf("%s/pkg_delete -K %s -p %s '%s'\n",
- BINDIR, _pkgdb_getPKGDB_DIR(), pkg->install_prefix,
+ BINDIR, _pkgdb_getPKGDB_DIR(), pkg->prefix,
pkg->other_version);
}
if (!Fake)
fexec(BINDIR "/pkg_delete", "-K", _pkgdb_getPKGDB_DIR(),
- "-p", pkg->install_prefix,
+ "-p", pkg->prefix,
pkg->other_version, NULL);
/* XXX Check return value and do what? */
@@ -1165,7 +1174,7 @@
warnx("mtree specification in pkg `%s' ignored", pkg->pkgname);
if (pkg->meta_data.meta_views != NULL) {
- if ((pkg->logdir = strdup(pkg->install_prefix)) == NULL)
+ if ((pkg->logdir = strdup(pkg->prefix)) == NULL)
err(EXIT_FAILURE, "strdup failed");
_pkgdb_setPKGDB_DIR(dirname_of(pkg->logdir));
} else {
diff -r 73e975413f83 -r 204662bbc12e pkgtools/pkg_install/files/lib/lib.h
--- a/pkgtools/pkg_install/files/lib/lib.h Mon May 19 16:25:24 2008 +0000
+++ b/pkgtools/pkg_install/files/lib/lib.h Tue May 20 15:00:44 2008 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lib.h,v 1.42.2.5 2008/05/19 10:42:41 joerg Exp $ */
+/* $NetBSD: lib.h,v 1.42.2.6 2008/05/20 15:00:44 joerg Exp $ */
/* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */
@@ -336,7 +336,7 @@
void add_plist_top(package_t *, pl_ent_t, const char *);
void delete_plist(package_t *, Boolean, pl_ent_t, char *);
void write_plist(package_t *, FILE *, char *);
-void stringify_plist(package_t *, char **, size_t *, char *);
+void stringify_plist(package_t *, char **, size_t *, const char *);
void parse_plist(package_t *, const char *);
void read_plist(package_t *, FILE *);
int delete_package(Boolean, Boolean, package_t *, Boolean);
diff -r 73e975413f83 -r 204662bbc12e pkgtools/pkg_install/files/lib/plist.c
--- a/pkgtools/pkg_install/files/lib/plist.c Mon May 19 16:25:24 2008 +0000
+++ b/pkgtools/pkg_install/files/lib/plist.c Tue May 20 15:00:44 2008 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: plist.c,v 1.17.4.1 2008/04/26 17:44:23 joerg Exp $ */
+/* $NetBSD: plist.c,v 1.17.4.2 2008/05/20 15:00:44 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static const char *rcsid = "from FreeBSD Id: plist.c,v 1.24 1997/10/08 07:48:15 charnier Exp";
#else
-__RCSID("$NetBSD: plist.c,v 1.17.4.1 2008/04/26 17:44:23 joerg Exp $");
+__RCSID("$NetBSD: plist.c,v 1.17.4.2 2008/05/20 15:00:44 joerg Exp $");
#endif
#endif
@@ -428,7 +428,8 @@
* Like write_plist, but compute memory string.
*/
void
-stringify_plist(package_t *pkg, char **real_buf, size_t *real_len, char *realprefix)
+stringify_plist(package_t *pkg, char **real_buf, size_t *real_len,
+ const char *realprefix)
{
plist_t *p;
const cmd_t *cmdp;
Home |
Main Index |
Thread Index |
Old Index