Merge pull request #19973 from Homebrew/livecheck/bitbucket-update-generated-urls

Bitbucket: update generated urls
This commit is contained in:
Bevan Kay 2025-05-19 23:22:32 +00:00 committed by GitHub
commit 14fbd47808
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -68,14 +68,14 @@ module Homebrew
# `/get/` archives are Git tag snapshots, so we need to check that tab
# instead of the main `/downloads/` page
if match[:dl_type] == "get"
values[:url] = "https://bitbucket.org/#{match[:path]}/downloads/?tab=tags"
values[:url] = "https://bitbucket.org/#{match[:path]}/downloads/?tab=tags&iframe=true&spa=0"
# Example tag regexes:
# * `/<td[^>]*?class="name"[^>]*?>\s*v?(\d+(?:\.\d+)+)\s*?</im`
# * `/<td[^>]*?class="name"[^>]*?>\s*abc-v?(\d+(?:\.\d+)+)\s*?</im`
values[:regex] = /<td[^>]*?class="name"[^>]*?>\s*#{regex_prefix}v?(\d+(?:\.\d+)+)\s*?</im
else
values[:url] = "https://bitbucket.org/#{match[:path]}/downloads/"
values[:url] = "https://bitbucket.org/#{match[:path]}/downloads/?iframe=true&spa=0"
# Use `\.t` instead of specific tarball extensions (e.g. .tar.gz)
suffix = T.must(match[:suffix]).sub(Strategy::TARBALL_EXTENSION_REGEX, ".t")

View File

@ -16,11 +16,11 @@ RSpec.describe Homebrew::Livecheck::Strategy::Bitbucket do
let(:generated) do
{
get: {
url: "https://bitbucket.org/abc/def/downloads/?tab=tags",
url: "https://bitbucket.org/abc/def/downloads/?tab=tags&iframe=true&spa=0",
regex: /<td[^>]*?class="name"[^>]*?>\s*v?(\d+(?:\.\d+)+)\s*?</im,
},
downloads: {
url: "https://bitbucket.org/abc/def/downloads/",
url: "https://bitbucket.org/abc/def/downloads/?iframe=true&spa=0",
regex: /href=.*?ghi-v?(\d+(?:\.\d+)+)\.t/i,
},
}