Bitbucket: update generated urls

The `Bitbucket` strategy checks download or tag pages but the content
is now fetched separately on page load, so the strategy is failing for
all related formulae. This updates the generated strategy URLs to
fetch the page content instead, which works as expected.
This commit is contained in:
Sam Ford 2025-05-19 12:03:28 -04:00
parent 69667974bc
commit 95abc7360b
No known key found for this signature in database
GPG Key ID: 7AF5CBEE1DD6F76D
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 # `/get/` archives are Git tag snapshots, so we need to check that tab
# instead of the main `/downloads/` page # instead of the main `/downloads/` page
if match[:dl_type] == "get" 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: # Example tag regexes:
# * `/<td[^>]*?class="name"[^>]*?>\s*v?(\d+(?:\.\d+)+)\s*?</im` # * `/<td[^>]*?class="name"[^>]*?>\s*v?(\d+(?:\.\d+)+)\s*?</im`
# * `/<td[^>]*?class="name"[^>]*?>\s*abc-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 values[:regex] = /<td[^>]*?class="name"[^>]*?>\s*#{regex_prefix}v?(\d+(?:\.\d+)+)\s*?</im
else 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) # Use `\.t` instead of specific tarball extensions (e.g. .tar.gz)
suffix = T.must(match[:suffix]).sub(Strategy::TARBALL_EXTENSION_REGEX, ".t") 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 let(:generated) do
{ {
get: { 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, regex: /<td[^>]*?class="name"[^>]*?>\s*v?(\d+(?:\.\d+)+)\s*?</im,
}, },
downloads: { 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, regex: /href=.*?ghi-v?(\d+(?:\.\d+)+)\.t/i,
}, },
} }