From 044f8b1391294f236b07953eff5af274a6b95dec Mon Sep 17 00:00:00 2001 From: jca Date: Thu, 26 Mar 2020 19:31:39 +0000 Subject: Add support for "alpha" suffixes in package versions We already supported "beta" releases but not "alpha", probably to discourage people from pushing "alpha-quality" software in the ports tree. We have 30 ports with distfiles matching "alpha", and people just work around the lack of explicit support for "alpha" releases with mixes of crafted PKGNAME and REVISION/EPOCH. This looks needlessly complicated and a bit unfair when compared to GH_COMMIT support. Pointers from landry@ and sthen@, lgtm landry@, no objection from espie@ --- usr.sbin/pkg_add/OpenBSD/PackageName.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'usr.sbin/pkg_add') diff --git a/usr.sbin/pkg_add/OpenBSD/PackageName.pm b/usr.sbin/pkg_add/OpenBSD/PackageName.pm index 4d9fb2d43f2..f4036deb1ce 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageName.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageName.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackageName.pm,v 1.53 2019/11/07 15:35:23 espie Exp $ +# $OpenBSD: PackageName.pm,v 1.54 2020/03/26 19:31:39 jca Exp $ # # Copyright (c) 2003-2010 Marc Espie # @@ -153,7 +153,7 @@ sub from_string my ($class, $string) = @_; my $o = bless { deweys => [ split(/\./o, $string) ], suffix => '', suffix_value => 0}, $class; - if ($o->{deweys}->[-1] =~ m/^(\d+)(rc|beta|pre|pl)(\d*)$/) { + if ($o->{deweys}->[-1] =~ m/^(\d+)(rc|alpha|beta|pre|pl)(\d*)$/) { $o->{deweys}->[-1] = $1; $o->{suffix} = $2; $o->{suffix_value} = $3; @@ -193,11 +193,14 @@ sub suffix_compare if ($a->{suffix} gt $b->{suffix}) { return -suffix_compare($b, $a); } - # order is '', beta, pre, rc + # order is '', alpha, beta, pre, rc # we know that a < b, if ($a->{suffix} eq '') { return 1; } + if ($a->{suffix} eq 'alpha') { + return -1; + } if ($a->{suffix} eq 'beta') { return -1; } -- cgit v1.2.3-59-g8ed1b