casey / just

🤖 Just a command runner
https://just.systems
Creative Commons Zero v1.0 Universal
17.59k stars 399 forks source link

just self update to update itself #2006

Open woutervh opened 3 weeks ago

woutervh commented 3 weeks ago

It would be nice if just could update itself via just self update.

For example:

> uv self update
   info: Checking for updates...
   success: You're on the latest version of `uv` (v0.1.32).

see https://github.com/astral-sh/uv/issues/1591

casey commented 3 weeks ago

How would this work with just installed via package manager, where just can't overwrite the installed binary?

woutervh commented 3 weeks ago

Not? I always use the curl-script.

casey commented 3 weeks ago

If this were implemented, just would need to be able to detect if it was installed in such a way where it was not safe to self-update.

laniakea64 commented 3 weeks ago

The programs linked in the original comment appear to be package managers whose self update commands leverage their own package management systems. just not being a package manager, it doesn't have the required framework to implement this, it has no way to know how to self-update.

It's not inconceivable this could work implemented as --self-update gated behind a disabled-by-default Cargo feature. The Github release builds could opt into the feature, and the self update could check if the binary can be written to and if so, download and update to latest Github release build. Other builds of just simply wouldn't have the flag or the self update functionality (unless of course someone specifically enables the feature and doesn't mind their build overwritten with a later Github release build).

But even adding self update functionality only for Github release builds might be unwise. It would break backwards-compatibility of repackaging the Github release just binaries as-is into third-party package management systems, which IIRC some people are doing. Not sure whether just's commitment to backwards compatibility includes stuff like this?

woutervh commented 3 weeks ago

The programs linked in the original comment appear to be package managers whose self update commands leverage their own package management systems.

No, uv is a stand-alone rust-based executable. The fact it is a replacement for pip that is a package manager for python is coincidence.

The implementation is here: https://github.com/astral-sh/uv/pull/2228/files#diff-7fcfb3d9338c46fcb8b07d828537551de2a3e78090ded4ffbf4337d8c4dcdb8a and uses https://github.com/axodotdev/axoupdater

How would this work with just installed via package manager, where just can't overwrite the installed binary?

image