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

Daniel Kahn Gillmor dkg at fifthhorseman.net
Sun Nov 20 17:08:03 GMT 2022


Hi Niels--

Thanks for taking a look at this.

On Sat 2022-11-19 15:12:35 +0100, in #1023413, Niels Thykier wrote:
> On Thu, 03 Nov 2022 12:13:43 -0400 Daniel Kahn Gillmor <dkg at fifthhorseman.net> wrote:
>> 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?

unfortunately, the name "Cargo.toml.orig" comes from the rust packaging
ecosystem (it's produced when a "crate" is generated from source).  So
this isn't something that the rust-team has any control over, and it
seems *very* unlikely that the upstream ecosystem will change this at
any point in the future.  afaict, the breakage described here is the
*only* peculiarity that has a negative impact on the ecosystem related
to the naming of Cargo.toml.orig.

> 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).

i'm not sure i fully understand the implications of this constraint, or
how i would go ahead and add that option via dh-cargo.  can you point me
to the right sort of way to do this thing in dh-cargo?

> 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).

I agree that this kind of "soup" isn't friendly or maintainable for
something as central as debhelper generally, and it's tough for
debhelper to know whether this kind of specific cleanup is appropriate
for a given package.

> 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.

OK, sounds like putting this in dh-cargo is the right way to do it, so
this report is assigned to the right package.  If you could give me a
pointer to the safest way to do this, i would appreciate it!

Or maybe someone who knows dh-cargo better than i do can try to make
this change?

        --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/20221120/55d0ad5f/attachment.sig>


More information about the Pkg-rust-maintainers mailing list