#1094483 rust-async-std: FTBFS with "nocheck" profile

#1094483#5
Date:
2025-01-28 14:42:01 UTC
From:
To:
Dear maintainer!

It is impossible to build package rust-async-std from source with
profile "nocheck".

Steps how to reproduce.

Create fresh docker container with Debian Trixie:
```
docker run --rm -it debian:trixie bash
```

In my case I received such image:
```
REPOSITORY                                                       TAG        IMAGE ID       CREATED        SIZE
debian                                                           trixie     a1b129fd683d   2 weeks ago    118MB
```


Update apt cache:
```
apt update
```

Install vim:
```
apt install vim
```

Add deb-src into all lines starting with "Types:" in file
/etc/apt/sources.list.d/debian.sources.

Update apt cache again:
```
apt update
```

Install dpkg-dev package:
```
apt install dpkg-dev
```

Download sources of package rust-async-std:
```
apt source rust-async-std
```

In my case I received version 1.13.0-3

Goto into folder with sources.

Set necessary environment variables:
```
export DEB_BUILD_OPTIONS="nocheck"
export DEB_BUILD_PROFILES="nocheck"
```

Install necessary build deps:
```
apt build-dep .
```

Run build process:
```
dpkg-buildpackage -b -uc
```

I received an error:
```
error: failed to prepare local package for uploading

Caused by:
  no matching package named `async-attributes` found
  location searched: registry `crates-io`
  required by package `async-std v1.13.0 (/root/rust-async-std-1.13.0)`
```

It is interesting, that according to file debian/control build dep
librust-async-attributes-1+default-dev has condition <!nocheck>. But as
I saw, this dependency is mandatory indeed.

Without "nocheck" package builds correctly.
Could you please fix build of this package with profile "nocheck"? It is
really important to have possibility to build package with "nocheck".

P.S. There are lot of other rust packages not building with "nocheck"
profile. For example rust-async-attributes 1.1.2 and a lot of others.

#1094483#10
Date:
2025-02-05 23:25:36 UTC
From:
To:
This is a dh-rust bug. When the build is done with the `nocheck`
profile, `cargo package` is still called in dh_auto_install. `cargo
package` expects the registry to be populated by the crate's
dependencies, so the build fails if d/control uses the <!nocheck>
qualifier for the B-Ds and these are not installed by other means. In
other words, the way dh-rust currently does things requires B-Ds to be
installed even if `nocheck` is used.

Downgrading severity to important because I couldn't find anything in
the policy or in https://release.debian.org/testing/rc_policy.txt to
suggest that packages must build with the `nocheck` profile. The
reported justification "Justification: fails to build from source (but
built successfully in the past)" is inaccurate because the packages do
in fact build from source with the default profile.

#1094483#21
Date:
2025-02-05 23:31:19 UTC
From:
To:
BTS control server was apparently unhappy with the retitling format,
trying again.

#1094483#26
Date:
2025-02-05 23:37:18 UTC
From:
To:
Third time's the charm, they say.
#1094483#37
Date:
2025-02-06 08:14:10 UTC
From:
To:
Quoting NoisyCoil (2025-02-06 00:25:36)

One way of looking at this is indeed to consider it a bug in dh-rust.

More reasonably, however, I consider it a feature request for dh-rust,
since dh-rust does not promise to support building without rust
dependencies available.  Consequently it is a bug in each and every
package using dh-rust to flag rust-related dependencies as <!nocheck>.

I noticed this some time ago and slowly began to cleanup build-
dependencies, but was too lazy to properly file related bugreports.
Thanks to you both for improving the reporting of this issue.

Arguably the bug in rust-async-std (and some 60 other packages) is
more severe, by the notion in Debian Policy §7.7 that it is optional to
declare dependencies, but if any are declared then they must be correct.

 - Jonas

#1094483#44
Date:
2025-02-08 14:12:22 UTC
From:
To:
I confirm the analysis of this bug which I gave in #1094199. Both bugs are the
manifestation of the same underlying implementation bug: dh-rust relies on
`cargo package` to normalize the crate and to include/exclude the desired files
from the Debian package. At this time, `cargo package` always generates or
creates a Cargo.lock file in the package, which requires the local registry to
be populated with all dependencies.

For what concerns this bug, cargo's behavior forces build-dependencies to be
installed even when they are not needed at all for the purposes of Debian
packaging: Cargo.lock is deleted from the package anyway. As a consequence, it
is forcing Jonas to remove the <!nocheck> condition in tens of packages' B-Ds.
In other contexts is makes useless gymastics compulsory, like needing to
resolve the installation order and forcing one into dependency cycles which
could be very hard to solve, like in bug #1094199. Upstream it is causing a
number of issues too, see e.g. [1] and [2].

The situation got (probably one order of magnitude?) worse with cargo 1.84,
which started to create lock files not only for binary crates and for library
crates with examples, but for *all* crates. Starting with cargo 1.84 Jonas will
have to remove the <!nocheck> condition from *all* of his packages as long as
he continues to use `cargo package` in dh-rust. An example of a package that I
could test to build with cargo 1.83 but not with cargo 1.84 is rust-nanorand
0.7.0-11, which just yesterday was updated to 0.7.0-12 in order (among other
things) to remove the <!nocheck>s.



[1] https://github.com/rust-lang/cargo/issues/15059
[2] https://github.com/rust-lang/cargo/issues/15151

#1094483#49
Date:
2025-02-08 14:58:46 UTC
From:
To:
control: retitle -1 dh-rust: please support install without dependent crates installed
control: severity -1 wishlist

Quoting NoisyCoil (2025-02-08 15:12:22)

As I also wrote at #1094199, this is a bug against dh-rust, and since
your arguments seem to be targeted at making changes to cargo, they are
likely better suited at a separate bugreport.

I have tried clarify this by changing the title for this bugreport.

Please track changes to cargo independently of this bugreport, and use
this bugreport only to track e.g. implementing support in dh-rust for
some future imaginative cargo command-line flag or environment variable.

Thanks,

 - Jonas

#1094483#58
Date:
2025-02-08 22:37:32 UTC
From:
To:
Here I described cargo's behavior to explain how it affects dh-rust and how it got worse starting with 1.84, to the point that it now grants RC bugs for all dh-rust packages with <!nocheck> B-Ds (instead of just some fraction of them, as was the case before).

The cargo part is being dealt with separately [1].


https://github.com/rust-lang/cargo/issues/15159

#1094483#63
Date:
2025-02-08 22:48:37 UTC
From:
To:
Quoting noisycoil@tutanota.com (2025-02-08 23:37:32)

None of that is actionable in dh-rust.

I recommend to file a bugreport against the Debian package src:cargo
with such information, and then tag that bugreport as affecting dh-rust.

Thanks for all your work on this,

 - Jonas