Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Aug 2000 14:08:55 -0700
From:      bmah@cisco.com (Bruce A. Mah)
To:        Kris Kennaway <kris@FreeBSD.ORG>
Cc:        Will Andrews <will@physics.purdue.edu>, Satoshi Asami <asami@FreeBSD.ORG>, ports@FreeBSD.ORG
Subject:   Re: Proposal: PORTREVISION and PORTEPOCH 
Message-ID:  <200008212108.e7LL8tZ44405@bmah-freebsd-0.cisco.com>
In-Reply-To: <Pine.BSF.4.21.0008201348290.36301-100000@freefall.freebsd.org> 
References:  <Pine.BSF.4.21.0008201348290.36301-100000@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--==_Exmh_-382147961P
Content-Type: multipart/mixed ;
	boundary="==_Exmh_-3830051180"

This is a multipart MIME message.

--==_Exmh_-3830051180
Content-Type: text/plain; charset=us-ascii

If memory serves me right, Kris Kennaway wrote:
> On Sun, 20 Aug 2000, Will Andrews wrote:
> 
> > On Sun, Aug 20, 2000 at 04:35:50AM -0700, Kris Kennaway wrote:
> > > PROPOSAL FOR PACKAGE NAMING CONVENTIONS
> > 
> > I'm all for this -- great job thinking this out, Kris!  :)
> > 
> > Satoshi?  Please implement this in bsd.port.mk.
> 
> Here's the patch (I didnt look at pkg_version yet, but as noted in the
> proposal it should continue to work as well as before until it can be
> taught about the new structure):

[snip]

Hi Kris--

If you haven't done so already, here's a patch for pkg_version that I
think will work correctly with the new structure for ports numbering.
Clearly, I've only tested it to a limited extent (since we have no ports
with the new numbering scheme).

Comments appreciated...

Cheers,

Bruce.


--==_Exmh_-3830051180
Content-Type: text/plain ; name="pkg_version.pl.diff"; charset=us-ascii
Content-Description: pkg_version.pl.diff

*** /usr/src/usr.sbin/pkg_install/version/pkg_version.pl	Tue Aug  8 23:06:17 2000
--- pkg_version.pl	Mon Aug 21 13:19:56 2000
***************
*** 94,114 ****
  #
  # GetNameAndVersion
  #
! # Get the name and version number of a package. Returns a two element
! # array, first element is name, second element is version number.
  #
  sub GetNameAndVersion {
!     local($string);
!     $string = $_[0];
  
!     # If no hyphens then no version number
!     return ($string, "") if $string !~ /-/;
  
!     # Match (and group) everything in between two hyphens. Because the
      # regexp is 'greedy', the first .* will try and match everything up
      # to (but not including) the last hyphen
!     $string =~ /(.*)-(.*)/;
!     return ($1, $2);
  }
  
  #
--- 94,129 ----
  #
  # GetNameAndVersion
  #
! # Get the name and versions number of a package. Returns a five-element
! # array, first element is name, second element is full version string,
! # remaining elements are version number, revision number, and epoch.
  #
  sub GetNameAndVersion {
!     local($fullname, $name, $fullversion, $version, $revision, $epoch);
!     $fullname = $_[0];
  
!     # If no hyphens then no version numbers
!     return ($fullname, "", "", "", "") if $fullname !~ /-/;
  
!     # Match (and group) everything after hyphen(s). Because the
      # regexp is 'greedy', the first .* will try and match everything up
      # to (but not including) the last hyphen
!     $fullname =~ /(.+)-(.+)/;
!     $name = $1;
!     $fullversion = $2;
! 
!     $fullversion =~ /([^_:]+)/;
!     $version = $1;
!     
!     if ($fullversion =~ /_([^_:]+)/) {
! 	$revision = $1;
!     }
!     
!     if ($fullversion =~ /:([^_:]+)/) {
! 	$epoch = $1;
!     }
! 
!     return ($name, $fullversion, $version, $revision, $epoch);
  }
  
  #
***************
*** 179,191 ****
  open CURRENT, "$CurrentPackagesCommand|";
  while (<CURRENT>) {
      ($packageString, $rest) = split;
!     ($packageName, $packageVersion) = &GetNameAndVersion($packageString);
      $currentPackages{$packageName}{'name'} = $packageName;
!     if (defined $currentPackages{$packageName}{'version'}) {
  	$currentPackages{$packageName}{'version'} .= "," . $packageVersion;
      }
      else {
  	$currentPackages{$packageName}{'version'} = $packageVersion;
      }
      $currentPackages{$packageName}{'refcount'}++;
  }
--- 194,213 ----
  open CURRENT, "$CurrentPackagesCommand|";
  while (<CURRENT>) {
      ($packageString, $rest) = split;
! 
!     ($packageName, $packageFullversion, $packageVersion, $packageRevision, $packageEpoch) = &GetNameAndVersion($packageString);
      $currentPackages{$packageName}{'name'} = $packageName;
!     if (defined $currentPackages{$packageName}{'fullversion'}) {
! 	$currentPackages{$packageName}{'fullversion'} .= "," . $packageFullversion;
  	$currentPackages{$packageName}{'version'} .= "," . $packageVersion;
+ 	$currentPackages{$packageName}{'revision'} .= "," . $packageRevision;
+ 	$currentPackages{$packageName}{'epoch'} .= "," . $packageEpoch;
      }
      else {
+ 	$currentPackages{$packageName}{'fullversion'} = $packageFullversion;
  	$currentPackages{$packageName}{'version'} = $packageVersion;
+ 	$currentPackages{$packageName}{'revision'} = $packageRevision;
+ 	$currentPackages{$packageName}{'epoch'} = $packageEpoch;
      }
      $currentPackages{$packageName}{'refcount'}++;
  }
***************
*** 198,213 ****
  open INDEX, "$IndexPackagesCommand|";
  while (<INDEX>) {
      ($packageString, $packagePath, $rest) = split(/\|/);
!     ($packageName, $packageVersion) = &GetNameAndVersion($packageString);
      $indexPackages{$packageName}{'name'} = $packageName;
      $indexPackages{$packageName}{'path'} = $packagePath;
!     if (defined $indexPackages{$packageName}{'version'}) {
  	$indexPackages{$packageName}{'version'} .= "," . $packageVersion;
      }
      else {
  	$indexPackages{$packageName}{'version'} = $packageVersion;
      }
-     $indexPackages{$packageName}{'refcount'}++;
  }
  close INDEX;
  
--- 220,241 ----
  open INDEX, "$IndexPackagesCommand|";
  while (<INDEX>) {
      ($packageString, $packagePath, $rest) = split(/\|/);
! 
!     ($packageName, $packageFullversion, $packageVersion, $packageRevision, $packageEpoch) = &GetNameAndVersion($packageString);
      $indexPackages{$packageName}{'name'} = $packageName;
      $indexPackages{$packageName}{'path'} = $packagePath;
!     if (defined $indexPackages{$packageName}{'fullversion'}) {
! 	$indexPackages{$packageName}{'fullversion'} .= "," . $packageFullversion;
  	$indexPackages{$packageName}{'version'} .= "," . $packageVersion;
+ 	$indexPackages{$packageName}{'revision'} .= "," . $packageRevision;
+ 	$indexPackages{$packageName}{'epoch'} .= "," . $packageEpoch;
      }
      else {
+ 	$indexPackages{$packageName}{'fullversion'} = $packageFullversion;
  	$indexPackages{$packageName}{'version'} = $packageVersion;
+ 	$indexPackages{$packageName}{'revision'} = $packageRevision;
+ 	$indexPackages{$packageName}{'epoch'} = $packageEpoch;
      }
  }
  close INDEX;
  
***************
*** 218,229 ****
      $~ = "STDOUT_VERBOSE"  if $VerboseFlag;
      $~ = "STDOUT_COMMANDS" if $ShowCommandsFlag;
  
!     $packageNameVer = "$packageName-$currentPackages{$packageName}{'version'}";
  
!     if (defined $indexPackages{$packageName}{'version'}) {
  
! 	$indexVersion = $indexPackages{$packageName}{'version'};
! 	$currentVersion = $currentPackages{$packageName}{'version'};
  
  	$indexRefcount = $indexPackages{$packageName}{'refcount'};
  	$currentRefcount = $currentPackages{$packageName}{'refcount'};
--- 246,257 ----
      $~ = "STDOUT_VERBOSE"  if $VerboseFlag;
      $~ = "STDOUT_COMMANDS" if $ShowCommandsFlag;
  
!     $packageNameVer = "$packageName-$currentPackages{$packageName}{'fullversion'}";
  
!     if (defined $indexPackages{$packageName}{'fullversion'}) {
  
! 	$indexVersion = $indexPackages{$packageName}{'fullversion'};
! 	$currentVersion = $currentPackages{$packageName}{'fullversion'};
  
  	$indexRefcount = $indexPackages{$packageName}{'refcount'};
  	$currentRefcount = $currentPackages{$packageName}{'refcount'};
***************
*** 236,242 ****
  	}
  	else {
  
! 	    $rc = &CompareVersions($currentVersion, $indexVersion);
  	    
  	    if ($rc == 0) {
  		next if $ShowCommandsFlag;
--- 264,286 ----
  	}
  	else {
  
! 	    # Comparison algorithm runs here.  First we check epochs
! 	    # for equality.  If they're equal, then check version
! 	    # numbers, and finally revisions.
! 	    $rc = &CompareVersions($currentPackages{$packageName}{'epoch'},
! 				   $indexPackages{$packageName}{'epoch'});
! 	    if ($rc == 0) {
! 		$rc = 
! 		    &CompareVersions($currentPackages{$packageName}{'version'},
! 				     $indexPackages{$packageName}{'version'});
! 
! 		if ($rc == 0) {
! 		    $rc = 
! 			&CompareVersions($currentPackages{$packageName}{'revision'},
! 					 $indexPackages{$packageName}{'revision'});
! 		}
! 	    }
! 		
  	    
  	    if ($rc == 0) {
  		next if $ShowCommandsFlag;
***************
*** 288,294 ****
  
  # Verbose report (-v flag)
  format STDOUT_VERBOSE =
! @<<<<<<<<<<<<<<<<<<<<<<<<<  @<  @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  $packageNameVer,           $versionCode, $Comment
  .
    ;
--- 332,338 ----
  
  # Verbose report (-v flag)
  format STDOUT_VERBOSE =
! @<<<<<<<<<<<<<<<<<<<<<<<<<  @<  @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  $packageNameVer,           $versionCode, $Comment
  .
    ;

--==_Exmh_-3830051180--



--==_Exmh_-382147961P
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 5.0i for non-commercial use
MessageID: CgaW7YHQdLlF50xs1TzdpXUWWiSMozax

iQA/AwUBOaGaZ9jKMXFboFLDEQL1dACgkEGj5gdk9A7uD5YaW5KPuv8pMQkAnRuH
2i33xFOhLiGXCsr6Iji6qCaR
=wsPt
-----END PGP SIGNATURE-----

--==_Exmh_-382147961P--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




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