292
292
for arch in archs:
293
293
self.updateContentsFile(suite, arch)
295
def updateLegacyContentArchiveRoot(self):
296
"""Replace content archive root with new contents location.
298
If there is a legacy content_archive_root, move it to the new
301
This is a temporary migration tool for the fix to bug 809211.
302
After this has run at least once on each system that needs it, for
303
each distribution archive, this method can go away.
305
content_archive_root = getattr(
306
config.archivepublisher, 'content_archive_root', None)
307
if content_archive_root is None:
308
# No legacy configuration; nothing to do.
310
old_content_dir = os.path.join(
311
content_archive_root, self.distribution.name + "-contents")
312
if not file_exists(old_content_dir):
313
# The data has already been moved (or didn't exist at all).
315
if file_exists(self.content_archive):
316
# The new contents directory has already been created.
319
"New contents directory %s has been created, "
320
"but legacy directory %s still exists. Ignoring the latter.",
321
self.content_archive, old_content_dir)
325
"Moving legacy contents directory %s into %s.",
326
old_content_dir, self.content_archive)
327
os.rename(old_content_dir, self.content_archive)
296
330
"""Prepare configuration and filesystem state for the script's work.
302
336
self.processOptions()
303
337
self.config = getPubConfig(self.distribution.main_archive)
304
338
self.content_archive = os.path.join(
305
config.archivepublisher.content_archive_root,
306
self.distribution.name + "-contents")
339
self.config.distroroot, "contents-generation")
340
self.updateLegacyContentArchiveRoot()
307
341
self.setUpContentArchive()