Gnome: Update default regex and version filtering
The `Gnome` strategy's default regex uses the `+` form of the standard regex for matching versions like 1.2.3. However, with the switch to the new version scheme, some packages had a release that omits a minor and patch (i.e., `40` instead of `40.0`). The default regex fails to match versions like this but the looser `*` form will match both. [When creating regexes, we generally start with the `+` form and only switch to the looser `*` form when it's necessary and contextually-appropriate.] This also updates the default version filtering logic that's applied to versions using the old GNOME version scheme (below version 40). Outside of the refactoring changes, this also filters out versions where the patch number is 90+, as these are also unstable.
This commit is contained in:
parent
fba051f98f
commit
5930880920
@ -66,7 +66,7 @@ module Homebrew
|
|||||||
# GNOME archive files seem to use a standard filename format, so we
|
# GNOME archive files seem to use a standard filename format, so we
|
||||||
# count on the delimiter between the package name and numeric
|
# count on the delimiter between the package name and numeric
|
||||||
# version being a hyphen and the file being a tarball.
|
# version being a hyphen and the file being a tarball.
|
||||||
values[:regex] = /#{regex_name}-(\d+(?:\.\d+)+)\.t/i
|
values[:regex] = /#{regex_name}-(\d+(?:\.\d+)*)\.t/i
|
||||||
|
|
||||||
values
|
values
|
||||||
end
|
end
|
||||||
@ -99,7 +99,11 @@ module Homebrew
|
|||||||
# Filter out unstable versions using the old version scheme where
|
# Filter out unstable versions using the old version scheme where
|
||||||
# the major version is below 40.
|
# the major version is below 40.
|
||||||
version_data[:matches].reject! do |_, version|
|
version_data[:matches].reject! do |_, version|
|
||||||
version.major < 40 && (version.minor >= 90 || version.minor.to_i.odd?)
|
next if version.major >= 40
|
||||||
|
next if version.minor.blank?
|
||||||
|
|
||||||
|
(version.minor.to_i.odd? || version.minor >= 90) ||
|
||||||
|
(version.patch.present? && version.patch >= 90)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,7 @@ describe Homebrew::Livecheck::Strategy::Gnome do
|
|||||||
let(:generated) {
|
let(:generated) {
|
||||||
{
|
{
|
||||||
url: "https://download.gnome.org/sources/abc/cache.json",
|
url: "https://download.gnome.org/sources/abc/cache.json",
|
||||||
regex: /abc-(\d+(?:\.\d+)+)\.t/i,
|
regex: /abc-(\d+(?:\.\d+)*)\.t/i,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user