← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~andrey-fedoseev/launchpad:debian-non-free-firmware into launchpad:master

 

Andrey Fedoseev has proposed merging ~andrey-fedoseev/launchpad:debian-non-free-firmware into launchpad:master.

Commit message:
Add `non-free-firmware` component for Debian imports

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~andrey-fedoseev/launchpad/+git/launchpad/+merge/433188
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~andrey-fedoseev/launchpad:debian-non-free-firmware into launchpad:master.
diff --git a/lib/lp/archiveuploader/tests/data/suite/README b/lib/lp/archiveuploader/tests/data/suite/README
new file mode 100644
index 0000000..307827e
--- /dev/null
+++ b/lib/lp/archiveuploader/tests/data/suite/README
@@ -0,0 +1,18 @@
+Some files in this directory are PGP-signed
+
+See `lp/testing/gpgkeys/data/README` for more information about the keys being used.
+
+To sign a file you should
+
+1. Import the key:
+
+```
+gpg --import lib/lp/testing/gpgkeys/data/foo.bar@xxxxxxxxxxxxxxxxx
+gpg --import lib/lp/testing/gpgkeys/data/foo.bar@xxxxxxxxxxxxxxxxx
+```
+
+2. Add a signature like so:
+
+```
+gpg --clearsign -u foo.bar@xxxxxxxxxxxxx PATH_TO_THE_FILE
+```
diff --git a/lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_nonfreefirmware_component/bar_1.0-1.diff.gz b/lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_nonfreefirmware_component/bar_1.0-1.diff.gz
new file mode 100644
index 0000000..5f9eeb9
Binary files /dev/null and b/lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_nonfreefirmware_component/bar_1.0-1.diff.gz differ
diff --git a/lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_nonfreefirmware_component/bar_1.0-1.dsc b/lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_nonfreefirmware_component/bar_1.0-1.dsc
new file mode 100644
index 0000000..63c210a
--- /dev/null
+++ b/lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_nonfreefirmware_component/bar_1.0-1.dsc
@@ -0,0 +1,21 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+Format: 1.0
+Source: bar
+Version: 1.0-1
+Binary: bar
+Maintainer: Launchpad team <launchpad@xxxxxxxxxxxxxxxxxxx>
+Architecture: any
+Standards-Version: 3.6.2
+Files: 
+ fc1464e5985b962a042d5354452f361d 164 bar_1.0.orig.tar.gz
+ 1e35b810764f140af9616de8274e6e73 537 bar_1.0-1.diff.gz
+
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.3 (GNU/Linux)
+
+iD8DBQFFt7Cojn63CGxkqMURAo6FAJ9ZUagUNtYpmZrqFwL6LXDKOUSOPwCdFqPa
+BdrMeT+0Hg+yMS69uO+qJRI=
+=mjFU
+-----END PGP SIGNATURE-----
diff --git a/lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_nonfreefirmware_component/bar_1.0-1_source.changes b/lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_nonfreefirmware_component/bar_1.0-1_source.changes
new file mode 100644
index 0000000..8fff1d9
--- /dev/null
+++ b/lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_nonfreefirmware_component/bar_1.0-1_source.changes
@@ -0,0 +1,31 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+Format: 1.7
+Date: Thu, 16 Feb 2006 15:34:09 +0000
+Source: bar
+Binary: bar
+Architecture: source
+Version: 1.0-1
+Distribution: breezy
+Urgency: low
+Maintainer: Launchpad team <launchpad@xxxxxxxxxxxxxxxxxxx>
+Changed-By: Daniel Silverstone <daniel.silverstone@xxxxxxxxxxxxx>
+Description: 
+ bar        - Stuff for testing
+Changes: 
+ bar (1.0-1) breezy; urgency=low
+ .
+   * Initial version
+Files: 
+ 5d533778b698edc1a122098a98c8490e 512 non-free-firmware/devel optional bar_1.0-1.dsc
+ fc1464e5985b962a042d5354452f361d 164 non-free-firmware/devel optional bar_1.0.orig.tar.gz
+ 1e35b810764f140af9616de8274e6e73 537 non-free-firmware/devel optional bar_1.0-1.diff.gz
+-----BEGIN PGP SIGNATURE-----
+Comment: GPGTools - http://gpgtools.org
+
+iHQEARECADQWIQQ0DKO7Jw4nFsnuC3aOfrcIbGSoxQUCY3YW7xYcZm9vLmJhckBj
+YW5vbmljYWwuY29tAAoJEI5+twhsZKjF2dAAnihUwKujXW1eHT4QspWTSzW6PSRs
+AJ9lJOiYUiKXJXfEcfaG/Pi7G1cLZA==
+=R1Ut
+-----END PGP SIGNATURE-----
diff --git a/lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_nonfreefirmware_component/bar_1.0.orig.tar.gz b/lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_nonfreefirmware_component/bar_1.0.orig.tar.gz
new file mode 100644
index 0000000..c5a58e8
Binary files /dev/null and b/lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_nonfreefirmware_component/bar_1.0.orig.tar.gz differ
diff --git a/lib/lp/archiveuploader/tests/test_uploadprocessor.py b/lib/lp/archiveuploader/tests/test_uploadprocessor.py
index 29d3024..1c4c37f 100644
--- a/lib/lp/archiveuploader/tests/test_uploadprocessor.py
+++ b/lib/lp/archiveuploader/tests/test_uploadprocessor.py
@@ -1417,6 +1417,7 @@ class TestUploadProcessor(StatsMixin, TestUploadProcessorBase):
     # such that:
     #   'contrib' -> 'multiverse'
     #   'non-free' -> 'multiverse'
+    #   'non-free-firmware' -> 'multiverse'
     #   everything else -> 'universe'
     #
     # This is to relieve the archive admins of some work where this is
@@ -1467,11 +1468,22 @@ class TestUploadProcessor(StatsMixin, TestUploadProcessorBase):
             "bar_1.0-1_nonfree_component", "multiverse"
         )
 
+    def testUploadNonfreeFirmwareComponentOverride(self):
+        """
+        Test the overriding of the non-free-firmware component on uploads.
+        """
+        # The component non-free-firmware does not exist in the sample data, so
+        # add it here.
+        getUtility(IComponentSet).new("non-free-firmware")
+        self.checkComponentOverride(
+            "bar_1.0-1_nonfreefirmware_component", "multiverse"
+        )
+
     def testUploadDefaultComponentOverride(self):
         """Test the overriding of the component on uploads.
 
-        Components other than non-free and contrib should override to
-        universe.
+        Components other than non-free, non-free-firmware, and contrib should
+        override to universe.
         """
         self.checkComponentOverride("bar_1.0-1", "universe")
 
diff --git a/lib/lp/registry/model/distribution.py b/lib/lp/registry/model/distribution.py
index c990027..5e0a7ff 100644
--- a/lib/lp/registry/model/distribution.py
+++ b/lib/lp/registry/model/distribution.py
@@ -2011,6 +2011,7 @@ class Distribution(
             "partner": ArchivePurpose.PARTNER,
             "contrib": ArchivePurpose.PRIMARY,
             "non-free": ArchivePurpose.PRIMARY,
+            "non-free-firmware": ArchivePurpose.PRIMARY,
         }
 
         try:
diff --git a/lib/lp/services/config/schema-lazr.conf b/lib/lp/services/config/schema-lazr.conf
index 640865d..dfa4f12 100644
--- a/lib/lp/services/config/schema-lazr.conf
+++ b/lib/lp/services/config/schema-lazr.conf
@@ -817,19 +817,19 @@ distroseries: bullseye
 pocketrelease: bullseye
 
 [gina_target.bookworm.optional]
-components: main,contrib,non-free
+components: main,contrib,non-free,non-free-firmware
 distro: debian
 distroseries: bookworm
 pocketrelease: bookworm
 
 [gina_target.sid.optional]
-components: main,contrib,non-free
+components: main,contrib,non-free,non-free-firmware
 distro: debian
 distroseries: sid
 pocketrelease: sid
 
 [gina_target.experimental.optional]
-components: main,contrib,non-free
+components: main,contrib,non-free,non-free-firmware
 distro: debian
 distroseries: experimental
 pocketrelease: experimental
diff --git a/lib/lp/soyuz/adapters/overrides.py b/lib/lp/soyuz/adapters/overrides.py
index 1a008c0..1ce3fdb 100644
--- a/lib/lp/soyuz/adapters/overrides.py
+++ b/lib/lp/soyuz/adapters/overrides.py
@@ -459,6 +459,7 @@ class UnknownOverridePolicy(BaseOverridePolicy):
     values.  The rules for overriding are: (See bug #120052)
         'contrib' -> 'multiverse'
         'non-free' -> 'multiverse'
+        'non-free-firmware' -> 'multiverse'
         everything else -> 'universe'
     This mainly relates to Debian syncs, where the default component
     is 'main' but should not be in main for Ubuntu.
@@ -467,6 +468,7 @@ class UnknownOverridePolicy(BaseOverridePolicy):
     DEBIAN_COMPONENT_OVERRIDE_MAP = {
         "contrib": "multiverse",
         "non-free": "multiverse",
+        "non-free-firmware": "multiverse",
     }
 
     DEFAULT_OVERRIDE_COMPONENT = "universe"
diff --git a/lib/lp/soyuz/adapters/tests/test_overrides.py b/lib/lp/soyuz/adapters/tests/test_overrides.py
index 63247ad..85deb99 100644
--- a/lib/lp/soyuz/adapters/tests/test_overrides.py
+++ b/lib/lp/soyuz/adapters/tests/test_overrides.py
@@ -563,7 +563,7 @@ class TestUnknownOverridePolicy(TestCaseWithFactory):
     def test_unknown_sources(self):
         # The unknown policy uses a default component based on the
         # pre-override component.
-        for component in ("contrib", "non-free"):
+        for component in ("contrib", "non-free", "non-free-firmware"):
             self.factory.makeComponent(component)
         distroseries = self.factory.makeDistroSeries()
         spns = [self.factory.makeSourcePackageName() for i in range(3)]
@@ -578,7 +578,7 @@ class TestUnknownOverridePolicy(TestCaseWithFactory):
                     component=getUtility(IComponentSet)[component]
                 )
                 for spn, component in zip(
-                    spns, ("main", "contrib", "non-free")
+                    spns, ("main", "contrib", "non-free", "non-free-firmware")
                 )
             }
         )
@@ -587,7 +587,7 @@ class TestUnknownOverridePolicy(TestCaseWithFactory):
                 component=getUtility(IComponentSet)[component], new=True
             )
             for spn, component in zip(
-                spns, ("universe", "multiverse", "multiverse")
+                spns, ("universe", "multiverse", "multiverse", "multiverse")
             )
         }
         self.assertEqual(expected, overrides)
diff --git a/lib/lp/soyuz/doc/distribution.rst b/lib/lp/soyuz/doc/distribution.rst
index 1997d7b..a0e13e2 100644
--- a/lib/lp/soyuz/doc/distribution.rst
+++ b/lib/lp/soyuz/doc/distribution.rst
@@ -364,6 +364,12 @@ their packages in the correct archive.
     >>> print(non_free_archive.displayname)
     Primary Archive for Ubuntu Test
 
+    >>> non_free_firmware_archive = ubuntutest.getArchiveByComponent(
+    ...     "non-free-firmware"
+    ... )
+    >>> print(non_free_firmware_archive.displayname)
+    Primary Archive for Ubuntu Test
+
     >>> contrib_archive = ubuntutest.getArchiveByComponent("contrib")
     >>> print(contrib_archive.displayname)
     Primary Archive for Ubuntu Test
diff --git a/lib/lp/soyuz/doc/soyuz-upload.rst b/lib/lp/soyuz/doc/soyuz-upload.rst
index 9a38d32..f32f5f7 100644
--- a/lib/lp/soyuz/doc/soyuz-upload.rst
+++ b/lib/lp/soyuz/doc/soyuz-upload.rst
@@ -251,6 +251,7 @@ NascentUpload in the 'sync' policy in the future.
     >>> from lp.soyuz.interfaces.component import IComponentSet
     >>> component_set = getUtility(IComponentSet)
     >>> non_free = component_set.new("non-free")
+    >>> non_free_firmware = component_set.new("non-free-firmware")
     >>> contrib = component_set.new("contrib")
     >>> import transaction
     >>> transaction.commit()
diff --git a/lib/lp/soyuz/tests/test_packagecopyjob.py b/lib/lp/soyuz/tests/test_packagecopyjob.py
index 451fd87..f28ec27 100644
--- a/lib/lp/soyuz/tests/test_packagecopyjob.py
+++ b/lib/lp/soyuz/tests/test_packagecopyjob.py
@@ -1205,6 +1205,20 @@ class PlainPackageCopyJobTests(TestCaseWithFactory, LocalTestHelper):
 
         self.assertEqual("multiverse", pcj.metadata["component_override"])
 
+    def test_copying_to_main_archive_debian_override_nonfree_firmware(self):
+        # The job uses the overrides to map debian components to
+        # the right components.
+        # 'nonfreefirmware' gets mapped to 'multiverse'.
+
+        # Create debian component.
+        self.factory.makeComponent("non-free-firmware")
+        # Create a copy job for a package in 'non-free-firmware'.
+        pcj = self.createCopyJob(
+            "package", "non-free-firmware", "web", "2.8.1"
+        )
+
+        self.assertEqual("multiverse", pcj.metadata["component_override"])
+
     def test_double_copy(self):
         # Copying a package already in the target successfully does nothing.
         job = create_proper_job(self.factory)