how do i get the correct hash for a package? previously i just let zig paste the hash for me after filling a bad one, but that doesn’t work for the below.
one of my packages is slang-zig, two of its sub-packages hashes are “FIXME”, when i build and run with the package used, it duplicates the package in zig-pkg under the name tmp-…random hash, throwing the same error, `error: invalid hash: short
Use zig fetch to cache a package and print its hash.
❯ zig fetch --help
Usage: zig fetch [options] <url>
Usage: zig fetch [options] <path>
Copy a package into the global cache and print its hash.
<url> must point to one of the following:
- A git+http / git+https server for the package
- A tarball file (with or without compression) containing
package source
- A git bundle file containing package source
Examples:
zig fetch --save git+https://example.com/andrewrk/fun-example-tool.git
zig fetch --save https://example.com/andrewrk/fun-example-tool/archive/refs/heads/master.tar.gz
Options:
-h, --help Print this help and exit
--global-cache-dir [path] Override path to global Zig cache directory
--debug-hash Print verbose hash information to stdout
--save Add the fetched package to build.zig.zon
--save=[name] Add the fetched package to build.zig.zon as name
--save-exact Add the fetched package to build.zig.zon, storing the URL verbatim
--save-exact=[name] Add the fetched package to build.zig.zon as name, storing the URL verbatim
the problem lies in the package’s zon file, which seems to freak out the package manager and send it into a loop of refetching the same broken package over and over
You are probably going to have to fork the package and update the hashes yourself. Then you will need to change your codebase to use your forked package. It would be great to try and contribute that back to the original. But at least this way you would unblock yourself.