[Pkg-rust-maintainers] Bug#984627: debcargo: should ignore build-dependencies that are marked cfg(target_env = "msvc")
Fabian Grünbichler
debian at fabian.gruenbichler.email
Sun Feb 15 14:41:21 GMT 2026
On Fri, 05 Mar 2021 19:00:19 -0500 Daniel Kahn Gillmor <dkg at fifthhorseman.net> wrote:
> Package: debcargo
> Version: 2.4.4-1
> Control: affects -1 src:rust-nettle-sys
>
> in Cargo.toml from nettle-sys 2.0.5, we see:
>
> [target."cfg(target_env = \"msvc\")".build-dependencies.vcpkg]
> version = "0.2.9"
>
>
> But debcargo 2.4.4 translates that into actual Build-Depends: and
> Depends: fields, despite the target environment not being the MSVC
> compiler. It generates:
>
> -----
> Source: rust-nettle-sys
> Section: rust
> Priority: optional
> Build-Depends: debhelper (>= 12),
> dh-cargo (>= 24),
> cargo:native <!nocheck>,
> rustc:native <!nocheck>,
> libstd-rust-dev <!nocheck>,
> librust-bindgen-0.55-dev <!nocheck> | librust-bindgen-0.54-dev <!nocheck> | librust-bindgen-0.53-dev (>= 0.53.1-~~) <!nocheck>,
> librust-pkg-config-0.3+default-dev <!nocheck>,
> librust-vcpkg-0.2+default-dev (>= 0.2.9-~~) <!nocheck>,
> nettle-dev (>= 3.5.1~~) <!nocheck>,
> llvm
> Maintainer: Debian Rust Maintainers <pkg-rust-maintainers at alioth-lists.debian.net>
> Uploaders:
> Daniel Kahn Gillmor <dkg at fifthhorseman.net>,
> kpcyrd <git at rxv.cc>
> Standards-Version: 4.5.1
> Vcs-Git: https://salsa.debian.org/rust-team/debcargo-conf.git [src/nettle-sys]
> Vcs-Browser: https://salsa.debian.org/rust-team/debcargo-conf/tree/master/src/nettle-sys
> Rules-Requires-Root: no
>
> Package: librust-nettle-sys-dev
> Architecture: any
> Multi-Arch: same
> Depends:
> ${misc:Depends},
> librust-bindgen-0.55-dev | librust-bindgen-0.54-dev | librust-bindgen-0.53-dev (>= 0.53.1-~~),
> librust-pkg-config-0.3+default-dev,
> librust-vcpkg-0.2+default-dev (>= 0.2.9-~~),
> nettle-dev (>= 3.5.1~~)
> Provides:
>
> -----
>
> So, i'll probably patch this out of the upstream sources for now, but
> debcargo should have handled this more cleanly.
just a short update on this - I've had a chat with decathorpe,
the Fedora rust packaging maintainer, who has written a tool
that does exactly this:
https://codeberg.org/rust2rpm/rust2rpm-helper/src/branch/main/Cargo.toml
the current plan is to restructure and rename this crate to
make it usable by debcargo, and then extend it to also support
some of the other low-hanging fruit that fall into the "generate
patch for Cargo.toml" category.
in the end, we will have a (default true) flag in debcargo.toml
along the lines of "disable_foreign_targets", and debcargo
will then synthesize a patch for Cargo.toml removing all
dependencies conditionalized for certain targets, as well as
feature entries that reference them.
since Cargo.toml post patching will then no longer have those
dependencies, neither will d/control or d/test/control.
More information about the Pkg-rust-maintainers
mailing list