← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/no-debug_archive into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/no-debug_archive into lp:launchpad.

Commit message:
Kill off Archive.debug_archive; ddebs will be published in the primary archive.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/no-debug_archive/+merge/161929

Kill off Archive.debug_archive; ddebs will be published in the primary archive. Add a specific rejection path for ddeb uploads to primary archives without build_debug_symbols set, to prevent them from accidentally hitting Ubuntu before we've finished the implementation.
-- 
https://code.launchpad.net/~wgrant/launchpad/no-debug_archive/+merge/161929
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/no-debug_archive into lp:launchpad.
=== modified file 'database/sampledata/current-dev.sql'
--- database/sampledata/current-dev.sql	2013-02-06 11:44:37 +0000
+++ database/sampledata/current-dev.sql	2013-05-01 19:27:28 +0000
@@ -2335,7 +2335,7 @@
 
 ALTER TABLE archive DISABLE TRIGGER ALL;
 
-INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score, external_dependencies, status, suppress_subscription_notifications, build_debug_symbols) VALUES (1, 17, NULL, true, NULL, 1, 1, false, NULL, NULL, NULL, NULL, NULL, false, 'primary', true, '2008-05-27 18:15:12.241774', 15, 1, 8, 5, 1, '2008-09-23 17:29:03.442606', NULL, NULL, NULL, 'Primary Archive for Ubuntu Linux', 0, NULL, 0, false, false);
+INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score, external_dependencies, status, suppress_subscription_notifications, build_debug_symbols) VALUES (1, 17, NULL, true, NULL, 1, 1, false, NULL, NULL, NULL, NULL, NULL, false, 'primary', true, '2008-05-27 18:15:12.241774', 15, 1, 8, 5, 1, '2008-09-23 17:29:03.442606', NULL, NULL, NULL, 'Primary Archive for Ubuntu Linux', 0, NULL, 0, false, true);
 INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score, external_dependencies, status, suppress_subscription_notifications, build_debug_symbols) VALUES (2, 1, NULL, true, NULL, 2, 1, false, NULL, NULL, NULL, NULL, NULL, false, 'primary', true, '2008-05-27 18:15:15.863812', 0, 0, 0, 0, 0, '2008-09-23 17:29:03.445921', NULL, NULL, NULL, 'Primary Archive for Redhat Advanced Server', 0, NULL, 0, false, false);
 INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score, external_dependencies, status, suppress_subscription_notifications, build_debug_symbols) VALUES (3, 1, NULL, true, NULL, 3, 1, false, NULL, NULL, NULL, NULL, NULL, false, 'primary', true, '2008-05-27 18:15:15.864941', 0, 0, 0, 0, 0, '2008-09-23 17:29:03.446557', NULL, NULL, NULL, 'Primary Archive for Debian GNU/Linux', 0, NULL, 0, false, false);
 INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score, external_dependencies, status, suppress_subscription_notifications, build_debug_symbols) VALUES (4, 1, NULL, true, NULL, 4, 1, false, NULL, NULL, NULL, NULL, NULL, false, 'primary', true, '2008-05-27 18:15:15.865502', 0, 0, 0, 0, 0, '2008-09-23 17:29:03.44689', NULL, NULL, NULL, 'Primary Archive for The Gentoo Linux', 0, NULL, 0, false, false);

=== modified file 'database/sampledata/current.sql'
--- database/sampledata/current.sql	2013-02-06 11:44:37 +0000
+++ database/sampledata/current.sql	2013-05-01 19:27:28 +0000
@@ -2331,7 +2331,7 @@
 
 ALTER TABLE archive DISABLE TRIGGER ALL;
 
-INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score, external_dependencies, status, suppress_subscription_notifications, build_debug_symbols) VALUES (1, 17, NULL, true, NULL, 1, 1, false, NULL, NULL, NULL, NULL, NULL, false, 'primary', true, '2008-05-27 18:15:12.241774', 15, 1, 8, 5, 1, '2008-09-23 17:29:03.442606', NULL, NULL, NULL, 'Primary Archive for Ubuntu Linux', 0, NULL, 0, false, false);
+INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score, external_dependencies, status, suppress_subscription_notifications, build_debug_symbols) VALUES (1, 17, NULL, true, NULL, 1, 1, false, NULL, NULL, NULL, NULL, NULL, false, 'primary', true, '2008-05-27 18:15:12.241774', 15, 1, 8, 5, 1, '2008-09-23 17:29:03.442606', NULL, NULL, NULL, 'Primary Archive for Ubuntu Linux', 0, NULL, 0, false, true);
 INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score, external_dependencies, status, suppress_subscription_notifications, build_debug_symbols) VALUES (2, 1, NULL, true, NULL, 2, 1, false, NULL, NULL, NULL, NULL, NULL, false, 'primary', true, '2008-05-27 18:15:15.863812', 0, 0, 0, 0, 0, '2008-09-23 17:29:03.445921', NULL, NULL, NULL, 'Primary Archive for Redhat Advanced Server', 0, NULL, 0, false, false);
 INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score, external_dependencies, status, suppress_subscription_notifications, build_debug_symbols) VALUES (3, 1, NULL, true, NULL, 3, 1, false, NULL, NULL, NULL, NULL, NULL, false, 'primary', true, '2008-05-27 18:15:15.864941', 0, 0, 0, 0, 0, '2008-09-23 17:29:03.446557', NULL, NULL, NULL, 'Primary Archive for Debian GNU/Linux', 0, NULL, 0, false, false);
 INSERT INTO archive (id, owner, description, enabled, authorized_size, distribution, purpose, private, sources_cached, binaries_cached, package_description_cache, fti, buildd_secret, require_virtualized, name, publish, date_updated, total_count, pending_count, succeeded_count, failed_count, building_count, date_created, signing_key, removed_binary_retention_days, num_old_versions_published, displayname, relative_build_score, external_dependencies, status, suppress_subscription_notifications, build_debug_symbols) VALUES (4, 1, NULL, true, NULL, 4, 1, false, NULL, NULL, NULL, NULL, NULL, false, 'primary', true, '2008-05-27 18:15:15.865502', 0, 0, 0, 0, 0, '2008-09-23 17:29:03.44689', NULL, NULL, NULL, 'Primary Archive for The Gentoo Linux', 0, NULL, 0, false, false);

=== modified file 'lib/lp/archiveuploader/tests/nascentupload-ddebs.txt'
--- lib/lp/archiveuploader/tests/nascentupload-ddebs.txt	2012-07-02 16:40:17 +0000
+++ lib/lp/archiveuploader/tests/nascentupload-ddebs.txt	2013-05-01 19:27:28 +0000
@@ -106,12 +106,11 @@
 Now, both, binary and debug-symbol packages are pending publication.
 
     >>> for bin_pub in bin_pubs:
-    ...     print '%s %s %s %s %s' % (
+    ...     print '%s %s %s %s' % (
     ...         bin_pub.displayname, bin_pub.status.name,
-    ...         bin_pub.component.name, bin_pub.section.name,
-    ...         bin_pub.archive.purpose.name)
-    debug-bin 1.0-1 in hoary i386 PENDING main devel PRIMARY
-    debug-bin-dbgsym 1.0-1 in hoary i386 PENDING main devel DEBUG
+    ...         bin_pub.component.name, bin_pub.section.name)
+    debug-bin 1.0-1 in hoary i386 PENDING main devel
+    debug-bin-dbgsym 1.0-1 in hoary i386 PENDING main devel
 
 DEBs and DDEBs are uploaded to separate archives, because the size
 impact of uploading them to a single archive on mirrors would be

=== modified file 'lib/lp/soyuz/interfaces/archive.py'
--- lib/lp/soyuz/interfaces/archive.py	2013-02-20 04:29:41 +0000
+++ lib/lp/soyuz/interfaces/archive.py	2013-05-01 19:27:28 +0000
@@ -510,9 +510,6 @@
         "Concatenation of the source and binary packages published in this "
         "archive. Its content is used for indexed searches across archives.")
 
-    debug_archive = Attribute(
-        "The archive into which debug binaries should be uploaded.")
-
     default_component = Reference(
         IComponent,
         title=_(

=== modified file 'lib/lp/soyuz/model/archive.py'
--- lib/lp/soyuz/model/archive.py	2013-03-19 06:29:38 +0000
+++ lib/lp/soyuz/model/archive.py	2013-05-01 19:27:28 +0000
@@ -417,15 +417,6 @@
         return dependencies
 
     @cachedproperty
-    def debug_archive(self):
-        """See `IArchive`."""
-        if self.purpose == ArchivePurpose.PRIMARY:
-            return getUtility(IArchiveSet).getByDistroPurpose(
-                self.distribution, ArchivePurpose.DEBUG)
-        else:
-            return self
-
-    @cachedproperty
     def default_component(self):
         """See `IArchive`."""
         if self.is_partner:
@@ -622,7 +613,7 @@
 
         if distroseries:
             clauses.append(
-                SourcePackagePublishingHistory.distroseriesID == 
+                SourcePackagePublishingHistory.distroseriesID ==
                     distroseries.id)
 
         if name:
@@ -2204,11 +2195,6 @@
         if enabled == False:
             new_archive.disable()
 
-        if purpose == ArchivePurpose.DEBUG:
-            if distribution.main_archive is not None:
-                del get_property_cache(
-                    distribution.main_archive).debug_archive
-
         # Private teams cannot have public PPAs.
         if owner.visibility == PersonVisibility.PRIVATE:
             new_archive.buildd_secret = create_unique_token_for_table(

=== modified file 'lib/lp/soyuz/model/publishing.py'
--- lib/lp/soyuz/model/publishing.py	2013-03-08 22:36:00 +0000
+++ lib/lp/soyuz/model/publishing.py	2013-05-01 19:27:28 +0000
@@ -76,6 +76,7 @@
     )
 from lp.services.worlddata.model.country import Country
 from lp.soyuz.enums import (
+    ArchivePurpose,
     BinaryPackageFormat,
     PackagePublishingPriority,
     PackagePublishingStatus,
@@ -141,23 +142,6 @@
     return component
 
 
-def get_archive(archive, bpr):
-    """Get the archive in which this binary should be published.
-
-    Debug packages live in a DEBUG archive instead of a PRIMARY archive.
-    This helper implements that override.
-    """
-    if (archive is not None and
-        bpr.binpackageformat == BinaryPackageFormat.DDEB):
-        debug_archive = archive.debug_archive
-        if debug_archive is None:
-            raise QueueInconsistentStateError(
-                "Could not find the corresponding DEBUG archive "
-                "for %s" % (archive.displayname))
-        archive = debug_archive
-    return archive
-
-
 def proxied_urls(files, parent):
     """Run the files passed through `ProxiedLibraryFileAlias`."""
     return [ProxiedLibraryFileAlias(file, parent).http_url for file in files]
@@ -1150,7 +1134,7 @@
                 BinaryPackagePublishingHistory.distroarchseries ==
                     self.distroarchseries,
                 binarypackagerelease=self.binarypackagerelease.debug_package,
-                archive=self.archive.debug_archive,
+                archive=self.archive,
                 pocket=self.pocket,
                 component=self.component,
                 section=self.section,
@@ -1257,8 +1241,8 @@
             # See if the archive has changed by virtue of the component
             # changing:
             distribution = self.distroarchseries.distroseries.distribution
-            new_archive = get_archive(
-                distribution.getArchiveByComponent(new_component.name), bpr)
+            new_archive = distribution.getArchiveByComponent(
+                new_component.name)
             if new_archive is not None and new_archive != self.archive:
                 raise OverrideError(
                     "Overriding component to '%s' failed because it would "
@@ -1487,19 +1471,28 @@
             # an unsupported architecture.
             return []
 
+        if (archive.purpose == ArchivePurpose.PRIMARY
+            and not archive.build_debug_symbols
+            and any(
+                1 for _, bpr, _ in expanded
+                if bpr.binpackageformat == BinaryPackageFormat.DDEB)):
+            raise QueueInconsistentStateError(
+                "Won't publish ddebs to a primary archive that doesn't want "
+                "them.")
+
         # Find existing publications.
         # We should really be able to just compare BPR.id, but
         # CopyChecker doesn't seem to ensure that there are no
         # conflicting binaries from other sources.
         def make_package_condition(archive, das, bpr):
             return And(
-                BinaryPackagePublishingHistory.archiveID ==
-                    get_archive(archive, bpr).id,
+                BinaryPackagePublishingHistory.archiveID == archive.id,
                 BinaryPackagePublishingHistory.distroarchseriesID == das.id,
                 BinaryPackagePublishingHistory.binarypackagenameID ==
                     bpr.binarypackagenameID,
                 BinaryPackageRelease.version == bpr.version,
                 )
+
         candidates = (
             make_package_condition(archive, das, bpr)
             for das, bpr, overrides in expanded)
@@ -1533,8 +1526,7 @@
              BPPH.binarypackagerelease, BPPH.binarypackagename,
              BPPH.component, BPPH.section, BPPH.priority, BPPH.status,
              BPPH.datecreated),
-            [(get_archive(archive, bpr), das, pocket, bpr,
-              bpr.binarypackagename,
+            [(archive, das, pocket, bpr, bpr.binarypackagename,
               get_component(archive, das.distroseries, component),
               section, priority, PackagePublishingStatus.PENDING, UTC_NOW)
               for (das, bpr, (component, section, priority)) in needed],

=== modified file 'lib/lp/soyuz/tests/test_archive.py'
--- lib/lp/soyuz/tests/test_archive.py	2013-02-05 06:11:57 +0000
+++ lib/lp/soyuz/tests/test_archive.py	2013-05-01 19:27:28 +0000
@@ -285,39 +285,6 @@
         self.assertEqual([series1, series2], archive.series_with_sources)
 
 
-class TestCorrespondingDebugArchive(TestCaseWithFactory):
-
-    layer = DatabaseFunctionalLayer
-
-    def testPrimaryDebugArchiveIsDebug(self):
-        distribution = self.factory.makeDistribution()
-        primary = self.factory.makeArchive(
-            distribution=distribution, purpose=ArchivePurpose.PRIMARY)
-        debug = self.factory.makeArchive(
-            distribution=distribution, purpose=ArchivePurpose.DEBUG)
-        self.assertEqual(primary.debug_archive, debug)
-
-    def testPartnerDebugArchiveIsSelf(self):
-        partner = self.factory.makeArchive(purpose=ArchivePurpose.PARTNER)
-        self.assertEqual(partner.debug_archive, partner)
-
-    def testCopyDebugArchiveIsSelf(self):
-        copy = self.factory.makeArchive(purpose=ArchivePurpose.COPY)
-        self.assertEqual(copy.debug_archive, copy)
-
-    def testDebugDebugArchiveIsSelf(self):
-        debug = self.factory.makeArchive(purpose=ArchivePurpose.DEBUG)
-        self.assertEqual(debug.debug_archive, debug)
-
-    def testPPADebugArchiveIsSelf(self):
-        ppa = self.factory.makeArchive(purpose=ArchivePurpose.PPA)
-        self.assertEqual(ppa.debug_archive, ppa)
-
-    def testMissingPrimaryDebugArchiveIsNone(self):
-        primary = self.factory.makeArchive(purpose=ArchivePurpose.PRIMARY)
-        self.assertIs(primary.debug_archive, None)
-
-
 class TestArchiveEnableDisable(TestCaseWithFactory):
     """Test the enable and disable methods of Archive."""
 

=== modified file 'lib/lp/soyuz/tests/test_publishing.py'
--- lib/lp/soyuz/tests/test_publishing.py	2013-03-08 19:07:28 +0000
+++ lib/lp/soyuz/tests/test_publishing.py	2013-05-01 19:27:28 +0000
@@ -342,7 +342,7 @@
                     conflicts, replaces, provides, pre_depends, enhances,
                     breaks, BinaryPackageFormat.DDEB, version=version)
                 pub_binaries += self.publishBinaryInArchive(
-                    binarypackagerelease_ddeb, archive.debug_archive, status,
+                    binarypackagerelease_ddeb, archive, status,
                     pocket, scheduleddeletiondate, dateremoved,
                     phased_update_percentage)
             else:
@@ -1632,39 +1632,21 @@
         args['pocket'] = PackagePublishingPocket.RELEASE
         [another_bpph] = getUtility(IPublishingSet).publishBinaries(**args)
 
-    def test_ddebs_need_debug_archive(self):
+    def test_primary_ddebs_need_ddebs_enabled(self):
         debug = self.factory.makeBinaryPackageRelease(
             binpackageformat=BinaryPackageFormat.DDEB)
         args = self.makeArgs(
             [debug], debug.build.distro_arch_series.distroseries)
+
+        # ddebs are rejected with build_debug_symbols unset
         self.assertRaises(
             QueueInconsistentStateError,
             getUtility(IPublishingSet).publishBinaries, **args)
 
-    def test_ddebs_go_to_debug_archive(self):
-        # Normal packages go to the given archive, but debug packages go
-        # to the corresponding debug archive.
-        das = self.factory.makeDistroArchSeries()
-        self.factory.makeArchive(
-            purpose=ArchivePurpose.DEBUG,
-            distribution=das.distroseries.distribution)
-        build = self.factory.makeBinaryPackageBuild(distroarchseries=das)
-        normal = self.factory.makeBinaryPackageRelease(build=build)
-        debug = self.factory.makeBinaryPackageRelease(
-            build=build, binpackageformat=BinaryPackageFormat.DDEB)
-        args = self.makeArgs([normal, debug], das.distroseries)
-        bpphs = getUtility(IPublishingSet).publishBinaries(**args)
-        self.assertEqual(2, len(bpphs))
-        self.assertContentEqual(
-            (normal, debug), [bpph.binarypackagerelease for bpph in bpphs])
-        self.assertContentEqual(
-            (das.main_archive, das.main_archive.debug_archive),
-            [bpph.archive for bpph in bpphs])
-
-        # A second copy does nothing, because it checks in the debug
-        # archive too.
-        self.assertContentEqual(
-            [], getUtility(IPublishingSet).publishBinaries(**args))
+        # But accepted with build_debug_symbols set
+        archive = debug.build.distro_arch_series.distroseries.main_archive
+        archive.build_debug_symbols = True
+        getUtility(IPublishingSet).publishBinaries(**args)
 
 
 class TestChangeOverride(TestNativePublishingBase):