Bug#1103995: [Pkg-rust-maintainers] Bug#1103995: unblock: rust-debcargo/2.7.8-4
On Thu, Apr 24, 2025 at 07:29:27AM +0200, Fabian Grünbichler wrote:
> On Thu, Apr 24, 2025, at 2:13 AM, Peter Green wrote:
> >>
> >> If preferred, a variant of the proposed changes with a default of "no" would
> >> also be possible
> >
> > I think the default (for bin packages) should be not to generate a multi-arch:
> > field at all.
> >
> > This is behaviorally equivalent to multi-arch: no, but it IMO has different
> > implications, it implies "noone has thought about multi-arch for this package"
> > rather than "sometime has thought about multi-arch for this package and
> > rejected it"
>
> Thanks for the quick feedback!
>
> Helmut Grohne raised a similar objection on IRC, and like I noted in unblock
> request, that works just as well. Having "no" as default is easiest, having
> no default (which like you say, is "behaviorally equivalent") means a bit
> more code changes, but can be supported as well.
debdiff for the "set no value by default" variant attached, rationale
remains identical to initial report.
diff -Nru rust-debcargo-2.7.8/debian/changelog rust-debcargo-2.7.8/debian/changelog
--- rust-debcargo-2.7.8/debian/changelog 2025-04-04 19:17:48.000000000 +0200
+++ rust-debcargo-2.7.8/debian/changelog 2025-04-24 08:17:04.000000000 +0200
@@ -1,3 +1,11 @@
+rust-debcargo (2.7.8-4) unstable; urgency=medium
+
+ * Package debcargo 2.7.8 from crates.io using debcargo 2.7.8
+ * Default no M-A value for bin packages (Closes: #1103920)
+ * Change M-A to no annotation instead of allowed
+
+ -- Fabian Grünbichler <debian@fabian.gruenbichler.email> Thu, 24 Apr 2025 08:17:04 +0200
+
rust-debcargo (2.7.8-3) unstable; urgency=medium
* Package debcargo 2.7.8 from crates.io using debcargo 2.7.8
diff -Nru rust-debcargo-2.7.8/debian/control rust-debcargo-2.7.8/debian/control
--- rust-debcargo-2.7.8/debian/control 2025-04-04 19:17:48.000000000 +0200
+++ rust-debcargo-2.7.8/debian/control 2025-04-24 08:17:04.000000000 +0200
@@ -91,7 +91,6 @@
Package: debcargo
Architecture: any
-Multi-Arch: allowed
Section: devel
Depends:
${misc:Depends},
diff -Nru rust-debcargo-2.7.8/debian/patches/0001-control-default-to-no-Multi-Arch-value-for-bin-packa.patch rust-debcargo-2.7.8/debian/patches/0001-control-default-to-no-Multi-Arch-value-for-bin-packa.patch
--- rust-debcargo-2.7.8/debian/patches/0001-control-default-to-no-Multi-Arch-value-for-bin-packa.patch 1970-01-01 01:00:00.000000000 +0100
+++ rust-debcargo-2.7.8/debian/patches/0001-control-default-to-no-Multi-Arch-value-for-bin-packa.patch 2025-04-24 08:17:04.000000000 +0200
@@ -0,0 +1,94 @@
+From 2e74fa1763f83209c5a62c1b40477021ea71ce66 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= <git@fabian.gruenbichler.email>
+Date: Wed, 23 Apr 2025 18:07:37 +0200
+Subject: [PATCH 1/2] control: default to no Multi-Arch value for 'bin' package
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+'allowed' should be the exception, not the default.
+
+Fixes: #1103920
+
+Signed-off-by: Fabian Grünbichler <git@fabian.gruenbichler.email>
+---
+ src/debian/control.rs | 10 ++++++----
+ src/debian/control/tests.rs | 6 +++---
+ 2 files changed, 9 insertions(+), 7 deletions(-)
+
+diff --git a/src/debian/control.rs b/src/debian/control.rs
+index c48147f..be745e7 100644
+--- a/src/debian/control.rs
++++ b/src/debian/control.rs
+@@ -35,7 +35,7 @@ pub struct Source {
+ pub struct Package {
+ name: String,
+ arch: String,
+- multi_arch: String,
++ multi_arch: Option<String>,
+ section: Option<String>,
+ depends: Vec<String>,
+ recommends: Vec<String>,
+@@ -126,7 +126,9 @@ impl fmt::Display for Package {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ writeln!(f, "Package: {}", self.name)?;
+ writeln!(f, "Architecture: {}", self.arch)?;
+- writeln!(f, "Multi-Arch: {}", self.multi_arch)?;
++ if let Some(ref multi_arch) = self.multi_arch {
++ writeln!(f, "Multi-Arch: {}", multi_arch)?;
++ }
+ if let Some(section) = &self.section {
+ writeln!(f, "Section: {}", section)?;
+ }
+@@ -452,7 +454,7 @@ impl Package {
+ // duplicate packages in the Debian archive. For very large crates we
+ // will eventually want to make debcargo generate -data packages that
+ // are arch:all and have the arch:any -dev packages depend on it.
+- multi_arch: "same".to_string(),
++ multi_arch: Some("same".to_string()),
+ section: None,
+ depends,
+ recommends,
+@@ -485,7 +487,7 @@ impl Package {
+ Package {
+ name,
+ arch: "any".to_string(),
+- multi_arch: "allowed".to_string(),
++ multi_arch: None,
+ section: section.map(|s| s.to_string()),
+ depends: vec![
+ "${misc:Depends}".to_string(),
+diff --git a/src/debian/control/tests.rs b/src/debian/control/tests.rs
+index bfad24b..f1d16cc 100644
+--- a/src/debian/control/tests.rs
++++ b/src/debian/control/tests.rs
+@@ -136,7 +136,7 @@ fn test_package_new() {
+ assert!(instance.is_ok());
+ let instance = instance.unwrap();
+ assert_eq!("any", instance.arch);
+- assert_eq!("same", instance.multi_arch);
++ assert_eq!(Some("same"), instance.multi_arch.as_deref());
+ assert_eq!(None, instance.section);
+ assert_eq!(vec!["${misc:Depends}"], instance.depends);
+ assert_eq!(Vec::<String>::new(), instance.recommends);
+@@ -167,7 +167,7 @@ fn test_package_new_bin() {
+ let instance = Package::new_bin(basename, name_suffix, section, summary, description);
+
+ assert_eq!("any", instance.arch);
+- assert_eq!("allowed", instance.multi_arch);
++ assert_eq!(None, instance.multi_arch);
+ assert_eq!(Some("rust".to_owned()), instance.section);
+ assert_eq!(
+ vec!["${misc:Depends}", "${shlibs:Depends}", "${cargo:Depends}"],
+@@ -201,7 +201,7 @@ fn test_package_display() {
+ );
+ let instance = Package::new_bin(basename, name_suffix, section, summary, description);
+
+- let expected = "Package: rsa\nArchitecture: any\nMulti-Arch: allowed\nSection: rust\nDepends:\n ${misc:Depends},\n ${shlibs:Depends},\n ${cargo:Depends}\nRecommends:\n ${cargo:Recommends}\nSuggests:\n ${cargo:Suggests}\nProvides:\n ${cargo:Provides}\nBuilt-Using: ${cargo:Built-Using}\nStatic-Built-Using: ${cargo:Static-Built-Using}\nDescription: \n description_start\n .\n empty lines\n .\n description_stop\n";
++ let expected = "Package: rsa\nArchitecture: any\nSection: rust\nDepends:\n ${misc:Depends},\n ${shlibs:Depends},\n ${cargo:Depends}\nRecommends:\n ${cargo:Recommends}\nSuggests:\n ${cargo:Suggests}\nProvides:\n ${cargo:Provides}\nBuilt-Using: ${cargo:Built-Using}\nStatic-Built-Using: ${cargo:Static-Built-Using}\nDescription: \n description_start\n .\n empty lines\n .\n description_stop\n";
+
+ assert_eq!(expected, instance.to_string());
+ }
+--
+2.49.0
+
diff -Nru rust-debcargo-2.7.8/debian/patches/0002-control-make-Multi-Arch-configurable.patch rust-debcargo-2.7.8/debian/patches/0002-control-make-Multi-Arch-configurable.patch
--- rust-debcargo-2.7.8/debian/patches/0002-control-make-Multi-Arch-configurable.patch 1970-01-01 01:00:00.000000000 +0100
+++ rust-debcargo-2.7.8/debian/patches/0002-control-make-Multi-Arch-configurable.patch 2025-04-24 08:17:04.000000000 +0200
@@ -0,0 +1,73 @@
+From 6095199141afbc8de85c044015dd7e72262a71cd Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= <git@fabian.gruenbichler.email>
+Date: Wed, 23 Apr 2025 18:18:51 +0200
+Subject: [PATCH 2/2] control: make Multi-Arch configurable
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+to allow overriding if needed, without the need to override all of
+debian/control.
+
+Signed-off-by: Fabian Grünbichler <git@fabian.gruenbichler.email>
+---
+ debcargo.toml.example | 4 ++++
+ src/config.rs | 5 +++++
+ src/debian/control.rs | 3 +++
+ 3 files changed, 12 insertions(+)
+
+diff --git a/debcargo.toml.example b/debcargo.toml.example
+index 862b6c2..da55db0 100644
+--- a/debcargo.toml.example
++++ b/debcargo.toml.example
+@@ -196,6 +196,10 @@ uploaders = [ "foo bar <foo@debian.org>" ]
+ #PLACEHOLDER
+ #"""
+
++# Value for the Multi-Arch field of the package. If omitted, debcargo will
++# automatically set no value for 'bin', and 'same' for all 'lib' packages.
++#multi_arch = "no|same|foreign|allowed"
++
+ # Additional Depends on top of the ones generated by debcargo. This should be
+ # used to pull in system libraries for crates that need them to build. You'll
+ # want the -dev versions of the library packages, since our crate packages are
+diff --git a/src/config.rs b/src/config.rs
+index 773d739..f445e53 100644
+--- a/src/config.rs
++++ b/src/config.rs
+@@ -76,6 +76,7 @@ pub struct PackageOverride {
+ section: Option<String>,
+ summary: Option<String>,
+ description: Option<String>,
++ multi_arch: Option<String>,
+ depends: Option<Vec<String>>,
+ recommends: Option<Vec<String>>,
+ suggests: Option<Vec<String>>,
+@@ -219,6 +220,10 @@ impl Config {
+ self.with_package(key, |pkg| pkg.description.as_deref())
+ }
+
++ pub fn package_multi_arch(&self, key: PackageKey) -> Option<&str> {
++ self.with_package(key, |pkg| pkg.multi_arch.as_deref())
++ }
++
+ pub fn package_depends(&self, key: PackageKey) -> Option<&Vec<String>> {
+ self.with_package(key, |pkg| pkg.depends.as_ref())
+ }
+diff --git a/src/debian/control.rs b/src/debian/control.rs
+index be745e7..eb46d81 100644
+--- a/src/debian/control.rs
++++ b/src/debian/control.rs
+@@ -589,6 +589,9 @@ impl Package {
+ .flatten()
+ .map(|s| s.to_string()),
+ );
++ if let Some(multi_arch) = config.package_multi_arch(key) {
++ self.multi_arch = Some(multi_arch.to_owned());
++ }
+ }
+ }
+
+--
+2.49.0
+
diff -Nru rust-debcargo-2.7.8/debian/patches/series rust-debcargo-2.7.8/debian/patches/series
--- rust-debcargo-2.7.8/debian/patches/series 2025-04-04 19:17:48.000000000 +0200
+++ rust-debcargo-2.7.8/debian/patches/series 2025-04-24 08:17:04.000000000 +0200
@@ -1 +1,3 @@
relax-git2.patch
+0001-control-default-to-no-Multi-Arch-value-for-bin-packa.patch
+0002-control-make-Multi-Arch-configurable.patch
Reply to: