Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/pkgviews]: src/usr.sbin/pkg_install Teach the pkg_* tools to use PKG_REG...



details:   https://anonhg.NetBSD.org/src/rev/a72b8719a977
branches:  pkgviews
changeset: 534267:a72b8719a977
user:      jlam <jlam%NetBSD.org@localhost>
date:      Mon Aug 25 20:17:08 2003 +0000

description:
Teach the pkg_* tools to use PKG_REGISTRY, then PKG_DBDIR, then /var/pkg/db
as the locatin of the package database directory.  PKG_DBDIR is treated by
pkg_view(1) as the location of the package database directory for the
default view.  Also modify pkg_view(1) to accept new env vars DEPOTBASE
and LOCALBASE as defaults for "stowdir" and "viewbase", respectively.
LOCALBASE is also used by linkfarm(1) so we now share a common env var
for a common concept.  PKG_VIEWBASE is obsoleted by this change.  Lastly,
modify pkg_view(1) to give nicer error messages and to output them to
stderr instead of stdout.

Bump the version to 20020821.

diffstat:

 usr.sbin/pkg_install/add/pkg_add.1       |  22 ++++---
 usr.sbin/pkg_install/admin/pkg_admin.1   |  18 +++--
 usr.sbin/pkg_install/create/pkg_create.1 |   8 +-
 usr.sbin/pkg_install/delete/pkg_delete.1 |   8 +-
 usr.sbin/pkg_install/info/pkg_info.1     |  16 +++--
 usr.sbin/pkg_install/lib/lib.h           |   8 ++-
 usr.sbin/pkg_install/lib/pkgdb.c         |   8 +-
 usr.sbin/pkg_install/lib/version.h       |   4 +-
 usr.sbin/pkg_install/view/pkg_view.1     |  44 ++++++++++-----
 usr.sbin/pkg_install/view/pkg_view.sh    |  88 +++++++++++++++++--------------
 10 files changed, 133 insertions(+), 91 deletions(-)

diffs (truncated from 485 to 300 lines):

diff -r 49f59f5e3d60 -r a72b8719a977 usr.sbin/pkg_install/add/pkg_add.1
--- a/usr.sbin/pkg_install/add/pkg_add.1        Sun Aug 24 09:28:39 2003 +0000
+++ b/usr.sbin/pkg_install/add/pkg_add.1        Mon Aug 25 20:17:08 2003 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_add.1,v 1.33.4.5 2003/08/21 22:13:06 jlam Exp $
+.\" $NetBSD: pkg_add.1,v 1.33.4.6 2003/08/25 20:17:08 jlam Exp $
 .\"
 .\" FreeBSD install - a package for the installation and maintenance
 .\" of non-core utilities.
@@ -120,8 +120,10 @@
 as the package database directory.
 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
+.Ev PKG_REGISTRY
+if it's set, otherwise it's taken from the value of the environment variable
+.Ev PKG_DBDIR
+if it's set, otherwise it defaults to
 .Pa /var/db/pkg .
 .It Fl L
 Don't add the package to any views after installation.
@@ -465,7 +467,8 @@
 flag to
 .Cm pkg_add .
 .Sh ENVIRONMENT
-.Ss PKG_PATH
+.Bl -tag -width PKG_TMPDIR
+.It Ev PKG_PATH
 The value of the
 .Ev PKG_PATH
 is used if a given package can't be found, it's usually set to
@@ -476,17 +479,18 @@
 The current directory may be indicated implicitly by an empty directory
 name, or explicitly by a single period.
 FTP URLs may not end with a slash.
-.Ss PKG_DBDIR
+.It Ev PKG_REGISTRY , Ev PKG_DBDIR
 If the
 .Fl K
-flag isn't given, then
-.Ev PKG_DBDIR
-notes where to register packages instead of
+flag isn't given, then these are tried in turn (if set) as the location
+of the package database directory.
+The default package database directory is
 .Pa /var/db/pkg .
-.Ss PKG_TMPDIR
+.It Ev PKG_TMPDIR
 Staging directory for installing packages, defaults to /var/tmp.
 Set to directory with lots of free disk if you run out of
 space when installing a binary package.
+.El
 .Sh EXAMPLES
 In all cases,
 .Nm
diff -r 49f59f5e3d60 -r a72b8719a977 usr.sbin/pkg_install/admin/pkg_admin.1
--- a/usr.sbin/pkg_install/admin/pkg_admin.1    Sun Aug 24 09:28:39 2003 +0000
+++ b/usr.sbin/pkg_install/admin/pkg_admin.1    Mon Aug 25 20:17:08 2003 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: pkg_admin.1,v 1.16.4.3 2003/08/21 22:13:07 jlam Exp $
+.\"    $NetBSD: pkg_admin.1,v 1.16.4.4 2003/08/25 20:17:09 jlam Exp $
 .\"
 .\" Copyright (c) 1999-2002 Hubert Feyrer.  All rights reserved.
 .\"
@@ -57,8 +57,10 @@
 as the package database directory.
 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
+.Ev PKG_REGISTRY
+if it's set, otherwise it's taken from the value of the environment variable
+.Ev PKG_DBDIR
+if it's set, otherwise it defaults to
 .Pa /var/db/pkg .
 .It Fl V
 Print version number and exit.
@@ -142,13 +144,13 @@
 .Pp
 .El
 .Sh ENVIRONMENT
-.Bl -tag -width PKG_DBDIR -compact
-.It Ev PKG_DBDIR
+.Bl -tag -width indent -compact
+.It Ev PKG_REGISTRY , Ev PKG_DBDIR
 If the
 .Fl K
-flag isn't given, then
-.Ev PKG_DBDIR
-notes where to register packages instead of
+flag isn't given, then these are tried in turn (if set) as the location
+of the package database directory.
+The default package database directory is
 .Pa /var/db/pkg .
 .El
 .Sh FILES
diff -r 49f59f5e3d60 -r a72b8719a977 usr.sbin/pkg_install/create/pkg_create.1
--- a/usr.sbin/pkg_install/create/pkg_create.1  Sun Aug 24 09:28:39 2003 +0000
+++ b/usr.sbin/pkg_install/create/pkg_create.1  Mon Aug 25 20:17:08 2003 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_create.1,v 1.32.4.4 2003/08/21 22:13:07 jlam Exp $
+.\" $NetBSD: pkg_create.1,v 1.32.4.5 2003/08/25 20:17:09 jlam Exp $
 .\"
 .\" FreeBSD install - a package for the installation and maintenance
 .\" of non-core utilities.
@@ -186,8 +186,10 @@
 as the package database directory.
 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
+.Ev PKG_REGISTRY
+if it's set, otherwise it's taken from the value of the environment variable
+.Ev PKG_DBDIR
+if it's set, otherwise it defaults to
 .Pa /var/db/pkg .
 .It Fl k Ar dscript
 Set
diff -r 49f59f5e3d60 -r a72b8719a977 usr.sbin/pkg_install/delete/pkg_delete.1
--- a/usr.sbin/pkg_install/delete/pkg_delete.1  Sun Aug 24 09:28:39 2003 +0000
+++ b/usr.sbin/pkg_install/delete/pkg_delete.1  Mon Aug 25 20:17:08 2003 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_delete.1,v 1.24.4.3 2003/08/21 22:13:08 jlam Exp $
+.\" $NetBSD: pkg_delete.1,v 1.24.4.4 2003/08/25 20:17:10 jlam Exp $
 .\"
 .\" FreeBSD install - a package for the installation and maintenance
 .\" of non-core utilities.
@@ -108,8 +108,10 @@
 as the package database directory.
 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
+.Ev PKG_REGISTRY
+if it's set, otherwise it's taken from the value of the environment variable
+.Ev PKG_DBDIR
+if it's set, otherwise it defaults to
 .Pa /var/db/pkg .
 .It Fl n
 Don't actually deinstall a package, just report the steps that
diff -r 49f59f5e3d60 -r a72b8719a977 usr.sbin/pkg_install/info/pkg_info.1
--- a/usr.sbin/pkg_install/info/pkg_info.1      Sun Aug 24 09:28:39 2003 +0000
+++ b/usr.sbin/pkg_install/info/pkg_info.1      Mon Aug 25 20:17:08 2003 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_info.1,v 1.29.2.3 2003/08/21 22:13:09 jlam Exp $
+.\" $NetBSD: pkg_info.1,v 1.29.2.4 2003/08/25 20:17:10 jlam Exp $
 .\"
 .\" FreeBSD install - a package for the installation and maintenance
 .\" of non-core utilities.
@@ -161,8 +161,10 @@
 as the package database directory.
 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
+.Ev PKG_REGISTRY
+if it's set, otherwise it's taken from the value of the environment variable
+.Ev PKG_DBDIR
+if it's set, otherwise it defaults to
 .Pa /var/db/pkg .
 .It Fl k
 Show the de-install script (if any) for each package.
@@ -208,12 +210,12 @@
 .El
 .Sh ENVIRONMENT
 .Bl -tag -width PKG_DBDIR
-.It Ev PKG_DBDIR
+.It Ev PKG_REGISTRY , Ev PKG_DBDIR
 If the
 .Fl K
-flag isn't given, then
-.Ev PKG_DBDIR
-sets the location of the package database directory instead of using
+flag isn't given, then these are tried in turn (if set) as the location
+of the package database directory.
+The default package database directory is
 .Pa /var/db/pkg .
 .It Ev PKG_PATH
 This can be used to specify a semicolon-separated list of paths and URLs to search for
diff -r 49f59f5e3d60 -r a72b8719a977 usr.sbin/pkg_install/lib/lib.h
--- a/usr.sbin/pkg_install/lib/lib.h    Sun Aug 24 09:28:39 2003 +0000
+++ b/usr.sbin/pkg_install/lib/lib.h    Mon Aug 25 20:17:08 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lib.h,v 1.43.2.6 2003/08/21 22:13:09 jlam Exp $ */
+/* $NetBSD: lib.h,v 1.43.2.7 2003/08/25 20:17:11 jlam Exp $ */
 
 /* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */
 
@@ -89,13 +89,17 @@
 #define CHGRP_CMD "chgrp"
 #endif
 
-/* Where we put logging information by default, else ${PKG_DBDIR} if set */
+/*
+ * Where we put logging information by default, if PKG_REGISTRY and
+ * PKG_DBDIR are both unset.
+ */
 #ifndef DEF_LOG_DIR
 #define DEF_LOG_DIR            "/var/db/pkg"
 #endif
 
 /* just in case we change the environment variable name */
 #define PKG_DBDIR              "PKG_DBDIR"
+#define PKG_REGISTRY           "PKG_REGISTRY"
 
 /* The names of our "special" files */
 #define CONTENTS_FNAME         "+CONTENTS"
diff -r 49f59f5e3d60 -r a72b8719a977 usr.sbin/pkg_install/lib/pkgdb.c
--- a/usr.sbin/pkg_install/lib/pkgdb.c  Sun Aug 24 09:28:39 2003 +0000
+++ b/usr.sbin/pkg_install/lib/pkgdb.c  Mon Aug 25 20:17:08 2003 +0000
@@ -1,8 +1,8 @@
-/*     $NetBSD: pkgdb.c,v 1.9.4.2 2003/08/21 22:13:09 jlam Exp $       */
+/*     $NetBSD: pkgdb.c,v 1.9.4.3 2003/08/25 20:17:11 jlam Exp $       */
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: pkgdb.c,v 1.9.4.2 2003/08/21 22:13:09 jlam Exp $");
+__RCSID("$NetBSD: pkgdb.c,v 1.9.4.3 2003/08/25 20:17:11 jlam Exp $");
 #endif
 
 /*
@@ -241,7 +241,9 @@
        char *tmp;
 
        if (pkgdb_dir == NULL) {
-               if ((tmp = getenv(PKG_DBDIR)))
+               if ((tmp = getenv(PKG_REGISTRY)))
+                       _pkgdb_setPKGDB_DIR(tmp);
+               else if ((tmp = getenv(PKG_DBDIR)))
                        _pkgdb_setPKGDB_DIR(tmp);
                else
                        _pkgdb_setPKGDB_DIR(DEF_LOG_DIR);
diff -r 49f59f5e3d60 -r a72b8719a977 usr.sbin/pkg_install/lib/version.h
--- a/usr.sbin/pkg_install/lib/version.h        Sun Aug 24 09:28:39 2003 +0000
+++ b/usr.sbin/pkg_install/lib/version.h        Mon Aug 25 20:17:08 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: version.h,v 1.13.4.12 2003/08/21 22:13:10 jlam Exp $   */
+/*     $NetBSD: version.h,v 1.13.4.13 2003/08/25 20:17:11 jlam Exp $   */
 
 /*
  * Copyright (c) 2001 Thomas Klausner.  All rights reserved.
@@ -33,6 +33,6 @@
 #ifndef _INST_LIB_VERSION_H_
 #define _INST_LIB_VERSION_H_
 
-#define PKGTOOLS_VERSION "20030820"
+#define PKGTOOLS_VERSION "20030821"
 
 #endif /* _INST_LIB_VERSION_H_ */
diff -r 49f59f5e3d60 -r a72b8719a977 usr.sbin/pkg_install/view/pkg_view.1
--- a/usr.sbin/pkg_install/view/pkg_view.1      Sun Aug 24 09:28:39 2003 +0000
+++ b/usr.sbin/pkg_install/view/pkg_view.1      Mon Aug 25 20:17:08 2003 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: pkg_view.1,v 1.1.2.10 2003/08/22 07:13:20 jlam Exp $
+.\"    $NetBSD: pkg_view.1,v 1.1.2.11 2003/08/25 20:17:12 jlam Exp $
 .\"
 .\" Copyright (c) 2003 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -86,7 +86,11 @@
 Set
 .Ar stowdir
 as the directory in which the installed packages can be found.
-The default
+If this option isn't specified, then the
+.Ar stowdir
+is taken from the value of the environment variable
+.Ev DEPOTBASE
+if it's set, otherwise the default
 .Ar stowdir
 is the
 .Pa packages
@@ -99,13 +103,13 @@
 .Ar package
 that should ignored when adding or removing the package from
 .Ar view .
-.It Fl k Ar pkg_dbdir_dflt
+.It Fl k Ar pkg_dbdir
 Set
-.Ar pkg_dbdir_dflt
+.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_DFLT ,
+.Ev PKG_DBDIR ,
 otherwise it defaults to
 .Pa /var/db/pkg .
 .It Fl V
@@ -121,7 +125,7 @@
 directory is
 .Pa /usr/pkg
 but may be overridden by the
-.Ev PKG_VIEWBASE
+.Ev LOCALBASE
 environment variable.
 .It Fl w Ar view
 Set
@@ -151,11 +155,29 @@
 .El



Home | Main Index | Thread Index | Old Index