launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #15622
[Merge] lp:~stevenk/launchpad/obsolete-series-garbo into lp:launchpad
Steve Kowalik has proposed merging lp:~stevenk/launchpad/obsolete-series-garbo into lp:launchpad with lp:~stevenk/launchpad/db-add-archive-permit-obsolete as a prerequisite.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #902836 in Launchpad itself: "Building in a PPA for obsolete release Karmic Koala isn't disabled"
https://bugs.launchpad.net/launchpad/+bug/902836
For more details, see:
https://code.launchpad.net/~stevenk/launchpad/obsolete-series-garbo/+merge/165535
Add a garbo job to populate the new Archive.permit_obsolete_series_uploads column.
--
https://code.launchpad.net/~stevenk/launchpad/obsolete-series-garbo/+merge/165535
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/obsolete-series-garbo into lp:launchpad.
=== modified file 'database/schema/security.cfg'
--- database/schema/security.cfg 2013-05-20 01:11:49 +0000
+++ database/schema/security.cfg 2013-05-24 05:20:37 +0000
@@ -2208,6 +2208,7 @@
public.accesspolicygrant = SELECT, DELETE
public.account = SELECT, DELETE
public.answercontact = SELECT, DELETE
+public.archive = SELECT, UPDATE
public.branch = SELECT, UPDATE
public.branchjob = SELECT, DELETE
public.binarypackagename = SELECT
=== modified file 'lib/lp/scripts/garbo.py'
--- lib/lp/scripts/garbo.py 2013-05-20 01:11:49 +0000
+++ lib/lp/scripts/garbo.py 2013-05-24 05:20:37 +0000
@@ -40,6 +40,7 @@
Or,
Row,
SQL,
+ Update,
)
from storm.info import ClassAlias
from storm.store import EmptyResultSet
@@ -1365,6 +1366,36 @@
transaction.commit()
+class PopulateArchivePermitObsoleteSeriesUploads(TunableLoop):
+
+ maximum_chunk_size = 5000
+
+ def __init__(self, log, abort_time=None):
+ super(PopulateArchivePermitObsoleteSeriesUploads, self).__init__(
+ log, abort_time)
+ self.start_at = 1
+ self.store = IMasterStore(Archive)
+
+ def findArchiveIDs(self):
+ return self.store.find(
+ Archive.id,
+ Archive.permit_obsolete_series_uploads == None,
+ Archive.id >= self.start_at).order_by(Archive.id)
+
+ def isDone(self):
+ return self.findArchiveIDs().is_empty()
+
+ def __call__(self, chunk_size):
+ archive_ids = list(self.findArchiveIDs()[:chunk_size])
+ self.store.execute(
+ Update(
+ {Archive.permit_obsolete_series_uploads: False},
+ Archive.id.is_in(archive_ids),
+ Archive))
+ self.start_at = archive_ids[-1] + 1
+ transaction.commit()
+
+
class BaseDatabaseGarbageCollector(LaunchpadCronScript):
"""Abstract base class to run a collection of TunableLoops."""
script_name = None # Script name for locking and database user. Override.
@@ -1619,6 +1650,7 @@
UnusedSessionPruner,
DuplicateSessionPruner,
BugHeatUpdater,
+ PopulateArchivePermitObsoleteSeriesUploads,
]
experimental_tunable_loops = []
=== modified file 'lib/lp/scripts/tests/test_garbo.py'
--- lib/lp/scripts/tests/test_garbo.py 2013-05-20 01:11:49 +0000
+++ lib/lp/scripts/tests/test_garbo.py 2013-05-24 05:20:37 +0000
@@ -1296,6 +1296,14 @@
'PopulateLatestPersonSourcePackageReleaseCache')
self.assertEqual(spph_2.id, job_data['last_spph_id'])
+ def test_PopulateArchivePermitObsoleteSeriesUploads(self):
+ switch_dbuser('testadmin')
+ archive = self.factory.makeArchive()
+ removeSecurityProxy(archive).permit_obsolete_series_uploads = None
+ transaction.commit()
+ self.runHourly()
+ self.assertIs(False, archive.permit_obsolete_series_uploads)
+
class TestGarboTasks(TestCaseWithFactory):
layer = LaunchpadZopelessLayer
=== modified file 'lib/lp/soyuz/interfaces/archive.py'
--- lib/lp/soyuz/interfaces/archive.py 2013-05-14 08:27:03 +0000
+++ lib/lp/soyuz/interfaces/archive.py 2013-05-24 05:20:37 +0000
@@ -489,6 +489,10 @@
description=_(
"Publish debug symbol packages in the apt repository."))
+ permit_obsolete_series_uploads = Bool(
+ title=_("Permit uploads to obsolete series"), required=False,
+ description=_("Allow uploads targeted to obsolete series."))
+
authorized_size = exported(
Int(
title=_("Authorized size"), required=False,
=== modified file 'lib/lp/soyuz/model/archive.py'
--- lib/lp/soyuz/model/archive.py 2013-05-14 08:27:03 +0000
+++ lib/lp/soyuz/model/archive.py 2013-05-24 05:20:37 +0000
@@ -282,6 +282,9 @@
publish_debug_symbols = BoolCol(
dbName='publish_debug_symbols', notNull=False, default=False)
+ permit_obsolete_series_uploads = BoolCol(
+ dbName='permit_obsolete_series_uploads', default=False)
+
authorized_size = IntCol(
dbName='authorized_size', notNull=False, default=2048)