diff options
author | jca <jca@openbsd.org> | 2020-03-26 19:31:39 +0000 |
---|---|---|
committer | jca <jca@openbsd.org> | 2020-03-26 19:31:39 +0000 |
commit | 044f8b1391294f236b07953eff5af274a6b95dec (patch) | |
tree | 879e95ad2c169160aa49c7c6208050950c7268e8 /usr.sbin/pkg_add | |
parent | Unify #ifdef guarding code to remove PPTP and L2TP sessions. (diff) | |
download | wireguard-openbsd-044f8b1391294f236b07953eff5af274a6b95dec.tar.xz wireguard-openbsd-044f8b1391294f236b07953eff5af274a6b95dec.zip |
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@
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackageName.pm | 9 |
1 files changed, 6 insertions, 3 deletions
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 <espie@openbsd.org> # @@ -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; } |