pkgsrc-Bugs archive

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

pkg/25229: "pkg_admin check" should be less verbose per default



>Number:         25229
>Category:       pkg
>Synopsis:       "pkg_admin check" should be less verbose per default
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Apr 18 17:41:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Roland Illig
>Release:        Linux 2.4.22-1-k7
>Organization:
>Environment:
System: Linux wwid 2.4.22-1-k7 #5 Sat Oct 4 14:11:12 EST 2003 i686 GNU/Linux
Architecture: i686

        
>Description:
This patch adds a "-v" command line flag to pkg_admin. If it is not
explicitly set, pkg_admin will not output a dot for each processed
package/file, so the output becomes more readable.

        
>How-To-Repeat:
        
call "pkg_admin check" and watch the dots ...
>Fix:
        
Index: main.c
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/pkg_install/files/admin/main.c,v
retrieving revision 1.14
diff -u -r1.14 main.c
--- main.c      7 Feb 2004 10:37:52 -0000       1.14
+++ main.c      18 Apr 2004 17:34:30 -0000
@@ -73,18 +73,20 @@
 
 #define DEFAULT_SFX    ".t[bg]z"       /* default suffix for ls{all,best} */
 
-static const char Options[] = "K:SVbd:s:";
+static const char Options[] = "K:SVbd:s:v";
 
 int     filecnt;
 int     pkgcnt;
 
+static int verbose_flag = FALSE;
+
 static int checkpattern_fn(const char *, void *);
 
 /* print usage message and exit */
 static void 
 usage(const char *prog)
 {
-       (void) fprintf(stderr, "usage: %s [-b] [-d lsdir] [-V] [-s sfx] command 
args ...\n"
+       (void) fprintf(stderr, "usage: %s [-b] [-d lsdir] [-V] [-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"
@@ -345,7 +347,9 @@
 #ifdef PKGDB_DEBUG
                printf("%s\n", de->d_name);
 #else
-               printf(".");
+               if (verbose_flag) {
+                       printf(".");
+               }
 #endif
 
                filecnt += add1pkg(de->d_name);
@@ -387,7 +391,9 @@
                chdir(de->d_name);
 
                check1pkg(de->d_name);
-               printf(".");
+               if (verbose_flag) {
+                       printf(".");
+               }
 
                chdir("..");
        }
@@ -395,7 +401,9 @@
        pkgdb_close();
 
 
-       printf("\n");
+       if (verbose_flag) {
+               printf("\n");
+       }
        printf("Checked %d file%s from %d package%s.\n",
            filecnt, (filecnt == 1) ? "" : "s",
            pkgcnt, (pkgcnt == 1) ? "" : "s");
@@ -411,7 +419,9 @@
                err(EXIT_FAILURE, "Cannot chdir to %s/%s", 
_pkgdb_getPKGDB_DIR(), pkg);
 
        check1pkg(pkg);
-       printf(".");
+       if (verbose_flag) {
+               printf(".");
+       }
 
        chdir("..");
 
@@ -478,6 +488,10 @@
                        use_default_sfx = FALSE;
                        break;
 
+               case 'v':
+                       verbose_flag = TRUE;
+                       break;
+
                default:
                        usage(prog);
                        /* NOTREACHED */
@@ -554,7 +568,9 @@
                                                }
                                        } else {
                                                check1pkg(*argv);
-                                               printf(".");
+                                               if (verbose_flag) {
+                                                       printf(".");
+                                               }
 
                                                chdir("..");
                                        }
@@ -563,14 +579,18 @@
                                argv++;
                        }
 
-                       printf("\n");
+                       if (verbose_flag) {
+                               printf("\n");
+                       }
                        printf("Checked %d file%s from %d package%s.\n",
                            filecnt, (filecnt == 1) ? "" : "s",
                            pkgcnt, (pkgcnt == 1) ? "" : "s");
                } else {
                        checkall();
                }
-               printf("Done.\n");
+               if (verbose_flag) {
+                       printf("Done.\n");
+               }
 
        } else if (strcasecmp(argv[0], "lsall") == 0) {
                int saved_wd;
>Release-Note:
>Audit-Trail:
>Unformatted:



Home | Main Index | Thread Index | Old Index