[Pkg-rust-maintainers] Bug#1023413: dh-cargo: should prevent dh_clean from removing Cargo.toml.orig
Niels Thykier
niels at thykier.net
Sat Nov 19 14:12:35 GMT 2022
On Thu, 03 Nov 2022 12:13:43 -0400 Daniel Kahn Gillmor
<dkg at fifthhorseman.net> wrote:
> Package: dh-cargo
> Version: 28
> Control: affects -1 debhelper src:rust-document-features debcargo
>
Hi,
> When packaging Rust crates, the rust-team typically packages from the
> bundles published on crates.io. Those are published with a modified
> version of Cargo.toml, and the original upstream source for Cargo.toml
> is present as Cargo.toml.orig.
>
> debhelper's dh_clean by default removes all files matching *.orig, which
> means that the upstream Cargo.toml.orig is getting stripped before the
> build happens. (dh_clean is typically invoked before a build)
>
Would it be possible to use a different name for it (like
Cargo.toml.upstream or even Cargo.toml.original)? Something that
dh_clean does not remove by default?
> This is problematic for tools like the document-features crate, which
> relies on comments in Cargo.toml.orig to extract documention about the
> features of any given crate.
>
> See the upstream discussion at
> https://github.com/slint-ui/document-features/issues/15
>
> If dh-cargo were able to force the exclusion Cargo.toml.orig, that would
> be great, but i tried hacking on the clean() function in cargo.pm to
> push something into @{dh{EXCLUDE}} and i couldn't get it to work. Maybe
> someone who knows debhelper or dh-cargo better than me can figure out
> how to do it.
>
In theory, a dh addon *can* add an option to dh_clean by default (i.e.,
if dh_clean is not overridden). That said, it does mean that the
sequence can no longer be conditional (e.g., only used in
Build-Depends-Arch).
> Or, maybe a newer version of debhelper itself could just generically
> avoid destroying Cargo.toml.orig in the top-level of any source tree,
> even though it removes all the other *.orig files ?
>
Special-casing Cargo.toml.orig also feels weird to me. But also, I do
not want every language special-case to cascade into "core" debhelper -
then debhelper becomes an unmaintainable soup of random things I cannot
keep track (like are they still relevant).
> [...]
>
>
> If the dh-cargo folks think it should be fixed in either debhelper or
> debcargo, feel free to reassign this bug report.
>
> Thanks,
>
> --dkg
The removal of .orig is been around for ages (to support cleaning up
after patches with merge conflicts). I am not inclined to remove that
from debhelper.
I hope we can use another name for the file or that dh-cargo can handle
the special-casing via a debhelper add-on.
Thanks,
~Niels
More information about the Pkg-rust-maintainers
mailing list