Skip site navigation (1)Skip section navigation (2)
Date:      Wed,  9 Mar 2005 15:42:37 -0300 (BRT)
From:      Marcus Grando <marcus@corp.grupos.com.br>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        marcus@FreeBSD.org
Subject:   i386/78640: pkg_version show plist.origin in verbose mode
Message-ID:  <20050309184237.B0B9720A22@corp.grupos.com.br>
Resent-Message-ID: <200503091850.j29Io1CN068089@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         78640
>Category:       i386
>Synopsis:       pkg_version show plist.origin in verbose mode
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-i386
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 09 18:50:00 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Marcus Grando
>Release:        FreeBSD 4.11-STABLE i386
>Organization:
Grupos Internet S/A
>Environment:
System: FreeBSD corp.grupos.com.br 4.11-STABLE FreeBSD 4.11-STABLE #42: Sun Feb 27 20:04:47 BRT 2005 root@corp.grupos.com.br:/usr/obj/usr/src/sys/CORP i386


	
>Description:
pkg_version show plist.origin in verbose mode to prevent "make search" or "pkg_info -o".
	
>How-To-Repeat:
	
>Fix:

	

--- pkg_install-version::perform.c begins here ---
--- usr.sbin/pkg_install/version/perform.c.orig	Wed Aug 11 13:16:24 2004
+++ usr.sbin/pkg_install/version/perform.c	Wed Mar  9 15:20:41 2005
@@ -31,7 +31,7 @@
 struct index_head Index = SLIST_HEAD_INITIALIZER(Index);
 
 static int pkg_do(char *);
-static void show_version(const char *, const char *, const char *);
+static void show_version(Package, const char *, const char *);
 
 /*
  * This is the traditional pkg_perform, except that the argument is _not_
@@ -153,7 +153,7 @@
 	    if ((latest = vpipe("/usr/bin/make -V PKGNAME", tmp)) == NULL)
 		warnx("Failed to get PKGNAME from %s/Makefile!", tmp);
 	    else
-		show_version(plist.name, latest, "port");
+		show_version(plist, latest, "port");
 	}
     }
     if (latest == NULL) {
@@ -219,9 +219,9 @@
 	    }
 	}
 	if (latest == NULL)
-	    show_version(plist.name, NULL, plist.origin);
+	    show_version(plist, NULL, NULL);
 	else
-	    show_version(plist.name, latest, "index");
+	    show_version(plist, latest, "index");
     }
     if (latest != NULL)
 	free(latest);
@@ -238,15 +238,15 @@
  * You get when you try to match perl output in C ;-).
  */
 void
-show_version(const char *installed, const char *latest, const char *source)
+show_version(Package plist, const char *latest, const char *source)
 {
     char *ch, tmp[PATH_MAX];
     const char *ver;
     int cmp = 0;
 
-    if (!installed || strlen(installed) == 0)
+    if (!plist.name || strlen(plist.name) == 0)
 	return;
-    strlcpy(tmp, installed, PATH_MAX);
+    strlcpy(tmp, plist.name, PATH_MAX);
     if (!Verbose) {
 	if ((ch = strrchr(tmp, '-')) != NULL)
 	    ch[0] = '\0';
@@ -257,10 +257,10 @@
 	    if (Verbose)
 		printf("   Comparison failed");
 	    printf("\n");
-	} else if (source != NULL && OUTPUT('?')) {
+	} else if (source == NULL && OUTPUT('?')) {
 	    printf("%-34s  ?", tmp);
 	    if (Verbose)
-		printf("   orphaned: %s", source);
+		printf("   orphaned: %s", plist.origin);
 	    printf("\n");
 	}
     } else if (strchr(latest,'|') != NULL) {
@@ -286,13 +286,13 @@
 	    printf("\n");
 	}
     } else {
-	cmp = version_cmp(installed, latest);
+	cmp = version_cmp(plist.name, latest);
 	ver = strrchr(latest, '-');
 	ver = ver ? &ver[1] : latest;
 	if (cmp < 0 && OUTPUT('<')) {
 	    printf("%-34s  <", tmp);
 	    if (Verbose)
-		printf("   needs updating (%s has %s)", source, ver);
+		printf("   needs updating (%s has %s on %s)", source, ver, plist.origin);
 	    printf("\n");
 	} else if (cmp == 0 && OUTPUT('=')) {
 	    printf("%-34s  =", tmp);
@@ -302,7 +302,7 @@
 	} else if (cmp > 0 && OUTPUT('>')) {
 	    printf("%-34s  >", tmp);
 	    if (Verbose)
-		printf("   succeeds %s (%s has %s)", source, source, ver);
+		printf("   succeeds %s (%s has %s on %s)", source, source, ver, plist.origin);
 	    printf("\n");
 	}
     }
--- pkg_install-version::perform.c ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050309184237.B0B9720A22>