-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
retroshare: update version, livecheck, add Rosetta #184638
Conversation
Can break up the regex using |
0135435
to
a2301c4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like upstream doesn't mark unstable versions as pre-release (e.g., v0.6.6-RC2 was the "latest" release in the past), so GithubLatest
is out. GithubReleases
works but the first-party download page directly links to the latest release's dmg file(s), so we could avoid the strategy
block if we check that instead.
The download page lists the version as 0.6.7a instead of the tag version, so it seems like we should be using the filename version instead of the tag version as version.csv.first
.
At this rate, we may want to consider simply capturing the entire suffix (0c03e93a4-01-03-2024-MacOS-10.15.7-Qt-5.15.11
) instead of extracting the individual parts. Either way technically works but there have been a number of changes to the suffix format over time and strictly matching a specific format can lead to breakages over time.
If that sounds reasonable, I can push a commit:
Commit diff
diff --git a/Casks/r/retroshare.rb b/Casks/r/retroshare.rb
index 0818a37f8c3..8d3e9e9af78 100644
--- a/Casks/r/retroshare.rb
+++ b/Casks/r/retroshare.rb
@@ -1,38 +1,26 @@
cask "retroshare" do
- version "0.6.7.2,0.6.7a,0c03e93a4-01-03-2024,10.15.7,5.15.11"
+ version "0.6.7a,0c03e93a4-01-03-2024-MacOS-10.15.7-Qt-5.15.11,0.6.7.2"
sha256 "6757a0bffba36fd85515117edba7e821bb3105500f8a282be942abeee3373230"
- url "https://github.com/RetroShare/RetroShare/releases/download/v#{version.csv.first}/RetroShare-#{version.csv.second}-#{version.csv.third}-MacOS-#{version.csv.fourth}-Qt-#{version.csv.fifth}.dmg",
+ url "https://github.com/RetroShare/RetroShare/releases/download/v#{version.csv.third || version.csv.first}/RetroShare-#{version.csv.first}#{"-#{version.csv.second}" if version.csv.second.present?}.dmg",
verified: "github.com/RetroShare/RetroShare/"
name "RetroShare"
desc "Friend-2-Friend and secure decentralised communication platform"
homepage "https://retroshare.cc/"
+ # The tag version can differ from the filename version, so we include both in
+ # the `version` when necessary.
livecheck do
- url :url
- regex(/
- Retroshare[._-]
- (\d+(?:\.\d+)+[a-z]?)[._-]
- ([\h-]+)[._-]
- MacOS[._-]
- (\d+(?:\.\d+)+)[._-]
- Qt[._-]
- (\d+(?:\.\d+)+)\.dmg$
- /xi)
- strategy :github_releases do |json, regex|
- json.map do |release|
- next if release["draft"] || release["prerelease"]
-
- tag_version = release["tag_name"][/^v?(\d+(?:\.\d+)+)$/i, 1]
- next if tag_version.blank?
-
- release["assets"]&.map do |asset|
- match = asset["name"]&.match(regex)
- next if match.blank?
-
- "#{tag_version},#{match[1]},#{match[2]},#{match[3]},#{match[4]}"
+ url "https://retroshare.cc/downloads.html"
+ regex(%r{/v?(\d+(?:\.\d+)+)/Retroshare[._-]v?(\d+(?:\.\d+)+[a-z]?)+(?:[._-]([^"' >]*?))?\.dmg}i)
+ strategy :page_match do |page, regex|
+ page.scan(regex).map do |match|
+ if match[2] && (match[0] != match[1])
+ "#{match[1]},#{match[2]},#{match[0]}"
+ else
+ "#{match[1]},#{match[2]},"
end
- end.flatten
+ end
end
end
--
2.46.0
I am ok with this @samford! Your expertise appreciated as I didn't really like this, but wanted to fix in the most direct way possible. This has actually been broken for quite some time and no one has complained, so I think any fix is good here.
|
Upstream doesn't mark unstable versions as pre-release (e.g., v0.6.6-RC2 was the "latest" release in the past), so `GithubLatest` is out. `GithubReleases` works but the first-party download page (https://retroshare.cc/downloads.html) directly links to the latest release's dmg file(s), so we can avoid the `strategy` block if we check that instead. The download page lists the version as 0.6.7a instead of the tag version, so it seems like we should be using the filename version instead of the tag version (0.6.7.2) as `version.csv.first`. At this rate, we may want to consider simply capturing the entire suffix (`0c03e93a4-01-03-2024-MacOS-10.15.7-Qt-5.15.11`) instead of extracting the individual parts. Either way technically works but there have been a number of changes to the suffix format over time and strictly matching a specific format will lead to breakages over time.
a2301c4
to
43bb369
Compare
Important: Do not tick a checkbox if you haven’t performed its action. Honesty is indispensable for a smooth review process.
In the following questions
<cask>
is the token of the cask you're submitting.After making any changes to a cask, existing or new, verify:
brew audit --cask --online <cask>
is error-free.brew style --fix <cask>
reports no offenses.Additionally, if adding a new cask:
brew audit --cask --new <cask>
worked successfully.HOMEBREW_NO_INSTALL_FROM_API=1 brew install --cask <cask>
worked successfully.brew uninstall --cask <cask>
worked successfully.Please tell me @samford there's a better way to do this 🙏