omni icon indicating copy to clipboard operation
omni copied to clipboard

`up`: only upgrade resource versions if `--upgrade` is passed as parameter

Open xaf opened this issue 1 year ago • 0 comments

Most versions don't need to be upgraded for each omni up, and only a base version is required. We should thus by default avoid upgrading versions all the time if a version exists and is usable for the existing constraints.

For instance, python: 3 should work for any version greater or equal to 3.0.0 of python. Of course, it should install the latest version available when none is available, but if version 3.0.1 is installed already, even if it's not the latest, it should directly be used unless --upgrade is specifically passed to indicate we want, as part of omni up, to upgrade all versions.

This logic could apply to:

  • any asdf-backed operation
  • any github-release operation
  • homebrew and similar (no need to try and update the tool if already installed, unless --upgrade is passed)

This would mean:

  • Adding support for omni up --upgrade parameter, which would trigger the current behavior of upgrading everything
  • Adding support for an upgrade parameter to homebrew (install and tap), asdf-backed operations and github-release, which if set to true would behave as if --upgrade is always passed but only for the specific entry
  • Adding support for each asdf-backed and github-release operations that a fresh install, outside of --upgrade, could simply use the latest-compatible-already-installed version of the tool instead of installing a new version
  • Handle latest versions to act as if it matches any somewhat latest version of the tool; this would allow to keep making sure we don't install an obsolete version, but that we allow for any somewhat-latest version to work and not require the very latest version each time
    • e.g. if the latest version is 3.4.5, then latest would behave as if 3 was passed as parameter
    • Or maybe it could allow the last minor to stay somewhat closer to the latest
    • Or maybe this could be provided as a configuration option that each user can decide how latest should behave outside of upgrade mode

xaf avatar Sep 28 '24 20:09 xaf