pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc Update pkg_install to version 20030912. Changes from ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/679b3018d7b7
branches:  trunk
changeset: 461243:679b3018d7b7
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Sat Sep 13 05:50:23 2003 +0000

description:
Update pkg_install to version 20030912.  Changes from 200230907 are
adding two new options to pkg_admin(1) to simply using this utility to
list the bare package names that match patterns when looking in PKG_DBDIR:

      -b      Print only the basenames when matching package names for
              lsall and lsbest.

      -d lsdir
              Set lsdir as the path to the directory in which to find
              matching package names for lsall and lsbest.

diffstat:

 doc/CHANGES                                     |   3 +-
 pkgtools/pkg_install/files/admin/main.c         |  44 +++++++++++++++++++-----
 pkgtools/pkg_install/files/admin/pkg_admin.1    |  25 +++++++++++--
 pkgtools/pkg_install/files/admin/pkg_admin.cat1 |  19 +++++++--
 pkgtools/pkg_install/files/lib/version.h        |   4 +-
 5 files changed, 74 insertions(+), 21 deletions(-)

diffs (239 lines):

diff -r b6bda72b0c5d -r 679b3018d7b7 doc/CHANGES
--- a/doc/CHANGES       Sat Sep 13 04:57:42 2003 +0000
+++ b/doc/CHANGES       Sat Sep 13 05:50:23 2003 +0000
@@ -1,4 +1,4 @@
-$NetBSD: CHANGES,v 1.3350 2003/09/12 23:11:07 jlam Exp $
+$NetBSD: CHANGES,v 1.3351 2003/09/13 05:50:23 jlam Exp $
 
 Changes to the packages collection and infrastructure in 2003:
 
@@ -3664,3 +3664,4 @@
        Updated p5-Digest-SHA1 to 2.04 [jlam 2003-09-12]
        Removed bsdpak [wiz 2003-09-12]
        Updated p5-Digest-MD5 to 2.27 [jlam 2003-09-12]
+       Updated pkg_install to 20030912 [jlam 2003-09-12]
diff -r b6bda72b0c5d -r 679b3018d7b7 pkgtools/pkg_install/files/admin/main.c
--- a/pkgtools/pkg_install/files/admin/main.c   Sat Sep 13 04:57:42 2003 +0000
+++ b/pkgtools/pkg_install/files/admin/main.c   Sat Sep 13 05:50:23 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.11 2003/09/09 13:34:18 jlam Exp $   */
+/*     $NetBSD: main.c,v 1.12 2003/09/13 05:50:26 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.11 2003/09/09 13:34:18 jlam Exp $");
+__RCSID("$NetBSD: main.c,v 1.12 2003/09/13 05:50:26 jlam Exp $");
 #endif
 
 /*
@@ -73,7 +73,7 @@
 
 #define DEFAULT_SFX    ".t[bg]z"       /* default suffix for ls{all,best} */
 
-static const char Options[] = "K:s:V";
+static const char Options[] = "bd:K:s:V";
 
 void    usage(void);
 
@@ -388,7 +388,13 @@
 {
        char *data = vp;
        printf("%s/%s\n", data, pkg);
-       
+       return 0;
+}
+
+static int
+lsbasepattern_fn(const char *pkg, void *vp)
+{
+       printf("%s\n", pkg);
        return 0;
 }
 
@@ -396,8 +402,11 @@
 main(int argc, char *argv[])
 {
        int     ch;
+       char    lsdir[FILENAME_MAX];
+       char   *lsdirp = NULL;
        char    sfx[FILENAME_MAX];
        Boolean use_default_sfx = TRUE;
+       Boolean show_basename_only = FALSE;
 
        setprogname(argv[0]);
 
@@ -406,6 +415,15 @@
 
        while ((ch = getopt(argc, argv, Options)) != -1)
                switch (ch) {
+               case 'b':
+                       show_basename_only = TRUE;
+                       break;
+
+               case 'd':
+                       (void) strlcpy(lsdir, optarg, sizeof(lsdir));
+                       lsdirp = lsdir;
+                       break;
+
                case 'K':
                        _pkgdb_setPKGDB_DIR(optarg);
                        break;
@@ -525,7 +543,7 @@
                        char cwd[MAXPATHLEN];
                        char base[FILENAME_MAX];
 
-                       dir = dirname_of(*argv);
+                       dir = lsdirp ? lsdirp : dirname_of(*argv);
                        basep = basename_of(*argv);
                        snprintf(base, sizeof(base), "%s%s", basep, sfx);
 
@@ -536,7 +554,12 @@
 
                        if (getcwd(cwd, sizeof(cwd)) == NULL)
                                err(EXIT_FAILURE, "getcwd");
-                       if (findmatchingname(cwd, base, lspattern_fn, cwd) == -1)
+
+                       if (show_basename_only)
+                               rc = findmatchingname(cwd, base, lsbasepattern_fn, cwd);
+                       else
+                               rc = findmatchingname(cwd, base, lspattern_fn, cwd);
+                       if (rc == -1)
                                errx(EXIT_FAILURE, "Error in findmatchingname(\"%s\", \"%s\", ...)",
                                     cwd, base);
 
@@ -563,7 +586,7 @@
                        char base[FILENAME_MAX];
                        char *p;
 
-                       dir = dirname_of(*argv);
+                       dir = lsdirp ? lsdirp : dirname_of(*argv);
                        basep = basename_of(*argv);
                        snprintf(base, sizeof(base), "%s%s", basep, sfx);
 
@@ -576,7 +599,10 @@
                                err(EXIT_FAILURE, "getcwd");
                        p = findbestmatchingname(cwd, base);
                        if (p) {
-                               printf("%s/%s\n", cwd, p);
+                               if (show_basename_only)
+                                       printf("%s\n", p);
+                               else
+                                       printf("%s/%s\n", cwd, p);
                                free(p);
                        }
                        
@@ -655,7 +681,7 @@
 void 
 usage(void)
 {
-       printf("usage: pkg_admin [-V] [-s sfx] command args ...\n"
+       printf("usage: pkg_admin [-b] [-d lsdir] [-V] [-s sfx] command args ...\n"
            "Where 'commands' and 'args' are:\n"
            " rebuild                     - rebuild pkgdb from +CONTENTS files\n"
            " check [pkg ...]             - check md5 checksum of installed files\n"
diff -r b6bda72b0c5d -r 679b3018d7b7 pkgtools/pkg_install/files/admin/pkg_admin.1
--- a/pkgtools/pkg_install/files/admin/pkg_admin.1      Sat Sep 13 04:57:42 2003 +0000
+++ b/pkgtools/pkg_install/files/admin/pkg_admin.1      Sat Sep 13 05:50:23 2003 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: pkg_admin.1,v 1.3 2003/09/09 13:34:18 jlam Exp $
+.\"    $NetBSD: pkg_admin.1,v 1.4 2003/09/13 05:50:26 jlam Exp $
 .\"
 .\" Copyright (c) 1999-2002 Hubert Feyrer.  All rights reserved.
 .\"
@@ -51,6 +51,18 @@
 .Sh OPTIONS
 The following command-line options are supported:
 .Bl -tag -width indent
+.It Fl b
+Print only the basenames when matching package names for
+.Cm lsall
+and
+.Cm lsbest .
+.It Fl d Ar lsdir
+Set
+.Ar lsdir
+as the path to the directory in which to find matching package names for
+.Cm lsall
+and
+.Cm lsbest .
 .It Fl K Ar pkg_dbdir
 Set
 .Ar pkg_dbdir
@@ -104,12 +116,17 @@
 and the data field - the package the file belongs to.
 .It Cm lsall Ar /dir/pkgpattern
 .It Cm lsbest Ar /dir/pkgpattern
-List all/best package matching pattern in the given directory.
+List all/best package matching pattern in the given directory
+.Pa /dir .
+If the
+.Fl d
+flag is given, then that directory path overrides
+.Pa /dir .
 Can be used to work around limitations of /bin/sh and other
 filename globbing mechanisms.
 This option implements matching of
-pkg-wildcards against arbitrary files, useful mainly in the build
-system itself.
+pkg-wildcards against arbitrary files and directories, useful mainly in
+the build system itself.
 See
 .Xr pkg_info 1
 for a description of the pattern.
diff -r b6bda72b0c5d -r 679b3018d7b7 pkgtools/pkg_install/files/admin/pkg_admin.cat1
--- a/pkgtools/pkg_install/files/admin/pkg_admin.cat1   Sat Sep 13 04:57:42 2003 +0000
+++ b/pkgtools/pkg_install/files/admin/pkg_admin.cat1   Sat Sep 13 05:50:23 2003 +0000
@@ -13,6 +13,13 @@
 OOPPTTIIOONNSS
      The following command-line options are supported:
 
+     --bb      Print only the basenames when matching package names for llssaallll
+             and llssbbeesstt.
+
+     --dd _l_s_d_i_r
+             Set _l_s_d_i_r as the path to the directory in which to find matching
+             package names for llssaallll and llssbbeesstt.
+
      --KK _p_k_g___d_b_d_i_r
              Set _p_k_g___d_b_d_i_r as the package database directory.  If this option
              isn't specified, then the package database directory is taken
@@ -59,11 +66,13 @@
      llssaallll _/_d_i_r_/_p_k_g_p_a_t_t_e_r_n
 
      llssbbeesstt _/_d_i_r_/_p_k_g_p_a_t_t_e_r_n
-             List all/best package matching pattern in the given directory.
-             Can be used to work around limitations of /bin/sh and other file-
-             name globbing mechanisms.  This option implements matching of
-             pkg-wildcards against arbitrary files, useful mainly in the build
-             system itself.  See pkg_info(1) for a description of the pattern.
+             List all/best package matching pattern in the given directory
+             _/_d_i_r.  If the --dd flag is given, then that directory path over-
+             rides _/_d_i_r.  Can be used to work around limitations of /bin/sh
+             and other filename globbing mechanisms.  This option implements
+             matching of pkg-wildcards against arbitrary files and directo-
+             ries, useful mainly in the build system itself.  See pkg_info(1)
+             for a description of the pattern.
 
              Example:
 
diff -r b6bda72b0c5d -r 679b3018d7b7 pkgtools/pkg_install/files/lib/version.h
--- a/pkgtools/pkg_install/files/lib/version.h  Sat Sep 13 04:57:42 2003 +0000
+++ b/pkgtools/pkg_install/files/lib/version.h  Sat Sep 13 05:50:23 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: version.h,v 1.12 2003/09/09 13:34:21 jlam Exp $        */
+/*     $NetBSD: version.h,v 1.13 2003/09/13 05:50:26 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 "20030907"
+#define PKGTOOLS_VERSION "20030912"
 
 #endif /* _INST_LIB_VERSION_H_ */



Home | Main Index | Thread Index | Old Index