Date: Mon, 19 May 2003 02:04:45 +0400 From: Sergey Matveychuk <sem@ciam.ru> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/52414: pkg_info improvement: get only package names with -q flag Message-ID: <E19HWGr-0001lv-00@sem-home.ciam.ru> Resent-Message-ID: <200305182250.h4IMoHZT028364@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 52414 >Category: ports >Synopsis: pkg_info improvement: get only package names with -q flag >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sun May 18 15:50:17 PDT 2003 >Closed-Date: >Last-Modified: >Originator: Sergey Matveychuk >Release: FreeBSD 5.0-RELEASE-p2 i386 >Organization: >Environment: System: FreeBSD sem-home.ciam.ru 5.0-RELEASE-p2 FreeBSD 5.0-RELEASE-p2 #4: Wed Apr 23 07:08:09 MSD 2003 root@sem-home.ciam.ru:/usr/src/sys/i386/compile/SEM-HOME i386 >Description: Almost impossible to get package names from script when glob or regex used. -q flag doesn't work in this case. This patch fix it and make -q flag useful for other cases. This feature can be use in bsd.port.mk, don't forget change PKG_INSTALL_VERSION constant if patch will commited. >How-To-Repeat: type: pkg_info -q glob, pkg_info -q -x pattern, pkg_info -a -q the results will the same as without -q flag >Fix: diff -ruN /usr/src/usr.sbin/pkg_install.orig/info/main.c info/main.c --- /usr/src/usr.sbin/pkg_install.orig/info/main.c Mon May 19 00:34:50 2003 +++ info/main.c Mon May 19 01:38:49 2003 @@ -54,11 +54,7 @@ TAILQ_INIT(whead); pkgs = start = argv; - if (argc == 1) { - MatchType = MATCH_ALL; - Flags = SHOW_INDEX; - } - else while ((ch = getopt(argc, argv, Options)) != -1) { + while ((ch = getopt(argc, argv, Options)) != -1) { switch(ch) { case 'a': MatchType = MATCH_ALL; @@ -199,6 +195,10 @@ break; } } + if (argc == 1) { + MatchType = MATCH_ALL; + Flags = SHOW_INDEX; + } argc -= optind; argv += optind; @@ -211,8 +211,8 @@ } /* Set some reasonable defaults */ - if (!Flags) - Flags = SHOW_COMMENT | SHOW_DESC | SHOW_REQBY; + if (!Flags && !Quiet) + Flags = SHOW_COMMENT | SHOW_DESC | SHOW_REQBY; /* Get all the remaining package names, if any */ while (*argv) { diff -ruN /usr/src/usr.sbin/pkg_install.orig/info/perform.c info/perform.c --- /usr/src/usr.sbin/pkg_install.orig/info/perform.c Mon May 19 00:34:50 2003 +++ info/perform.c Mon May 19 01:31:47 2003 @@ -188,6 +188,13 @@ show_index(tmp, COMMENT_FNAME); } else { + if(!Flags && Quiet) { + if(QUIET) + printf("%s", InfoPrefix); + printf("%s\n", pkg); + code = 0; + goto bail; + } /* Start showing the package contents */ if (!Quiet) printf("%sInformation for %s:\n\n", InfoPrefix, pkg); >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E19HWGr-0001lv-00>