mitchellh/zig-overlay

Update script does not handle new tagged releases correctly

Luexa opened this issue · 11 comments

Luexa commented

When doing the "recursive merge" step in the update script, only the entries corresponding to the "master" binary will be merged into the new sources.json. This means that the 0.10.0 release is not added to sources.json after running the script (sources.json remains unchanged).

It seems that this is caused by only merging paths .[0] and .[1] when slurping the old+new files, ignoring anything beyond that. For me, 0.10.0 is .[2].

Luexa commented

Extra comment: is it intentional that sources.new.json is a series of JSON objects rather than a singular JSON object? If it is unintentional, this is the cause of the bug.

I just noticed this too. It’s been awhile since I looked at this. When I get to a computer I’ll take a look. PRs welcome in the mean time but I’ll take a look later!

Luexa commented

Yeah, I'm working on a solution right now. 0.1.1 is weird due to not having a Linux or macOS build, though, so it isn't as simple as I thought.

I think I've got something that works. Its not the prettiest but it only takes another line of jq. If you get something cleaner I'll take it. Pushed up a branch now and testing.

Luexa commented

Ah, fair enough. I was about to push my solution which uses reduce to do it in the same script, but I was fiddling around wondering if I should manually update latest to point to 0.10.0 (since the current nightly is behind; if it was ahead, it would be 0.11.0-dev).

If you have a cleaner solution that produces the same results, I'll take it!

Luexa commented

Well, I don't generate Windows entries, otherwise I'd be happy to push it. My workaround for the null issue was this in the toentry function:

-   )] | add;
+   )] | add | first(values, {});

Ah good idea to maybe just add anyways in case a broken one comes through... I think perhaps adding windows into the sources.json for historical reasons might be a good idea though. Another project could always slurp the sources.json (non-Nix) for Windows if that is helpful.

Luexa commented

I'll add Windows sources, rebase, and push my branch in a few minutes.

Thanks, and sorry to snipe your fix, I wasn't sure what your status was and wanted to get this resolved 😄 Hopefully I can get your other change in though!

Luexa commented

Oh it's no problem. I take a long time to do simple things sometimes. Would've been quicker if this was last year; I used to write crazy things in jq!