new: keep vendored *.orig files through dh_clean in the rust rules
CI / build (push) Failing after 2m58s
CI / test (push) Skipped
CI / snap (push) Skipped

dh_clean unlinks *.orig patch backups, and vendored crates carry
Cargo.toml.orig (and the occasional *.xml.orig) that cargo's per-file
checksums require on cold builds. Override dh_clean with -X .orig.
This commit is contained in:
2026-09-17 23:54:52 +02:00
parent 4ab41e691a
commit 2b017dcf43
+11
View File
@@ -101,6 +101,9 @@ impl Template for Rust {
/// sources (e.g. `-sys` crates shipping `config.sub`/`config.guess`)
/// carry per-file cargo checksums, and debhelper refreshing those files
/// with the system's newer copies would break `cargo build --offline`.
/// `dh_clean` gets `-X Cargo.toml.orig` for the same reason: it treats
/// every vendored `Cargo.toml.orig` as a patch backup and deletes it,
/// which breaks the checksums on any build without a warm cache.
fn rules_extra(&self, opts: &NewOptions) -> String {
let locked = if lockfile_present(opts) {
" --locked"
@@ -125,6 +128,12 @@ impl Template for Rust {
\n\
override_dh_update_autotools_config:\n\
\n\
override_dh_clean:\n\
\t# dh_clean unlinks `*.orig` patch backups, but vendored crates\n\
\t# ship files like `Cargo.toml.orig` that cargo's per-file\n\
\t# checksums require on cold builds (chroots, Launchpad).\n\
\tdh_clean -X .orig\n\
\n\
override_dh_auto_clean:\n\
\tcargo clean\n",
locked = locked,
@@ -552,6 +561,8 @@ mod tests {
);
assert!(extra.contains("override_dh_auto_test:\n\tcargo test --release --offline\n"));
assert!(extra.contains("override_dh_auto_clean:\n\tcargo clean"));
assert!(extra.contains("override_dh_clean:"));
assert!(extra.contains("\tdh_clean -X .orig"));
assert!(!extra.contains("--locked"));
}