new: keep vendored *.orig files through dh_clean in the rust rules
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:
@@ -101,6 +101,9 @@ impl Template for Rust {
|
|||||||
/// sources (e.g. `-sys` crates shipping `config.sub`/`config.guess`)
|
/// sources (e.g. `-sys` crates shipping `config.sub`/`config.guess`)
|
||||||
/// carry per-file cargo checksums, and debhelper refreshing those files
|
/// carry per-file cargo checksums, and debhelper refreshing those files
|
||||||
/// with the system's newer copies would break `cargo build --offline`.
|
/// 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 {
|
fn rules_extra(&self, opts: &NewOptions) -> String {
|
||||||
let locked = if lockfile_present(opts) {
|
let locked = if lockfile_present(opts) {
|
||||||
" --locked"
|
" --locked"
|
||||||
@@ -125,6 +128,12 @@ impl Template for Rust {
|
|||||||
\n\
|
\n\
|
||||||
override_dh_update_autotools_config:\n\
|
override_dh_update_autotools_config:\n\
|
||||||
\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\
|
override_dh_auto_clean:\n\
|
||||||
\tcargo clean\n",
|
\tcargo clean\n",
|
||||||
locked = locked,
|
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_test:\n\tcargo test --release --offline\n"));
|
||||||
assert!(extra.contains("override_dh_auto_clean:\n\tcargo clean"));
|
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"));
|
assert!(!extra.contains("--locked"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user