When adding depoted packages into the depot, manipulate the correct
pkgdb.byfile.db by using the fact that depoted packages have their dbdir == ${DEPOTBASE}.
This commit is contained in:
parent
8ca90bd4e4
commit
6a37e1039a
|
@ -1,11 +1,11 @@
|
|||
/* $NetBSD: perform.c,v 1.86 2003/09/02 07:34:50 jlam Exp $ */
|
||||
/* $NetBSD: perform.c,v 1.87 2003/09/08 07:00:10 jlam Exp $ */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.44 1997/10/13 15:03:46 jkh Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: perform.c,v 1.86 2003/09/02 07:34:50 jlam Exp $");
|
||||
__RCSID("$NetBSD: perform.c,v 1.87 2003/09/08 07:00:10 jlam Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -72,8 +72,9 @@ installprereq(const char *name, int *errc)
|
|||
if (Verbose)
|
||||
printf("Loading it from %s.\n", name);
|
||||
path_setenv("PKG_PATH");
|
||||
if (vsystem("%s/pkg_add -s %s %s%s%s %s%s %s%s%s %s%s",
|
||||
if (vsystem("%s/pkg_add -K %s -s %s %s%s%s %s%s %s%s%s %s%s",
|
||||
BINDIR,
|
||||
_pkgdb_getPKGDB_DIR(),
|
||||
get_verification(),
|
||||
NoView ? "-L " : "",
|
||||
View ? "-w " : "",
|
||||
|
@ -110,7 +111,7 @@ pkg_do(const char *pkg)
|
|||
char replace_to[FILENAME_MAX];
|
||||
int replacing = 0;
|
||||
char *where_to, *extract;
|
||||
char *dbdir;
|
||||
char dbdir[FILENAME_MAX];
|
||||
const char *exact;
|
||||
FILE *cfile;
|
||||
int errc;
|
||||
|
@ -283,18 +284,17 @@ pkg_do(const char *pkg)
|
|||
if (fexists(VIEWS_FNAME))
|
||||
is_depoted_pkg = TRUE;
|
||||
|
||||
dbdir = _pkgdb_getPKGDB_DIR();
|
||||
(void) snprintf(LogDir, sizeof(LogDir), "%s/%s", dbdir, PkgName);
|
||||
|
||||
/* check if the dbdir is wrong because this is a depoted package */
|
||||
/*
|
||||
* Depoted packages' dbdir is the same as DEPOTBASE. Non-depoted
|
||||
* packages' dbdir comes from the command-line or the environment.
|
||||
*/
|
||||
if (is_depoted_pkg) {
|
||||
if ((p = find_plist(&Plist, PLIST_CWD))) {
|
||||
if (strcmp(p->name, LogDir) != 0) {
|
||||
warnx("%s is not the depot directory for %s.",
|
||||
dbdir, PkgName);
|
||||
goto success;
|
||||
}
|
||||
}
|
||||
p = find_plist(&Plist, PLIST_CWD);
|
||||
(void) strlcpy(dbdir, dirname_of(p->name), sizeof(dbdir));
|
||||
(void) strlcpy(LogDir, p->name, sizeof(LogDir));
|
||||
} else {
|
||||
(void) strlcpy(dbdir, _pkgdb_getPKGDB_DIR(), sizeof(dbdir));
|
||||
(void) snprintf(LogDir, sizeof(LogDir), "%s/%s", dbdir, PkgName);
|
||||
}
|
||||
|
||||
/* make sure dbdir actually exists! */
|
||||
|
@ -620,12 +620,18 @@ ignore_replace_depends_check:
|
|||
}
|
||||
}
|
||||
|
||||
/* Now finally extract the entire show if we're not going direct */
|
||||
if (!inPlace && !Fake)
|
||||
if (!extract_plist(".", &Plist)) {
|
||||
errc = 1;
|
||||
goto fail;
|
||||
}
|
||||
/*
|
||||
* Now finally extract the entire show if we're not going direct.
|
||||
* We need to reset the package dbdir so that extract_plist()
|
||||
* updates the correct pkgdb.byfile.db database.
|
||||
*/
|
||||
if (!inPlace && !Fake) {
|
||||
_pkgdb_setPKGDB_DIR(dbdir);
|
||||
if (!extract_plist(".", &Plist)) {
|
||||
errc = 1;
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Fake && fexists(MTREE_FNAME)) {
|
||||
if (Verbose)
|
||||
|
@ -771,8 +777,9 @@ ignore_replace_depends_check:
|
|||
/* Add the package to a default view. */
|
||||
if (!Fake && !NoView && is_depoted_pkg) {
|
||||
if (Verbose) {
|
||||
printf("%s/pkg_view %s%s %s%s %sadd %s\n",
|
||||
printf("%s/pkg_view -d %s %s%s %s%s %sadd %s\n",
|
||||
BINDIR,
|
||||
dbdir,
|
||||
View ? "-w " : "",
|
||||
View ? View : "",
|
||||
Viewbase ? "-W " : "",
|
||||
|
@ -780,8 +787,9 @@ ignore_replace_depends_check:
|
|||
Verbose ? "-v " : "",
|
||||
PkgName);
|
||||
}
|
||||
vsystem("%s/pkg_view %s%s %s%s %sadd %s",
|
||||
vsystem("%s/pkg_view -d %s %s%s %s%s %sadd %s",
|
||||
BINDIR,
|
||||
dbdir,
|
||||
View ? "-w " : "",
|
||||
View ? View : "",
|
||||
Viewbase ? "-W " : "",
|
||||
|
|
Loading…
Reference in New Issue