[Pkg-rust-maintainers] [Debian Wiki] Update of "Teams/RustPackaging/Policy" by Infinity0

Ximin Luo infinity0 at debian.org
Tue Feb 6 20:12:00 UTC 2018


Right, it does not do that currently. For git2 we have:

[features]
curl = ["libgit2-sys/curl"]

which cargo treats as "git2-with-feature-curl must depend on libgit2-sys-with-feature-curl"

For num-bigint we have

[dependencies.rand]
optional = true

which cargo treats as "num-bigint-with-feature-rand must depend on the rand crate".

and something similar for serde.

OTOH, we also have various crates that have dependencies with "{ default-features = false }", e.g. chrono-0.4 on num-0.1-with-default-features-false.

So for all of these reasons I think it would be cleaner in the end not to special-case the "default" feature by combining it with the bare crate (as debcargo currently seems to be doing). Rather, we should:

1. have the bare crate Provides: the X feature, only if all deps of X are satisfied by it (for any X, including X = "default"). From the output of the winapi-0.3 crate, it seems we're already doing this. if not, then X needs to go in a real separate Package stanza.

2. translate crate-dependencies to +default debian dependencies, unless it is annotated with default-features = false in which case we translate it to the bare debian package.

This seems acceptable with current policy. For context, in practise this affects about 4 crates out of the 135 that I've tried so far.

X

Josh Triplett:
> debcargo is supposed to add all the corresponding Depends for the
> "default" feature to the base crate, to go along with that Provides. If
> it doesn't, that seems like a bug.
> 
> On Tue, Feb 06, 2018 at 05:38:00PM +0000, Ximin Luo wrote:
>> Hey Josh,
>>
>> All versions of debcargo [1] have generated a Provides: +default for all library crates. This breaks for packages where the default feature pulls in extra dependencies on top of the bare create - examples are git2, num-bigint, semver.
>>
>> I had thought the packaging policy needs updating but it is actually fine, so I've just tweaked the wording to be a bit clearer about it. It is debcargo itself that needs to generate explicit Package: stanzas for +default when they pull in more dependencies than the bare crate does, e.g. [2]. Vasudev says he's currently working on a fix.
>>
>> This was detected by running `cargo build` as part of dh_auto_test, so I think it is good to continue doing this for all crates in the future.
>>
>> X
>>
>> [1] I checked as far back as 1.3.0 + 3 commits (b5b880b), before that it requires older openssl which I didn't bother installing.
>> [2] https://anonscm.debian.org/git/pkg-rust/debcargo.git/tree/tests/sh/configs/git2-0.6/debian/control?id=pu/cargo-build-everything
>>
>> Josh Triplett:
>>> Can you elaborate a bit on the goal here?
>>>
>>> On Tue, Feb 06, 2018 at 12:42:09PM -0000, Debian Wiki wrote:
>>>> Dear Wiki user,
>>>>
>>>> You have subscribed to a wiki page or wiki category on "Debian Wiki" for change notification.
>>>>
>>>> The "Teams/RustPackaging/Policy" page has been changed by Infinity0:
>>>> https://wiki.debian.org/Teams/RustPackaging/Policy?action=diff&rev1=20&rev2=21
>>>>
>>>> Comment:
>>>> make it clear that it is not always appropriate to Provides: the `default` feature
>>>>
>>>>   
>>>>   A library crate must also generate binary packages for every Cargo "feature" it declares, named `librust-cratename-version+featurename-dev`.  Cargo crate names do not allow a plus sign (`+`) in them, so this package name will not conflict with the package name for any other Rust library crate or feature package.  If the feature name contains underscores (`_`), the corresponding binary package name must replace them with dashes (`-`).
>>>>   
>>>> - Each feature package must pull in all the dependencies needed to build a package that depends on that feature of the crate, including any dependencies on other features of the same crate.  If a feature package pulls in no additional dependencies, the main `librust-cratename-version-dev` package can use a versioned Provides to supply that feature package.  The `librust-cratename-version-dev` should normally incorporate any dependencies required to build the `default` feature of the crate, and use a versioned Provides to supply the `librust-cratename-version+default-dev` package as well as any feature packages for features that require no additional dependencies beyond `default`.
>>>> + Each feature package must pull in all the dependencies needed to build a package that depends on that feature of the crate, including any dependencies on other features of the same crate.  If a feature package pulls in no additional dependencies, the main `librust-cratename-version-dev` package can use a versioned Provides to supply that feature package.  (For example, the `librust-cratename-version-dev` would normally incorporate any dependencies required to build the `default` feature of the crate, and use a versioned Provides to supply the `librust-cratename-version+default-dev` package as well as any feature packages for features that require no additional dependencies beyond `default`.)
>>>>   
>>>>   Each feature package must have a versioned dependency on the same version of the main `librust-cratename-version-dev` package.  If a feature of the crate depends on another feature of the same crate, the corresponding feature package for the first feature must have a dependency on the same version of the feature package for the second feature.
>>>>   
>>
>>
>> -- 
>> GPG: ed25519/56034877E1F87C35
>> GPG: rsa4096/1318EFAC5FBBDBCE
>> https://github.com/infinity0/pubkeys.git
> 
> _______________________________________________
> Pkg-rust-maintainers mailing list
> Pkg-rust-maintainers at lists.alioth.debian.org
> https://lists.alioth.debian.org/mailman/listinfo/pkg-rust-maintainers
> 


-- 
GPG: ed25519/56034877E1F87C35
GPG: rsa4096/1318EFAC5FBBDBCE
https://github.com/infinity0/pubkeys.git



More information about the Pkg-rust-maintainers mailing list