niv update error
Steps to reproduce
- Add package using custom URL:
$ niv add gpxtools -a rev=919fb5953af8de1e71f61244eb70dd56b670a429 -o irdvo -r gpxtools \
-t "https://notabug.org/<owner>/<repo>/archive/<rev>.tar.gz"
- Update with rev attribute:
$ niv update gpxtools -a rev=f7d289ab9f42e492e6db800a073f4464db24dd56
Update gpxtools
Done: Update gpxtools
- Update without rev attribute:
$ niv update gpxtools
Update gpxtools
FATAL: Could not read the output of 'nix-prefetch-url'. This is a bug. Please create a
ticket:
https://github.com/nmattia/niv/issues/new
Thanks! I'll buy you a beer.
stdout:
stderr:
error: unable to download 'https://notabug.org/irdvo/gpxtools/archive/5a752894dcedf9c9a2848c5ef347121718fa98bf.tar.gz': HTTP error 404
FATAL: One or more packages failed to update:
gpxtools: ExitFailure 1
ERROR: ExitFailure 1
- Let's remove owner or repo attribute and update:
$ niv add gpxtools -a rev=919fb5953af8de1e71f61244eb70dd56b670a429 -r gpxtools \
-t "https://notabug.org/irdvo/<repo>/archive/<rev>.tar.gz"
$ niv update gpxtools
Update gpxtools
Done: Update gpxtools
Actual behaviour
Update without attributes fails (I guess niv wrongly treats it as github repo).
Expected behaviour
Update without attributes should not fail.
I think the reason is that the tarball doesn't exist:
$ curl -I https://notabug.org/irdvo/gpxtools/archive/5a752894dcedf9c9a2848c5ef347121718fa98bf.tar.gz
HTTP/2 404
server: nginx/1.12.1
date: Tue, 21 Jul 2020 08:55:16 GMT
content-type: text/html; charset=UTF-8
vary: Accept-Encoding
set-cookie: lang=en-US; Path=/; secure; Max-Age=2147483647
set-cookie: notabug_session=1222349f80f267ff; Path=/; secure; HttpOnly
set-cookie: _csrf=3cPJ8IxJ6yDtfomB3I5Oo-4j0Tw6MTU5NTMyMTcxNjQ0OTM4NjEwMQ%3D%3D; Path=/; secure; Expires=Wed, 22 Jul 2020 08:55:16 GMT; HttpOnly
x-clacks-overhead: GNU Terry Pratchett
content-security-policy: default-src 'self'; connect-src 'self'; img-src *; script-src 'self'; style-src 'self' 'unsafe-inline'; font-src 'self' data:;
strict-transport-security: max-age=31536000; includeSubDomains; preload
Also you can see that niv (correctly) assumes this is a tarball (look at the type):
$ niv show gpxtools
gpxtools
homepage: <barabajagal>
url: https://notabug.org/irdvo/gpxtools/archive/f7d289ab9f42e492e6db800a073f4464db24dd56.tar.gz
owner: irdvo
branch: master
url_template: https://notabug.org/<owner>/<repo>/archive/<rev>.tar.gz
repo: gpxtools
type: tarball
sha256: 15smkw2izqml4y9knyi0ywnn7805v13gbdz09r9ygqk5z50xsv7b
description: A collection of c++ tools for using GPX files
rev: f7d289ab9f42e492e6db800a073f4464db24dd56
Can you check that the tarball actually exists?
Re. what happens when the owner and repo are removed, that's odd. I get a different behavior:
$ niv drop gpxtools owner repo
Dropping attributes :owner repo
In package: gpxtools
$ niv update gpxtools
Update gpxtools
FATAL: One or more packages failed to update:
gpxtools: Update failed: Could not render template https://notabug.org/<owner>/<repo>/archive/<rev>.tar.gz
with keys: homepage, url, branch, url_template, type, sha256, description, rev
CallStack (from HasCallStack):
error, called at src/Niv/Update.hs:80:25 in niv-0.2.14-1IB6KFr90FY2Kts68ArwbO:Niv.Update
ERROR: ExitFailure 1
In your case I believe it works after re-adding it because you're back to using the original rev.
Actually, there's something really odd happening. It looks like nix-prefetch-url is given the wrong tarball (the rev is different in the 404 scenario). Need to investigate.
Haha, you're definitely right. Niv thinks it's a github repo and fetches the last rev from GitHub. Will need to think about how to fix this.
Any updates on this problem?