New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
common-updater: use nix-prefetch-url to get new hash #31627
Conversation
that way the downloaded archive is not discarded.
nix-build --no-out-link -A "$attr.src" 2>"$attr.fetchlog" >/dev/null || true | ||
# FIXME: use nix-build --hash here once https://github.com/NixOS/nix/issues/1172 is fixed | ||
newHash=$(tail -n2 "$attr.fetchlog" | grep "output path .* has .* hash .* when .* was expected" | head -n1 | tr -dc '\040-\177' | awk '{ print $(NF-4) }') | ||
newHash=$(nix-prefetch-url -A "$attr.src" 2>"$attr.fetchlog") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also replaced hashes contained enclosing '
characters before.
Have you tried this for something using |
(BTW if you want to look at my existing auto-updater stuff it's at https://github.com/dezgeg/nixpkgs/blob/updater-next/pkgs/common-updater/scripts/list-upstream-versions, eye bleach needed at least currently ;) |
@dezgeg yes since some time all pre-fetch scripts has been replaced by |
@@ -34,6 +34,20 @@ if [ -z "$drvName" -o -z "$oldVersion" ]; then | |||
die "Couldn't evaluate name and version from '$attr.name'!" | |||
fi | |||
|
|||
if [ -z "$newVersion" ]; then | |||
# works for fetchFromGitHub & fetchgit | |||
url=$(nix-instantiate --eval --strict --expr "with import <nixpkgs> {}; if $attr ? src.meta.homepage then $attr.src.meta.homepage else $attr.src.url") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like I have reinvented the wheel, since I saw your comment too late.
945247a
to
fd86590
Compare
fd86590
to
9a12f24
Compare
Try this:
|
the old version prints |
Ah, which Nix version is that? It works on 1.11.15 which gives |
I will rather rewrite this in some more robust than shell. |
Yeah, I don't mind rewriting that script, as long as the functionality is equivalent or better ;) and that we don't end up in a situation where every single script in nixpkgs is written in a different language. Probably Python is the next most popular one after Bash and Perl. But, IMHO this 'figure out latest version from GitHub/Apache directory listings/divine knowledge' belongs in another script. In my grand vision (which is not yet written down anywhere unfortunately) there would be a system similar to the phases in stdenv where individual packages could override only some parts of the update process. |
@dezgeg i am having the same issue with single-quotes in the checksum with nix-unstable 1.12. nix-daemon 1.11:
nix-daemon unstable 1.12:
|
Motivation for this change
that way the downloaded archive is not discarded.
@dezgeg
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)