Skip to content
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

Trying to update to a version that doesn't exist changes package version #12

Open
worldofpeace opened this issue Jul 29, 2020 · 1 comment

Comments

@worldofpeace
Copy link

If I do the following:

 nix-update --version 517748bcac9484df6a1f03c84f77c9a066ed8793 "pantheon.elementary-calculator"

we will get a traceback

curl: (22) The requested URL returned error: 404 Not Found
error: cannot download source from any mirror
builder for '/nix/store/swrqgasi5gr6508qk9hq30r1hk67v48y-source.drv' failed with exit code 1
error: build of '/nix/store/swrqgasi5gr6508qk9hq30r1hk67v48y-source.drv' failed
Traceback (most recent call last):
  File "/nix/store/qjlas1n0sgnqcmy3ij395a334zbj4jw4-nix-update/bin/.nix-update-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/qjlas1n0sgnqcmy3ij395a334zbj4jw4-nix-update/lib/python3.8/site-packages/nix_update/__init__.py", line 142, in main
    package = update(options)
  File "/nix/store/qjlas1n0sgnqcmy3ij395a334zbj4jw4-nix-update/lib/python3.8/site-packages/nix_update/update.py", line 82, in update
    update_src_hash(opts, package.filename, package.hash)
  File "/nix/store/qjlas1n0sgnqcmy3ij395a334zbj4jw4-nix-update/lib/python3.8/site-packages/nix_update/update.py", line 42, in update_src_hash
    target_hash = nix_prefetch([f"(import {opts.import_path} {{}}).{opts.attribute}"])
  File "/nix/store/qjlas1n0sgnqcmy3ij395a334zbj4jw4-nix-update/lib/python3.8/site-packages/nix_update/update.py", line 37, in nix_prefetch
    res = run(["nix-prefetch"] + cmd)
  File "/nix/store/qjlas1n0sgnqcmy3ij395a334zbj4jw4-nix-update/lib/python3.8/site-packages/nix_update/utils.py", line 32, in run
    return subprocess.run(command, cwd=cwd, check=check, text=True, stdout=stdout)
  File "/nix/store/f87w21b91cws0wbsvyfn5vnlyv491czi-python3-3.8.3/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['nix-prefetch', '(import ./. {}).pantheon.elementary-calculator']' returned non-zero exit status 1.

because that archive doesn't exist.

But this has now written to the expression to have the version 517748bcac9484df6a1f03c84f77c9a066ed8793.

I believe this will require more safely modifying files by not modifying them in place until we know we have a success?

@Mic92
Copy link
Owner

Mic92 commented Jul 29, 2020

The best it can do is reverting to the previous content. It needs to be written so that nix-prefetch can fetch source..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants