new: keep generated builds away from local build outputs and vendored autotools files
This commit is contained in:
+16
-3
@@ -107,9 +107,19 @@ fn source_format(opts: &NewOptions) -> OutputFile {
|
||||
|
||||
/// `debian/source/local-options` with `single-debian-patch`, so later
|
||||
/// upstream-tree edits stay representable as one `debian/patches/debian-changes-*`
|
||||
/// patch instead of failing the build (quilt only).
|
||||
/// patch instead of failing the build (quilt only). Common build-output
|
||||
/// directories are excluded from the delta as well: compiling locally before
|
||||
/// a source build must not turn `target/`, `node_modules/` or `.venv/`
|
||||
/// binaries into unrepresentable changes (dpkg ignores `__pycache__` and
|
||||
/// friends by default, but not those).
|
||||
fn local_options() -> OutputFile {
|
||||
OutputFile::new("debian/source/local-options", "single-debian-patch\n")
|
||||
OutputFile::new(
|
||||
"debian/source/local-options",
|
||||
"single-debian-patch\n\
|
||||
extend-diff-ignore = ^target/\n\
|
||||
extend-diff-ignore = ^node_modules/\n\
|
||||
extend-diff-ignore = ^\\.venv/\n",
|
||||
)
|
||||
}
|
||||
|
||||
/// `debian/changelog`: the single initial entry, distribution UNRELEASED by
|
||||
@@ -558,7 +568,10 @@ mod tests {
|
||||
assert_eq!(find("debian/source/format").contents, "3.0 (quilt)\n");
|
||||
assert_eq!(
|
||||
find("debian/source/local-options").contents,
|
||||
"single-debian-patch\n"
|
||||
"single-debian-patch\n\
|
||||
extend-diff-ignore = ^target/\n\
|
||||
extend-diff-ignore = ^node_modules/\n\
|
||||
extend-diff-ignore = ^\\.venv/\n"
|
||||
);
|
||||
|
||||
let native = NewOptions {
|
||||
|
||||
+4
-1
@@ -428,7 +428,10 @@ mod tests {
|
||||
);
|
||||
assert_eq!(
|
||||
std::fs::read_to_string(tree.join("debian/source/local-options")).unwrap(),
|
||||
"single-debian-patch\n"
|
||||
"single-debian-patch\n\
|
||||
extend-diff-ignore = ^target/\n\
|
||||
extend-diff-ignore = ^node_modules/\n\
|
||||
extend-diff-ignore = ^\\.venv/\n"
|
||||
);
|
||||
|
||||
// Orig tarball: contains the skeleton file, excludes debian/.
|
||||
|
||||
@@ -96,6 +96,11 @@ impl Template for Rust {
|
||||
/// created it, see [`patch_rules_locked`]); omitting it is always safe.
|
||||
/// The built artifact of a skeleton is named after its crate (a
|
||||
/// sanitized package name) and installed under the command name.
|
||||
///
|
||||
/// `dh_update_autotools_config` is overridden away: crates embedding C
|
||||
/// 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`.
|
||||
fn rules_extra(&self, opts: &NewOptions) -> String {
|
||||
let locked = if lockfile_present(opts) {
|
||||
" --locked"
|
||||
@@ -118,6 +123,8 @@ impl Template for Rust {
|
||||
override_dh_auto_test:\n\
|
||||
\tcargo test --release --offline{locked}\n\
|
||||
\n\
|
||||
override_dh_update_autotools_config:\n\
|
||||
\n\
|
||||
override_dh_auto_clean:\n\
|
||||
\tcargo clean\n",
|
||||
locked = locked,
|
||||
@@ -564,6 +571,10 @@ mod tests {
|
||||
let extra = template.rules_extra(&with_lock);
|
||||
assert!(extra.contains("\tcargo build --release --offline --locked\n"));
|
||||
assert!(extra.contains("\tcargo test --release --offline --locked\n"));
|
||||
// debhelper refreshing embedded autotools files (e.g. `-sys` crates
|
||||
// shipping config.sub/config.guess) would break cargo's per-file
|
||||
// vendored checksums — the override skips the refresh entirely.
|
||||
assert!(extra.contains("override_dh_update_autotools_config:\n"));
|
||||
}
|
||||
|
||||
/// Package names may carry `+`/`.` (legal dpkg, rejected by cargo): the
|
||||
|
||||
Reference in New Issue
Block a user