From e335b9ed0d3583f0782665abf3ad884bc40d81d1 Mon Sep 17 00:00:00 2001
From: Dalton Durst <debian@daltondur.st>
Date: Tue, 20 Feb 2024 16:50:36 -0700
Subject: [PATCH] New arch:all binary on migrated source

---
 t/new-all-binary/description                  | 28 +++++++++++++++++++
 t/new-all-binary/expected                     |  1 +
 t/new-all-binary/expected-excuses.yaml        |  2 ++
 t/new-all-binary/test-data                    |  2 ++
 .../var/data/testing/Packages_amd64           |  6 ++++
 .../var/data/testing/Packages_i386            |  6 ++++
 t/new-all-binary/var/data/testing/Sources     |  5 ++++
 .../var/data/unstable/Packages_amd64          | 13 +++++++++
 .../var/data/unstable/Packages_i386           | 13 +++++++++
 t/new-all-binary/var/data/unstable/Sources    |  5 ++++
 10 files changed, 81 insertions(+)
 create mode 100644 t/new-all-binary/description
 create mode 100644 t/new-all-binary/expected
 create mode 100644 t/new-all-binary/expected-excuses.yaml
 create mode 100644 t/new-all-binary/test-data
 create mode 100644 t/new-all-binary/var/data/testing/Packages_amd64
 create mode 100644 t/new-all-binary/var/data/testing/Packages_i386
 create mode 100644 t/new-all-binary/var/data/testing/Sources
 create mode 100644 t/new-all-binary/var/data/unstable/Packages_amd64
 create mode 100644 t/new-all-binary/var/data/unstable/Packages_i386
 create mode 100644 t/new-all-binary/var/data/unstable/Sources

diff --git a/t/new-all-binary/description b/t/new-all-binary/description
new file mode 100644
index 0000000..c0026eb
--- /dev/null
+++ b/t/new-all-binary/description
@@ -0,0 +1,28 @@
+Test arch-indep binary showing up after migration.
+
+test-src migrated after its amd64 and i386 binaries appeared. It also
+has architecture-independent binaries that miraculously only showed up
+after migration was complete (maybe someone hinted through the package
+too early).
+
+When this occurs, you might expect the arch:all binaries to migrate
+normally or to get information from britney why that couldn't happen.
+Instead, britney2 outputs the empty list in its excuses. This occurs
+because ExcuseFinder._should_upgrade_srcarch explicitly skips all
+architecture-independent binaries. If there are no other changes to the
+source which would cause excuses output, britney says nothing. If the
+package were binNMU'd, though, britney would migrate everything
+including the arch:all package if it passed checks. This behavior
+instability might be undesirable.
+
+The code which skips arch:all packages dates all the way back to
+britney2's original import[1], so it's not clear if it's still
+load-bearing. I've been researching the reason for the explicit ignore,
+but I've come up empty. For my part, I removed the descendent of the
+code[2] and only hit #1064427 when running britney2-tests against it.
+
+This may also relate to bugs like #909555, but without a reproduction
+case I wouldn't hold my breath on that.
+
+[1] https://salsa.debian.org/release-team/britney2/-/commit/b1603db2e459a2499de76d38179e49107d46be9d#7440b429abaafd59360558493c5473fab20e5088_0_425
+[2] https://salsa.debian.org/release-team/britney2/-/blob/7544ecb2b24e00344f74912fa5dc236114aee515/britney2/excusefinder.py#L140-145
diff --git a/t/new-all-binary/expected b/t/new-all-binary/expected
new file mode 100644
index 0000000..0c6b808
--- /dev/null
+++ b/t/new-all-binary/expected
@@ -0,0 +1 @@
+unknown 1-2 source devel
diff --git a/t/new-all-binary/expected-excuses.yaml b/t/new-all-binary/expected-excuses.yaml
new file mode 100644
index 0000000..fb0cbde
--- /dev/null
+++ b/t/new-all-binary/expected-excuses.yaml
@@ -0,0 +1,2 @@
+generated-date: 2024-02-20 23:41:34.924183
+# I'm not sure what is expected in this case
diff --git a/t/new-all-binary/test-data b/t/new-all-binary/test-data
new file mode 100644
index 0000000..7fb8ae1
--- /dev/null
+++ b/t/new-all-binary/test-data
@@ -0,0 +1,2 @@
+architectures: amd64 i386
+No-Break-Architectures: amd64 i386
diff --git a/t/new-all-binary/var/data/testing/Packages_amd64 b/t/new-all-binary/var/data/testing/Packages_amd64
new file mode 100644
index 0000000..297b41f
--- /dev/null
+++ b/t/new-all-binary/var/data/testing/Packages_amd64
@@ -0,0 +1,6 @@
+Package: test-bin-arch
+Section: devel
+Architecture: amd64
+Source: test-src
+Maintainer: The R-Team <debian-release@lists.debian.org>
+Version: 1-2
diff --git a/t/new-all-binary/var/data/testing/Packages_i386 b/t/new-all-binary/var/data/testing/Packages_i386
new file mode 100644
index 0000000..7d43e9f
--- /dev/null
+++ b/t/new-all-binary/var/data/testing/Packages_i386
@@ -0,0 +1,6 @@
+Package: test-bin-arch
+Section: devel
+Architecture: i386
+Source: test-src
+Maintainer: The R-Team <debian-release@lists.debian.org>
+Version: 1-2
diff --git a/t/new-all-binary/var/data/testing/Sources b/t/new-all-binary/var/data/testing/Sources
new file mode 100644
index 0000000..a6d1993
--- /dev/null
+++ b/t/new-all-binary/var/data/testing/Sources
@@ -0,0 +1,5 @@
+Package: test-src
+Binary: test-bin-arch, test-bin-all
+Version: 1-2
+Section: utils
+Maintainer: The R-Team <debian-release@lists.debian.org>
diff --git a/t/new-all-binary/var/data/unstable/Packages_amd64 b/t/new-all-binary/var/data/unstable/Packages_amd64
new file mode 100644
index 0000000..9f79f54
--- /dev/null
+++ b/t/new-all-binary/var/data/unstable/Packages_amd64
@@ -0,0 +1,13 @@
+Package: test-bin-arch
+Section: devel
+Architecture: amd64
+Source: test-src
+Maintainer: The R-Team <debian-release@lists.debian.org>
+Version: 1-2
+
+Package: test-bin-all
+Section: devel
+Architecture: all
+Source: test-src
+Maintainer: The R-Team <debian-release@lists.debian.org>
+Version: 1-2
diff --git a/t/new-all-binary/var/data/unstable/Packages_i386 b/t/new-all-binary/var/data/unstable/Packages_i386
new file mode 100644
index 0000000..3493522
--- /dev/null
+++ b/t/new-all-binary/var/data/unstable/Packages_i386
@@ -0,0 +1,13 @@
+Package: test-bin-arch
+Section: devel
+Architecture: i386
+Source: test-src
+Maintainer: The R-Team <debian-release@lists.debian.org>
+Version: 1-2
+
+Package: test-bin-all
+Section: devel
+Architecture: all
+Source: test-src
+Maintainer: The R-Team <debian-release@lists.debian.org>
+Version: 1-2
diff --git a/t/new-all-binary/var/data/unstable/Sources b/t/new-all-binary/var/data/unstable/Sources
new file mode 100644
index 0000000..a6d1993
--- /dev/null
+++ b/t/new-all-binary/var/data/unstable/Sources
@@ -0,0 +1,5 @@
+Package: test-src
+Binary: test-bin-arch, test-bin-all
+Version: 1-2
+Section: utils
+Maintainer: The R-Team <debian-release@lists.debian.org>
-- 
2.34.1

