Hi Marc, Marc Espie wrote on Sat, Sep 29, 2007 at 09:09:17PM +0200: > On Sat, Sep 29, 2007 at 07:53:27PM +0200, Ingo Schwarze wrote:
>> S: package Stem (e.g. "mutt"), >> optionally including multi-packages suffixes >> N: version Number (e.g. "1.5.16") >> pP: official OpenBSD Patch level (e.g. "p0") >> In case this is missing, it is treated as "-1". >> vV: user Variant level (e.g. "v0") >> F: Flavor suffix (e.g. "sidebar") > > False. Ooops. Sorry for spreading confusion. > vV is still official stuff. It's there for bumps in the regular naming > so that version numbers are still monotonically increasing. Are you saying that we can rely on monotonically increasing version numbers N, and that porters *must* bump vV whenever the upstream numbering scheme fails to conform to that principle? If that holds true, we *can* implement a better OVERRIDE relation just using the package names, completely within OpenBSD::PackageName, without ever inspecting UpdateInfo via OpenBSD::Update. I would regard that as very good news. > For instance, we went DBD-SQlite-1.12 -> DBD-SQlite-1.13 -> > DBD-SQlite-1.12v0 -> DBD-SQlite-1.14v0 [ and on ports-changes@ ] > Log message: > Once you bump v, you can *never* go back. Hmm, i doubt everybody will find this pretty - but certainly, it is easy to maintain in a consistent manner. It does not appear to be in wide use yet: [EMAIL PROTECTED] $ cut -d\| -f1 /usr/ports/INDEX | grep -- '-[01-9].*v[01-9]' esound-0.2.34p0v0 catalyst-tutorial-0.02p1v0 py-silc-0.4p0v0 In case you stick to that principle, i suggest adapting OpenBSD::PackageName to it. Currently, if you have both DBD-SQlite-1.12 and DBD-SQlite-1.12v0 in your PKG_PATH, pkg_add -u will regard this as an ambiguity. Rather, the OVERRIDE relation ought to read T-MpQvW-G >= S-NpPvV-F :<=> T-M-G = S-N-F && (W > V || (W = V && Q >= P)) This is implemented by the patch below. I pulled my previous, misleading patch and put up the new one as http://www.studis.de/Software/pkg_add-vnum-u1.patch instead. Yours, Ingo P.S. Would you like a "uU" convention as described in my previous post for user modified packages? The code will be rather short and simple and, as far as i see, strictly local to OpenBSD::PackageName. Or is there another standard naming scheme for user-patched packages that i'm not aware of? If "uU" is wanted, i shall rework my previous patch for a seperate submission - mixing that up with the "vV" issue is obviously a bad idea. Index: PackageName.pm =================================================================== RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PackageName.pm,v retrieving revision 1.31 diff -u -p -r1.31 PackageName.pm --- PackageName.pm 23 Aug 2007 09:09:16 -0000 1.31 +++ PackageName.pm 29 Sep 2007 20:11:06 -0000 @@ -87,25 +87,17 @@ sub is_stem sub splitp { local $_ = shift; - - if (/^(.*\-\d[^-]*)p(\d+)(.*)$/o) { - return ($1.$3, $2); - } else { - return ($_,-1); - } + m/^(.*?)(?:(\-\d.*?)(?:p(\d+))?(?:v(\d+))?(-.*)?)?$/o; + return $1 . (defined $2 ? $2 : '') . (defined $5 ? $5 : ''), + [ (defined $4 ? $4 : -1), (defined $3 ? $3 : -1) ]; } sub rebuildp { - my ($pkg, $p) = @_; - if ($p == -1) { - return $pkg; - } - if ($pkg =~ m/^(.*?)(\-\d[^-v]*)(.*)$/o) { - return "$1$2p$p$3"; - } else { - return $pkg."p".$p; - } + my ($pkg, $v, $p) = ($_[0], @{$_[1]}); + $pkg =~ m/^(.*?)(?:(\-\d.*?)(-.*)?)?$/o; + return $1 . (defined $2 ? $2 : '') . ($p >= 0 ? "p$p" : '') . + ($v >= 0 ? "v$v" : '') . (defined $3 ? $3 : ''); } sub keep_most_recent @@ -113,7 +105,8 @@ sub keep_most_recent my $h = {}; for my $pkgname (@_) { my ($p, $v) = splitp($pkgname); - if (!defined $h->{$p} || $h->{$p} < $v) { + if (!defined $h->{$p} || $h->{$p}->[0] < $v->[0] || + ($h->{$p}->[0] == $v->[0] && $h->{$p}->[1] < $v->[1])) { $h->{$p} = $v; } }
