Date: 26 Sep 2000 18:19:17 -0000 From: "Peter Pentchev" <roam@orbitel.bg> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/21567: [PATCH] pkg_version -v confuzzled by multiple versions Message-ID: <20000926181917.419.qmail@ringwraith.office1>
next in thread | raw e-mail | index | archive | help
>Number: 21567
>Category: bin
>Synopsis: [PATCH] pkg_version -v confuzzled by multiple versions
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Tue Sep 26 11:20:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: "Peter Pentchev" <roam@orbitel.bg>
>Release: FreeBSD 4.1.1-STABLE i386
>Organization:
Orbitel JSCo.
>Environment:
a RELENG_4 as of today
>Description:
When there are multiple versions of a package in the INDEX file,
pkg_version does not even try to check if you have one of the listed
versions (which would theoretically imply no need for upgrade).
Attached is a proposed patch to add a -m option, which checks if
the installed version is amongst the versions in the package, and if so,
reports it as "up-to-date (index has .....)".
Note: this functionality is ONLY explicitly enabled by specifying the -m
option on the command line; the default action is still to report the package
as '*' (multiple versions), so existing grep -v up-to-date scripts do not
break.
>How-To-Repeat:
Install e.g. vim or XFree86; run pkg_version -v; see it not attempt to
give any judgement on the package.
With the proposed patch, pkg_version -vm lists it as up-to-date.
>Fix:
diff -urN src/usr.sbin/pkg_install/version/pkg_version.1 mysrc/usr.sbin/pkg_install/version/pkg_version.1
--- src/usr.sbin/pkg_install/version/pkg_version.1 Wed Sep 20 15:15:53 2000
+++ mysrc/usr.sbin/pkg_install/version/pkg_version.1 Thu Sep 21 21:15:37 2000
@@ -32,7 +32,7 @@
.Nd summarize installed versions of packages
.Sh SYNOPSIS
.Nm pkg_version
-.Op Fl cdhv
+.Op Fl cdhmv
.Op Fl l Ar limchar
.Op Ar index
.Sh DESCRIPTION
@@ -93,6 +93,9 @@
to the shell, it is best to quote
.Ar limchar
with single quotes.
+.It Fl m
+Even if multiple versions are present, report a match if the installed
+version is among those in the INDEX.
.It Fl v
Enable verbose output. Verbose output includes some English-text
interpretations of the version number comparisons, as well as the
diff -urN src/usr.sbin/pkg_install/version/pkg_version.pl mysrc/usr.sbin/pkg_install/version/pkg_version.pl
--- src/usr.sbin/pkg_install/version/pkg_version.pl Wed Sep 20 15:15:53 2000
+++ mysrc/usr.sbin/pkg_install/version/pkg_version.pl Thu Sep 21 21:14:07 2000
@@ -48,6 +48,7 @@
$VerboseFlag = 0;
$CommentChar = "#";
$LimitFlag = "";
+$MultipleFlag = 0;
#
# CompareNumbers
@@ -206,7 +207,7 @@
#
# Parse command-line arguments, deal with them
#
-if (!getopts('cdhl:v') || ($opt_h)) {
+if (!getopts('cdhl:mv') || ($opt_h)) {
&PrintHelp();
exit;
}
@@ -219,6 +220,9 @@
if ($opt_l) {
$LimitFlag = $opt_l;
}
+if ($opt_m) {
+ $MultipleFlag = 1;
+}
if ($opt_v) {
$VerboseFlag = 1;
}
@@ -309,6 +313,17 @@
$versionCode = "*";
$Comment = "multiple versions (index has $indexVersion)";
$Comment =~ s/\|/,/g;
+
+ if ($MultipleFlag) {
+ @iVer = split(/\|/, $indexVersion);
+ foreach $ver (@iVer) {
+ if (&CompareVersions($currentVersion, $ver) == 0) {
+ $versionCode = "=";
+ $Comment = "up-to-date (index has $indexVersion)";
+ $Comment =~ s/\|/,/g;
+ }
+ }
+ }
}
else {
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000926181917.419.qmail>
