tristanisham / zvm

zvm (Zig Version Manager) lets you easily install/upgrade between different versions of Zig.
https://www.zvm.app
MIT License
430 stars 31 forks source link

Add the possibily to install master from a specific commit hash #23

Open guidoschmidt opened 1 year ago

guidoschmidt commented 1 year ago

I've been using zvm for a few months now and it is really helpful, thanks for the effort you've put into it 🙏🏽. As I've started to use the master branch zig version more frequently, I sometimes would have needed the possibility to have multiple "master versions" installed from different commit hashes.

sth. like

zvm install master

Would install the latest commit from the zig master branch, and then

zvm install master#972e70b

Would install the given commit hash from the master branch.

I'm not sure if that can be easily done, looks like this feature would need to pull the zig git repository and build the given version then 🤔.

tristanisham commented 1 year ago

Hey @guidoschmidt ! This is something I've been working on for the past few months. Unfortunately, it's been a bit more of a commitment than I expected. I'd have to save every hash released by the Zig team (multiple a week) and reliably fetch them.

Now, that doesn't mean It's not going to happen. Far from it (I'm thinking v0.3.0), but there are some more QOL things I'd like to get out of the way first on v0.2.* before I fully solve this issue. That being said, I also really like your syntax suggestion. I might just implement it with that exact syntax.

teobler commented 11 months ago

Thanks @tristanisham for your awesome work! if this is hard to implement right now, could it support install a dev version like 'zvm install 0.12.0-dev.163+6780a6bbf'

tristanisham commented 11 months ago

Hey! Thank you so much. This is definitely going to be the next big feature of ZVM. I’m actively working on it now. The only challenge is finding a way to store Zig’s daily builds in a sustainable matter. It’s very important to me that ZVM is the most portable and reliable version manager for Zig, so I want whatever hosting solution to be stable and (as just one guy) cost effective in the long run. 

As for syntax, I’m thinking of allowing a few different syntaxes. 

This would be to position ZVM to potentially allow you to install other tools like ZLS along with Zig. The current version-based strings would continue to work as is. 

zvm install @.***+62a0fbdae Or just: 0.12.0-dev.706+62a0fbdae Let me know what you guys think. 

mifopen commented 10 months ago

Hmm, tbh I do not think that having all the builds available as a list is as important as having ability to install some particular version of choice. The feature is major for current state of Zig when some projects (mach) require some specific version and it's important to develop against master at the same time.

So, I would propose adding ability to run zvm install 0.12.0-dev.706+62a0fbdae. If the version is not published by zig CI (i.e. navigating to https://ziglang.org/builds/.tar.gz gives 403), then it can be simply communicated to the user.

tristanisham commented 9 months ago

image

Does the Build CI stores specific hashes of master? I'm getting a 403 error fetching the page anyway. Right now I have a few releases being automatically stored on a personal server I plan to migrate to a public object store and use with ZVM. I'm just wrapping up a class for grad school (and had a death in the family) so I've been unable to dedicate the time to write high-quality software for ZVM. I'll be returning to the project next week.

OlshaMB commented 7 months ago

As there is no way of figuring list of versions, I will try to implement an algorithm:

  1. find version in version map
  2. If fails, try to download from ziglang without manifest.
  3. if fails, report an error
tristanisham commented 7 months ago

There is.zvm ls --all. What JSON you're hosting should match the schema of the official version map.

OlshaMB commented 7 months ago

I know. But sometimes you need really specific version. But maybe there is a way of creating a list based on git history of this file https://github.com/ziglang/www.ziglang.org/commits/master/data/releases.json

OlshaMB commented 7 months ago

I can try to make a script to generate version map from history

tristanisham commented 7 months ago

I have an archive of daily zig versions covering the past few months. I just need to sit down and build the server for it.

OlshaMB commented 7 months ago

I suggest introducing --force(maybe some better name) flag to install command which would bypass versionmap and download directly from https://ziglang.org/builds/

tristanisham commented 7 months ago

Could you expand on good that would work? The version map is how ZVM finds the correct build URL? Regardless of who created the version map?

OlshaMB commented 7 months ago

My idea works like this:

  1. Check if BypassVersionMap flag is available
  2. If so, download from "https://ziglang.org/builds/zig-" + version + ".tar.gz"
  3. and install it
OlshaMB commented 7 months ago

I also have a janky script to generate the full version map of all zig master versions using git: https://github.com/OlshaMB/olshamb-version-map/blob/main/generate.ts