-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Here's my typical process for synchronizing the hash field for a dependency in build.zig.zon:
- Set the hash field to a bogus value
- Run
zig build - Update
build.zig.zonwith the actual hash displayed in the error message - Run
zig buildagain to verify it worked
My initial proposal is to introduce a special value "?" that tells Zig to update build.zig.zon for us. The new flow becomes.
- Set the hash field to
"?" - Run
zig buildto update the hash/verify it works
There have since been other good suggestions:
from @zenMaya: add a command for zig to download and report the hash of a URL (i.e. zig download URL). This might be a good command to make available regardless of whether we need it for this specific use case?
from @mpfaff: put hashes into a separate "lock file" meant to be managed more "automatically" instead of manually. This isn't a full solution but could make other ideas easier.
from @Pyrolistical: add a flag (or maybe a separate command?) that tells zig to update hashes (instead of using a special hash value). I believe this would require zig to assume that all hashes could be invalid meaning it would need to download/recalculate all dependency hashes and update them accordingly, or, zig could maintain a known URL to HASH mapping and only update hashes where this mapping has not been calculated yet. In other words, if the user modifies a URL, zig will see that it hasn't calculated a hash for it yet.