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 Allow using "-K <pkg_dbdir>" instead...



details:   https://anonhg.NetBSD.org/src/rev/ccbc849354e8
branches:  pkgviews
changeset: 534262:ccbc849354e8
user:      jlam <jlam%NetBSD.org@localhost>
date:      Thu Aug 21 22:13:06 2003 +0000

description:
Allow using "-K <pkg_dbdir>" instead of using "PKG_DBDIR=<pkg_dbdir>" to
specify the package database directory to the pkg_install tools.  Order of
precedence for locating the package database directory is:

        <pkg_dbdir> specified by "-K <pkg_dbdir>"
        ${PKG_DBDIR}
        /var/db/pkg

Bump the pkg_install tools version to 20030820.

diffstat:

 usr.sbin/pkg_install/add/main.c          |  10 +++-
 usr.sbin/pkg_install/add/pkg_add.1       |  25 +++++++++++--
 usr.sbin/pkg_install/admin/main.c        |  10 +++-
 usr.sbin/pkg_install/admin/pkg_admin.1   |  20 +++++++++-
 usr.sbin/pkg_install/create/main.c       |  10 +++-
 usr.sbin/pkg_install/create/pkg_create.1 |  14 +++++++-
 usr.sbin/pkg_install/delete/main.c       |  58 +++++++++++++++++--------------
 usr.sbin/pkg_install/delete/perform.c    |   6 +-
 usr.sbin/pkg_install/delete/pkg_delete.1 |  20 +++++++++-
 usr.sbin/pkg_install/info/main.c         |  10 +++-
 usr.sbin/pkg_install/info/pkg_info.1     |  23 +++++++++--
 usr.sbin/pkg_install/lib/lib.h           |   3 +-
 usr.sbin/pkg_install/lib/pkgdb.c         |  31 ++++++++++++----
 usr.sbin/pkg_install/lib/version.h       |   4 +-
 14 files changed, 177 insertions(+), 67 deletions(-)

diffs (truncated from 608 to 300 lines):

diff -r d982c2daf0e0 -r ccbc849354e8 usr.sbin/pkg_install/add/main.c
--- a/usr.sbin/pkg_install/add/main.c   Thu Aug 21 09:27:44 2003 +0000
+++ b/usr.sbin/pkg_install/add/main.c   Thu Aug 21 22:13:06 2003 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: main.c,v 1.25.2.3 2003/08/17 04:55:21 jlam Exp $       */
+/*     $NetBSD: main.c,v 1.25.2.4 2003/08/21 22:13:06 jlam Exp $       */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char *rcsid = "from FreeBSD Id: main.c,v 1.16 1997/10/08 07:45:43 charnier Exp";
 #else
-__RCSID("$NetBSD: main.c,v 1.25.2.3 2003/08/17 04:55:21 jlam Exp $");
+__RCSID("$NetBSD: main.c,v 1.25.2.4 2003/08/21 22:13:06 jlam Exp $");
 #endif
 #endif
 
@@ -37,7 +37,7 @@
 #include "add.h"
 #include "verify.h"
 
-static char Options[] = "ILMRSVW:fhnp:s:t:uvw:";
+static char Options[] = "IK:LMRSVW:fhnp:s:t:uvw:";
 
 char   *Prefix = NULL;
 char   *View = NULL;
@@ -84,6 +84,10 @@
                        NoInstall = TRUE;
                        break;
 
+               case 'K':
+                       _pkgdb_setPKGDB_DIR(optarg);
+                       break;
+
                case 'L':
                        NoView = TRUE;
                        break;
diff -r d982c2daf0e0 -r ccbc849354e8 usr.sbin/pkg_install/add/pkg_add.1
--- a/usr.sbin/pkg_install/add/pkg_add.1        Thu Aug 21 09:27:44 2003 +0000
+++ b/usr.sbin/pkg_install/add/pkg_add.1        Thu Aug 21 22:13:06 2003 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_add.1,v 1.33.4.4 2003/08/21 03:07:55 jlam Exp $
+.\" $NetBSD: pkg_add.1,v 1.33.4.5 2003/08/21 22:13:06 jlam Exp $
 .\"
 .\" FreeBSD install - a package for the installation and maintenance
 .\" of non-core utilities.
@@ -27,6 +27,9 @@
 .Nm
 .Op Fl fILMnRSuVv
 .Bk -words
+.Op Fl K Ar pkg_dbdir
+.Ek
+.Bk -words
 .Op Fl p Ar prefix
 .Ek
 .Bk -words
@@ -111,6 +114,15 @@
 a failure to find one will not be fatal.
 .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.
+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 /var/db/pkg .
 .It Fl L
 Don't add the package to any views after installation.
 .It Fl M
@@ -422,8 +434,9 @@
 Any package dependencies are recorded in the other packages'
 .Pa /var/db/pkg/\*[Lt]other-pkg\*[Gt]/+REQUIRED_BY
 file
-(if the environment variable PKG_DBDIR is set, this overrides the
-.Pa /var/db/pkg/
+(if an alternate package database directory is specified, then it
+overrides the
+.Pa /var/db/pkg
 path shown above).
 .It
 If the package is a depoted package, then add it to the default view.
@@ -464,7 +477,11 @@
 name, or explicitly by a single period.
 FTP URLs may not end with a slash.
 .Ss PKG_DBDIR
-Where to register packages instead of
+If the
+.Fl K
+flag isn't given, then
+.Ev PKG_DBDIR
+notes where to register packages instead of
 .Pa /var/db/pkg .
 .Ss PKG_TMPDIR
 Staging directory for installing packages, defaults to /var/tmp.
diff -r d982c2daf0e0 -r ccbc849354e8 usr.sbin/pkg_install/admin/main.c
--- a/usr.sbin/pkg_install/admin/main.c Thu Aug 21 09:27:44 2003 +0000
+++ b/usr.sbin/pkg_install/admin/main.c Thu Aug 21 22:13:06 2003 +0000
@@ -1,8 +1,8 @@
-/*     $NetBSD: main.c,v 1.28.2.3 2003/07/31 19:17:36 jlam Exp $       */
+/*     $NetBSD: main.c,v 1.28.2.4 2003/08/21 22:13:07 jlam Exp $       */
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.28.2.3 2003/07/31 19:17:36 jlam Exp $");
+__RCSID("$NetBSD: main.c,v 1.28.2.4 2003/08/21 22:13:07 jlam Exp $");
 #endif
 
 /*
@@ -49,7 +49,7 @@
 
 #define DEFAULT_SFX    ".t[bg]z"       /* default suffix for ls{all,best} */
 
-static const char Options[] = "s:V";
+static const char Options[] = "K:s:V";
 
 void    usage(void);
 
@@ -353,6 +353,10 @@
 
        while ((ch = getopt(argc, argv, Options)) != -1)
                switch (ch) {
+               case 'K':
+                       _pkgdb_setPKGDB_DIR(optarg);
+                       break;
+
                case 's':
                        (void) strlcpy(sfx, optarg, sizeof(sfx));
                        use_default_sfx = FALSE;
diff -r d982c2daf0e0 -r ccbc849354e8 usr.sbin/pkg_install/admin/pkg_admin.1
--- a/usr.sbin/pkg_install/admin/pkg_admin.1    Thu Aug 21 09:27:44 2003 +0000
+++ b/usr.sbin/pkg_install/admin/pkg_admin.1    Thu Aug 21 22:13:06 2003 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: pkg_admin.1,v 1.16.4.2 2003/07/31 19:17:37 jlam Exp $
+.\"    $NetBSD: pkg_admin.1,v 1.16.4.3 2003/08/21 22:13:07 jlam Exp $
 .\"
 .\" Copyright (c) 1999-2002 Hubert Feyrer.  All rights reserved.
 .\"
@@ -38,6 +38,9 @@
 .Nm
 .Op Fl V
 .Bk -words
+.Op Fl K Ar pkg_dbdir
+.Ek
+.Bk -words
 .Op Fl s Ar sfx_pattern
 .Ek
 .Ar command Op args ...
@@ -48,6 +51,15 @@
 Available commands are:
 .Pp
 .Bl -tag -width check
+.It Fl K Ar pkg_dbdir
+Set
+.Ar pkg_dbdir
+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
+.Pa /var/db/pkg .
 .It Fl V
 Print version number and exit.
 .It Fl s Ar sfx_pattern
@@ -132,7 +144,11 @@
 .Sh ENVIRONMENT
 .Bl -tag -width PKG_DBDIR -compact
 .It Ev PKG_DBDIR
-Where to register packages instead of
+If the
+.Fl K
+flag isn't given, then
+.Ev PKG_DBDIR
+notes where to register packages instead of
 .Pa /var/db/pkg .
 .El
 .Sh FILES
diff -r d982c2daf0e0 -r ccbc849354e8 usr.sbin/pkg_install/create/main.c
--- a/usr.sbin/pkg_install/create/main.c        Thu Aug 21 09:27:44 2003 +0000
+++ b/usr.sbin/pkg_install/create/main.c        Thu Aug 21 22:13:06 2003 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: main.c,v 1.21.2.4 2003/07/29 01:37:44 jlam Exp $       */
+/*     $NetBSD: main.c,v 1.21.2.5 2003/08/21 22:13:07 jlam Exp $       */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: main.c,v 1.17 1997/10/08 07:46:23 charnier Exp";
 #else
-__RCSID("$NetBSD: main.c,v 1.21.2.4 2003/07/29 01:37:44 jlam Exp $");
+__RCSID("$NetBSD: main.c,v 1.21.2.5 2003/08/21 22:13:07 jlam Exp $");
 #endif
 #endif
 
@@ -24,7 +24,7 @@
 #include "lib.h"
 #include "create.h"
 
-static const char Options[] = "B:C:D:EFI:L:OP:RS:UVX:b:c:d:f:hi:k:lm:n:p:r:s:t:v";
+static const char Options[] = "B:C:D:EFI:K:L:OP:RS:UVX:b:c:d:f:hi:k:lm:n:p:r:s:t:v";
 
 char   *Prefix = NULL;
 char   *Comment = NULL;
@@ -130,6 +130,10 @@
                        Install = optarg;
                        break;
 
+               case 'K':
+                       _pkgdb_setPKGDB_DIR(optarg);
+                       break;
+
                case 'k':
                        DeInstall = optarg;
                        break;
diff -r d982c2daf0e0 -r ccbc849354e8 usr.sbin/pkg_install/create/pkg_create.1
--- a/usr.sbin/pkg_install/create/pkg_create.1  Thu Aug 21 09:27:44 2003 +0000
+++ b/usr.sbin/pkg_install/create/pkg_create.1  Thu Aug 21 22:13:06 2003 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_create.1,v 1.32.4.3 2003/08/21 09:27:44 jlam Exp $
+.\" $NetBSD: pkg_create.1,v 1.32.4.4 2003/08/21 22:13:07 jlam Exp $
 .\"
 .\" FreeBSD install - a package for the installation and maintenance
 .\" of non-core utilities.
@@ -43,6 +43,9 @@
 .Op Fl D Ar displayfile
 .Ek
 .Bk -words
+.Op Fl K Ar pkg_dbdir
+.Ek
+.Bk -words
 .Op Fl P Ar dpkgs
 .Ek
 .Bk -words
@@ -177,6 +180,15 @@
 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.
+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 /var/db/pkg .
 .It Fl k Ar dscript
 Set
 .Ar dscript
diff -r d982c2daf0e0 -r ccbc849354e8 usr.sbin/pkg_install/delete/main.c
--- a/usr.sbin/pkg_install/delete/main.c        Thu Aug 21 09:27:44 2003 +0000
+++ b/usr.sbin/pkg_install/delete/main.c        Thu Aug 21 22:13:06 2003 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: main.c,v 1.20.2.2 2003/08/20 01:52:39 jlam Exp $       */
+/*     $NetBSD: main.c,v 1.20.2.3 2003/08/21 22:13:08 jlam Exp $       */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char *rcsid = "from FreeBSD Id: main.c,v 1.11 1997/10/08 07:46:48 charnier Exp";
 #else
-__RCSID("$NetBSD: main.c,v 1.20.2.2 2003/08/20 01:52:39 jlam Exp $");
+__RCSID("$NetBSD: main.c,v 1.20.2.3 2003/08/21 22:13:08 jlam Exp $");
 #endif
 #endif
 
@@ -35,7 +35,7 @@
 #include "lib.h"
 #include "delete.h"
 
-static char Options[] = "DFORVdfhnp:rv";
+static char Options[] = "DFK:ORVdfhnp:rv";
 
 char   *Prefix = NULL;
 char   *ProgramPath = NULL;
@@ -67,22 +67,6 @@
 
        while ((ch = getopt(argc, argv, Options)) != -1)
                switch (ch) {
-               case 'v':
-                       Verbose = TRUE;
-                       break;
-
-               case 'f':
-                       Force += 1;
-                       break;
-
-               case 'F':
-                       File2Pkg = TRUE;
-                       break;
-
-               case 'p':
-                       Prefix = optarg;
-                       break;
-
                case 'D':
                        NoDeInstall = TRUE;
                        break;



Home | Main Index | Thread Index | Old Index