← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/bug-612157-ppa-quota-ddebs into lp:launchpad/devel

 

William Grant has proposed merging lp:~wgrant/launchpad/bug-612157-ppa-quota-ddebs into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #612157 PPA size calculation should no longer exclude DDEBs
  https://bugs.launchpad.net/bugs/612157


When reactivating PPA ddeb publication (fixing bug #604433), I failed to notice that the PPA size calculation excluded ddebs (bug #612157). This branch removes the special case and its tests, and fixes lint.
-- 
https://code.launchpad.net/~wgrant/launchpad/bug-612157-ppa-quota-ddebs/+merge/31471
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/bug-612157-ppa-quota-ddebs into lp:launchpad/devel.
=== modified file 'lib/lp/soyuz/model/archive.py'
--- lib/lp/soyuz/model/archive.py	2010-07-27 12:53:24 +0000
+++ lib/lp/soyuz/model/archive.py	2010-08-01 00:01:44 +0000
@@ -77,7 +77,6 @@
     ArchivePermissionType, IArchivePermissionSet)
 from lp.soyuz.interfaces.archivesubscriber import (
     ArchiveSubscriberStatus, IArchiveSubscriberSet, ArchiveSubscriptionError)
-from lp.soyuz.interfaces.binarypackagerelease import BinaryPackageFileType
 from lp.soyuz.interfaces.binarypackagebuild import IBinaryPackageBuildSet
 from lp.soyuz.interfaces.buildrecords import (
     IHasBuildRecords, IncompatibleArguments)
@@ -336,9 +335,9 @@
     def archive_url(self):
         """See `IArchive`."""
         archive_postfixes = {
-            ArchivePurpose.PRIMARY : '',
-            ArchivePurpose.PARTNER : '-partner',
-            ArchivePurpose.DEBUG : '-debug',
+            ArchivePurpose.PRIMARY: '',
+            ArchivePurpose.PARTNER: '-partner',
+            ArchivePurpose.DEBUG: '-debug',
         }
 
         if self.is_ppa:
@@ -431,7 +430,7 @@
             try:
                 status = tuple(status)
             except TypeError:
-                status = (status,)
+                status = (status, )
             clauses.append("""
                 SourcePackagePublishingHistory.status IN %s
             """ % sqlvalues(status))
@@ -501,7 +500,7 @@
             try:
                 status = tuple(status)
             except TypeError:
-                status = (status,)
+                status = (status, )
             clauses.append("""
                 SourcePackagePublishingHistory.status IN %s
             """ % sqlvalues(status))
@@ -543,7 +542,7 @@
         result = store.find((
             LibraryFileAlias.filename,
             LibraryFileContent.sha1,
-            LibraryFileContent.filesize,),
+            LibraryFileContent.filesize),
             SourcePackagePublishingHistory.archive == self.id,
             SourcePackagePublishingHistory.dateremoved == None,
             SourcePackagePublishingHistory.sourcepackagereleaseID ==
@@ -568,7 +567,7 @@
         # the result is empty, so instead:
         return sum(result.values(LibraryFileContent.filesize))
 
-    def _getBinaryPublishingBaseClauses (
+    def _getBinaryPublishingBaseClauses(
         self, name=None, version=None, status=None, distroarchseries=None,
         pocket=None, exact_match=False):
         """Base clauses and clauseTables for binary publishing queries.
@@ -615,7 +614,7 @@
             try:
                 status = tuple(status)
             except TypeError:
-                status = (status,)
+                status = (status, )
             clauses.append("""
                 BinaryPackagePublishingHistory.status IN %s
             """ % sqlvalues(status))
@@ -624,7 +623,7 @@
             try:
                 distroarchseries = tuple(distroarchseries)
             except TypeError:
-                distroarchseries = (distroarchseries,)
+                distroarchseries = (distroarchseries, )
             # XXX cprov 20071016: there is no sqlrepr for DistroArchSeries
             # uhmm, how so ?
             das_ids = "(%s)" % ", ".join(str(d.id) for d in distroarchseries)
@@ -648,7 +647,7 @@
             distroarchseries=distroarchseries, exact_match=exact_match)
 
         all_binaries = BinaryPackagePublishingHistory.select(
-            ' AND '.join(clauses) , clauseTables=clauseTables,
+            ' AND '.join(clauses), clauseTables=clauseTables,
             orderBy=orderBy)
 
         return all_binaries
@@ -720,15 +719,8 @@
             BinaryPackagePublishingHistory.binarypackagereleaseID ==
                 BinaryPackageFile.binarypackagereleaseID,
             BinaryPackageFile.libraryfileID == LibraryFileAlias.id,
-            LibraryFileAlias.contentID == LibraryFileContent.id
+            LibraryFileAlias.contentID == LibraryFileContent.id,
             ]
-
-        # Exclude DDEBs from the repository size, they are not published
-        # on disk for PPAs. See bug #399444 for more information.
-        if self.is_ppa:
-            clauses.append(
-                BinaryPackageFile.filetype != BinaryPackageFileType.DDEB)
-
         result = store.find(LibraryFileContent, *clauses)
 
         # See `IArchive.sources_size`.
@@ -750,10 +742,10 @@
     def allowUpdatesToReleasePocket(self):
         """See `IArchive`."""
         purposeToPermissionMap = {
-            ArchivePurpose.COPY : True,
-            ArchivePurpose.PARTNER : True,
-            ArchivePurpose.PPA : True,
-            ArchivePurpose.PRIMARY : False,
+            ArchivePurpose.COPY: True,
+            ArchivePurpose.PARTNER: True,
+            ArchivePurpose.PPA: True,
+            ArchivePurpose.PRIMARY: False,
         }
 
         try:
@@ -914,7 +906,7 @@
 
         find_spec = (
             BuildFarmJob.status,
-            Count(BinaryPackageBuild.id)
+            Count(BinaryPackageBuild.id),
             )
         result = store.using(
             BinaryPackageBuild, PackageBuild, BuildFarmJob).find(
@@ -955,7 +947,7 @@
                 BuildStatus.BUILDING,
                 BuildStatus.FULLYBUILT,
                 BuildStatus.SUPERSEDED,
-                ]
+                ],
             }
 
         # If we were asked to include builds with the state NEEDSBUILD,
@@ -1668,7 +1660,6 @@
 
         return default_name_by_purpose[purpose]
 
-
     def getByDistroPurpose(self, distribution, purpose, name=None):
         """See `IArchiveSet`."""
         if purpose == ArchivePurpose.PPA:
@@ -1777,7 +1768,6 @@
 
         return new_archive
 
-
     def __iter__(self):
         """See `IArchiveSet`."""
         return iter(Archive.select())
@@ -1852,7 +1842,8 @@
         origin = (
             Archive,
             Join(SourcePackagePublishingHistory,
-                 SourcePackagePublishingHistory.archive == Archive.id),)
+                 SourcePackagePublishingHistory.archive == Archive.id),
+            )
         results = store.using(*origin).find(
             Archive,
             Archive.signing_key == None,
@@ -1977,7 +1968,7 @@
         # If a single purpose is passed in, convert it into a tuple,
         # otherwise assume a list was passed in.
         if purposes in ArchivePurpose:
-            purposes = (purposes,)
+            purposes = (purposes, )
 
         if purposes:
             extra_exprs.append(Archive.purpose.is_in(purposes))

=== modified file 'lib/lp/soyuz/tests/test_archive.py'
--- lib/lp/soyuz/tests/test_archive.py	2010-07-21 07:45:50 +0000
+++ lib/lp/soyuz/tests/test_archive.py	2010-08-01 00:01:44 +0000
@@ -29,7 +29,6 @@
 from lp.services.worlddata.interfaces.country import ICountrySet
 from lp.soyuz.interfaces.archivearch import IArchiveArchSet
 from lp.soyuz.interfaces.binarypackagename import IBinaryPackageNameSet
-from lp.soyuz.interfaces.binarypackagerelease import BinaryPackageFormat
 from lp.soyuz.interfaces.component import IComponentSet
 from lp.soyuz.interfaces.processor import IProcessorFamilySet
 from lp.soyuz.interfaces.publishing import PackagePublishingStatus
@@ -167,24 +166,6 @@
         self.ppa = self.factory.makeArchive(
             name="testing", distribution=self.publisher.ubuntutest)
 
-    def test_binaries_size_does_not_include_ddebs_for_ppas(self):
-        # DDEBs are not computed in the PPA binaries size because
-        # they are not being published. See bug #399444.
-        self.assertEquals(0, self.ppa.binaries_size)
-        self.publisher.getPubBinaries(
-            filecontent='X', format=BinaryPackageFormat.DDEB,
-            archive=self.ppa)
-        self.assertEquals(0, self.ppa.binaries_size)
-
-    def test_binaries_size_includes_ddebs_for_other_archives(self):
-        # DDEBs size are computed for all archive purposes, except PPAs.
-        previous_size = self.publisher.ubuntutest.main_archive.binaries_size
-        self.publisher.getPubBinaries(
-            filecontent='X', format=BinaryPackageFormat.DDEB)
-        self.assertEquals(
-            previous_size + 1,
-            self.publisher.ubuntutest.main_archive.binaries_size)
-
     def test_sources_size_on_empty_archive(self):
         # Zero is returned for an archive without sources.
         self.assertEquals(