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

flatpak-cargo-generator doesn't support the new cargo lock format #99

Closed
emmanueltouzery opened this issue Mar 11, 2020 · 2 comments · Fixed by #107
Closed

flatpak-cargo-generator doesn't support the new cargo lock format #99

emmanueltouzery opened this issue Mar 11, 2020 · 2 comments · Fixed by #107

Comments

@emmanueltouzery
Copy link

I tried to use the flatpak-cargo-generator script for a new rust project and realized it doesn't support the new rust 1.41 cargo.lock format:

https://blog.rust-lang.org/2020/01/30/Rust-1.41.0.html#whats-in-1.41.0-stable

a more git-friendly Cargo.lock

https://blog.rust-lang.org/2020/01/30/Rust-1.41.0.html#less-conflict-prone-cargolock-format

This new format will be used for all new lockfiles, while existing lockfiles will still rely on the previous format. You can learn about the choices leading to the new format in the PR adding it.

The error I got using the new script with a new Cargo.lock file was:

$ python3 flatpak-cargo-generator.py Cargo.lock -o cargo-sources.json                                                                                                   
Traceback (most recent call last):
  File "flatpak-cargo-generator.py", line 216, in <module>
    main()
  File "flatpak-cargo-generator.py", line 210, in main
    generated_sources = generate_sources(load_cargo_lock(args.cargo_lock))
  File "flatpak-cargo-generator.py", line 68, in generate_sources
    metadata = cargo_lock['metadata']
KeyError: 'metadata'
@muelli
Copy link
Member

muelli commented Mar 16, 2020

FTR: rust-lang/cargo#7070

Do you have a project or something that makes it easy enough to work on this problem?

@emmanueltouzery
Copy link
Author

i actually re-bootstrapped my project on an older rustc so i got an old lock file now and the generator works for me :)

but generally rustc will keep the old format if you have an existing old-format lock file, else it'll generate a new-format lock file.

so just deleting the cargo.lock then rebuilding with rust >=1.41 will create a new-style cargo.lock -- or just making a dummy new rust 1.41+ project.

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

Successfully merging a pull request may close this issue.

2 participants