86
86
SilentLaunchpadScriptFailure,
88
88
from lp.services.session.model import SessionData
89
from lp.soyuz.model.publishing import (
90
BinaryPackagePublishingHistory,
91
SourcePackagePublishingHistory,
89
93
from lp.translations.interfaces.potemplate import IPOTemplateSet
90
94
from lp.translations.model.potranslation import POTranslation
91
95
from lp.translations.model.potmsgset import POTMsgSet
950
954
transaction.commit()
957
# XXX: StevenK 2011-09-14 bug=849683: This can be removed when done.
958
class SourcePackagePublishingHistorySPNPopulator(TunableLoop):
959
"""Populate the new sourcepackagename column of SPPH."""
962
maximum_chunk_size = 5000
965
return IMasterStore(SourcePackagePublishingHistory).find(
966
SourcePackagePublishingHistory,
967
SourcePackagePublishingHistory.sourcepackagename == None
968
).order_by(SourcePackagePublishingHistory.id)
971
"""See `TunableLoop`."""
974
def __call__(self, chunk_size):
975
"""See `TunableLoop`."""
976
spphs = self.findSPPHs()[:chunk_size]
978
spph.sourcepackagename = (
979
spph.sourcepackagerelease.sourcepackagename)
981
self.done = self.findSPPHs().is_empty()
984
# XXX: StevenK 2011-09-14 bug=849683: This can be removed when done.
985
class BinaryPackagePublishingHistoryBPNPopulator(TunableLoop):
986
"""Populate the new binarypackagename column of BPPH."""
989
maximum_chunk_size = 5000
992
return IMasterStore(BinaryPackagePublishingHistory).find(
993
BinaryPackagePublishingHistory,
994
BinaryPackagePublishingHistory.binarypackagename == None
995
).order_by(BinaryPackagePublishingHistory.id)
998
"""See `TunableLoop`."""
1001
def __call__(self, chunk_size):
1002
"""See `TunableLoop`."""
1003
bpphs = self.findBPPHs()[:chunk_size]
1005
bpph.binarypackagename = (
1006
bpph.binarypackagerelease.binarypackagename)
1007
transaction.commit()
1008
self.done = self.findBPPHs().is_empty()
953
1011
class BaseDatabaseGarbageCollector(LaunchpadCronScript):
954
1012
"""Abstract base class to run a collection of TunableLoops."""
955
1013
script_name = None # Script name for locking and database user. Override.