Merge pull request #13409 from samford/livecheck/gnome-update-default-regex-and-filtering

Gnome: Update default regex and version filtering
This commit is contained in:
Sam Ford 2022-06-13 23:14:32 -04:00 committed by GitHub
commit edea67f8bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -66,7 +66,7 @@ module Homebrew
# GNOME archive files seem to use a standard filename format, so we
# count on the delimiter between the package name and numeric
# 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
end
@ -99,7 +99,11 @@ module Homebrew
# Filter out unstable versions using the old version scheme where
# the major version is below 40.
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

View File

@ -12,7 +12,7 @@ describe Homebrew::Livecheck::Strategy::Gnome do
let(:generated) {
{
url: "https://download.gnome.org/sources/abc/cache.json",
regex: /abc-(\d+(?:\.\d+)+)\.t/i,
regex: /abc-(\d+(?:\.\d+)*)\.t/i,
}
}