From root@talentq.com  Mon Nov  6 22:24:57 2000
Return-Path: <root@talentq.com>
Received: from hobbits.int.talentq.com (unknown [203.117.75.247])
	by hub.freebsd.org (Postfix) with ESMTP id AE1B637B4D7
	for <FreeBSD-gnats-submit@freebsd.org>; Mon,  6 Nov 2000 22:24:56 -0800 (PST)
Received: by hobbits.int.talentq.com (Postfix, from userid 0)
	id 4E4BFB1; Tue,  7 Nov 2000 14:24:48 +0800 (SGT)
Message-Id: <20001107062448.4E4BFB1@hobbits.int.talentq.com>
Date: Tue,  7 Nov 2000 14:24:48 +0800 (SGT)
From: root@talentq.com
Reply-To: root@talentq.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: pkg_version does not work for ports that add -gtk suffix
X-Send-Pr-Version: 3.2

>Number:         22659
>Category:       ports
>Synopsis:       pkg_version does not work for ports that add -gtk suffix
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 06 22:30:01 PST 2000
>Closed-Date:    Wed Nov 8 12:54:45 PST 2000
>Last-Modified:  Wed Nov 08 12:57:39 PST 2000
>Originator:     Calvin NG
>Release:        FreeBSD 4.2-BETA i386
>Organization:
<Organization>
>Environment:

	

>Description:

	Recently, some of the the ports that define 'USE_GTK'
	adds the '-gtk' suffix to the package name/port name.
	This breaks the pkg_version utility as it cannot fine
	the portname/package in the INDEX file.

>How-To-Repeat:


>Fix:

	A simple workaround will be to strip the -gtk suffix 
	when doing comparison.  A suggested (unified) patch that 
	works on my machine is as follows:

--- pkg_version-411     Thu Nov  2 13:23:14 2000
+++ pkg_version Tue Nov  7 14:14:36 2000
@@ -341,6 +341,9 @@
     $packageNameVer = $packageString;
     $packageName = $currentPackages{$packageString}{'name'};

+### strip -gtk suffix
+       $packageName =~ s/-gtk$//;
+
     $currentVersion = $currentPackages{$packageString}{'fullversion'};

     if (defined $currentPackages{$packageString}{'portversion'}) {
@@ -408,7 +411,7 @@
     else {
        next if $ShowCommandsFlag;
        $versionCode = "?";
-       $Comment = "unknown in index";
+       $Comment = "$packageName unknown in index";
     }

     # Having figured out what to print, now determine, based on the


>Release-Note:
>Audit-Trail:

From: Hobbits <calvinng@talentq.com>
To: freebsd-gnats-submit@FreeBSD.org, root@talentq.com
Cc:  
Subject: Re: ports/22659: pkg_version does not work for ports that add -gtk 
 suffix
Date: Tue, 07 Nov 2000 15:05:34 +0800

 Greetings,
 
   found a minor problem with the previous fix, because
   some ports actually contains -gtk in their name.
 
   This is slightly better, it only strips -gtk if
   the not found in INDEX.
 
 --- pkg_version-411     Thu Nov  2 13:23:14 2000
 +++ pkg_version Tue Nov  7 14:55:20 2000
 @@ -341,6 +341,15 @@
      $packageNameVer = $packageString;
      $packageName = $currentPackages{$packageString}{'name'};
  
 +    if (!defined $indexPackages{$packageName}{'fullversion'})
 +    {
 +        $packageGTK = $packageName; $packageGTK =~ s/-gtk$//;
 +        if (defined $indexPackages{$packageGTK}{'fullversion'})
 +        {
 +            $packageName = $packageGTK;
 +        }
 +    }
 +
      $currentVersion = $currentPackages{$packageString}{'fullversion'};
  
      if (defined $currentPackages{$packageString}{'portversion'}) {
 
State-Changed-From-To: open->closed 
State-Changed-By: bmah 
State-Changed-When: Wed Nov 8 12:54:45 PST 2000 
State-Changed-Why:  
Thanks for the patch.  I'm closing this PR because we've recently 
added some code to the pkg_* utilities that solves this problem 
(and several other similar ones) by allowing an installed package 
to keep track of what port directory it was built from.  It isn't 
fully supported in 4.2-RELEASE because it needs a commit to the 
ports collection infrastructure that will happen shortly after 
the release. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=22659 
>Unformatted:
