pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc Bump version to 20030907. Changes from previous versi...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/0324bad5ad64
branches:  trunk
changeset: 461014:0324bad5ad64
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Tue Sep 09 13:34:11 2003 +0000

description:
Bump version to 20030907.  Changes from previous version include:

    * Teaching pkg_add(1) to be smarter about how to add a depoted packge.

    * "pkg_delete foo" only deletes foo if it's a unique package.

    * Make "pkg_delete -O foo" for delete file entries for foo from
      pkgdb.byfile.db actually work.

    * Teach pkg_admin(1) two new commands "add" and "delete" for working
      with pkgdb.byfile.db.

    * pkg_view(1) uses the new pkg_admin(1) commands to keep the
      pkgdb.byfile.db files consistent in each view.

    * Man page fixes.

diffstat:

 doc/CHANGES                                       |    3 +-
 pkgtools/pkg_install/DESCR                        |    4 +-
 pkgtools/pkg_install/files/add/perform.c          |   54 +++--
 pkgtools/pkg_install/files/add/pkg_add.1          |   22 +-
 pkgtools/pkg_install/files/add/pkg_add.cat1       |   15 +-
 pkgtools/pkg_install/files/admin/main.c           |  221 +++++++++++++--------
 pkgtools/pkg_install/files/admin/pkg_admin.1      |   43 +++-
 pkgtools/pkg_install/files/admin/pkg_admin.cat1   |  137 +++++++-----
 pkgtools/pkg_install/files/create/pkg_create.1    |  107 ++++++----
 pkgtools/pkg_install/files/create/pkg_create.cat1 |   62 +++---
 pkgtools/pkg_install/files/delete/perform.c       |   60 ++++-
 pkgtools/pkg_install/files/delete/pkg_delete.1    |    4 +-
 pkgtools/pkg_install/files/delete/pkg_delete.cat1 |    2 +-
 pkgtools/pkg_install/files/info/perform.c         |   12 +-
 pkgtools/pkg_install/files/info/pkg_info.1        |    4 +-
 pkgtools/pkg_install/files/info/pkg_info.cat1     |    2 +-
 pkgtools/pkg_install/files/lib/pkgdb.c            |   25 +-
 pkgtools/pkg_install/files/lib/str.c              |    6 +-
 pkgtools/pkg_install/files/lib/version.h          |    4 +-
 pkgtools/pkg_install/files/view/linkfarm.1        |   11 +-
 pkgtools/pkg_install/files/view/linkfarm.cat1     |    8 +-
 pkgtools/pkg_install/files/view/pkg_view.1        |   78 ++++---
 pkgtools/pkg_install/files/view/pkg_view.cat1     |   91 ++++----
 pkgtools/pkg_install/files/view/pkg_view.sh.in    |    5 +-
 24 files changed, 577 insertions(+), 403 deletions(-)

diffs (truncated from 2019 to 300 lines):

diff -r d96aa6c8b5a6 -r 0324bad5ad64 doc/CHANGES
--- a/doc/CHANGES       Tue Sep 09 13:28:17 2003 +0000
+++ b/doc/CHANGES       Tue Sep 09 13:34:11 2003 +0000
@@ -1,4 +1,4 @@
-$NetBSD: CHANGES,v 1.3292 2003/09/09 13:28:17 recht Exp $
+$NetBSD: CHANGES,v 1.3293 2003/09/09 13:34:11 jlam Exp $
 
 Changes to the packages collection and infrastructure in 2003:
 
@@ -3588,3 +3588,4 @@
        Updated py-wxWindows to 2.4.1.2 [recht 2003-09-09]
        Added py-gnome2 2.0.0 [recht 2003-09-09]
        Updated pyslk to 1.2.4 [recht 2003-09-09]
+       Updated pkg_install to 20030907 [jlam 2003-09-09]
diff -r d96aa6c8b5a6 -r 0324bad5ad64 pkgtools/pkg_install/DESCR
--- a/pkgtools/pkg_install/DESCR        Tue Sep 09 13:28:17 2003 +0000
+++ b/pkgtools/pkg_install/DESCR        Tue Sep 09 13:34:11 2003 +0000
@@ -1,4 +1,4 @@
 This is a copy of NetBSD-current's pkg_* tools in a format which
-is able to be installed as a package. To prevent deinstallation,
-they don't register themselves as a package. On NetBSD, they simply
+is able to be installed as a package.  To prevent deinstallation,
+they don't register themselves as a package.  On NetBSD, they simply
 replace the tools in /usr/sbin.
diff -r d96aa6c8b5a6 -r 0324bad5ad64 pkgtools/pkg_install/files/add/perform.c
--- a/pkgtools/pkg_install/files/add/perform.c  Tue Sep 09 13:28:17 2003 +0000
+++ b/pkgtools/pkg_install/files/add/perform.c  Tue Sep 09 13:34:11 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: perform.c,v 1.9 2003/09/02 08:28:23 jlam Exp $ */
+/*     $NetBSD: perform.c,v 1.10 2003/09/09 13:34:17 jlam Exp $        */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -11,7 +11,7 @@
 #if 0
 static const char *rcsid = "from FreeBSD Id: perform.c,v 1.44 1997/10/13 15:03:46 jkh Exp";
 #else
-__RCSID("$NetBSD: perform.c,v 1.9 2003/09/02 08:28:23 jlam Exp $");
+__RCSID("$NetBSD: perform.c,v 1.10 2003/09/09 13:34:17 jlam Exp $");
 #endif
 #endif
 
@@ -86,8 +86,9 @@
        if (Verbose)
                printf("Loading it from %s.\n", name);
        path_setenv("PKG_PATH");
-       if (vsystem("%s/pkg_add -s %s %s%s%s %s%s %s%s%s %s%s",
+       if (vsystem("%s/pkg_add -K %s -s %s %s%s%s %s%s %s%s%s %s%s",
                        BINDIR,
+                       _pkgdb_getPKGDB_DIR(),
                        get_verification(),
                        NoView ? "-L " : "",
                        View ? "-w " : "",
@@ -124,7 +125,7 @@
        char    replace_to[FILENAME_MAX];
        int     replacing = 0;
        char   *where_to, *extract;
-       char   *dbdir;
+       char   dbdir[FILENAME_MAX];
        const char *exact;
        FILE   *cfile;
        int     errc;
@@ -297,18 +298,17 @@
        if (fexists(VIEWS_FNAME))
                is_depoted_pkg = TRUE;
        
-       dbdir = _pkgdb_getPKGDB_DIR();
-       (void) snprintf(LogDir, sizeof(LogDir), "%s/%s", dbdir, PkgName);
-
-       /* check if the dbdir is wrong because this is a depoted package */
+       /*
+        * Depoted packages' dbdir is the same as DEPOTBASE.  Non-depoted
+        * packages' dbdir comes from the command-line or the environment.
+        */
        if (is_depoted_pkg) {
-               if ((p = find_plist(&Plist, PLIST_CWD))) {
-                       if (strcmp(p->name, LogDir) != 0) {
-                               warnx("%s is not the depot directory for %s.",
-                                       dbdir, PkgName);
-                               goto success;
-                       }
-               }
+               p = find_plist(&Plist, PLIST_CWD);
+               (void) strlcpy(dbdir, dirname_of(p->name), sizeof(dbdir));
+               (void) strlcpy(LogDir, p->name, sizeof(LogDir));
+       } else {
+               (void) strlcpy(dbdir, _pkgdb_getPKGDB_DIR(), sizeof(dbdir));
+               (void) snprintf(LogDir, sizeof(LogDir), "%s/%s", dbdir, PkgName);
        }
 
        /* make sure dbdir actually exists! */
@@ -634,12 +634,18 @@
                }
        }
 
-       /* Now finally extract the entire show if we're not going direct */
-       if (!inPlace && !Fake)
-           if (!extract_plist(".", &Plist)) {
-               errc = 1;
-               goto fail;
-           }
+       /*
+        * Now finally extract the entire show if we're not going direct.
+        * We need to reset the package dbdir so that extract_plist()
+        * updates the correct pkgdb.byfile.db database.
+        */
+       if (!inPlace && !Fake) {
+               _pkgdb_setPKGDB_DIR(dbdir);
+               if (!extract_plist(".", &Plist)) {
+                       errc = 1;
+                       goto fail;
+               }
+       }
 
        if (!Fake && fexists(MTREE_FNAME)) {
                if (Verbose)
@@ -785,8 +791,9 @@
        /* Add the package to a default view. */
        if (!Fake && !NoView && is_depoted_pkg) {
                if (Verbose) {
-                       printf("%s/pkg_view %s%s %s%s %sadd %s\n",
+                       printf("%s/pkg_view -d %s %s%s %s%s %sadd %s\n",
                                BINDIR,
+                               dbdir,
                                View ? "-w " : "",
                                View ? View : "",
                                Viewbase ? "-W " : "",
@@ -794,8 +801,9 @@
                                Verbose ? "-v " : "",
                                PkgName);
                }
-               vsystem("%s/pkg_view %s%s %s%s %sadd %s",
+               vsystem("%s/pkg_view -d %s %s%s %s%s %sadd %s",
                                BINDIR,
+                               dbdir,
                                View ? "-w " : "",
                                View ? View : "",
                                Viewbase ? "-W " : "",
diff -r d96aa6c8b5a6 -r 0324bad5ad64 pkgtools/pkg_install/files/add/pkg_add.1
--- a/pkgtools/pkg_install/files/add/pkg_add.1  Tue Sep 09 13:28:17 2003 +0000
+++ b/pkgtools/pkg_install/files/add/pkg_add.1  Tue Sep 09 13:34:11 2003 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_add.1,v 1.3 2003/09/01 16:27:11 jlam Exp $
+.\" $NetBSD: pkg_add.1,v 1.4 2003/09/09 13:34:18 jlam Exp $
 .\"
 .\" FreeBSD install - a package for the installation and maintenance
 .\" of non-core utilities.
@@ -17,7 +17,7 @@
 .\"
 .\"     @(#)pkg_add.1
 .\"
-.Dd August 15, 2002
+.Dd September 8, 2003
 .Dt PKG_ADD 1
 .Os
 .Sh NAME
@@ -251,6 +251,9 @@
 .Ar viewbase
 directory is set by
 .Xr pkg_view 1 .
+This value also may be set from the
+.Ev LOCALBASE
+environment variable.
 .It Fl w Ar view
 Set the
 .Ar view
@@ -259,6 +262,9 @@
 .Ar view
 is set by
 .Xr pkg_view 1 .
+This value also may be set from the
+.Ev PKG_VIEW
+environment variable.
 .El
 .Pp
 One or more
@@ -466,6 +472,14 @@
 .Cm pkg_add .
 .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
@@ -489,6 +503,10 @@
 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.
+.It Ev PKG_VIEW
+The default view can be specified in the
+.Ev PKG_VIEW
+environment variable.
 .El
 .Sh EXAMPLES
 In all cases,
diff -r d96aa6c8b5a6 -r 0324bad5ad64 pkgtools/pkg_install/files/add/pkg_add.cat1
--- a/pkgtools/pkg_install/files/add/pkg_add.cat1       Tue Sep 09 13:28:17 2003 +0000
+++ b/pkgtools/pkg_install/files/add/pkg_add.cat1       Tue Sep 09 13:34:11 2003 +0000
@@ -135,11 +135,13 @@
 
      --WW _v_i_e_w_b_a_s_e
              Set _v_i_e_w_b_a_s_e as the base directory for the managed views.  The
-             default _v_i_e_w_b_a_s_e directory is set by pkg_view(1).
+             default _v_i_e_w_b_a_s_e directory is set by pkg_view(1).  This value al-
+             so may be set from the LOCALBASE environment variable.
 
      --ww _v_i_e_w
              Set the _v_i_e_w to which packages should be added after installa-
-             tion.  The default _v_i_e_w is set by pkg_view(1).
+             tion.  The default _v_i_e_w is set by pkg_view(1).  This value also
+             may be set from the PKG_VIEW environment variable.
 
      One or more _p_k_g_-_n_a_m_e arguments may be specified, each being either a file
      containing the package (these usually ending with the ``.tgz'' suffix) or
@@ -263,6 +265,10 @@
      user might change it with the --pp flag to ppkkgg__aadddd.
 
 EENNVVIIRROONNMMEENNTT
+     LOCALBASE   This is the location of the _v_i_e_w_b_a_s_e directory in which all
+                 the views are managed.  The default _v_i_e_w_b_a_s_e directory is
+                 _/_u_s_r_/_p_k_g.
+
      PKG_DBDIR   If the --KK flag isn't given, then PKG_DBDIR is the location of
                  the package database directory.  The default package database
                  directory is _/_v_a_r_/_d_b_/_p_k_g.
@@ -279,6 +285,9 @@
                  /var/tmp.  Set to directory with lots of free disk if you run
                  out of space when installing a binary package.
 
+     PKG_VIEW    The default view can be specified in the PKG_VIEW environment
+                 variable.
+
 EEXXAAMMPPLLEESS
      In all cases, ppkkgg__aadddd will try to install binary packages listed in de-
      pendencies list.
@@ -325,4 +334,4 @@
 
      Sure to be others.
 
-NetBSD 1.6.1_STABLE             August 15, 2002                              5
+NetBSD 1.6.1_STABLE            September 8, 2003                             6
diff -r d96aa6c8b5a6 -r 0324bad5ad64 pkgtools/pkg_install/files/admin/main.c
--- a/pkgtools/pkg_install/files/admin/main.c   Tue Sep 09 13:28:17 2003 +0000
+++ b/pkgtools/pkg_install/files/admin/main.c   Tue Sep 09 13:34:11 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.10 2003/09/02 08:28:25 jlam Exp $   */
+/*     $NetBSD: main.c,v 1.11 2003/09/09 13:34:18 jlam Exp $   */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -8,7 +8,7 @@
 #include <sys/cdefs.h>
 #endif
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.10 2003/09/02 08:28:25 jlam Exp $");
+__RCSID("$NetBSD: main.c,v 1.11 2003/09/09 13:34:18 jlam Exp $");
 #endif
 
 /*
@@ -174,26 +174,122 @@
        pkgcnt++;
 }
 
+/*
+ * add1pkg(<pkg>)
+ *     adds the files listed in the +CONTENTS of <pkg> into the
+ *     pkgdb.byfile.db database file in the current package dbdir.  It
+ *     returns the number of files added to the database file.
+ */
+static int
+add1pkg(const char *pkgdir)
+{
+       FILE           *f;
+       plist_t        *p;
+       package_t       Plist;
+       char            contents[FILENAME_MAX];
+       char           *PkgDBDir, *PkgName, *dirp;
+       char            file[FILENAME_MAX];
+       char            dir[FILENAME_MAX];
+       int             cnt;
+
+       if (!pkgdb_open(ReadWrite))
+               err(EXIT_FAILURE, "cannot open pkgdb");
+
+       PkgDBDir = _pkgdb_getPKGDB_DIR();
+       (void) snprintf(contents, sizeof(contents), "%s/%s", PkgDBDir, pkgdir);
+       if (!(isdir(contents) || islinktodir(contents)))
+               errx(EXIT_FAILURE, "`%s' does not exist.", contents);
+
+       (void) strlcat(contents, "/", sizeof(contents));
+       (void) strlcat(contents, CONTENTS_FNAME, sizeof(contents));
+       if ((f = fopen(contents, "r")) == NULL)
+               errx(EXIT_FAILURE, "%s: can't open `%s'", pkgdir, CONTENTS_FNAME);



Home | Main Index | Thread Index | Old Index