summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_install
diff options
context:
space:
mode:
authorjoerg <joerg>2010-01-22 13:30:41 +0000
committerjoerg <joerg>2010-01-22 13:30:41 +0000
commit59b9639130297670720b3f6b5045288bdb20cfaa (patch)
tree98c4986cb67ac2971e60b47e1666d503cd48427f /pkgtools/pkg_install
parenta896ec08cf82180409d4e2a4d1d8ffb2931a637e (diff)
downloadpkgsrc-59b9639130297670720b3f6b5045288bdb20cfaa.tar.gz
pkg_install-20100122:
- Refactor man pages: - Move description of environmental variables into pkg_install.conf(5) - Remove a bunch of dead references - Avoid using hard-coded path names that can easily be overridden by the user. - Refactor pkgdb related logic, so that -K behaves consistently. - Add some helper functions to isolate more places from the pkgdb layout. - Sync license list. - Handle PKG_REFCOUNT_DBDIR consistently as option too. - Utilize connection cache from libfetch. - Add helper target for cat pages updates.
Diffstat (limited to 'pkgtools/pkg_install')
-rw-r--r--pkgtools/pkg_install/Makefile12
-rw-r--r--pkgtools/pkg_install/files/add/Makefile.in4
-rw-r--r--pkgtools/pkg_install/files/add/add.h3
-rw-r--r--pkgtools/pkg_install/files/add/main.c19
-rw-r--r--pkgtools/pkg_install/files/add/perform.c18
-rw-r--r--pkgtools/pkg_install/files/add/pkg_add.1 (renamed from pkgtools/pkg_install/files/add/pkg_add.1.in)171
-rw-r--r--pkgtools/pkg_install/files/admin/Makefile.in4
-rw-r--r--pkgtools/pkg_install/files/admin/README9
-rw-r--r--pkgtools/pkg_install/files/admin/check.c11
-rw-r--r--pkgtools/pkg_install/files/admin/main.c21
-rw-r--r--pkgtools/pkg_install/files/admin/pkg_admin.1 (renamed from pkgtools/pkg_install/files/admin/pkg_admin.1.in)69
-rw-r--r--pkgtools/pkg_install/files/bpm/bpm.cat161
-rwxr-xr-xpkgtools/pkg_install/files/configure4
-rw-r--r--pkgtools/pkg_install/files/configure.ac15
-rw-r--r--pkgtools/pkg_install/files/create/Makefile.in4
-rw-r--r--pkgtools/pkg_install/files/create/main.c10
-rw-r--r--pkgtools/pkg_install/files/create/pkg_create.1 (renamed from pkgtools/pkg_install/files/create/pkg_create.1.in)27
-rw-r--r--pkgtools/pkg_install/files/delete/Makefile.in4
-rw-r--r--pkgtools/pkg_install/files/delete/pkg_delete.1296
-rw-r--r--pkgtools/pkg_install/files/delete/pkg_delete.c23
-rw-r--r--pkgtools/pkg_install/files/info/Makefile.in4
-rw-r--r--pkgtools/pkg_install/files/info/main.c12
-rw-r--r--pkgtools/pkg_install/files/info/perform.c12
-rw-r--r--pkgtools/pkg_install/files/info/pkg_info.1 (renamed from pkgtools/pkg_install/files/info/pkg_info.1.in)34
-rw-r--r--pkgtools/pkg_install/files/lib/Makefile.in8
-rw-r--r--pkgtools/pkg_install/files/lib/conflicts.c9
-rw-r--r--pkgtools/pkg_install/files/lib/iterate.c4
-rw-r--r--pkgtools/pkg_install/files/lib/lib.h20
-rw-r--r--pkgtools/pkg_install/files/lib/license.c6
-rw-r--r--pkgtools/pkg_install/files/lib/parse-config.c55
-rw-r--r--pkgtools/pkg_install/files/lib/pkg_install.conf.5.in44
-rw-r--r--pkgtools/pkg_install/files/lib/pkg_install.conf.cat5.in153
-rw-r--r--pkgtools/pkg_install/files/lib/pkg_summary.cat5103
-rw-r--r--pkgtools/pkg_install/files/lib/pkgdb.c72
-rw-r--r--pkgtools/pkg_install/files/lib/pkgsrc.cat719
-rw-r--r--pkgtools/pkg_install/files/lib/version.h4
-rw-r--r--pkgtools/pkg_install/files/view/pkg_view.1 (renamed from pkgtools/pkg_install/files/view/pkg_view.1.in)20
37 files changed, 607 insertions, 757 deletions
diff --git a/pkgtools/pkg_install/Makefile b/pkgtools/pkg_install/Makefile
index 160fa0e8571..771fd6dbe5d 100644
--- a/pkgtools/pkg_install/Makefile
+++ b/pkgtools/pkg_install/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.169 2010/01/20 23:17:12 joerg Exp $
+# $NetBSD: Makefile,v 1.170 2010/01/22 13:30:41 joerg Exp $
# Notes to package maintainers:
#
@@ -165,4 +165,14 @@ update:
${MAKE} ${UPDATE_TARGET}
${MAKE} clean
+update-catpages:
+ for f in lib/pkgsrc.7 add/pkg_add.1 admin/pkg_admin.1 \
+ create/pkg_create.1 delete/pkg_delete.1 info/pkg_info.1 \
+ lib/pkg_summary.5 lib/pkgsrc.7; do \
+ nroff -mdoc ${FILESDIR}/$$f > \
+ ${FILESDIR}/$${f%%.[157]}.cat; \
+ done
+ nroff -mdoc ${FILESDIR}/lib/pkg_install.conf.5.in > \
+ ${FILESDIR}/lib/pkg_install.conf.cat.in
+
.include "../../mk/bsd.pkg.mk"
diff --git a/pkgtools/pkg_install/files/add/Makefile.in b/pkgtools/pkg_install/files/add/Makefile.in
index 1eb6bab76de..1bfc66ce846 100644
--- a/pkgtools/pkg_install/files/add/Makefile.in
+++ b/pkgtools/pkg_install/files/add/Makefile.in
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.in,v 1.20 2009/02/13 11:21:07 joerg Exp $
+# $NetBSD: Makefile.in,v 1.21 2010/01/22 13:30:41 joerg Exp $
srcdir= @srcdir@
@@ -49,4 +49,4 @@ install:
$(INSTALL) -m 755 -d ${DESTDIR}$(cat1dir)
$(INSTALL) $(PROG) ${DESTDIR}$(sbindir)/$(PROG)
$(INSTALL) -m 444 $(PROG).1 ${DESTDIR}$(man1dir)/$(PROG).1
- $(INSTALL) -m 444 $(PROG).cat1 ${DESTDIR}$(cat1dir)/$(PROG).0
+ $(INSTALL) -m 444 $(PROG).cat ${DESTDIR}$(cat1dir)/$(PROG).0
diff --git a/pkgtools/pkg_install/files/add/add.h b/pkgtools/pkg_install/files/add/add.h
index d2f073734bb..d897a429e61 100644
--- a/pkgtools/pkg_install/files/add/add.h
+++ b/pkgtools/pkg_install/files/add/add.h
@@ -1,4 +1,4 @@
-/* $NetBSD: add.h,v 1.16 2009/10/07 12:53:26 joerg Exp $ */
+/* $NetBSD: add.h,v 1.17 2010/01/22 13:30:41 joerg Exp $ */
/* from FreeBSD Id: add.h,v 1.8 1997/02/22 16:09:15 peter Exp */
@@ -25,7 +25,6 @@
#ifndef _INST_ADD_H_INCLUDE
#define _INST_ADD_H_INCLUDE
-extern const char *PlainPkgdb;
extern char *Destdir;
extern char *OverrideMachine;
extern char *Prefix;
diff --git a/pkgtools/pkg_install/files/add/main.c b/pkgtools/pkg_install/files/add/main.c
index 3392bf69135..f1479f54f97 100644
--- a/pkgtools/pkg_install/files/add/main.c
+++ b/pkgtools/pkg_install/files/add/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.22 2009/10/07 12:53:26 joerg Exp $ */
+/* $NetBSD: main.c,v 1.23 2010/01/22 13:30:41 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -7,7 +7,7 @@
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
-__RCSID("$NetBSD: main.c,v 1.22 2009/10/07 12:53:26 joerg Exp $");
+__RCSID("$NetBSD: main.c,v 1.23 2010/01/22 13:30:41 joerg Exp $");
/*
*
@@ -41,7 +41,6 @@ __RCSID("$NetBSD: main.c,v 1.22 2009/10/07 12:53:26 joerg Exp $");
static char Options[] = "AIK:LP:RVW:fhm:np:t:uvw:";
-const char *PlainPkgdb = NULL;
char *Destdir = NULL;
char *OverrideMachine = NULL;
char *Prefix = NULL;
@@ -72,7 +71,6 @@ main(int argc, char **argv)
{
int ch, error=0;
lpkg_head_t pkgs;
- const char *pkgdb = NULL;
setprogname(argv[0]);
while ((ch = getopt(argc, argv, Options)) != -1) {
@@ -98,7 +96,7 @@ main(int argc, char **argv)
break;
case 'K':
- pkgdb = optarg;
+ pkgdb_set_dir(optarg, 3);
break;
case 'L':
@@ -154,18 +152,13 @@ main(int argc, char **argv)
pkg_install_config();
- if (pkgdb == NULL)
- pkgdb = _pkgdb_getPKGDB_DIR();
- PlainPkgdb = xstrdup(pkgdb);
-
if (Destdir != NULL) {
char *pkgdbdir;
- pkgdbdir = xasprintf("%s/%s", Destdir, pkgdb);
- _pkgdb_setPKGDB_DIR(pkgdbdir);
+ pkgdbdir = xasprintf("%s/%s", Destdir, config_pkg_dbdir);
+ pkgdb_set_dir(pkgdbdir, 4);
free(pkgdbdir);
- } else
- _pkgdb_setPKGDB_DIR(pkgdb);
+ }
process_pkg_path();
TAILQ_INIT(&pkgs);
diff --git a/pkgtools/pkg_install/files/add/perform.c b/pkgtools/pkg_install/files/add/perform.c
index 55483e17486..c58b853a9fb 100644
--- a/pkgtools/pkg_install/files/add/perform.c
+++ b/pkgtools/pkg_install/files/add/perform.c
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.91 2009/10/07 12:53:26 joerg Exp $ */
+/* $NetBSD: perform.c,v 1.92 2010/01/22 13:30:41 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.91 2009/10/07 12:53:26 joerg Exp $");
+__RCSID("$NetBSD: perform.c,v 1.92 2010/01/22 13:30:41 joerg Exp $");
/*-
* Copyright (c) 2003 Grant Beattie <grant@NetBSD.org>
@@ -875,7 +875,7 @@ run_install_script(struct pkg_task *pkg, const char *argument)
setenv(PKG_DESTDIR_VNAME, Destdir, 1);
setenv(PKG_PREFIX_VNAME, pkg->prefix, 1);
setenv(PKG_METADATA_DIR_VNAME, pkg->logdir, 1);
- setenv(PKG_REFCOUNT_DBDIR_VNAME, pkgdb_refcount_dir(), 1);
+ setenv(PKG_REFCOUNT_DBDIR_VNAME, config_pkg_refcount_dbdir, 1);
if (Verbose)
printf("Running install with PRE-INSTALL for %s.\n", pkg->pkgname);
@@ -1087,13 +1087,13 @@ pkg_register_views(struct pkg_task *pkg)
if (Verbose) {
printf("%s/pkg_view -d %s %s%s %s%s %sadd %s\n",
- BINDIR, _pkgdb_getPKGDB_DIR(),
+ BINDIR, pkgdb_get_dir(),
View ? "-w " : "", View ? View : "",
Viewbase ? "-W " : "", Viewbase ? Viewbase : "",
Verbose ? "-v " : "", pkg->pkgname);
}
- fexec_skipempty(BINDIR "/pkg_view", "-d", _pkgdb_getPKGDB_DIR(),
+ fexec_skipempty(BINDIR "/pkg_view", "-d", pkgdb_get_dir(),
View ? "-w " : "", View ? View : "",
Viewbase ? "-W " : "", Viewbase ? Viewbase : "",
Verbose ? "-v " : "", "add", pkg->pkgname,
@@ -1136,12 +1136,12 @@ start_replacing(struct pkg_task *pkg)
if (Verbose || Fake) {
printf("%s/pkg_delete -K %s -p %s%s%s '%s'\n",
- BINDIR, _pkgdb_getPKGDB_DIR(), pkg->prefix,
+ BINDIR, pkgdb_get_dir(), pkg->prefix,
Destdir ? " -P ": "", Destdir ? Destdir : "",
pkg->other_version);
}
if (!Fake)
- fexec_skipempty(BINDIR "/pkg_delete", "-K", _pkgdb_getPKGDB_DIR(),
+ fexec_skipempty(BINDIR "/pkg_delete", "-K", pkgdb_get_dir(),
"-p", pkg->prefix,
Destdir ? "-P": "", Destdir ? Destdir : "",
pkg->other_version, NULL);
@@ -1327,9 +1327,9 @@ pkg_do(const char *pkgpath, int mark_automatic, int top_level)
if (pkg->meta_data.meta_views != NULL) {
pkg->logdir = xstrdup(pkg->prefix);
- _pkgdb_setPKGDB_DIR(dirname_of(pkg->logdir));
+ pkgdb_set_dir(dirname_of(pkg->logdir), 4);
} else {
- pkg->logdir = xasprintf("%s/%s", PlainPkgdb, pkg->pkgname);
+ pkg->logdir = xasprintf("%s/%s", config_pkg_dbdir, pkg->pkgname);
}
if (Destdir != NULL)
diff --git a/pkgtools/pkg_install/files/add/pkg_add.1.in b/pkgtools/pkg_install/files/add/pkg_add.1
index e568ef74f47..f895b67e5cc 100644
--- a/pkgtools/pkg_install/files/add/pkg_add.1.in
+++ b/pkgtools/pkg_install/files/add/pkg_add.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_add.1.in,v 1.1 2010/01/21 21:58:06 jmmv Exp $
+.\" $NetBSD: pkg_add.1,v 1.41 2010/01/22 13:30:41 joerg Exp $
.\"
.\" FreeBSD install - a package for the installation and maintenance
.\" of non-core utilities.
@@ -17,7 +17,7 @@
.\"
.\" @(#)pkg_add.1
.\"
-.Dd January 20, 2010
+.Dd January 22, 2010
.Dt PKG_ADD 1
.Os
.Sh NAME
@@ -128,12 +128,10 @@ architecture the package was built on differ from that of the host.
.It Fl I
If an installation script exists for a given package, do not execute it.
.It Fl K Ar pkg_dbdir
-Set
-.Ar pkg_dbdir
-as the package database directory.
-See the
-.Sx ENVIRONMENT
-section below for details on how the default value is calculated.
+Override the value of the
+.Dv PKG_DBDIR
+configuration option with the value
+.Ar pkg_dbdir .
.It Fl L
Don't add the package to any views after installation.
.It Fl m
@@ -146,22 +144,11 @@ would be taken if it was.
Prefix all file and directory names with
.Ar destdir .
For packages without install scripts this has the same behavior as
-using chroot.
+using
+.Xr chroot 8 .
.It Fl p Ar prefix
-Set
-.Ar prefix
-as the directory in which to extract files from a package.
-If a package has set its default directory, it will be overridden
-by this flag.
-Note that only the first
-.Cm @cwd
-directive will be replaced, since
-.Nm
-has no way of knowing which directory settings are relative and
-which are absolute.
-Only one directory transition is supported and the second one is expected to go
-into
-.Ar pkgdb .
+Override the prefix stored in the package with
+.Ar prefix .
.It Fl R
Do not record the installation of a package.
This implies
@@ -180,27 +167,13 @@ Print version number and exit.
.It Fl v
Turn on verbose output.
.It Fl W Ar viewbase
-Set
-.Ar viewbase
-as the base directory for the managed views.
-The default
-.Ar viewbase
-directory is set by
-.Xr pkg_view 1 .
-This value also may be set from the
-.Ev LOCALBASE
-environment variable.
+Passed down to
+.Xr pkg_view 1
+for managed views.
.It Fl w Ar view
-Set the
-.Ar view
-to which packages should be added after installation.
-The default
-.Ar view
-is set by
-.Xr pkg_view 1 .
-This value also may be set from the
-.Ev PKG_VIEW
-environment variable.
+Passed down to
+.Xr pkg_view 1
+for managed views.
.El
.Pp
One or more
@@ -346,18 +319,17 @@ after the package has been installed.
After installation is complete, a copy of the packing list,
.Ar deinstall
script, description, and display files are copied into
-.Pa @pkgdbdir@/\*[Lt]pkg-name\*[Gt]
+.Pa \*[Lt]PKG_DBDIR\*[Gt]/\*[Lt]pkg-name\*[Gt]
for subsequent possible use by
.Xr pkg_delete 1 .
Any package dependencies are recorded in the other packages'
-.Pa @pkgdbdir@/\*[Lt]other-pkg\*[Gt]/+REQUIRED_BY
-file
-(if an alternate package database directory is specified, then it
-overrides the
-.Pa @pkgdbdir@
-path shown above).
+.Pa +REQUIRED_BY
+file.
.It
-If the package is a depoted package, then add it to the default view.
+If the package is a depoted package, then add it to the registered
+by calling
+.Xr pkg_view 1
+accordingly.
.It
Finally, if we were upgrading a package, any
.Pa +REQUIRED_BY
@@ -393,50 +365,19 @@ flag was given to
.Ev PKG_DESTDIR
will be set to
.Ar destdir .
+Additionally,
+.Ev PKG_METADATA_DIR
+and
+.Ev PKG_REFCOUNT_DBDIR
+are prefixed with
+.Ar destdir .
.Sh ENVIRONMENT
-.Bl -tag -width PKG_TMPDIR
-.It Ev LOCALBASE
-This is the location of the
-.Ar viewbase
-directory in which all the views are managed.
-The default
-.Ar viewbase
-directory is
-.Pa /usr/pkg .
-.It Ev PKG_DBDIR
-If the
-.Fl K
-flag isn't given, then the value of the
-.Ev PKG_DBDIR
-variable overrides the
-.Xr pkg_install.conf 5
-variable of the same name.
-If all of this fails to locate a value, then it typically defaults to
-.Pa @pkgdbdir@ .
-.It Ev PKG_PATH
-The value of the
-.Ev PKG_PATH
-variable overrides the
+See
.Xr pkg_install.conf 5
-variable of the same name.
-It is used if a given package can't be found, it's usually set to
-.Pa /usr/pkgsrc/packages/All .
-The environment variable
-should be a series of entries separated by semicolons.
-Each entry consists of a directory name or URL.
-The current directory may be indicated implicitly by an empty directory
-name, or explicitly by a single period.
-.It Ev PKG_REFCOUNT_DBDIR
-Location of the package reference counts database directory.
-The default location is the path to the package database directory with
-.Dq .refcount
-appended to the path, e.g.
-.Pa @pkgdbdir@.refcount .
-.It Ev PKG_VIEW
-The default view can be specified in the
-.Ev PKG_VIEW
-environment variable.
-.El
+for options, that can also be specified using the environment.
+Packages using views are also affected by the environment variables
+documented for
+.Xr pkg_view 1 .
.Sh EXAMPLES
In all cases,
.Nm
@@ -460,59 +401,19 @@ emits more messages to terminal.
.Pp
You can grab a compiled binary package from remote location by specifying
a URL.
-The URL can be put into an environment variable,
-.Ev PKG_PATH .
+The base URL can also be provided by the configuration variable,
+.Dv PKG_PATH .
.Bd -literal
# pkg_add -v ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/i386/3.1_2007Q2/All/firefox-2.0.0.4.tgz
# export PKG_PATH=ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/i386/3.1_2007Q2/All
# pkg_add -v firefox
.Ed
-.Pp
-Over time, as problems are found in packages, they will be moved
-from the
-.Pa All
-subdirectory into the
-.Pa vulnerable
-subdirectory.
-If you want to accept vulnerable packages by default
-(and know what you are doing),
-you can add the
-.Pa vulnerable
-directory to your
-.Ev PKG_PATH
-like this:
-.Bd -literal
-# export PKG_PATH="ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/i386/3.1_2007Q2/All/;ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/i386/3.1_2007Q2/vulnerable/"
-.Ed
-.Pp
-(The quotes are needed because semicolon
-.Pq Sq \&;
-is a shell meta-character.)
-If you do this, consider using the audit capabilities in
-.Xr pkg_admin 1
-and running it after every
-.Nm .
-.Sh CONFIGURATION VARIABLES
-The following variables change the behavior of
-.Nm
-and are described in
-.Xr pkg_install.conf 5 :
-.Bl -tag -compact -offset indent -width CERTIFICATE_ANCHOR_PKGS
-.It Ev CHECK_LICENSE
-.It Ev CHECK_VULNERABILITIES
-.It Ev CERTIFICATE_ANCHOR_PKGS
-.It Ev CERTIFICATE_CHAIN
-.It Ev VERIFIED_INSTALLATION
-.El
.Sh SEE ALSO
.Xr pkg_admin 1 ,
.Xr pkg_create 1 ,
.Xr pkg_delete 1 ,
.Xr pkg_info 1 ,
-.Xr tar 1 ,
-.Xr mktemp 3 ,
-.Xr sysconf 3 ,
.Xr pkg_install.conf 5 ,
.Xr pkgsrc 7
.Sh AUTHORS
diff --git a/pkgtools/pkg_install/files/admin/Makefile.in b/pkgtools/pkg_install/files/admin/Makefile.in
index 2c6c7bbf88c..dbfd1d31cea 100644
--- a/pkgtools/pkg_install/files/admin/Makefile.in
+++ b/pkgtools/pkg_install/files/admin/Makefile.in
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.in,v 1.17 2009/02/13 11:21:07 joerg Exp $
+# $NetBSD: Makefile.in,v 1.18 2010/01/22 13:30:41 joerg Exp $
srcdir= @srcdir@
@@ -58,7 +58,7 @@ install:
$(INSTALL) $(PROG) ${DESTDIR}$(sbindir)/$(PROG)
$(INSTALL) -m 555 $(SCRIPTS) ${DESTDIR}$(sbindir)
$(INSTALL) -m 444 $(PROG).1 ${DESTDIR}$(man1dir)/$(PROG).1
- $(INSTALL) -m 444 $(PROG).cat1 ${DESTDIR}$(cat1dir)/$(PROG).0
+ $(INSTALL) -m 444 $(PROG).cat ${DESTDIR}$(cat1dir)/$(PROG).0
audit-packages: audit-packages.sh.in
sed -e 's|@PKG_ADMIN@|${sbindir}/pkg_admin|' \
diff --git a/pkgtools/pkg_install/files/admin/README b/pkgtools/pkg_install/files/admin/README
deleted file mode 100644
index 74c13e0f1ed..00000000000
--- a/pkgtools/pkg_install/files/admin/README
+++ /dev/null
@@ -1,9 +0,0 @@
-Some of the options of this utility (add, delete) are *not* intended for
-public release. Any work regarding the consistancy of the pkgdb should
-be put into pkg_add/pkg_delete, instead of a brute-force "rebuild".
-
-The "rebuild" should be only needed wen upgrading from non-pkgdb-
-pkg_* tools to pkgdb-pkg_* tools.
-
-
- - hubertf
diff --git a/pkgtools/pkg_install/files/admin/check.c b/pkgtools/pkg_install/files/admin/check.c
index 82f77e1bcb5..dd0012b207b 100644
--- a/pkgtools/pkg_install/files/admin/check.c
+++ b/pkgtools/pkg_install/files/admin/check.c
@@ -1,4 +1,4 @@
-/* $NetBSD: check.c,v 1.9 2009/04/24 14:00:25 joerg Exp $ */
+/* $NetBSD: check.c,v 1.10 2010/01/22 13:30:41 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -7,7 +7,7 @@
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
-__RCSID("$NetBSD: check.c,v 1.9 2009/04/24 14:00:25 joerg Exp $");
+__RCSID("$NetBSD: check.c,v 1.10 2010/01/22 13:30:41 joerg Exp $");
/*-
* Copyright (c) 1999-2008 The NetBSD Foundation, Inc.
@@ -87,7 +87,6 @@ check1pkg(const char *pkgdir, int *filecnt, int *pkgcnt)
package_t Plist;
char *PkgName, *dirp = NULL, *md5file;
char file[MaxPathSize];
- char dir[MaxPathSize];
char *content;
content = pkgdb_pkg_file(pkgdir, CONTENTS_FNAME);
@@ -150,10 +149,8 @@ check1pkg(const char *pkgdir, int *filecnt, int *pkgcnt)
case PLIST_CWD:
if (strcmp(p->name, ".") != 0)
dirp = p->name;
- else {
- (void) snprintf(dir, sizeof(dir), "%s/%s", _pkgdb_getPKGDB_DIR(), pkgdir);
- dirp = dir;
- }
+ else
+ dirp = pkgdb_pkg_dir(pkgdir);
break;
case PLIST_IGNORE:
p = p->next;
diff --git a/pkgtools/pkg_install/files/admin/main.c b/pkgtools/pkg_install/files/admin/main.c
index 8e4e8b793c0..ba63ee2306d 100644
--- a/pkgtools/pkg_install/files/admin/main.c
+++ b/pkgtools/pkg_install/files/admin/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.58 2009/10/21 17:10:36 joerg Exp $ */
+/* $NetBSD: main.c,v 1.59 2010/01/22 13:30:41 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -7,7 +7,7 @@
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
-__RCSID("$NetBSD: main.c,v 1.58 2009/10/21 17:10:36 joerg Exp $");
+__RCSID("$NetBSD: main.c,v 1.59 2010/01/22 13:30:41 joerg Exp $");
/*-
* Copyright (c) 1999-2009 The NetBSD Foundation, Inc.
@@ -140,10 +140,8 @@ add_pkg(const char *pkgdir, void *vp)
plist_t *p;
package_t Plist;
char *contents;
- const char *PkgDBDir;
char *PkgName, *dirp;
char file[MaxPathSize];
- char dir[MaxPathSize];
struct pkgdb_count *count;
if (!pkgdb_open(ReadWrite))
@@ -152,7 +150,6 @@ add_pkg(const char *pkgdir, void *vp)
count = vp;
++count->packages;
- PkgDBDir = _pkgdb_getPKGDB_DIR();
contents = pkgdb_pkg_file(pkgdir, CONTENTS_FNAME);
if ((f = fopen(contents, "r")) == NULL)
errx(EXIT_FAILURE, "%s: can't open `%s'", pkgdir, CONTENTS_FNAME);
@@ -190,12 +187,10 @@ add_pkg(const char *pkgdir, void *vp)
++count->directories;
break;
case PLIST_CWD:
- if (strcmp(p->name, ".") != 0) {
+ if (strcmp(p->name, ".") != 0)
dirp = p->name;
- } else {
- (void) snprintf(dir, sizeof(dir), "%s/%s", PkgDBDir, pkgdir);
- dirp = dir;
- }
+ else
+ dirp = pkgdb_pkg_dir(pkgdir);
break;
case PLIST_IGNORE:
p = p->next;
@@ -237,14 +232,14 @@ delete1pkg(const char *pkgdir)
static void
rebuild(void)
{
- char cachename[MaxPathSize];
+ char *cachename;
struct pkgdb_count count;
count.files = 0;
count.directories = 0;
count.packages = 0;
- (void) _pkgdb_getPKGDB_FILE(cachename, sizeof(cachename));
+ cachename = pkgdb_get_database();
if (unlink(cachename) != 0 && errno != ENOENT)
err(EXIT_FAILURE, "unlink %s", cachename);
@@ -376,7 +371,7 @@ main(int argc, char *argv[])
break;
case 'K':
- _pkgdb_setPKGDB_DIR(optarg);
+ pkgdb_set_dir(optarg, 3);
break;
case 'S':
diff --git a/pkgtools/pkg_install/files/admin/pkg_admin.1.in b/pkgtools/pkg_install/files/admin/pkg_admin.1
index 7299addde2e..1e099448ffd 100644
--- a/pkgtools/pkg_install/files/admin/pkg_admin.1.in
+++ b/pkgtools/pkg_install/files/admin/pkg_admin.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_admin.1.in,v 1.1 2010/01/21 21:58:06 jmmv Exp $
+.\" $NetBSD: pkg_admin.1,v 1.31 2010/01/22 13:30:41 joerg Exp $
.\"
.\" Copyright (c) 1999-2010 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -34,7 +34,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd January 20, 2010
+.Dd January 22, 2010
.Dt PKG_ADMIN 1
.Os
.Sh NAME
@@ -72,12 +72,10 @@ as the path to the directory in which to find matching package names for
and
.Cm lsbest .
.It Fl K Ar pkg_dbdir
-Set
-.Ar pkg_dbdir
-as the package database directory.
-See the
-.Sx ENVIRONMENT
-section below for details on how the default value is calculated.
+Override the value of the
+.Dv PKG_DBDIR
+configuration option with the value
+.Ar pkg_dbdir .
.It Fl q
Perform checks in a quiet manner.
In normal operation,
@@ -205,7 +203,7 @@ is given, the fetch is conditional and the file transfer is only done if
the remote version is newer than the one in pkgdb.
.It Cm findbest Ar pattern ...
Search the entries of
-.Ev PKG_PATH
+.Dv PKG_PATH
for packages matching
.Ar pattern .
Print the URL of the best matching package to stdout for each pattern.
@@ -254,23 +252,9 @@ matches
.Ar pattern ,
otherwise returns false.
.It Cm rebuild
-Rebuild the package database mapping from scratch, scanning
-subdirectories in
-.Pa @pkgdbdir@
-for
-.Pa +CONTENTS
-files, parsing them and writing the resulting absolute pathnames
-together with the package they belong to into the package database.
-.Pp
-This option is intended to be used for upgrading from non-pkgdb-pkg_*
-tools to pkgdb-pkg_* tools, further manipulation of the pkgdb will be
-done by
-.Xr pkg_add 1 ,
-.Xr pkg_delete 1 ,
-and
-.Xr pkg_create 1 .
-.Pp
-Needs to be run as root.
+Rebuild the package database mapping from scratch.
+This option is only intended for recovery after system crashes
+during package installation and removal.
.It Cm rebuild-tree
Rebuild the +REQUIRED_BY files from scratch by reresolving all dependencies.
.Pp
@@ -306,36 +290,13 @@ as output file.
Remove an installation variable.
.El
.Sh ENVIRONMENT
-.Bl -tag -width indent -compact
-.It Ev PKG_DBDIR
-If the
-.Fl K
-flag isn't given, then the value of the
-.Ev PKG_DBDIR
-variable overrides the
+See
.Xr pkg_install.conf 5
-variable of the same name.
-If all of this fails to locate a value, then it typically defaults to
-.Pa @pkgdbdir@ .
-.El
-.Sh CONFIGURATION VARIABLES
-The following variables change the behavior of
-.Nm
-and are described in
-.Xr pkg_install.conf 5 :
-.Bl -tag -width CERTIFICATE_ANCHOR_PKGS
-.It Ev CERTIFICATE_ANCHOR_PKGS
-.It Ev CERTIFICATE_ANCHOR_PKGVULN
-.It Ev CERTIFICATE_CHAIN
-.It Ev GPG
-.It Ev PKGVULNDIR
-.It Ev PKGVULNURL
-.It Ev IGNORE_URL
-.El
+for options, that can also be specified using the environment.
.Sh FILES
-.Bl -tag -width @pkgdbdir@/pkgdb.byfile.db -compact
-.It Pa @pkgdbdir@/pkgdb.byfile.db
-.It Pa @pkgdbdir@/\*[Lt]pkg\*[Gt]/+CONTENTS
+.Bl -tag -width /var/db/pkg/pkgdb.byfile.db -compact
+.It Pa /var/db/pkg/pkgdb.byfile.db
+.It Pa /var/db/pkg/\*[Lt]pkg\*[Gt]/+CONTENTS
.El
.Sh SEE ALSO
.Xr pkg_add 1 ,
diff --git a/pkgtools/pkg_install/files/bpm/bpm.cat1 b/pkgtools/pkg_install/files/bpm/bpm.cat1
deleted file mode 100644
index 443c66f1846..00000000000
--- a/pkgtools/pkg_install/files/bpm/bpm.cat1
+++ /dev/null
@@ -1,61 +0,0 @@
-BPM(1) NetBSD General Commands Manual BPM(1)
-
-NNAAMMEE
- bbppmm -- menu-based binary package manager
-
-SSYYNNOOPPSSIISS
- bbppmm [--hhnnVVvv] [--bb _b_a_s_e_U_R_L] [--mm _m_a_c_h_i_n_e] [--rr _r_e_l_e_a_s_e] [--ww _s_e_c_o_n_d_s]
-
-DDEESSCCRRIIPPTTIIOONN
- The bbppmm command is used to locate and install binary packages from any
- reachable URL.
-
- The following command-line options are supported:
-
- --bb _b_a_s_e_U_R_L
- Specify a base URL from which to download binary packages. The
- default URL is _f_t_p_:_/_/_f_t_p_._N_e_t_B_S_D_._o_r_g_/_p_u_b_/_p_k_g_s_r_c_/_p_a_c_k_a_g_e_s.
-
- --hh Print a help message and then exit.
-
- --mm _m_a_c_h_i_n_e
- Use _m_a_c_h_i_n_e as the machine architecture to be used, instead of
- that returned by uname(1).
-
- --nn Don't actually execute the commands to add the package.
-
- --rr _r_e_l_e_a_s_e
- Use _r_e_l_e_a_s_e as the operating system release to be used, instead
- of that returned by uname(1).
-
- --VV Print version number and exit.
-
- --vv Turn on verbose output.
-
- --ww _s_e_c_o_n_d_s
- The number of _s_e_c_o_n_d_s to wait after displaying an error message
- and returning to normal menu operations.
-
- bbppmm provides a menu-based binary package manager for NetBSD. bbppmm first
- connects to the URL using ftp(1), and displays a list of categories for
- which binary packages exist. If no categories are displayed, it could be
- that the machine architecture or operating system release string have
- been wrongly interpreted, and that it will be necessary to override this
- values by means of the command line options. Within a category, a list
- of packages will be displayed, and by selecting one using the number
- assigned to it, the package will be downloaded automatically, and
- installed, using the pkg_add(1) utility. It is also possible to change
- the category currently being examined, and to quit from the utility, sim-
- ply by selecting the appropriate choices on the menu.
-
-EENNVVIIRROONNMMEENNTT
- The environment variables which govern the behavior of ftp(1) and
- pkg_add(1) are valid for bbppmm.
-
-SSEEEE AALLSSOO
- ftp(1), pkg_add(1), uname(1)
-
-AAUUTTHHOORRSS
- The bbppmm utility was written by Alistair Crooks <agc@NetBSD.org>.
-
-NetBSD 5.0 August 3, 2007 NetBSD 5.0
diff --git a/pkgtools/pkg_install/files/configure b/pkgtools/pkg_install/files/configure
index 85e3d5ad2d1..fd7aa4809f6 100755
--- a/pkgtools/pkg_install/files/configure
+++ b/pkgtools/pkg_install/files/configure
@@ -4977,7 +4977,7 @@ esac
SYSCONFDIR="$sysconfdir"
-ac_config_files="$ac_config_files Makefile add/Makefile admin/Makefile bpm/bpm.sh create/Makefile delete/Makefile info/Makefile lib/Makefile lib/pkg_install.conf.5 lib/pkg_install.conf.cat5"
+ac_config_files="$ac_config_files Makefile add/Makefile admin/Makefile bpm/bpm.sh create/Makefile delete/Makefile info/Makefile lib/Makefile lib/pkg_install.conf.5 lib/pkg_install.conf.cat"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -5668,7 +5668,7 @@ do
"info/Makefile") CONFIG_FILES="$CONFIG_FILES info/Makefile" ;;
"lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;;
"lib/pkg_install.conf.5") CONFIG_FILES="$CONFIG_FILES lib/pkg_install.conf.5" ;;
- "lib/pkg_install.conf.cat5") CONFIG_FILES="$CONFIG_FILES lib/pkg_install.conf.cat5" ;;
+ "lib/pkg_install.conf.cat") CONFIG_FILES="$CONFIG_FILES lib/pkg_install.conf.cat" ;;
*) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
diff --git a/pkgtools/pkg_install/files/configure.ac b/pkgtools/pkg_install/files/configure.ac
index 2e1d2dfe904..9c15054820a 100644
--- a/pkgtools/pkg_install/files/configure.ac
+++ b/pkgtools/pkg_install/files/configure.ac
@@ -1,3 +1,4 @@
+dnl $NetBSD: configure.ac,v 1.33 2010/01/22 13:30:41 joerg Exp $
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.52)
AC_INIT([pkg_install], [20090911], [joerg@NetBSD.org])
@@ -144,14 +145,10 @@ AH_BOTTOM(
SYSCONFDIR="$sysconfdir"
AC_SUBST(SYSCONFDIR)
+PKG_DBDIR="$pkgdbdir"
+AC_SUBST(PKG_DBDIR)
-AC_CONFIG_FILES([Makefile \
- add/Makefile add/pkg_add.1 add/pkg_add.cat1 \
- admin/Makefile admin/pkg_admin.1 admin/pkg_admin.cat1 \
- bpm/bpm.sh \
- create/Makefile create/pkg_create.1 create/pkg_create.cat1 \
- delete/Makefile delete/pkg_delete.1 delete/pkg_delete.cat1 \
- info/Makefile info/pkg_info.1 info/pkg_info.cat1 \
- lib/Makefile lib/pkg_install.conf.5 \ lib/pkg_install.conf.cat5 \
- view/pkg_view.1 view/pkg_view.cat1])
+AC_CONFIG_FILES([Makefile add/Makefile admin/Makefile bpm/bpm.sh \
+ create/Makefile delete/Makefile info/Makefile \
+ lib/Makefile lib/pkg_install.conf.5 lib/pkg_install.conf.cat])
AC_OUTPUT
diff --git a/pkgtools/pkg_install/files/create/Makefile.in b/pkgtools/pkg_install/files/create/Makefile.in
index 319653d85d2..95f73814752 100644
--- a/pkgtools/pkg_install/files/create/Makefile.in
+++ b/pkgtools/pkg_install/files/create/Makefile.in
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.in,v 1.15 2008/03/10 12:14:32 wiz Exp $
+# $NetBSD: Makefile.in,v 1.16 2010/01/22 13:30:41 joerg Exp $
srcdir= @srcdir@
@@ -50,4 +50,4 @@ install:
$(INSTALL) -m 755 -d ${DESTDIR}$(cat1dir)
$(INSTALL) $(PROG) ${DESTDIR}$(sbindir)/$(PROG)
$(INSTALL) -m 444 $(PROG).1 ${DESTDIR}$(man1dir)/$(PROG).1
- $(INSTALL) -m 444 $(PROG).cat1 ${DESTDIR}$(cat1dir)/$(PROG).0
+ $(INSTALL) -m 444 $(PROG).cat ${DESTDIR}$(cat1dir)/$(PROG).0
diff --git a/pkgtools/pkg_install/files/create/main.c b/pkgtools/pkg_install/files/create/main.c
index 67faf147b1b..ad9be9ee158 100644
--- a/pkgtools/pkg_install/files/create/main.c
+++ b/pkgtools/pkg_install/files/create/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.18 2010/01/20 22:34:47 jmmv Exp $ */
+/* $NetBSD: main.c,v 1.19 2010/01/22 13:30:41 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -7,7 +7,7 @@
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
-__RCSID("$NetBSD: main.c,v 1.18 2010/01/20 22:34:47 jmmv Exp $");
+__RCSID("$NetBSD: main.c,v 1.19 2010/01/22 13:30:41 joerg Exp $");
/*
* FreeBSD install - a package for the installation and maintainance
@@ -73,7 +73,6 @@ int
main(int argc, char **argv)
{
int ch;
- const char *pkgdb = NULL;
setprogname(argv[0]);
while ((ch = getopt(argc, argv, Options)) != -1)
@@ -135,7 +134,7 @@ main(int argc, char **argv)
break;
case 'K':
- pkgdb = optarg;
+ pkgdb_set_dir(optarg, 3);
break;
case 'k':
@@ -197,9 +196,6 @@ main(int argc, char **argv)
pkg_install_config();
- if (pkgdb != NULL)
- _pkgdb_setPKGDB_DIR(pkgdb);
-
if (argc == 0) {
warnx("missing package name");
usage();
diff --git a/pkgtools/pkg_install/files/create/pkg_create.1.in b/pkgtools/pkg_install/files/create/pkg_create.1
index 180c2c557a3..17e4c2d0551 100644
--- a/pkgtools/pkg_install/files/create/pkg_create.1.in
+++ b/pkgtools/pkg_install/files/create/pkg_create.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_create.1.in,v 1.1 2010/01/21 21:58:06 jmmv Exp $
+.\" $NetBSD: pkg_create.1,v 1.24 2010/01/22 13:30:41 joerg Exp $
.\"
.\" FreeBSD install - a package for the installation and maintenance
.\" of non-core utilities.
@@ -193,12 +193,10 @@ to be the install procedure for the package.
This can be any executable program (or shell script).
It will be invoked automatically when the package is later installed.
.It Fl K Ar pkg_dbdir
-Set
-.Ar pkg_dbdir
-as the package database directory.
-See the
-.Sx ENVIRONMENT
-section below for details on how the default value is calculated.
+Override the value of the
+.Dv PKG_DBDIR
+configuration option with the value
+.Ar pkg_dbdir .
.It Fl k Ar dscript
Set
.Ar dscript
@@ -478,24 +476,15 @@ package, as the two packages contain references to the same files,
and so cannot co-exist on the same system.
.El
.Sh ENVIRONMENT
-.Bl -tag -width PKG_DBDIR
-.It Ev PKG_DBDIR
-If the
-.Fl K
-flag isn't given, then the value of the
-.Ev PKG_DBDIR
-variable overrides the
+See
.Xr pkg_install.conf 5
-variable of the same name.
-If all of this fails to locate a value, then it typically defaults to
-.Pa @pkgdbdir@ .
-.El
+for options, that can also be specified using the environment.
.Sh SEE ALSO
.Xr pkg_add 1 ,
.Xr pkg_admin 1 ,
.Xr pkg_delete 1 ,
.Xr pkg_info 1 ,
-.Xr sysconf 3 ,
+.Xr pkg_install.conf 5
.Xr pkgsrc 7
.Sh HISTORY
The
diff --git a/pkgtools/pkg_install/files/delete/Makefile.in b/pkgtools/pkg_install/files/delete/Makefile.in
index 76239b03a17..e0adbe572b4 100644
--- a/pkgtools/pkg_install/files/delete/Makefile.in
+++ b/pkgtools/pkg_install/files/delete/Makefile.in
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.in,v 1.13 2009/02/25 16:29:08 joerg Exp $
+# $NetBSD: Makefile.in,v 1.14 2010/01/22 13:30:41 joerg Exp $
srcdir= @srcdir@
@@ -42,4 +42,4 @@ install:
$(INSTALL) -m 755 -d ${DESTDIR}$(cat1dir)
$(INSTALL) $(PROG) ${DESTDIR}$(sbindir)/$(PROG)
$(INSTALL) -m 444 $(PROG).1 ${DESTDIR}$(man1dir)/$(PROG).1
- $(INSTALL) -m 444 $(PROG).cat1 ${DESTDIR}$(cat1dir)/$(PROG).0
+ $(INSTALL) -m 444 $(PROG).cat ${DESTDIR}$(cat1dir)/$(PROG).0
diff --git a/pkgtools/pkg_install/files/delete/pkg_delete.1 b/pkgtools/pkg_install/files/delete/pkg_delete.1
new file mode 100644
index 00000000000..0cc38868290
--- /dev/null
+++ b/pkgtools/pkg_install/files/delete/pkg_delete.1
@@ -0,0 +1,296 @@
+.\" $NetBSD: pkg_delete.1,v 1.26 2010/01/22 13:30:41 joerg Exp $
+.\"
+.\" FreeBSD install - a package for the installation and maintenance
+.\" of non-core utilities.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" Jordan K. Hubbard
+.\"
+.\"
+.\" from FreeBSD: @(#)pkg_delete.1
+.\"
+.Dd January 20, 2010
+.Dt PKG_DELETE 1
+.Os
+.Sh NAME
+.Nm pkg_delete
+.Nd a utility for deleting previously installed software package distributions
+.Sh SYNOPSIS
+.Nm
+.Op Fl ADFfkNnORrVv
+.Bk -words
+.Op Fl K Ar pkg_dbdir
+.Ek
+.Bk -words
+.Op Fl P Ar destdir
+.Op Fl p Ar prefix
+.Ek
+.Ar pkg-name ...
+.Sh DESCRIPTION
+The
+.Nm
+command is used to delete packages that have been previously installed
+with the
+.Xr pkg_add 1
+command.
+The given packages are sorted, so that the dependencies of a package
+are deleted after the package.
+Before any action is executed,
+.Nm
+checks for packages that are marked as
+.Cm preserved
+or have depending packages left.
+If the
+.Fl k
+flag is given, preserved packages are removed from the list of packages
+to remove.
+Unless the
+.Fl f
+flag is given,
+.Nm
+stops on the first error.
+.Sh WARNING
+.Bf -emphasis
+Since the
+.Nm
+command may execute scripts or programs provided by a package file,
+your system may be susceptible to
+.Dq Trojan horses
+or other subtle
+attacks from miscreants who create dangerous package files.
+.Pp
+You are advised to verify the competence and identity of those who
+provide installable package files.
+For extra protection, examine all the package control files in the
+package record directory
+.Pa \*[Lt]PKG_DBDIR\*[Gt]/\*[Lt]pkg-name\*[Gt]/ ) .
+Pay particular
+attention to any
+.Pa +INSTALL
+or
+.Pa +DEINSTALL
+files, and inspect the
+.Pa +CONTENTS
+file for
+.Cm @cwd ,
+.Cm @mode
+(check for setuid),
+.Cm @dirrm ,
+.Cm @exec ,
+and
+.Cm @unexec
+directives, and/or use the
+.Xr pkg_info 1
+command to examine the installed package control files.
+.Ef
+.Sh OPTIONS
+The following command line options are supported:
+.Bl -tag -width indent
+.It Ar pkg-name ...
+The named packages are deinstalled, wildcards can be used, see
+.Xr pkg_info 1 .
+If no version is given, the one currently installed
+will be removed.
+If the
+.Fl F
+flag is given, one or more (absolute) filenames may be specified and
+the Package Database will be consulted for the package to which the
+given file belongs.
+These packages are then deinstalled.
+.It Fl A
+Recursively remove all automatically installed packages that were needed
+by the given packages and are no longer required.
+See also the
+.Fl R
+flag.
+.It Fl D
+If a deinstallation script exists for a given package, do not execute it.
+.It Fl F
+Any pkg-name given will be interpreted as pathname which is
+subsequently transformed in a (real) package name via the Package
+Database.
+That way, packages can be deleted by giving a filename
+instead of the package-name.
+.It Fl f
+Force removal of the package, even if a dependency is recorded or the
+deinstall script fails.
+.It Fl ff
+Force removal of the package, even if the package is marked as a
+.Cm preserved
+package.
+Note that this is a dangerous operation.
+See also the
+.Fl k
+option.
+.It Fl K Ar pkg_dbdir
+Override the value of the
+.Dv PKG_DBDIR
+configuration option with the value
+.Ar pkg_dbdir .
+.It Fl k
+Silently skip all packages that are marked as
+.Cm preserved .
+.It Fl N
+Remove the package's registration and its entries from the package database,
+but leave the files installed.
+Don't run any deinstall scripts or @unexec lines either.
+.It Fl n
+Don't actually deinstall a package, just report the steps that
+would be taken if it were.
+.It Fl O
+Only delete the package's entries from the package database, do not
+touch the package or its files itself.
+.It Fl p Ar destdir
+Prefix all file and directory names with
+.Ar destdir .
+For packages without install scripts this has the same behavior as
+using chroot.
+.It Fl p Ar prefix
+Set
+.Ar prefix
+as the directory in which to delete files from any installed packages
+which do not explicitly set theirs.
+For most packages, the prefix will
+be set automatically to the installed location by
+.Xr pkg_add 1 .
+.It Fl R
+Recursively remove all packages that were needed by the given packages
+and that have no other dependencies left.
+This option overrides the
+.Fl A
+flag.
+.It Fl r
+Recursively remove all packages that require one of the packages given.
+.It Fl V
+Print version number and exit.
+.It Fl v
+Turn on verbose output.
+.El
+.Sh TECHNICAL DETAILS
+.Nm
+does pretty much what it says.
+It examines installed package records in
+.Pa \*[Lt]PKG_DBDIR\*[Gt]/\*[Lt]pkg-name\*[Gt] ,
+deletes the package contents, and finally removes the package records.
+.Pp
+If a package is required by other installed packages,
+.Nm
+will list those dependent packages and refuse to delete the package
+(unless the
+.Fl f
+option is given).
+.Pp
+If a package has been marked as a
+.Cm preserved
+package, it will not be able to be deleted
+(unless more than one occurrence of the
+.Fl f
+option is given).
+.Pp
+If a filename is given instead of a package name, the package of which
+the given file belongs to can be deleted if the
+.Fl F
+Flag is given.
+The filename needs to be absolute, see the output produced by the pkg_info
+.Fl aF
+command.
+.Pp
+If a
+.Cm deinstall
+script exists for the package, it is executed before and after
+any files are removed.
+It is this script's responsibility to clean up any additional messy details
+around the package's installation, since all
+.Nm
+knows how to do is delete the files created in the original distribution.
+The
+.Ic deinstall
+script is called as:
+.Bd -filled -offset indent -compact
+.Cm deinstall
+.Aq Ar pkg-name
+.Ar VIEW-DEINSTALL
+.Ed
+before removing the package from a view, and as:
+.Bd -filled -offset indent -compact
+.Cm deinstall
+.Aq Ar pkg-name
+.Ar DEINSTALL
+.Ed
+before deleting all files and as:
+.Bd -filled -offset indent -compact
+.Cm deinstall
+.Aq Ar pkg-name
+.Ar POST-DEINSTALL
+.Ed
+after deleting them.
+Passing the keywords
+.Ar VIEW-DEINSTALL ,
+.Ar DEINSTALL
+and
+.Ar POST-DEINSTALL
+lets you potentially write only one program/script that handles all
+aspects of installation and deletion.
+.Pp
+All scripts are called with the environment variable
+.Ev PKG_PREFIX
+set to the installation prefix (see the
+.Fl p
+option above).
+This allows a package author to write a script
+that reliably performs some action on the directory where the package
+is installed, even if the user might have changed it by specifying the
+.Fl p
+option when running
+.Nm
+or
+.Xr pkg_add 1 .
+The scripts are also called with the
+.Ev PKG_METADATA_DIR
+environment variable set to the location of the
+.Pa +*
+meta-data files, and with the
+.Ev PKG_REFCOUNT_DBDIR
+environment variable set to the location of the package reference counts
+database directory.
+If the
+.Fl P
+flag was given to
+.Nm ,
+.Ev PKG_DESTDIR
+will be set to
+.Ar destdir .
+.Sh ENVIRONMENT
+See
+.Xr pkg_install.conf 5
+for options, that can also be specified using the environment.
+.Sh SEE ALSO
+.Xr pkg_add 1 ,
+.Xr pkg_admin 1 ,
+.Xr pkg_create 1 ,
+.Xr pkg_info 1 ,
+.Xr pkg_install.conf 5
+.Xr pkgsrc 7
+.Sh AUTHORS
+.Bl -tag -width indent -compact
+.It "Jordan Hubbard"
+most of the work
+.It "John Kohl"
+refined it for
+.Nx
+.It "Hubert Feyrer"
+.Nx
+wildcard dependency processing, pkgdb, recursive "down"
+delete, etc.
+.It Joerg Sonnenberger
+Rewrote most of the code to compute correct order of deinstallation
+and to improve error handling.
+.El
diff --git a/pkgtools/pkg_install/files/delete/pkg_delete.c b/pkgtools/pkg_install/files/delete/pkg_delete.c
index 9a806d526ba..38721878537 100644
--- a/pkgtools/pkg_install/files/delete/pkg_delete.c
+++ b/pkgtools/pkg_install/files/delete/pkg_delete.c
@@ -34,7 +34,7 @@
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
-__RCSID("$NetBSD: pkg_delete.c,v 1.9 2010/01/20 22:34:47 jmmv Exp $");
+__RCSID("$NetBSD: pkg_delete.c,v 1.10 2010/01/22 13:30:42 joerg Exp $");
#if HAVE_ERR_H
#include <err.h>
@@ -483,7 +483,7 @@ run_deinstall_script(const char *pkg, int do_postdeinstall)
return 0;
}
- pkgdir = xasprintf("%s/%s", _pkgdb_getPKGDB_DIR(), pkg);
+ pkgdir = pkgdb_pkg_dir(pkg);
if (chmod(fname, 0555))
warn("chmod of `%s' failed", fname);
rv = fcexec(pkgdir, fname, pkg, target, NULL);
@@ -679,8 +679,8 @@ remove_pkg(const char *pkg)
add_plist_top(&plist, PLIST_NAME, pkg);
}
- setenv(PKG_PREFIX_VNAME, p->name, 1);
- fname = xasprintf("%s/%s", _pkgdb_getPKGDB_DIR(), pkg);
+ setenv(PKG_REFCOUNT_DBDIR_VNAME, config_pkg_refcount_dbdir, 1);
+ fname = pkgdb_pkg_dir(pkg);
setenv(PKG_METADATA_DIR_VNAME, fname, 1);
free(fname);
@@ -749,7 +749,7 @@ remove_pkg(const char *pkg)
* Kill the pkgdb subdirectory. The files have been removed, so
* this is way beyond the point of no return.
*/
- pkgdir = xasprintf("%s/%s", _pkgdb_getPKGDB_DIR(), pkg);
+ pkgdir = pkgdb_pkg_dir(pkg);
(void) remove_files(pkgdir, "+*");
rv = 1;
if (isemptydir(pkgdir)&& rmdir(pkgdir) == 0)
@@ -793,7 +793,7 @@ main(int argc, char *argv[])
++Force;
break;
case 'K':
- pkgdb = optarg;
+ pkgdb_set_dir(optarg, 3);
break;
case 'k':
keep_preserve = 1;
@@ -833,19 +833,14 @@ main(int argc, char *argv[])
pkg_install_config();
+ pkgdb = xstrdup(pkgdb_get_dir());
+
if (destdir != NULL) {
char *pkgdbdir;
- if (pkgdb == NULL)
- pkgdb = _pkgdb_getPKGDB_DIR();
-
pkgdbdir = xasprintf("%s/%s", destdir, pkgdb);
- _pkgdb_setPKGDB_DIR(pkgdbdir);
+ pkgdb_set_dir(pkgdbdir, 4);
free(pkgdbdir);
- } else if (pkgdb != NULL) {
- _pkgdb_setPKGDB_DIR(pkgdb);
- } else {
- pkgdb = _pkgdb_getPKGDB_DIR();
}
argc -= optind;
diff --git a/pkgtools/pkg_install/files/info/Makefile.in b/pkgtools/pkg_install/files/info/Makefile.in
index a406fa30702..787def7435a 100644
--- a/pkgtools/pkg_install/files/info/Makefile.in
+++ b/pkgtools/pkg_install/files/info/Makefile.in
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.in,v 1.19 2009/02/14 03:02:58 obache Exp $
+# $NetBSD: Makefile.in,v 1.20 2010/01/22 13:30:42 joerg Exp $
srcdir= @srcdir@
@@ -53,4 +53,4 @@ install:
$(INSTALL) -m 755 -d ${DESTDIR}$(cat1dir)
$(INSTALL) $(PROG) ${DESTDIR}$(sbindir)/$(PROG)
$(INSTALL) -m 444 $(PROG).1 ${DESTDIR}$(man1dir)/$(PROG).1
- $(INSTALL) -m 444 $(PROG).cat1 ${DESTDIR}$(cat1dir)/$(PROG).0
+ $(INSTALL) -m 444 $(PROG).cat ${DESTDIR}$(cat1dir)/$(PROG).0
diff --git a/pkgtools/pkg_install/files/info/main.c b/pkgtools/pkg_install/files/info/main.c
index 42ec95b0aa3..e5c605279b6 100644
--- a/pkgtools/pkg_install/files/info/main.c
+++ b/pkgtools/pkg_install/files/info/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.29 2010/01/20 22:34:47 jmmv Exp $ */
+/* $NetBSD: main.c,v 1.30 2010/01/22 13:30:42 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -7,7 +7,7 @@
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
-__RCSID("$NetBSD: main.c,v 1.29 2010/01/20 22:34:47 jmmv Exp $");
+__RCSID("$NetBSD: main.c,v 1.30 2010/01/22 13:30:42 joerg Exp $");
/*
*
@@ -67,7 +67,6 @@ main(int argc, char **argv)
{
char *CheckPkg = NULL;
char *BestCheckPkg = NULL;
- const char *pkgdb = NULL;
lpkg_t *lpp;
int ch;
int rc;
@@ -127,7 +126,7 @@ main(int argc, char **argv)
break;
case 'K':
- pkgdb = optarg;
+ pkgdb_set_dir(optarg, 3);
break;
case 'k':
@@ -215,9 +214,6 @@ main(int argc, char **argv)
pkg_install_config();
- if (pkgdb != NULL)
- _pkgdb_setPKGDB_DIR(pkgdb);
-
if (argc == 0 && !Flags && !CheckPkg) {
/* No argument or relevant flags specified - assume -I */
Flags = SHOW_INDEX;
@@ -305,7 +301,7 @@ main(int argc, char **argv)
} else {
const char *dbdir;
- dbdir = _pkgdb_getPKGDB_DIR();
+ dbdir = pkgdb_get_dir();
if (**argv == '/' && strncmp(*argv, dbdir, strlen(dbdir)) == 0) {
*argv += strlen(dbdir) + 1;
if ((*argv)[strlen(*argv) - 1] == '/') {
diff --git a/pkgtools/pkg_install/files/info/perform.c b/pkgtools/pkg_install/files/info/perform.c
index 5bda21d1c96..075e57f16fe 100644
--- a/pkgtools/pkg_install/files/info/perform.c
+++ b/pkgtools/pkg_install/files/info/perform.c
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.59 2009/08/02 17:56:45 joerg Exp $ */
+/* $NetBSD: perform.c,v 1.60 2010/01/22 13:30:42 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -13,7 +13,7 @@
#if HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
-__RCSID("$NetBSD: perform.c,v 1.59 2009/08/02 17:56:45 joerg Exp $");
+__RCSID("$NetBSD: perform.c,v 1.60 2010/01/22 13:30:42 joerg Exp $");
/*-
* Copyright (c) 2008 Joerg Sonnenberger <joerg@NetBSD.org>.
@@ -336,9 +336,9 @@ static int
pkg_do(const char *pkg)
{
struct pkg_meta *meta;
- char log_dir[MaxPathSize];
int code = 0;
const char *binpkgfile = NULL;
+ char *pkgdir;
if (IS_URL(pkg) || (fexists(pkg) && isfile(pkg))) {
#ifdef BOOTSTRAP
@@ -370,9 +370,8 @@ pkg_do(const char *pkg)
* It's not an uninstalled package, try and find it among the
* installed
*/
- (void) snprintf(log_dir, sizeof(log_dir), "%s/%s",
- _pkgdb_getPKGDB_DIR(), pkg);
- if (!fexists(log_dir) || !(isdir(log_dir) || islinktodir(log_dir))) {
+ pkgdir = pkgdb_pkg_dir(pkg);
+ if (!fexists(pkgdir) || !(isdir(pkgdir) || islinktodir(pkgdir))) {
switch (add_installed_pkgs_by_basename(pkg, &pkgs)) {
case 1:
return 0;
@@ -384,6 +383,7 @@ pkg_do(const char *pkg)
errx(EXIT_FAILURE, "Error during search in pkgdb for %s", pkg);
}
}
+ free(pkgdir);
meta = read_meta_data_from_pkgdb(pkg);
}
diff --git a/pkgtools/pkg_install/files/info/pkg_info.1.in b/pkgtools/pkg_install/files/info/pkg_info.1
index 8b023100274..572e51956a3 100644
--- a/pkgtools/pkg_install/files/info/pkg_info.1.in
+++ b/pkgtools/pkg_install/files/info/pkg_info.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_info.1.in,v 1.1 2010/01/21 21:58:06 jmmv Exp $
+.\" $NetBSD: pkg_info.1,v 1.27 2010/01/22 13:30:42 joerg Exp $
.\"
.\" FreeBSD install - a package for the installation and maintenance
.\" of non-core utilities.
@@ -17,7 +17,7 @@
.\"
.\" @(#)pkg_info.1
.\"
-.Dd January 20, 2010
+.Dd January 22, 2010
.Dt PKG_INFO 1
.Os
.Sh NAME
@@ -129,12 +129,10 @@ Show the index entry for each package.
.It Fl i
Show the install script (if any) for each package.
.It Fl K Ar pkg_dbdir
-Set
-.Ar pkg_dbdir
-as the package database directory.
-See the
-.Sx ENVIRONMENT
-section below for details on how the default value is calculated.
+Override the value of the
+.Dv PKG_DBDIR
+configuration option with the value
+.Ar pkg_dbdir .
.It Fl k
Show the de-install script (if any) for each package.
.It Fl L
@@ -205,7 +203,7 @@ Its primary use is to contain all information about the contents of a
Package info is either extracted from package files named on the
command line, or from already installed package information
in
-.Pa @pkgdbdir@/\*[Lt]pkg-name\*[Gt] .
+.Pa \*[Lt]PKG_DBDIR\*[Gt]/\*[Lt]pkg-name\*[Gt] .
.Pp
A filename can be given instead of a (installed) package name to query
information on the package this file belongs to.
@@ -293,26 +291,16 @@ equates to a
.Pa patch level
and has the same value as a dot in the dewey-decimal ordering schemes.
.Sh ENVIRONMENT
-.Bl -tag -width PKG_DBDIR
-.It Ev PKG_DBDIR
-If the
-.Fl K
-flag isn't given, then the value of the
-.Ev PKG_DBDIR
-variable overrides the
+See
.Xr pkg_install.conf 5
-variable of the same name.
-If all of this fails to locate a value, then it typically defaults to
-.Pa @pkgdbdir@ .
-.El
+for options, that can also be specified using the environment.
.Sh SEE ALSO
.Xr pkg_add 1 ,
.Xr pkg_admin 1 ,
.Xr pkg_create 1 ,
.Xr pkg_delete 1 ,
-.Xr mktemp 3 ,
-.Xr pkgsrc 7 ,
-.Xr mtree 8
+.Xr pkg_install.conf 5
+.Xr pkgsrc 7
.Sh AUTHORS
.Bl -tag -width indent -compact
.It "Jordan Hubbard"
diff --git a/pkgtools/pkg_install/files/lib/Makefile.in b/pkgtools/pkg_install/files/lib/Makefile.in
index 3dc8ca65301..c8b4e7ff69c 100644
--- a/pkgtools/pkg_install/files/lib/Makefile.in
+++ b/pkgtools/pkg_install/files/lib/Makefile.in
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.in,v 1.27 2009/04/25 21:31:13 joerg Exp $
+# $NetBSD: Makefile.in,v 1.28 2010/01/22 13:30:42 joerg Exp $
srcdir= @srcdir@
@@ -62,8 +62,8 @@ install:
$(INSTALL) -m 755 -d ${DESTDIR}$(man7dir)
$(INSTALL) -m 755 -d ${DESTDIR}$(cat7dir)
$(INSTALL) -m 444 pkg_summary.5 ${DESTDIR}$(man5dir)/pkg_summary.5
- $(INSTALL) -m 444 pkg_summary.cat5 ${DESTDIR}$(cat5dir)/pkg_summary.0
+ $(INSTALL) -m 444 pkg_summary.cat ${DESTDIR}$(cat5dir)/pkg_summary.0
$(INSTALL) -m 444 pkg_install.conf.5 ${DESTDIR}$(man5dir)/pkg_install.conf.5
- $(INSTALL) -m 444 pkg_install.conf.cat5 ${DESTDIR}$(cat5dir)/pkg_install.conf.0
+ $(INSTALL) -m 444 pkg_install.conf.cat ${DESTDIR}$(cat5dir)/pkg_install.conf.0
$(INSTALL) -m 444 pkgsrc.7 ${DESTDIR}$(man7dir)/pkgsrc.7
- $(INSTALL) -m 444 pkgsrc.cat7 ${DESTDIR}$(cat7dir)/pkgsrc.0
+ $(INSTALL) -m 444 pkgsrc.cat ${DESTDIR}$(cat7dir)/pkgsrc.0
diff --git a/pkgtools/pkg_install/files/lib/conflicts.c b/pkgtools/pkg_install/files/lib/conflicts.c
index 9e15e5def72..22c7fd9c1fa 100644
--- a/pkgtools/pkg_install/files/lib/conflicts.c
+++ b/pkgtools/pkg_install/files/lib/conflicts.c
@@ -1,4 +1,4 @@
-/* $NetBSD: conflicts.c,v 1.9 2009/08/02 17:56:45 joerg Exp $ */
+/* $NetBSD: conflicts.c,v 1.10 2010/01/22 13:30:42 joerg Exp $ */
/*-
* Copyright (c) 2007 Roland Illig <rillig@NetBSD.org>.
@@ -48,7 +48,7 @@
#include <sys/cdefs.h>
#endif
-__RCSID("$NetBSD: conflicts.c,v 1.9 2009/08/02 17:56:45 joerg Exp $");
+__RCSID("$NetBSD: conflicts.c,v 1.10 2010/01/22 13:30:42 joerg Exp $");
#if HAVE_ERR_H
#include <err.h>
@@ -75,15 +75,16 @@ struct package_conflict {
static FILE *
fopen_contents(const char *pkgname, const char *mode)
{
- char fname[MaxPathSize];
+ char *fname;
FILE *f;
- snprintf(fname, sizeof(fname), "%s/%s/%s", _pkgdb_getPKGDB_DIR(), pkgname, CONTENTS_FNAME);
+ fname = pkgdb_pkg_file(pkgname, CONTENTS_FNAME);
f = fopen(fname, mode);
if (f == NULL) {
err(EXIT_FAILURE, "%s", fname);
/* NOTREACHED */
}
+ free(fname);
return f;
}
diff --git a/pkgtools/pkg_install/files/lib/iterate.c b/pkgtools/pkg_install/files/lib/iterate.c
index 1e446950b89..36778a07ab9 100644
--- a/pkgtools/pkg_install/files/lib/iterate.c
+++ b/pkgtools/pkg_install/files/lib/iterate.c
@@ -1,4 +1,4 @@
-/* $NetBSD: iterate.c,v 1.7 2009/08/02 17:56:45 joerg Exp $ */
+/* $NetBSD: iterate.c,v 1.8 2010/01/22 13:30:42 joerg Exp $ */
/*-
* Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>.
@@ -154,7 +154,7 @@ iterate_pkg_db(int (*matchiter)(const char *, void *), void *cookie)
DIR *dirp;
int retval;
- if ((dirp = opendir(_pkgdb_getPKGDB_DIR())) == NULL) {
+ if ((dirp = opendir(pkgdb_get_dir())) == NULL) {
if (errno == ENOENT)
return 0; /* No pkgdb directory == empty pkgdb */
return -1;
diff --git a/pkgtools/pkg_install/files/lib/lib.h b/pkgtools/pkg_install/files/lib/lib.h
index 2b97cfc346d..f85bf1c0b01 100644
--- a/pkgtools/pkg_install/files/lib/lib.h
+++ b/pkgtools/pkg_install/files/lib/lib.h
@@ -1,4 +1,4 @@
-/* $NetBSD: lib.h,v 1.58 2009/08/16 21:10:15 joerg Exp $ */
+/* $NetBSD: lib.h,v 1.59 2010/01/22 13:30:42 joerg Exp $ */
/* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */
@@ -354,10 +354,18 @@ int pkgdb_dump(void);
int pkgdb_remove(const char *);
int pkgdb_remove_pkg(const char *);
char *pkgdb_refcount_dir(void);
-char *_pkgdb_getPKGDB_FILE(char *, unsigned);
-const char *_pkgdb_getPKGDB_DIR(void);
-void _pkgdb_setPKGDB_DIR(const char *);
-
+char *pkgdb_get_database(void);
+const char *pkgdb_get_dir(void);
+/*
+ * Priorities:
+ * 0 builtin default
+ * 1 config file
+ * 2 environment
+ * 3 command line
+ * 4 destdir/views reset
+ */
+void pkgdb_set_dir(const char *, int);
+char *pkgdb_pkg_dir(const char *);
char *pkgdb_pkg_file(const char *, const char *);
/* List of packages functions */
@@ -426,7 +434,9 @@ extern const char *certs_packages;
extern const char *certs_pkg_vulnerabilities;
extern const char *check_vulnerabilities;
extern const char *config_file;
+extern const char *config_pkg_dbdir;
extern const char *config_pkg_path;
+extern const char *config_pkg_refcount_dbdir;
extern const char *do_license_check;
extern const char *verified_installation;
extern const char *gpg_cmd;
diff --git a/pkgtools/pkg_install/files/lib/license.c b/pkgtools/pkg_install/files/lib/license.c
index 31ff6056b44..be423cad38b 100644
--- a/pkgtools/pkg_install/files/lib/license.c
+++ b/pkgtools/pkg_install/files/lib/license.c
@@ -1,4 +1,4 @@
-/* $NetBSD: license.c,v 1.10 2009/10/25 21:32:48 wiz Exp $ */
+/* $NetBSD: license.c,v 1.11 2010/01/22 13:30:42 joerg Exp $ */
/*-
* Copyright (c) 2009 Joerg Sonnenberger <joerg@NetBSD.org>.
@@ -58,7 +58,9 @@ const char *default_acceptable_licenses =
"cpl-1.0 "
"open-font-license "
"mpl-1.0 mpl-1.1 "
- "zpl";
+ "zpl "
+ "python-software-foundation "
+ "info-zip";
#ifdef DEBUG
static size_t hash_collisions;
diff --git a/pkgtools/pkg_install/files/lib/parse-config.c b/pkgtools/pkg_install/files/lib/parse-config.c
index 1effd47f0d1..7c55c110dbc 100644
--- a/pkgtools/pkg_install/files/lib/parse-config.c
+++ b/pkgtools/pkg_install/files/lib/parse-config.c
@@ -1,4 +1,4 @@
-/* $NetBSD: parse-config.c,v 1.13 2010/01/20 22:34:47 jmmv Exp $ */
+/* $NetBSD: parse-config.c,v 1.14 2010/01/22 13:30:42 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -7,7 +7,7 @@
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
-__RCSID("$NetBSD: parse-config.c,v 1.13 2010/01/20 22:34:47 jmmv Exp $");
+__RCSID("$NetBSD: parse-config.c,v 1.14 2010/01/22 13:30:42 joerg Exp $");
/*-
* Copyright (c) 2008, 2009 Joerg Sonnenberger <joerg@NetBSD.org>.
@@ -46,8 +46,15 @@ __RCSID("$NetBSD: parse-config.c,v 1.13 2010/01/20 22:34:47 jmmv Exp $");
#include <string.h>
#endif
+#ifndef BOOTSTRAP
+#include <fetch.h>
+#endif
+
#include "lib.h"
+static int cache_connections = 16;
+static int cache_connections_host = 4;
+
const char *config_file = SYSCONFDIR"/pkg_install.conf";
char fetch_flags[10] = ""; /* Workaround Mac OS X linker issues with BSS */
@@ -59,8 +66,11 @@ const char *cert_chain_file;
const char *certs_packages;
const char *certs_pkg_vulnerabilities;
const char *check_vulnerabilities;
+static const char *config_cache_connections;
+static const char *config_cache_connections_host;
const char *config_pkg_dbdir;
const char *config_pkg_path;
+const char *config_pkg_refcount_dbdir;
const char *do_license_check;
const char *verified_installation;
const char *gpg_cmd;
@@ -82,6 +92,8 @@ static struct config_variable {
{ "ACCEPTABLE_LICENSES", &acceptable_licenses },
{ "ACTIVE_FTP", &active_ftp },
{ "CACHE_INDEX", &cache_index },
+ { "CACHE_CONNECTIONS", &config_cache_connections },
+ { "CACHE_CONNECTIONS_HOST", &config_cache_connections_host },
{ "CERTIFICATE_ANCHOR_PKGS", &certs_packages },
{ "CERTIFICATE_ANCHOR_PKGVULN", &certs_pkg_vulnerabilities },
{ "CERTIFICATE_CHAIN", &cert_chain_file },
@@ -97,6 +109,7 @@ static struct config_variable {
{ "IGNORE_URL", &ignore_advisories },
{ "PKG_DBDIR", &config_pkg_dbdir },
{ "PKG_PATH", &config_pkg_path },
+ { "PKG_REFCOUNT_DBDIR", &config_pkg_refcount_dbdir },
{ "PKGVULNDIR", &pkg_vulnerabilities_dir },
{ "PKGVULNURL", &pkg_vulnerabilities_url },
{ "VERBOSE_NETIO", &verbose_netio },
@@ -159,15 +172,23 @@ pkg_install_config(void)
{
int do_cache_index;
char *value;
+
parse_pkg_install_conf();
if ((value = getenv("PKG_DBDIR")) != NULL)
- config_pkg_dbdir = value;
+ pkgdb_set_dir(value, 2);
else if (config_pkg_dbdir != NULL)
- _pkgdb_setPKGDB_DIR(config_pkg_dbdir);
+ pkgdb_set_dir(config_pkg_dbdir, 1);
+ config_pkg_dbdir = xstrdup(pkgdb_get_dir());
+
+ if ((value = getenv("PKG_REFCOUNT_DBDIR")) != NULL)
+ config_pkg_refcount_dbdir = value;
+ else if (config_pkg_refcount_dbdir == NULL)
+ config_pkg_refcount_dbdir = xasprintf("%s.refcount",
+ pkgdb_get_dir());
if (pkg_vulnerabilities_dir == NULL)
- pkg_vulnerabilities_dir = _pkgdb_getPKGDB_DIR();
+ pkg_vulnerabilities_dir = pkgdb_get_dir();
pkg_vulnerabilities_file = xasprintf("%s/pkg-vulnerabilities",
pkg_vulnerabilities_dir);
if (pkg_vulnerabilities_url == NULL) {
@@ -195,6 +216,30 @@ pkg_install_config(void)
do_cache_index = 0;
}
+ if (config_cache_connections && *config_cache_connections) {
+ long v = strtol(config_cache_connections, &value, 10);
+ if (*value == '\0') {
+ if (v >= INT_MAX || v < 0)
+ v = -1;
+ cache_connections = v;
+ }
+ }
+ config_cache_connections = xasprintf("%d", cache_connections);
+
+ if (config_cache_connections_host) {
+ long v = strtol(config_cache_connections_host, &value, 10);
+ if (*value == '\0') {
+ if (v >= INT_MAX || v < 0)
+ v = -1;
+ cache_connections_host = v;
+ }
+ }
+ config_cache_connections_host = xasprintf("%d", cache_connections_host);
+
+#ifndef BOOTSTRAP
+ fetchConnectionCacheInit(cache_connections, cache_connections_host);
+#endif
+
snprintf(fetch_flags, sizeof(fetch_flags), "%s%s%s%s",
(do_cache_index) ? "c" : "",
(verbose_netio && *verbose_netio) ? "v" : "",
diff --git a/pkgtools/pkg_install/files/lib/pkg_install.conf.5.in b/pkgtools/pkg_install/files/lib/pkg_install.conf.5.in
index 2b547e7e79f..8f8bf3d5088 100644
--- a/pkgtools/pkg_install/files/lib/pkg_install.conf.5.in
+++ b/pkgtools/pkg_install/files/lib/pkg_install.conf.5.in
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_install.conf.5.in,v 1.12 2010/01/20 22:34:47 jmmv Exp $
+.\" $NetBSD: pkg_install.conf.5.in,v 1.13 2010/01/22 13:30:42 joerg Exp $
.\"
.\" Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -27,7 +27,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd January 19, 2010
+.Dd January 22, 2010
.Dt PKG_INSTALL.CONF 5
.Os
.Sh NAME
@@ -46,6 +46,9 @@ If the value consists of more than one line, each line is prefixed with
The current value of a variable can be checked by running
.Dl Ic pkg_admin config-var VARIABLE
.Pp
+Some variables are overriden by environmental variables of the same name.
+Those are marked by (*).
+.Pp
The following variables are supported:
.Bl -tag -width indent
.It Dv ACCEPTABLE_LICENSES
@@ -98,6 +101,17 @@ A missing pkg-vulnerabilities file is considered an error.
.It Dv interactive
The user is always asked to confirm installation of vulnerable packages.
.El
+.It Dv CONFIG_CACHE_CONNECTIONS
+Limit the global connection cache to this value.
+For FTP this is the number of sessions without active command.
+For HTTP this is the number of connections open with keep-alive.
+.It Dv CONFIG_CACHE_CONNECTIONS_HOST
+Like
+.Dv CONFIG_CACHE_CONNECTIONS ,
+but limit the number of connections to the host as well.
+See
+.Xr fetch 3
+for further details
.It Dv DEFAULT_ACCEPTABLE_LICENSES
List of common Free and Open Source licenses packages are allowed to carry.
The default value contains all OSI approved licenses in pkgsrc on the date
@@ -133,15 +147,19 @@ One line per advisory which should be ignored when running
The URL from the
.Pa pkg-vulnerabilities
file should be used as value.
-.It Dv PKG_DBDIR
+.It Dv PKG_DBDIR (*)
Location of the packages database.
-Overridden by the environment variable
-.Ev PKG_DBDIR .
-.It Dv PKG_PATH
-Search path as used by
-.Nm pkg_add .
-Overridden by the environment variable
-.Ev PKG_PATH .
+This option is always overriden by the argument of the
+.Fl K
+option.
+.It Dv PKG_PATH (*)
+Search path for packages.
+The entries are separated by semicolon.
+Each entry specifies a directory or URL to search for packages.
+.It Dv PKG_REFCOUNT_DBDIR (*)
+Location of the package reference counts database directory.
+The default value is
+.Pa ${PKG_DBDIR}.refcount .
.It Dv PKGVULNDIR
Directory name in which the
.Pa pkg-vulnerabilities
@@ -153,8 +171,7 @@ URL which is used for updating the local
.Pa pkg-vulnerabilities
file when running
.Dl Ic pkg_admin fetch-pkg-vulnerabilities
-The default is
-.Pa http://ftp.NetBSD.org/pub/NetBSD/packages/vulns/pkg-vulnerabilities.gz
+The default location is ftp.NetBSD.org using HTTP.
.Em Note :
Usually, only the compression type should be changed.
Currently supported are uncompressed files and files compressed by
@@ -189,3 +206,6 @@ Default location for the file described in this manual page.
.Sh SEE ALSO
.Xr pkg_add 1 ,
.Xr pkg_admin 1
+.Xr pkg_create 1 ,
+.Xr pkg_delete 1 ,
+.Xr pkg_info 1
diff --git a/pkgtools/pkg_install/files/lib/pkg_install.conf.cat5.in b/pkgtools/pkg_install/files/lib/pkg_install.conf.cat5.in
deleted file mode 100644
index e883b66280c..00000000000
--- a/pkgtools/pkg_install/files/lib/pkg_install.conf.cat5.in
+++ /dev/null
@@ -1,153 +0,0 @@
-PKG_INSTALL.CONF(5) NetBSD File Formats Manual PKG_INSTALL.CONF(5)
-
-NNAAMMEE
- ppkkgg__iinnssttaallll..ccoonnff -- configuration file for package installation tools
-
-DDEESSCCRRIIPPTTIIOONN
- The file ppkkgg__iinnssttaallll..ccoonnff contains system defaults for the package
- installation tools as a list of variable-value pairs. Each line has the
- format VARIABLE=VALUE. If the value consists of more than one line, each
- line is prefixed with VARIABLE=.
-
- The current value of a variable can be checked by running
- ppkkgg__aaddmmiinn ccoonnffiigg--vvaarr VVAARRIIAABBLLEE
-
- The following variables are supported:
-
- ACCEPTABLE_LICENSES
- List of licenses packages are allowed to carry. License names
- are case-sensitive.
-
- ACTIVE_FTP
- Force the use of active FTP.
-
- CACHE_INDEX
- Cache directory listenings in memory. This avoids retransfers of
- the large directory index for HTTP and is enabled by default.
-
- CERTIFICATE_ANCHOR_PKGS
- Path to the file containing the certificates used for validating
- binary packages. A package is trusted when a certificate chain
- ends in one of the certificates contained in this file. The cer-
- tificates must be PEM-encoded.
-
- CERTIFICATE_ANCHOR_PKGVULN
- Analogous to CERTIFICATE_ANCHOR_PKGS. The _p_k_g_-_v_u_l_n_e_r_a_b_i_l_i_t_i_e_s is
- trusted when a certificate chain ends in one of the certificates
- contained in this file.
-
- CERTIFICATE_CHAIN
- Path to a file containing additional certificates that can be
- used for completing certificate chains when validating binary
- packages or pkg-vulnerabilities files.
-
- CHECK_LICENSE
- Check the license conditions of packages before installing them.
- Supported values are:
-
- no The check is not performed.
-
- yes The check is performed if the package has license
- conditions set.
-
- always Passing the license check is required. Missing
- license conditions are considered an error.
-
- CHECK_VULNERABILITIES
- Check for vulnerabilities when installing packages. Supported
- values are:
-
- never No check is performed.
-
- always Passing the vulnerability check is required. A
- missing pkg-vulnerabilities file is considered an
- error.
-
- interactive The user is always asked to confirm installation
- of vulnerable packages.
-
- DEFAULT_ACCEPTABLE_LICENSES
- List of common Free and Open Source licenses packages are allowed
- to carry. The default value contains all OSI approved licenses
- in pkgsrc on the date pkg_install was released. License names
- are case-sensitive.
-
- GPG Path to gpg(1), which can be used to verify the signature in the
- _p_k_g_-_v_u_l_n_e_r_a_b_i_l_i_t_i_e_s file when running
- ppkkgg__aaddmmiinn cchheecckk--ppkkgg--vvuullnneerraabbiilliittiieess --ss
- or
- ppkkgg__aaddmmiinn ffeettcchh--ppkkgg--vvuullnneerraabbiilliittiieess --ss
- It can also be used to verify and sign binary packages.
-
- GPG_KEYRING_PKGVULN
- Non-default keyring to use for verifying GPG signatures of
- _p_k_g_-_v_u_l_n_e_r_a_b_i_l_i_t_i_e_s.
-
- GPG_KEYRING_SIGN
- Non-default keyring to use for signing packages with GPG.
-
- GPG_KEYRING_VERIFY
- Non-default keyring to use for verifying GPG signature of pack-
- ages.
-
- GPG_SIGN_AS
- User-id to use for signing packages.
-
- IGNORE_PROXY
- Use direct connections and ignore FTP_PROXY and HTTP_PROXY.
-
- IGNORE_URL
- One line per advisory which should be ignored when running
- ppkkgg__aaddmmiinn aauuddiitt
- The URL from the _p_k_g_-_v_u_l_n_e_r_a_b_i_l_i_t_i_e_s file should be used as
- value.
-
- PKG_DBDIR
- Location of the packages database. Overridden by the environment
- variable PKG_DBDIR.
-
- PKG_PATH
- Search path as used by ppkkgg__aadddd. Overridden by the environment
- variable PKG_PATH.
-
- PKGVULNDIR
- Directory name in which the _p_k_g_-_v_u_l_n_e_r_a_b_i_l_i_t_i_e_s file resides.
- Default is _$_{_P_K_G___D_B_D_I_R_}.
-
- PKGVULNURL
- URL which is used for updating the local _p_k_g_-_v_u_l_n_e_r_a_b_i_l_i_t_i_e_s file
- when running
- ppkkgg__aaddmmiinn ffeettcchh--ppkkgg--vvuullnneerraabbiilliittiieess
- The default is
- _h_t_t_p_:_/_/_f_t_p_._N_e_t_B_S_D_._o_r_g_/_p_u_b_/_N_e_t_B_S_D_/_p_a_c_k_a_g_e_s_/_v_u_l_n_s_/_p_k_g_-_v_u_l_n_e_r_a_b_i_l_i_t_i_e_s_._g_z
- _N_o_t_e: Usually, only the compression type should be changed. Cur-
- rently supported are uncompressed files and files compressed by
- bzip2(1) (_._b_z_2) or gzip(1) (_._g_z).
-
- VERBOSE_NETIO
- Log details of network IO to stderr.
-
- VERIFIED_INSTALLATION
- Set trust level used when installation. Supported values are:
-
- never No signature checks are performed.
-
- always A valid signature is required. If the binary
- package can not be verified, the installation is
- terminated
-
- trusted A valid signature is required. If the binary
- package can not be verified, the user is asked
- interactively.
-
- interactive The user is always asked interactively when
- installing a package.
-
-FFIILLEESS
- @SYSCONFDIR@/pkg_install.conf Default location for the file described in
- this manual page.
-
-SSEEEE AALLSSOO
- pkg_add(1), pkg_admin(1)
-
-NetBSD 5.0 January 19, 2010 NetBSD 5.0
diff --git a/pkgtools/pkg_install/files/lib/pkg_summary.cat5 b/pkgtools/pkg_install/files/lib/pkg_summary.cat5
deleted file mode 100644
index 830d61be8b3..00000000000
--- a/pkgtools/pkg_install/files/lib/pkg_summary.cat5
+++ /dev/null
@@ -1,103 +0,0 @@
-PKG_SUMMARY(5) NetBSD File Formats Manual PKG_SUMMARY(5)
-
-NNAAMMEE
- ppkkgg__ssuummmmaarryy -- summary of binary package repository
-
-DDEESSCCRRIIPPTTIIOONN
- The file ppkkgg__ssuummmmaarryy contains information about each package in a binary
- package repository as a list of variable-value pairs. The variables
- describing different packages are separated by one empty line. Each line
- has the format VARIABLE=VALUE. If the value consists of more than one
- line, each line is prefixed with VARIABLE=. Multi-line variables are
- guaranteed to be in consecutive lines.
-
- The following variables are used:
-
- BUILD_DATE
- (required) The date and time when the package was built.
-
- CATEGORIES
- (required) A list of categories which this package fits in, sepa-
- rated by space.
-
- COMMENT
- (required) A one-line description of the package.
-
- CONFLICTS
- (optional) A list of dewey patterns of packages the package con-
- flicts with, one per line. If missing, this package has no con-
- flicts.
-
- DEPENDS
- (optional) A list of dewey patterns of packages the package
- depends on, one per line. If missing, this package has no depen-
- dencies.
-
- DESCRIPTION
- (required) A more detailed description of the package.
-
- FILE_NAME
- (optional) The name of the binary package file. If not given,
- _P_K_G_N_A_M_E_._t_g_z can be assumed.
-
- FILE_SIZE
- (optional) The size of the binary package file, in bytes.
-
- HOMEPAGE
- (optional) A URL where more information about the package can be
- found.
-
- LICENSE
- (optional) The type of license this package is distributed under.
- If empty or missing, it is OSI-approved.
-
- MACHINE_ARCH
- (required) The architecture on which the package was compiled.
-
- OPSYS (required) The operating system on which the package was com-
- piled.
-
- OS_VERSION
- (required) The version of the operating system on which the pack-
- age was compiled.
-
- PKG_OPTIONS
- (optional) Any options selected to compile this package. If
- missing, the package does not support options.
-
- PKGNAME
- (required) The name of the package.
-
- PKGPATH
- (required) The path of the package directory within pkgsrc.
-
- PKGTOOLS_VERSION
- (required) The version of the package tools used to create the
- package.
-
- PROVIDES
- (optional) A list of shared libraries provided by the package,
- including major version number, one per line. If missing, this
- package does not provide shared libraries.
-
- REQUIRES
- (optional) A list of shared libraries needed by the package,
- including major version number, one per line. If missing, this
- package does not require shared libraries.
-
- SIZE_PKG
- (required) The size of the package when installed, in bytes.
-
- The ppkkgg__ssuummmmaarryy file can be generated using the pkg_info(1) --XX option.
- For example, the following will list this data for all installed pack-
- ages:
-
- pkg_info -X -a
-
-SSEEEE AALLSSOO
- pkg_info(1)
-
-HHIISSTTOORRYY
- The ppkkgg__ssuummmmaarryy format was first officially documented in April 2006.
-
-NetBSD 5.0 August 29, 2007 NetBSD 5.0
diff --git a/pkgtools/pkg_install/files/lib/pkgdb.c b/pkgtools/pkg_install/files/lib/pkgdb.c
index a72664d542a..7a6d2da34fb 100644
--- a/pkgtools/pkg_install/files/lib/pkgdb.c
+++ b/pkgtools/pkg_install/files/lib/pkgdb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pkgdb.c,v 1.36 2009/10/22 22:51:29 joerg Exp $ */
+/* $NetBSD: pkgdb.c,v 1.37 2010/01/22 13:30:42 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -7,7 +7,7 @@
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
-__RCSID("$NetBSD: pkgdb.c,v 1.36 2009/10/22 22:51:29 joerg Exp $");
+__RCSID("$NetBSD: pkgdb.c,v 1.37 2010/01/22 13:30:42 joerg Exp $");
/*-
* Copyright (c) 1999-2008 The NetBSD Foundation, Inc.
@@ -77,7 +77,18 @@ __RCSID("$NetBSD: pkgdb.c,v 1.36 2009/10/22 22:51:29 joerg Exp $");
#define PKG_DBDIR "PKG_DBDIR"
static DB *pkgdbp;
-static char *pkgdb_dir = NULL;
+static char pkgdb_dir_default[] = DEF_LOG_DIR;
+static char *pkgdb_dir = pkgdb_dir_default;
+static int pkgdb_dir_prio = 0;
+
+/*
+ * Return name of cache file in the buffer that was passed.
+ */
+char *
+pkgdb_get_database(void)
+{
+ return xasprintf("%s/%s", pkgdb_get_dir(), PKGDB_FILE);
+}
/*
* Open the pkg-database
@@ -89,7 +100,7 @@ int
pkgdb_open(int mode)
{
BTREEINFO info;
- char cachename[MaxPathSize];
+ char *cachename;
/* try our btree format first */
info.flags = 0;
@@ -100,9 +111,11 @@ pkgdb_open(int mode)
info.compare = NULL;
info.prefix = NULL;
info.lorder = 0;
- pkgdbp = (DB *) dbopen(_pkgdb_getPKGDB_FILE(cachename, sizeof(cachename)),
+ cachename = pkgdb_get_database();
+ pkgdbp = (DB *) dbopen(cachename,
(mode == ReadOnly) ? O_RDONLY : O_RDWR | O_CREAT,
0644, DB_BTREE, (void *) &info);
+ free(cachename);
return (pkgdbp != NULL);
}
@@ -231,12 +244,12 @@ pkgdb_remove_pkg(const char *pkg)
int type;
int ret;
size_t cc;
- char cachename[MaxPathSize];
+ char *cachename;
if (pkgdbp == NULL) {
return 0;
}
- (void) _pkgdb_getPKGDB_FILE(cachename, sizeof(cachename));
+ cachename = pkgdb_get_database();
cc = strlen(pkg);
for (ret = 1, type = R_FIRST; (*pkgdbp->seq)(pkgdbp, &key, &data, type) == 0 ; type = R_NEXT) {
if ((cc + 1) == data.size && strncmp(data.data, pkg, cc) == 0) {
@@ -256,6 +269,7 @@ pkgdb_remove_pkg(const char *pkg)
}
}
}
+ free(cachename);
return ret;
}
@@ -271,17 +285,7 @@ pkgdb_refcount_dir(void)
if ((tmp = getenv(PKG_REFCOUNT_DBDIR_VNAME)) != NULL)
strlcpy(buf, tmp, sizeof(buf));
else
- snprintf(buf, sizeof(buf), "%s.refcount", _pkgdb_getPKGDB_DIR());
- return buf;
-}
-
-/*
- * Return name of cache file in the buffer that was passed.
- */
-char *
-_pkgdb_getPKGDB_FILE(char *buf, unsigned size)
-{
- (void) snprintf(buf, size, "%s/%s", _pkgdb_getPKGDB_DIR(), PKGDB_FILE);
+ snprintf(buf, sizeof(buf), "%s.refcount", pkgdb_get_dir());
return buf;
}
@@ -289,16 +293,8 @@ _pkgdb_getPKGDB_FILE(char *buf, unsigned size)
* Return directory where pkgdb is stored
*/
const char *
-_pkgdb_getPKGDB_DIR(void)
+pkgdb_get_dir(void)
{
- char *tmp;
-
- if (pkgdb_dir == NULL) {
- if ((tmp = getenv(PKG_DBDIR)) != NULL)
- _pkgdb_setPKGDB_DIR(tmp);
- else
- _pkgdb_setPKGDB_DIR(DEF_LOG_DIR);
- }
return pkgdb_dir;
}
@@ -307,19 +303,29 @@ _pkgdb_getPKGDB_DIR(void)
* Set the first place we look for where pkgdb is stored.
*/
void
-_pkgdb_setPKGDB_DIR(const char *dir)
+pkgdb_set_dir(const char *dir, int prio)
{
- char *new_dir;
+
+ if (prio < pkgdb_dir_prio)
+ return;
+
+ pkgdb_dir_prio = prio;
if (dir == pkgdb_dir)
return;
- new_dir = xstrdup(dir);
- free(pkgdb_dir);
- pkgdb_dir = new_dir;
+ if (pkgdb_dir != pkgdb_dir_default)
+ free(pkgdb_dir);
+ pkgdb_dir = xstrdup(dir);
+}
+
+char *
+pkgdb_pkg_dir(const char *pkg)
+{
+ return xasprintf("%s/%s", pkgdb_get_dir(), pkg);
}
char *
pkgdb_pkg_file(const char *pkg, const char *file)
{
- return xasprintf("%s/%s/%s", _pkgdb_getPKGDB_DIR(), pkg, file);
+ return xasprintf("%s/%s/%s", pkgdb_get_dir(), pkg, file);
}
diff --git a/pkgtools/pkg_install/files/lib/pkgsrc.cat7 b/pkgtools/pkg_install/files/lib/pkgsrc.cat7
deleted file mode 100644
index 14556516ed2..00000000000
--- a/pkgtools/pkg_install/files/lib/pkgsrc.cat7
+++ /dev/null
@@ -1,19 +0,0 @@
-PKGSRC(7) NetBSD Miscellaneous Information Manual PKGSRC(7)
-
-NNAAMMEE
- ppkkggssrrcc -- NetBSD packages collection (framework for third-party software)
-
-DDEESSCCRRIIPPTTIIOONN
- The NetBSD Packages Collection (pkgsrc) is a framework for building and
- maintaining third-party software on NetBSD and other UNIX-like systems.
- It is used to enable freely available software to be configured and built
- easily on supported platforms.
-
- Tools are available to install ready-to-use packages and to perform vari-
- ous administrative tasks for the package system.
-
-SSEEEE AALLSSOO
- pkg_add(1), pkg_delete(1), pkg_info(1),
- _h_t_t_p_:_/_/_w_w_w_._n_e_t_b_s_d_._o_r_g_/_D_o_c_u_m_e_n_t_a_t_i_o_n_/_p_k_g_s_r_c_/
-
-NetBSD 4.0 March 2, 2007 NetBSD 4.0
diff --git a/pkgtools/pkg_install/files/lib/version.h b/pkgtools/pkg_install/files/lib/version.h
index 9776be591bc..e7d4b492a4d 100644
--- a/pkgtools/pkg_install/files/lib/version.h
+++ b/pkgtools/pkg_install/files/lib/version.h
@@ -1,4 +1,4 @@
-/* $NetBSD: version.h,v 1.145 2010/01/21 21:58:06 jmmv Exp $ */
+/* $NetBSD: version.h,v 1.146 2010/01/22 13:30:42 joerg Exp $ */
/*
* Copyright (c) 2001 Thomas Klausner. All rights reserved.
@@ -27,6 +27,6 @@
#ifndef _INST_LIB_VERSION_H_
#define _INST_LIB_VERSION_H_
-#define PKGTOOLS_VERSION "20100121"
+#define PKGTOOLS_VERSION "20100122"
#endif /* _INST_LIB_VERSION_H_ */
diff --git a/pkgtools/pkg_install/files/view/pkg_view.1.in b/pkgtools/pkg_install/files/view/pkg_view.1
index c8bf701f963..376dd79a152 100644
--- a/pkgtools/pkg_install/files/view/pkg_view.1.in
+++ b/pkgtools/pkg_install/files/view/pkg_view.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_view.1.in,v 1.1 2010/01/21 21:58:07 jmmv Exp $
+.\" $NetBSD: pkg_view.1,v 1.13 2010/01/22 13:30:42 joerg Exp $
.\"
.\" Copyright (c) 2003 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -31,7 +31,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd January 20, 2010
+.Dd September 8, 2003
.Dt PKG_VIEW 1
.Os
.Sh NAME
@@ -115,14 +115,12 @@ to the list of files in
that should ignored when adding or removing the package instance from
.Ar view .
.It Fl k Ar pkg_dbdir
-Set
-.Ar pkg_dbdir
-as the package database directory for the default (empty) view.
-If this option isn't specified, then the package database directory is
-taken from the value of the environment variable
-.Ev PKG_DBDIR ,
-otherwise it defaults to
-.Pa @pkgdbdir@ .
+Override the value of the
+.Dv PKG_DBDIR
+configuration option with the value
+.Ar pkg_dbdir .
+This is used as as the package database directory for the
+default (empty) view.
.It Fl n
Don't actually execute the commands for manipulating the package instances.
.It Fl V
@@ -196,7 +194,7 @@ flag isn't given, then the value of the environment variable
.Ev PKG_DBDIR
is the package database directory for the default view,
otherwise it defaults to
-.Pa @pkgdbdir@ .
+.Pa /var/db/pkg .
.It Ev PLIST_IGNORE_FILES
This can be used to specify files in
.Ar package