Coder Social home page Coder Social logo

Comments (10)

bevanjkay avatar bevanjkay commented on May 26, 2024

Suggest modifying brew upgrade --cask to judge the current installed version number. For example, by using defaults read /Applications/Google\ Chrome.app/Contents/Info.plist CFBundleShortVersionString to determine if the installed version

This sounds like a decent solution.

Regarding the general behaviour of brew upgrade.
I would note that calling brew upgrade without explicitly referencing google-chrome, will not upgrade casks that have the auto_updates true flag set. Calling brew upgrade google-chrome directly implies that you would like to upgrade Google Chrome regardless of whether it has an auto-update mechanism.

from brew.

missuo avatar missuo commented on May 26, 2024

Suggest modifying brew upgrade --cask to judge the current installed version number. For example, by using defaults read /Applications/Google\ Chrome.app/Contents/Info.plist CFBundleShortVersionString to determine if the installed version

This sounds like a decent solution.

Regarding the general behaviour of brew upgrade. I would note that calling brew upgrade without explicitly referencing google-chrome, will not upgrade casks that have the auto_updates true flag set. Calling brew upgrade google-chrome directly implies that you would like to upgrade Google Chrome regardless of whether it has an auto-update mechanism.

I think we should check for the existence of automatic update mechanism before performing the update operation.

For example, when executing brew upgrade google-chrome --cask, if the automatic update mechanism has already updated Chrome to the latest version, there is no need for Homebrew to redownload and reinstall it. Only updating the version number in the brew database is sufficient.

from brew.

bevanjkay avatar bevanjkay commented on May 26, 2024

Only updating the version number in the brew database is sufficient.

The only challenge with a cask such as google-chrome is that the download is actually unversioned, so although the cask has been updated to a newer version, the version that is downloaded may be different. So a true comparison cannot be completed without downloading the files.

from brew.

missuo avatar missuo commented on May 26, 2024
~ defaults read /Applications/Google\ Chrome.app/Contents/Info.plist CFBundleShortVersionString
123.0.6312.107

It seems that I can accurately get the version number of Chrome, and of course, the situation you mentioned may indeed occur.

from brew.

MikeMcQuaid avatar MikeMcQuaid commented on May 26, 2024

Calling brew upgrade google-chrome directly implies that you would like to upgrade Google Chrome regardless of whether it has an auto-update mechanism.

Agreed, and this makes sense to me.

Only updating the version number in the brew database is sufficient.

There is no database here. The version is stored in a folder name on disk e.g. /opt/homebrew/Caskroom/google-chrome/123.0.6312.107/. Updating the contents of this folder will require pretty much the same time as all but downloading the existing change.

I'm also not necessarily convinced that the version in the plist should mean that an upgrade should not happen. This would not upgrade based on e.g. actual changes to the Cask file contents, potentially ever.

brew info --json=v2 google-chrome | jq '.casks[0]'.bundle_short_version will output this short version and we are able to query it with Cask internals, I'm just not sure it should be tied to the brew upgrade case specifically.


Leaving this open for other Cask folks to chip in but, personally, I'm 👎🏻 on the changes described here.

from brew.

razvanazamfirei avatar razvanazamfirei commented on May 26, 2024

I would note that calling brew upgrade without explicitly referencing google-chrome, will not upgrade casks that have the auto_updates true flag set. Calling brew upgrade google-chrome directly implies that you would like to upgrade Google Chrome regardless of whether it has an auto-update mechanism.

I think our current approach here is reasonable and not sure if adding an additional layer of complexity here makes sense. Casks do not have consistent versioning schemes and occasionally, the scheme will be completely unrelated to CFBundleShortVersionString. This is a great idea in theory, but not super feasible IMO. Personally, I would pass on this. Sorry!

from brew.

missuo avatar missuo commented on May 26, 2024

Thank you for considering this idea. Thank you for your contributions.

from brew.

MikeMcQuaid avatar MikeMcQuaid commented on May 26, 2024

Thanks for your understanding @missuo!

from brew.

MikeMcQuaid avatar MikeMcQuaid commented on May 26, 2024

Casks do not have consistent versioning schemes and occasionally, the scheme will be completely unrelated to CFBundleShortVersionString.

@razvanazamfirei @Homebrew/cask Relatedly: I do think making versions either the short version string or version string where possible (and a DSL to indicate which one is used) would make life much better around these sort of issues in future.

from brew.

bevanjkay avatar bevanjkay commented on May 26, 2024

It's always the goal, but we basically need to collect whatever is required to assemble the url dynamically as the "version". Alternative would be to split the version dsl, to have the actual version, and then any additional dynamic url parts.

from brew.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.