Homebrew / brew

🍺 The missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
40.85k stars 9.59k forks source link

version.major_minor_patch has changed behaviour #7217

Closed domrim closed 4 years ago

domrim commented 4 years ago

What you were trying to do (and why)

I tried to update the keepassxc cask to it's newest version (2.5.3-2). So i changed the version and the sha265 to the new values. Because the github download-link doesn't include the part after the dash i also fixed the download link from

url "https://github.com/keepassxreboot/keepassxc/releases/download/#{version}/KeePassXC-#{version}.dmg"

to

url "https://github.com/keepassxreboot/keepassxc/releases/download/#{version.major_minor_patch}/KeePassXC-#{version}.dmg"

according to the documentation in https://github.com/Homebrew/homebrew-cask/blob/master/doc/cask_language_reference/stanzas/version.md

What happened (include command output)

When i now run brew cask install keepassxc following error appears:

Command output
==> Downloading https://github.com/keepassxreboot/keepassxc/releases/download/2.5.3-2/KeePassXC-2.5.3-2.dmg
#=#=#
curl: (22) The requested URL returned error: 404 Not Found
Error: Download failed on Cask 'keepassxc' with message: Download failed: https://github.com/keepassxreboot/keepassxc/releases/download/2.5.3-2/KeePassXC-2.5.3-2.dmg
  

What you expected to happen

I expected version.major_minor_patch to return only 2.5.3 instead of 2.5.3-2. I think the reason for this behaviour is the changes which were made in #6820 . This could also happen to other repos like these (found them with grep -r . -e major_minor_patch | grep github in homebrew-cask):

- yacreader - coqide - kap - switchhosts - keepassxc - fontforge - db-browser-for-sqlite - macs-fan-control - qtum-qt - manuskript - munki - tabula - ricochet - gqrx - darktable - magicavoxel

I don't know what the best solution to this issue is? Here are my thoughts whats possible:

MikeMcQuaid commented 4 years ago

Unfortunately it's expected behaviour that version.major_minor_patch may return different values depending on changes to this repository. I'm not a cask maintainer but I'd advise hardcoding versions in URLs instead.