flatpak / flatpak-builder-tools

Various helper tools for flatpak-builder
191 stars 107 forks source link

Find all crates in git repositories, matching cargo's behavior #399

Closed sgvictorino closed 5 months ago

sgvictorino commented 7 months ago

Right now, get_git_repo_packages only finds git dependencies that are:

Otherwise, get_git_package_sources throws a KeyError.

I found this with eframe:

package.name = "uses-eframe"
dependencies.eframe.git = "https://github.com/emilk/egui"
cargo generate-lockfile # succeeds
flatpak-cargo-generator.py Cargo.lock -d # KeyError: 'eframe'
Full Debug Log

DEBUG:asyncio:Using selector: EpollSelector
DEBUG:root:depends-on-eframe has no source
INFO:root:Loading packages from https://github.com/emilk/egui
DEBUG:root:Loading workspace member ./crates/ecolor/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./crates/egui_demo_app/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./crates/egui_demo_lib/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./crates/egui_extras/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./crates/egui_glow/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./crates/egui_plot/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./crates/egui-wgpu/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./crates/egui-winit/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./crates/egui/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./crates/emath/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./crates/epaint/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./examples/confirm_exit/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./examples/test_inline_glow_paint/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./examples/test_viewports/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./examples/keyboard_events/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./examples/user_attention/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./examples/custom_font_style/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./examples/custom_3d_glow/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./examples/custom_plot_manipulation/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./examples/screenshot/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./examples/serial_windows/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./examples/hello_world_simple/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./examples/custom_font/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./examples/multiple_viewports/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./examples/file_dialog/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./examples/custom_window_frame/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./examples/hello_world_par/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./examples/images/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./examples/hello_world/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./examples/puffin_profiler/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Loading workspace member ./examples/save_plot/Cargo.toml in /home/me/.cache/flatpak-cargo/https_github.com_emilk_egui
DEBUG:root:Packages in https://github.com/emilk/egui:
{
    "ecolor": "crates/ecolor",
    "egui_demo_app": "crates/egui_demo_app",
    "egui_demo_lib": "crates/egui_demo_lib",
    "egui_extras": "crates/egui_extras",
    "egui_glow": "crates/egui_glow",
    "egui_plot": "crates/egui_plot",
    "egui-wgpu": "crates/egui-wgpu",
    "egui-winit": "crates/egui-winit",
    "egui": "crates/egui",
    "emath": "crates/emath",
    "epaint": "crates/epaint",
    "confirm_exit": "examples/confirm_exit",
    "test_inline_glow_paint": "examples/test_inline_glow_paint",
    "test_viewports": "examples/test_viewports",
    "keyboard_events": "examples/keyboard_events",
    "user_attention": "examples/user_attention",
    "custom_font_style": "examples/custom_font_style",
    "custom_3d_glow": "examples/custom_3d_glow",
    "custom_plot_manipulation": "examples/custom_plot_manipulation",
    "screenshot": "examples/screenshot",
    "serial_windows": "examples/serial_windows",
    "hello_world_simple": "examples/hello_world_simple",
    "custom_font": "examples/custom_font",
    "multiple_viewports": "examples/multiple_viewports",
    "file_dialog": "examples/file_dialog",
    "custom_window_frame": "examples/custom_window_frame",
    "hello_world_par": "examples/hello_world_par",
    "images": "examples/images",
    "hello_world": "examples/hello_world",
    "puffin_profiler": "examples/puffin_profiler",
    "save_plot": "examples/save_plot"
}
INFO:root:Adding package ecolor from https://github.com/emilk/egui
INFO:root:Adding package eframe from https://github.com/emilk/egui
INFO:root:Adding package egui from https://github.com/emilk/egui
INFO:root:Adding package egui-wgpu from https://github.com/emilk/egui
INFO:root:Adding package egui-winit from https://github.com/emilk/egui
INFO:root:Adding package egui_glow from https://github.com/emilk/egui
INFO:root:Adding package emath from https://github.com/emilk/egui
INFO:root:Adding package epaint from https://github.com/emilk/egui
Traceback (most recent call last):
  File "/tmp/flatpak-builder-tools/cargo/flatpak-cargo-generator.py", line 470, in 
    main()
  File "/tmp/flatpak-builder-tools/cargo/flatpak-cargo-generator.py", line 463, in main
    generated_sources = asyncio.run(generate_sources(load_toml(args.cargo_lock),
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/tmp/flatpak-builder-tools/cargo/flatpak-cargo-generator.py", line 417, in generate_sources
    for pkg in await asyncio.gather(*pkg_coros):
  File "/tmp/flatpak-builder-tools/cargo/flatpak-cargo-generator.py", line 367, in get_package_sources
    return await get_git_package_sources(package, git_repos)
  File "/tmp/flatpak-builder-tools/cargo/flatpak-cargo-generator.py", line 326, in get_git_package_sources
    git_pkg = git_repo['commits'][commit][name]
KeyError: 'eframe'

hfiguiere commented 5 months ago

Thanks for the help reviewing this.