deb,build: export ddebs from binary builds
CI / build (push) Failing after 54s
CI / test (push) Skipped
CI / snap (push) Skipped
CI / publish (push) Skipped

dh_strip registers debug-symbol packages in debian/files under their
renamed .ddeb name; they are deliverables of the build just like the
regular .debs. Both artifact-type filters, the one collecting the
build's artifacts and the one feeding the .buildinfo/.changes
checksum sections, accepted only deb and udeb, so every ddeb a build
produced was silently discarded: nothing exported next to the .debs,
nothing in the upload metadata.

The filter is now a shared FilesEntry::is_binary_artifact() predicate
(plus unit tests) used by both call sites, so the two cannot drift
apart again.

One dpkg distinction has to be copied rather than shared:
dpkg-genchanges lists only deb/udeb packages in the changes' Binary:
and Description (a ddeb travels in Files and the checksum sections
but is not a listed binary of the upload), while dpkg-genbuildinfo
lists every binary artifact's package, ddebs included. The package
list is therefore accumulated twice, once per consumer.

The binary-metadata differential fixture gains a Package-Type: ddeb
package, so the native .changes/.buildinfo generation is compared
against real dpkg with a ddeb present. Without the fix the comparison
fails on the checksum sections (golden distributes the ddeb, ours
dropped it); with it every field matches.
This commit is contained in:
2026-09-30 14:18:45 +02:00
parent 72992f6ec8
commit ed76b3ef7f
4 changed files with 55 additions and 10 deletions
+30
View File
@@ -46,6 +46,21 @@ impl FilesEntry {
entry.priority = priority.to_string();
entry
}
/// Whether this entry is a binary-package artifact that must be
/// exported from the build: a `.deb`, a `.udeb`, or a `.ddeb`.
///
/// Debug-symbol packages are registered in `debian/files` by
/// `dh_strip` under their renamed `.ddeb` name; they are as much
/// a deliverable of the build as the regular `.deb`s (they belong
/// in the upload set), so any filter keyed on artifact type has
/// to accept them.
pub fn is_binary_artifact(&self) -> bool {
matches!(
self.package_type.as_deref(),
Some("deb") | Some("udeb") | Some("ddeb")
)
}
}
/// Derive metadata from an artifact file name following the common
@@ -243,6 +258,21 @@ mod tests {
assert_eq!(e.package_type, None);
}
#[test]
fn binary_artifact_filter_accepts_ddebs() {
let deb = parse_filename("hello_2.10-3_amd64.deb").unwrap();
let udeb = parse_filename("hello_2.10-3_amd64.udeb").unwrap();
let ddeb = parse_filename("hello-dbgsym_2.10-3_amd64.ddeb").unwrap();
let buildinfo = parse_filename("hello_2.10-3_amd64.buildinfo").unwrap();
let changes = parse_filename("hello_2.10-3_amd64.changes").unwrap();
assert!(deb.is_binary_artifact());
assert!(udeb.is_binary_artifact());
assert!(ddeb.is_binary_artifact(), "ddebs must be exported");
assert!(!buildinfo.is_binary_artifact());
assert!(!changes.is_binary_artifact());
}
#[test]
fn load_save_roundtrip() {
let dir = tempfile::tempdir().unwrap();