kornelski / cargo-deb

A cargo subcommand that generates Debian packages from information in Cargo.toml
https://lib.rs/cargo-deb
MIT License
404 stars 48 forks source link

Allow a cargo sub sub command for --cargo-build (cargo auditable build) #134

Closed kpcyrd closed 3 weeks ago

kpcyrd commented 3 weeks ago

Hello!

I'm trying to use cargo-deb and cargo-auditable together, I noticed cargo deb has an option to replace the build subcommand with something else so I tried auditable build but it seems this is taken as an opaque string (actually looking for a /usr/bin/cargo-auditable build binary).

The error looks like this:

% cargo deb --cargo-build 'auditable build'
error: no such command: `auditable build`

    View all installed commands with `cargo --list`
    Find a package to install `auditable build` with `cargo search cargo-auditable build`
cargo-deb: build failed

I could probably work around this by creating a cargo-auditable-build dummy subcommand that calls cargo auditable build for me, passing along all arguments:

#!/bin/sh
shift
cargo auditable build "$@"

I think legitimate cargo subcommands are very unlikely to contain spaces, so splitting by space seems fairly safe, but alternatively there could be a --auditable flag that internally configures ["auditable", "build"] without changing anything else about existing --cargo-build behavior.

This would allow using cargo audit bin /usr/bin/... on files that have been installed with cargo-deb.

Thanks!

kornelski commented 3 weeks ago

There's also --no-build option that just picks whatever is already in target/release.

kornelski commented 3 weeks ago

This will probably conflict with stripping too, so --no-strip.

kpcyrd commented 3 weeks ago

Thanks for the hint!

I've checked in regards to --no-strip and the dependency data is stored in a .dep-v0 section that is left untouched by strip.