From 8565c7cefefea0ec44aec10769f50fea073ca2eb Mon Sep 17 00:00:00 2001 From: Rylan Polster Date: Tue, 24 Sep 2024 16:25:52 -0400 Subject: [PATCH 1/8] dolphin@dev: replace `url do` with versioned URL --- Casks/d/dolphin@dev.rb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Casks/d/dolphin@dev.rb b/Casks/d/dolphin@dev.rb index 53927b8dce4d..984d6d71f989 100644 --- a/Casks/d/dolphin@dev.rb +++ b/Casks/d/dolphin@dev.rb @@ -1,14 +1,17 @@ cask "dolphin@dev" do - version :latest - sha256 :no_check + version "2409-45" + sha256 "17046a69f8cceda3a239f6b19e306545988a9c10e16429d355d648cfc2f8891a" - url "https://dolphin-emu.org/download/list/master/1/" do |page| - page[/href="([^"]+\.dmg)"/, 1] - end + url "https://dl.dolphin-emu.org/builds/d5/33/dolphin-master-#{version}-universal.dmg" name "Dolphin Dev" desc "Emulator to play GameCube and Wii games" homepage "https://dolphin-emu.org/" + livecheck do + url "https://dolphin-emu.org/download/list/master/1/" + regex(/href=.*?dolphin[._-]master[._-]v?(\d+(?:[._-]\d+)+)-universal\.dmg/i) + end + conflicts_with cask: [ "dolphin", "dolphin@beta", From 2edbb2ed63089c4eba6abad06db5391ce934150e Mon Sep 17 00:00:00 2001 From: Rylan Polster Date: Tue, 24 Sep 2024 16:45:42 -0400 Subject: [PATCH 2/8] keepassxc@snapshot: replace `url do` with versioned URL --- Casks/k/keepassxc@snapshot.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Casks/k/keepassxc@snapshot.rb b/Casks/k/keepassxc@snapshot.rb index 0e80cc3c448a..5641956a0056 100644 --- a/Casks/k/keepassxc@snapshot.rb +++ b/Casks/k/keepassxc@snapshot.rb @@ -1,15 +1,17 @@ cask "keepassxc@snapshot" do - version :latest - sha256 :no_check + version "2.8.0" + sha256 "bde7044cc2b7bb30c01d3991dcc756da052d2ce5538d56a789323f3168426221" - url "https://snapshot.keepassxc.org/latest/" do |page| - file_path = page[/href="([^"]+-snapshot\.dmg)"/, 1] - URI.join(page.url, file_path) - end + url "https://snapshot.keepassxc.org/latest/KeePassXC-#{version}-snapshot.dmg" name "KeePassXC" desc "Password manager app" homepage "https://keepassxc.org/" + livecheck do + url "https://snapshot.keepassxc.org/latest/" + regex(/href=.*?KeePassXC[._-]v?(\d+(?:[._-]\d+)+)-snapshot\.dmg/i) + end + deprecate! date: "2025-05-01", because: :unsigned app "KeePassXC.app" From 7e9b26285d90c874a9ae4a7f1967fcd383649a19 Mon Sep 17 00:00:00 2001 From: Rylan Polster Date: Tue, 24 Sep 2024 16:36:14 -0400 Subject: [PATCH 3/8] transmission@nightly: replace `url do` with versioned URL --- Casks/t/transmission@nightly.rb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Casks/t/transmission@nightly.rb b/Casks/t/transmission@nightly.rb index 842721647fec..a15283c7dcda 100644 --- a/Casks/t/transmission@nightly.rb +++ b/Casks/t/transmission@nightly.rb @@ -1,19 +1,21 @@ cask "transmission@nightly" do - version :latest - sha256 :no_check + version "ed2c6c4085" + sha256 "7b705f4fcad1a200f6327c363c8ce8cdb923dd7ac08dbb22a87260f9199282a0" - url "https://build.transmissionbt.com/job/trunk-mac/lastSuccessfulBuild/artifact/release/" do |page| - file_path = page[/href="([^"]+.dmg)"/, 1] - URI.join(page.url, file_path) - end + url "https://build.transmissionbt.com/job/trunk-mac/lastSuccessfulBuild/artifact/release/Transmission-#{version}.dmg" name "Transmission" desc "Open-source BitTorrent client" homepage "https://transmissionbt.com/" + livecheck do + url "https://build.transmissionbt.com/job/trunk-mac/lastSuccessfulBuild/artifact/release/" + regex(/href=.*?Transmission[._-]([a-f0-9]+)\.dmg/i) + end + deprecate! date: "2025-05-01", because: :unsigned conflicts_with cask: "transmission" - depends_on macos: ">= :mojave" + depends_on macos: ">= :big_sur" app "Transmission.app" From 523c69acde207eed022615fc517ff0b3cfc48c41 Mon Sep 17 00:00:00 2001 From: Rylan Polster Date: Tue, 24 Sep 2024 17:59:04 -0400 Subject: [PATCH 4/8] vlc@nightly: replace `url do` with versioned URL --- Casks/v/vlc@nightly.rb | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/Casks/v/vlc@nightly.rb b/Casks/v/vlc@nightly.rb index 0843695db437..d491703b0316 100644 --- a/Casks/v/vlc@nightly.rb +++ b/Casks/v/vlc@nightly.rb @@ -1,20 +1,33 @@ cask "vlc@nightly" do arch arm: "arm64", intel: "x86_64" - version :latest - sha256 :no_check - - url "https://artifacts.videolan.org/vlc/nightly-macos-#{arch}/" do |page| - folder_path = page[%r{\d+-\d+/}] - url URI.join(page.url, folder_path) do |version_page| - file_path = version_page[/href="([^"]+.dmg)"/, 1] - URI.join(version_page.url, file_path) - end + on_arm do + version "20240924-0413,daab68e6" + sha256 "4ce9455a08682876d8a9660883d305d74e6edb144e9d830d5b81f8489babd6f2" + + url "https://artifacts.videolan.org/vlc/nightly-macos-#{arch}/#{version.csv.first}/vlc-4.0.0-dev-arm64-#{version.csv.second}.dmg" + end + on_intel do + version "20240924-0416,daab68e6" + sha256 "f617a21edee78c509a8dbb31dbac8cd27705a48188adec88a2e53c2615c1a6e8" + + url "https://artifacts.videolan.org/vlc/nightly-macos-#{arch}/#{version.csv.first}/vlc-4.0.0-dev-intel64-#{version.csv.second}.dmg" end + name "VLC media player" desc "Open-source cross-platform multimedia player" homepage "https://www.videolan.org/vlc/" + livecheck do + url "https://artifacts.videolan.org/vlc/nightly-macos-#{arch}/" + strategy :page_match do |page| + date = page[%r{href="(\d+-\d+)/"}, 1] + filename_arch = (arch == "x86_64") ? "intel64" : arch + version_page = Homebrew::Livecheck::Strategy.page_content("https://artifacts.videolan.org/vlc/nightly-macos-#{arch}/#{date}/") + "#{date},#{version_page[:content].scan(/href=.*?vlc-4\.0\.0-dev-#{filename_arch}-([0-9a-f]+)\.dmg/i).flatten.first}" + end + end + deprecate! date: "2025-05-01", because: :unsigned conflicts_with cask: "vlc" From d2be1fbaaf41ea403a286940af40d1a40bbb8fd5 Mon Sep 17 00:00:00 2001 From: Sam Ford <1584702+samford@users.noreply.github.com> Date: Wed, 25 Sep 2024 13:03:01 -0400 Subject: [PATCH 5/8] dolphin@dev: update version, livecheck The directories that precede the dmg file are different for each build, so we also need to capture those and store them in the cask `version`. --- Casks/d/dolphin@dev.rb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Casks/d/dolphin@dev.rb b/Casks/d/dolphin@dev.rb index 984d6d71f989..062831657538 100644 --- a/Casks/d/dolphin@dev.rb +++ b/Casks/d/dolphin@dev.rb @@ -1,15 +1,18 @@ cask "dolphin@dev" do - version "2409-45" - sha256 "17046a69f8cceda3a239f6b19e306545988a9c10e16429d355d648cfc2f8891a" + version "2409-48,4c,e6" + sha256 "6a720704035b5b80bd9da8354456ef5dc0a0b629752bebafa986adbe61f08703" - url "https://dl.dolphin-emu.org/builds/d5/33/dolphin-master-#{version}-universal.dmg" + url "https://dl.dolphin-emu.org/builds/#{version.csv.second}/#{version.csv.third}/dolphin-master-#{version.csv.first}-universal.dmg" name "Dolphin Dev" desc "Emulator to play GameCube and Wii games" homepage "https://dolphin-emu.org/" livecheck do - url "https://dolphin-emu.org/download/list/master/1/" - regex(/href=.*?dolphin[._-]master[._-]v?(\d+(?:[._-]\d+)+)-universal\.dmg/i) + url "https://dolphin-emu.org/download/" + regex(%r{href=.*?/builds/([^/]+?)/([^/]+?)/dolphin[._-]master[._-]v?(\d+(?:[.-]\d+)+)-universal\.dmg}i) + strategy :page_match do |page, regex| + page.scan(regex).map { |match| "#{match[2]},#{match[0]},#{match[1]}" } + end end conflicts_with cask: [ From 2ae49cfcc6aa840248b1dbaa60531ca074b40bc6 Mon Sep 17 00:00:00 2001 From: Sam Ford <1584702+samford@users.noreply.github.com> Date: Wed, 25 Sep 2024 13:08:08 -0400 Subject: [PATCH 6/8] keepassxc@snapshot: update version, livecheck All of the recent snapshot builds of `keepassxc` use a 2.8.0 version in the filename. If we use the dmg file in the `/latest/` directory and the version doesn't change between builds, then we will get a checksum mismatch when the build is updated. Instead, we have to use a fully-versioned URL that uses a build directory instead, as this will remain static between builds. Similarly, `/latest/` is an actual directory and not just a url that redirects to the latest build, so checking the dmg file in that directory won't give us the full URL with the build number in it. With this setup, we have to find the newest build directory number on the main snapshots page, then check the directory listing page for that build directory to find the version in the dmg file name. --- Casks/k/keepassxc@snapshot.rb | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/Casks/k/keepassxc@snapshot.rb b/Casks/k/keepassxc@snapshot.rb index 5641956a0056..cb2534e5d140 100644 --- a/Casks/k/keepassxc@snapshot.rb +++ b/Casks/k/keepassxc@snapshot.rb @@ -1,15 +1,32 @@ cask "keepassxc@snapshot" do - version "2.8.0" + version "2.8.0,252895" sha256 "bde7044cc2b7bb30c01d3991dcc756da052d2ce5538d56a789323f3168426221" - url "https://snapshot.keepassxc.org/latest/KeePassXC-#{version}-snapshot.dmg" + url "https://snapshot.keepassxc.org/build-#{version.csv.second}/KeePassXC-#{version.csv.first}-snapshot.dmg" name "KeePassXC" desc "Password manager app" homepage "https://keepassxc.org/" livecheck do - url "https://snapshot.keepassxc.org/latest/" - regex(/href=.*?KeePassXC[._-]v?(\d+(?:[._-]\d+)+)-snapshot\.dmg/i) + url "https://snapshot.keepassxc.org/" + regex(/href=.*?KeePassXC[._-]v?(\d+(?:\.\d+)+)-snapshot\.dmg/i) + strategy :page_match do |page, regex| + # Identify build numbers from directories like `build-123456` + newest_build = page.scan(%r{href=["']?build[._-]v?(\d+(?:\.\d+)*)/?["' >]}i) + .flatten + .uniq + .max + next if newest_build.blank? + + # Fetch the directory listing page for newest build + build_response = Homebrew::Livecheck::Strategy.page_content("https://snapshot.keepassxc.org/build-#{newest_build}/") + next if (build_page = build_response[:content]).blank? + + match = build_page.match(regex) + next if match.blank? + + "#{match[1]},#{newest_build}" + end end deprecate! date: "2025-05-01", because: :unsigned From 1275931a64afbe1d5ae545f7f41d928421fd08f4 Mon Sep 17 00:00:00 2001 From: Sam Ford <1584702+samford@users.noreply.github.com> Date: Wed, 25 Sep 2024 13:16:13 -0400 Subject: [PATCH 7/8] transmission@nightly: update version, livecheck File names for nightly `transmission` releases only include a hash but we also need the build number to be able to use a fully-versioned URL. Using a `lastSuccessfulBuild` dmg URL would result in a 404 (Not Found) response when the next build occurs, as the expected file won't be available anymore. With that in mind, we need to use a build-specific dmg URL. This updates the cask to include the build number in the `version` and to capture that information in the `livecheck` block regex. Unfortunately the dmg URL on the `lastSuccessfulBuild` page doesn't use a build number but we can identify the build number from other areas of the page. --- Casks/t/transmission@nightly.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Casks/t/transmission@nightly.rb b/Casks/t/transmission@nightly.rb index a15283c7dcda..999ca9cf2a40 100644 --- a/Casks/t/transmission@nightly.rb +++ b/Casks/t/transmission@nightly.rb @@ -1,15 +1,18 @@ cask "transmission@nightly" do - version "ed2c6c4085" + version "9662,ed2c6c4085" sha256 "7b705f4fcad1a200f6327c363c8ce8cdb923dd7ac08dbb22a87260f9199282a0" - url "https://build.transmissionbt.com/job/trunk-mac/lastSuccessfulBuild/artifact/release/Transmission-#{version}.dmg" + url "https://build.transmissionbt.com/job/trunk-mac/#{version.csv.first}/artifact/release/Transmission-#{version.csv.second}.dmg" name "Transmission" desc "Open-source BitTorrent client" homepage "https://transmissionbt.com/" livecheck do url "https://build.transmissionbt.com/job/trunk-mac/lastSuccessfulBuild/artifact/release/" - regex(/href=.*?Transmission[._-]([a-f0-9]+)\.dmg/i) + regex(/>\s*\#(\d+)\s*<.+?href=.*?Transmission[._-](\h+)\.dmg/im) + strategy :page_match do |page, regex| + page.scan(regex).map { |match| "#{match[0]},#{match[1]}" } + end end deprecate! date: "2025-05-01", because: :unsigned From dbd43d49a64637c6a5d5271542555d18559a34eb Mon Sep 17 00:00:00 2001 From: Sam Ford <1584702+samford@users.noreply.github.com> Date: Wed, 25 Sep 2024 13:18:47 -0400 Subject: [PATCH 8/8] vlc@nightly: update version, livecheck The file name version has remained consistent from the start of this year (at least) but we should capture it in the `livecheck` regex and include it in the cask `version`, so we can easily version bump the cask if/when the version changes in the future. Besides that, this reworks the `livecheck` block's `strategy` block to better align with existing standards/patterns. --- Casks/v/vlc@nightly.rb | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/Casks/v/vlc@nightly.rb b/Casks/v/vlc@nightly.rb index d491703b0316..2ce932430456 100644 --- a/Casks/v/vlc@nightly.rb +++ b/Casks/v/vlc@nightly.rb @@ -1,17 +1,18 @@ cask "vlc@nightly" do arch arm: "arm64", intel: "x86_64" + livecheck_arch = on_arch_conditional arm: "-arm64", intel: "-intel64" on_arm do - version "20240924-0413,daab68e6" - sha256 "4ce9455a08682876d8a9660883d305d74e6edb144e9d830d5b81f8489babd6f2" + version "4.0.0,20240925-0413,7df26860" + sha256 "62843cf361be0018d4aca1ef5d1edc283fe25464f52b585475cf0ccfcdcfdd31" - url "https://artifacts.videolan.org/vlc/nightly-macos-#{arch}/#{version.csv.first}/vlc-4.0.0-dev-arm64-#{version.csv.second}.dmg" + url "https://artifacts.videolan.org/vlc/nightly-macos-#{arch}/#{version.csv.second}/vlc-#{version.csv.first}-dev-arm64-#{version.csv.third}.dmg" end on_intel do - version "20240924-0416,daab68e6" - sha256 "f617a21edee78c509a8dbb31dbac8cd27705a48188adec88a2e53c2615c1a6e8" + version "4.0.0,20240925-0415,7df26860" + sha256 "42814cb5289539e08867c6f721ed629e177aa80a05598562385516299dd1a5b7" - url "https://artifacts.videolan.org/vlc/nightly-macos-#{arch}/#{version.csv.first}/vlc-4.0.0-dev-intel64-#{version.csv.second}.dmg" + url "https://artifacts.videolan.org/vlc/nightly-macos-#{arch}/#{version.csv.second}/vlc-#{version.csv.first}-dev-intel64-#{version.csv.third}.dmg" end name "VLC media player" @@ -20,11 +21,24 @@ livecheck do url "https://artifacts.videolan.org/vlc/nightly-macos-#{arch}/" - strategy :page_match do |page| - date = page[%r{href="(\d+-\d+)/"}, 1] - filename_arch = (arch == "x86_64") ? "intel64" : arch - version_page = Homebrew::Livecheck::Strategy.page_content("https://artifacts.videolan.org/vlc/nightly-macos-#{arch}/#{date}/") - "#{date},#{version_page[:content].scan(/href=.*?vlc-4\.0\.0-dev-#{filename_arch}-([0-9a-f]+)\.dmg/i).flatten.first}" + regex(/href=.*?vlc[._-]v?(\d+(?:\.\d+)+)-dev#{livecheck_arch}-(\h+)\.dmg/i) + strategy :page_match do |page, regex| + directory = page.scan(%r{href=["']?v?(\d+(?:[.-]\d+)+)/?["' >]}i) + .flatten + .uniq + .max + next if directory.blank? + + # Fetch the directory listing page for newest build + build_response = Homebrew::Livecheck::Strategy.page_content( + "https://artifacts.videolan.org/vlc/nightly-macos-#{arch}/#{directory}/", + ) + next if (build_page = build_response[:content]).blank? + + match = build_page.match(regex) + next if match.blank? + + "#{match[1]},#{directory},#{match[2]}" end end