Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/pkg_install Allow the package entries in the pkgdbd...



details:   https://anonhg.NetBSD.org/src/rev/315b9939f684
branches:  trunk
changeset: 551609:315b9939f684
user:      jlam <jlam%NetBSD.org@localhost>
date:      Mon Sep 08 22:11:12 2003 +0000

description:
Allow the package entries in the pkgdbdir to be either directories or
symlinks to directories.  This gives the user more rope, but lets those
who know what they're doing to do what they want.

diffstat:

 usr.sbin/pkg_install/admin/main.c     |  10 +++++-----
 usr.sbin/pkg_install/delete/perform.c |   6 +++---
 usr.sbin/pkg_install/info/perform.c   |  12 ++++++------
 usr.sbin/pkg_install/lib/str.c        |   6 +++---
 4 files changed, 17 insertions(+), 17 deletions(-)

diffs (146 lines):

diff -r fa764a2629c0 -r 315b9939f684 usr.sbin/pkg_install/admin/main.c
--- a/usr.sbin/pkg_install/admin/main.c Mon Sep 08 21:02:55 2003 +0000
+++ b/usr.sbin/pkg_install/admin/main.c Mon Sep 08 22:11:12 2003 +0000
@@ -1,8 +1,8 @@
-/*     $NetBSD: main.c,v 1.38 2003/09/08 07:04:40 jlam Exp $   */
+/*     $NetBSD: main.c,v 1.39 2003/09/08 22:11:12 jlam Exp $   */
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.38 2003/09/08 07:04:40 jlam Exp $");
+__RCSID("$NetBSD: main.c,v 1.39 2003/09/08 22:11:12 jlam Exp $");
 #endif
 
 /*
@@ -173,7 +173,7 @@
 
        PkgDBDir = _pkgdb_getPKGDB_DIR();
        (void) snprintf(contents, sizeof(contents), "%s/%s", PkgDBDir, pkgdir);
-       if (!isdir(contents))
+       if (!(isdir(contents) || islinktodir(contents)))
                errx(EXIT_FAILURE, "`%s' does not exist.", contents);
 
        (void) strlcat(contents, "/", sizeof(contents));
@@ -276,7 +276,7 @@
        if (dp == NULL)
                err(EXIT_FAILURE, "opendir failed");
        while ((de = readdir(dp))) {
-               if (!isdir(de->d_name))
+               if (!(isdir(de->d_name) || islinktodir(de->d_name)))
                        continue;
 
                if (strcmp(de->d_name, ".") == 0 ||
@@ -318,7 +318,7 @@
        if (dp == NULL)
                err(EXIT_FAILURE, "opendir failed");
        while ((de = readdir(dp))) {
-               if (!isdir(de->d_name))
+               if (!(isdir(de->d_name) || islinktodir(de->d_name)))
                        continue;
 
                if (strcmp(de->d_name, ".") == 0 ||
diff -r fa764a2629c0 -r 315b9939f684 usr.sbin/pkg_install/delete/perform.c
--- a/usr.sbin/pkg_install/delete/perform.c     Mon Sep 08 21:02:55 2003 +0000
+++ b/usr.sbin/pkg_install/delete/perform.c     Mon Sep 08 22:11:12 2003 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: perform.c,v 1.44 2003/09/08 07:08:11 jlam Exp $        */
+/*     $NetBSD: perform.c,v 1.45 2003/09/08 22:11:13 jlam Exp $        */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: perform.c,v 1.15 1997/10/13 15:03:52 jkh Exp";
 #else
-__RCSID("$NetBSD: perform.c,v 1.44 2003/09/08 07:08:11 jlam Exp $");
+__RCSID("$NetBSD: perform.c,v 1.45 2003/09/08 22:11:13 jlam Exp $");
 #endif
 #endif
 
@@ -607,7 +607,7 @@
 
        (void) snprintf(LogDir, sizeof(LogDir), "%s/%s",
            _pkgdb_getPKGDB_DIR(), pkg);
-       if (!fexists(LogDir) || !isdir(LogDir)) {
+       if (!fexists(LogDir) || !(isdir(LogDir) || islinktodir(LogDir))) {
                /* Check if the given package name matches something
                 * with 'pkg-[0-9]*' */
                char            try[FILENAME_MAX];
diff -r fa764a2629c0 -r 315b9939f684 usr.sbin/pkg_install/info/perform.c
--- a/usr.sbin/pkg_install/info/perform.c       Mon Sep 08 21:02:55 2003 +0000
+++ b/usr.sbin/pkg_install/info/perform.c       Mon Sep 08 22:11:12 2003 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: perform.c,v 1.47 2003/09/02 07:34:58 jlam Exp $        */
+/*     $NetBSD: perform.c,v 1.48 2003/09/08 22:11:14 jlam Exp $        */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: perform.c,v 1.23 1997/10/13 15:03:53 jkh Exp";
 #else
-__RCSID("$NetBSD: perform.c,v 1.47 2003/09/02 07:34:58 jlam Exp $");
+__RCSID("$NetBSD: perform.c,v 1.48 2003/09/08 22:11:14 jlam Exp $");
 #endif
 #endif
 
@@ -120,7 +120,7 @@
                 */
                (void) snprintf(log_dir, sizeof(log_dir), "%s/%s",
                    _pkgdb_getPKGDB_DIR(), pkg);
-               if (!fexists(log_dir) || !isdir(log_dir)) {
+               if (!fexists(log_dir) || !(isdir(log_dir) || islinktodir(log_dir))) {
                        {
                                /* Check if the given package name matches
                                 * something with 'pkg-[0-9]*' */
@@ -253,7 +253,7 @@
 
        /* we only want to display this if it really is a directory */
        snprintf(buf, sizeof(buf), "%s/%s", data, found);
-       if (!isdir(buf)) {
+       if (!(isdir(buf) || islinktodir(buf))) {
                /* return value seems to be ignored for now */
                return -1;
        }
@@ -286,7 +286,7 @@
        }
        /* simple match */
        (void) snprintf(buf, sizeof(buf), "%s/%s", dbdir, pkgspec);
-       error = !isdir(buf);
+       error = !(isdir(buf) || islinktodir(buf));
        if (!error && !Quiet) {
                printf("%s\n", pkgspec);
        }
@@ -325,7 +325,7 @@
        if (CheckPkg) {
                err_cnt += CheckForPkg(CheckPkg, dbdir);
        } else if (AllInstalled) {
-               if (!(isdir(dbdir) || islinktodir(dbdir)))
+               if (!isdir(dbdir))
                        return 1;
 
                if (File2Pkg) {
diff -r fa764a2629c0 -r 315b9939f684 usr.sbin/pkg_install/lib/str.c
--- a/usr.sbin/pkg_install/lib/str.c    Mon Sep 08 21:02:55 2003 +0000
+++ b/usr.sbin/pkg_install/lib/str.c    Mon Sep 08 22:11:12 2003 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: str.c,v 1.43 2003/09/02 07:35:04 jlam Exp $    */
+/*     $NetBSD: str.c,v 1.44 2003/09/08 22:11:14 jlam Exp $    */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "Id: str.c,v 1.5 1997/10/08 07:48:21 charnier Exp";
 #else
-__RCSID("$NetBSD: str.c,v 1.43 2003/09/02 07:35:04 jlam Exp $");
+__RCSID("$NetBSD: str.c,v 1.44 2003/09/08 22:11:14 jlam Exp $");
 #endif
 #endif
 
@@ -644,7 +644,7 @@
        char fn[FILENAME_MAX];
 
        snprintf(fn, sizeof(fn), "%s/%s", _pkgdb_getPKGDB_DIR(), pkg);
-       if (!isfile(fn)) {      /* might as well use sanity_check() */
+       if (!(isdir(fn) || islinktodir(fn))) {
                lpp = alloc_lpkg(pkg);
                TAILQ_INSERT_TAIL(pkgs, lpp, lp_link);
        }



Home | Main Index | Thread Index | Old Index