summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pkg_install/version
diff options
context:
space:
mode:
authorcperciva <cperciva@FreeBSD.org>2005-05-24 08:26:44 +0000
committercperciva <cperciva@FreeBSD.org>2005-05-24 08:26:44 +0000
commita2e5c5c0f415c2965a0e3e4cde46953caf61319e (patch)
tree5324d7d5bab449b1365e082a313690a5625618c9 /usr.sbin/pkg_install/version
parentefdca9b052ac70564136ac8109e37ebff6e4573f (diff)
downloadFreeBSD-src-a2e5c5c0f415c2965a0e3e4cde46953caf61319e.zip
FreeBSD-src-a2e5c5c0f415c2965a0e3e4cde46953caf61319e.tar.gz
Add an -I option to pkg_version:
-I Use only the index file for determining if a package is out of date. This is much faster than using the version number from a port's Makefile, at the expense of potentially giving an incor- rect result if the index file is out of date. Without this option, the index file is only consulted if "make -V PKGNAME" cannot be used. Approved by: portmgr (krion)
Diffstat (limited to 'usr.sbin/pkg_install/version')
-rw-r--r--usr.sbin/pkg_install/version/main.c9
-rw-r--r--usr.sbin/pkg_install/version/perform.c2
-rw-r--r--usr.sbin/pkg_install/version/pkg_version.17
-rw-r--r--usr.sbin/pkg_install/version/version.h1
4 files changed, 15 insertions, 4 deletions
diff --git a/usr.sbin/pkg_install/version/main.c b/usr.sbin/pkg_install/version/main.c
index a025c9a..10c63a2 100644
--- a/usr.sbin/pkg_install/version/main.c
+++ b/usr.sbin/pkg_install/version/main.c
@@ -25,12 +25,13 @@ __FBSDID("$FreeBSD$");
#include "version.h"
#include <err.h>
-static char Options[] = "dhl:L:qs:XtTv";
+static char Options[] = "dIhl:L:qs:XtTv";
char *LimitChars = NULL;
char *PreventChars = NULL;
char *MatchName = NULL;
Boolean RegexExtended = FALSE;
+Boolean UseINDEXOnly = FALSE;
static void usage __P((void));
@@ -54,6 +55,10 @@ main(int argc, char **argv)
Verbose = TRUE;
break;
+ case 'I':
+ UseINDEXOnly = TRUE;
+ break;
+
case 'l':
LimitChars = optarg;
break;
@@ -100,7 +105,7 @@ static void
usage()
{
fprintf(stderr, "%s\n%s\n%s\n",
- "usage: pkg_version [-hqv] [-l limchar] [-L limchar] [[-X] -s string] [index]",
+ "usage: pkg_version [-hIqv] [-l limchar] [-L limchar] [[-X] -s string] [index]",
" pkg_version -t v1 v2",
" pkg_version -T name pattern");
exit(1);
diff --git a/usr.sbin/pkg_install/version/perform.c b/usr.sbin/pkg_install/version/perform.c
index d5b817d..8d089c5 100644
--- a/usr.sbin/pkg_install/version/perform.c
+++ b/usr.sbin/pkg_install/version/perform.c
@@ -147,7 +147,7 @@ pkg_do(char *pkg)
* latest version from there. If we fail, we start looking in the
* INDEX, first matching the origin and then the package name.
*/
- if (plist.origin != NULL) {
+ if (plist.origin != NULL && !UseINDEXOnly) {
snprintf(tmp, PATH_MAX, "%s/%s", PORTS_DIR, plist.origin);
if (isdir(tmp) && chdir(tmp) != FAIL && isfile("Makefile")) {
if ((latest = vpipe("/usr/bin/make -V PKGNAME", tmp)) == NULL)
diff --git a/usr.sbin/pkg_install/version/pkg_version.1 b/usr.sbin/pkg_install/version/pkg_version.1
index b846e0a..07f7679 100644
--- a/usr.sbin/pkg_install/version/pkg_version.1
+++ b/usr.sbin/pkg_install/version/pkg_version.1
@@ -32,7 +32,7 @@
.Nd summarize installed versions of packages
.Sh SYNOPSIS
.Nm
-.Op Fl hqv
+.Op Fl hIqv
.Op Fl l Ar limchar
.Op Fl L Ar limchar
.Oo
@@ -118,6 +118,11 @@ utility supports several command-line arguments:
.Bl -tag -width indent
.It Fl h
Print help message.
+.It Fl I
+Use only the index file for determining if a package is out of date.
+This is much faster than using the version number from a port's
+Makefile, at the expense of potentially giving an incorrect result if
+the index file is out of date.
.It Fl l
Limit the output to those packages whose status flag matches the
character(s) in
diff --git a/usr.sbin/pkg_install/version/version.h b/usr.sbin/pkg_install/version/version.h
index 3f3bcb8..c223dc7 100644
--- a/usr.sbin/pkg_install/version/version.h
+++ b/usr.sbin/pkg_install/version/version.h
@@ -41,6 +41,7 @@ extern char *LimitChars;
extern char *PreventChars;
extern char *MatchName;
extern Boolean RegexExtended;
+extern Boolean UseINDEXOnly;
extern int version_match(char *, const char *);
OpenPOWER on IntegriCloud