[Pkg-rust-maintainers] Bug#1023413: dh-cargo: should prevent dh_clean from removing Cargo.toml.orig

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Nov 3 16:13:43 GMT 2022


Package: dh-cargo
Version: 28
Control: affects -1 debhelper src:rust-document-features debcargo

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)

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.

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 ?

Alternately, debcargo could be modified to add the following stanza to
its autogenerated debian/rules:

--- debian/rules
+++ debian/rules
@@ -4,3 +4,6 @@
 
 override_dh_auto_test:
 	dh_auto_test -- test --all
+
+override_dh_clean:
+	dh_clean -XCargo.toml.orig


If the dh-cargo folks think it should be fixed in either debhelper or
debcargo, feel free to reassign this bug report.

Thanks,

        --dkg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-rust-maintainers/attachments/20221103/f3139add/attachment.sig>


More information about the Pkg-rust-maintainers mailing list