Skip to content

[Regression] package broken in Nix builds #827

@mrcjkb

Description

@mrcjkb

#819 has introduced a regression that prevents the use of octocrab when building in a sandboxed environemnt (e.g. using Nix).

Specifically, the attempt to parse the Cargo manifest fails, because e.g. dev dependencies, optional depencdencies, etc. are not present in the Cargo.lock of packages that depend on octocrab:

    let metadata = MetadataCommand::new()
        .manifest_path(&manifest_path)
        .exec()
        .expect("failed to parse `cargo metadata`");

Example (See lumen-oss/lux#1202):

        > error: failed to run custom build command for `octocrab v0.48.0`
       >
       > Caused by:
       >   process didn't exit successfully: `/build/source/target/release/build/octocrab-cdca9476018831b2/build-script-build` (exit status: 101)
       >   --- stdout
       >   cargo:rerun-if-changed=Cargo.toml
       >
       >   --- stderr
       >
       >   thread 'main' panicked at /nix/store/i79glcwih9fq5p6zal9jxfsb0418385l-vendor-cargo-deps/c19b7c6f923b580ac259164a89f2577984ad5ab09ee9d583b888f934adbbe8d0/octocrab-0.48.0/build.rs:15:10:
       >   failed to parse `cargo metadata`: CargoMetadata { stderr: "error: no matching package named `crypto_box` found\nlocation searched: directory source `/nix/store/i79glcwih9fq5p6zal9jxfsb0418385l-vendor-cargo-deps/c19b7c6f923b580ac259164a89f2577984ad5ab09ee9d583b888f934adbbe8d0` (which is replacing registry `crates-io`)\nrequired by package `octocrab v0.48.0 (/nix/store/i79glcwih9fq5p6zal9jxfsb0418385l-vendor-cargo-deps/c19b7c6f923b580ac259164a89f2577984ad5ab09ee9d583b888f934adbbe8d0/octocrab-0.48.0)`\n" }
       >   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
       > warning: build failed, waiting for other jobs to finish...
       For full logs, run:
         nix log /nix/store/mhdvlxnlyynmm5bg331lshhfjllivvdc-lux-deps-0.1.0.drv
error: Cannot build '/nix/store/yrzhkybhsyimdss6c8nxqf76z228wvbm-lux-clippy-clippy-0.20.1.drv'.
       Reason: 1 dependency failed.
       Output paths:
         /nix/store/p0qm063agz3yfpfr9vpcpirg6pzppm7b-lux-clippy-clippy-0.20.1

To be able to build my package with Nix, I would now have to add all of octocrab's dev dependencies (and also optional dependencies, ...) to my project's Cargo.toml.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions