Merge lp:~wgrant/launchpad/please-dont-generateListings into lp:launchpad

Proposed by William Grant
Status: Merged
Merged at revision: 16985
Proposed branch: lp:~wgrant/launchpad/please-dont-generateListings
Merge into: lp:launchpad
Diff against target: 67 lines (+0/-32)
2 files modified
lib/lp/archivepublisher/scripts/publish_ftpmaster.py (+0/-18)
lib/lp/archivepublisher/tests/test_publish_ftpmaster.py (+0/-14)
To merge this branch: bzr merge lp:~wgrant/launchpad/please-dont-generateListings
Reviewer Review Type Date Requested Status
Celso Providelo (community) Approve
Review via email: mp+215925@code.launchpad.net

Commit message

Drop ls-lR.gz generation from publish-ftpmaster, as it's now done by lp:ubuntu-archive-publishing. This is mostly to let finalize.d trigger proposed-migration moments after the dists switch, rather than waiting for ls-lR to complete.

Description of the change

We want to trigger proposed-migration as soon as Launchpad performs the dists switch. Rather than adding a new run-parts hook, we'll reuse finalize.d and move the expensive bit between the dists switch and finalize.d (ls-lR generation) into a later step of finalize.d.

https://code.launchpad.net/~wgrant/ubuntu-archive-publishing/ls-lR/+merge/215916 adds the new hook to finalize.d. This branch removes the built-in Launchpad ls-lR generation.

To post a comment you must log in.
Revision history for this message
Celso Providelo (cprov) wrote :

Great job!

finalize.d is excellent for accommodating *specialties* like this.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/archivepublisher/scripts/publish_ftpmaster.py'
--- lib/lp/archivepublisher/scripts/publish_ftpmaster.py 2014-03-11 03:47:50 +0000
+++ lib/lp/archivepublisher/scripts/publish_ftpmaster.py 2014-04-15 16:50:41 +0000
@@ -476,23 +476,6 @@
476 os.rename(backup_dists, dists)476 os.rename(backup_dists, dists)
477 os.rename(temp_dists, backup_dists)477 os.rename(temp_dists, backup_dists)
478478
479 def generateListings(self, distribution):
480 """Create ls-lR.gz listings."""
481 self.logger.debug("Creating ls-lR.gz...")
482 lslr = "ls-lR.gz"
483 lslr_new = "." + lslr + ".new"
484 for purpose, archive_config in self.configs[distribution].iteritems():
485 lslr_file = os.path.join(archive_config.archiveroot, lslr)
486 new_lslr_file = os.path.join(archive_config.archiveroot, lslr_new)
487 if file_exists(new_lslr_file):
488 os.remove(new_lslr_file)
489 self.executeShell(
490 "cd -- '%s' ; TZ=UTC ls -lR | gzip -9n >'%s'"
491 % (archive_config.archiveroot, lslr_new),
492 failure=LaunchpadScriptFailure(
493 "Failed to create %s for %s." % (lslr, purpose.title)))
494 os.rename(new_lslr_file, lslr_file)
495
496 def clearEmptyDirs(self, distribution):479 def clearEmptyDirs(self, distribution):
497 """Clear out any redundant empty directories."""480 """Clear out any redundant empty directories."""
498 for archive_config in self.configs[distribution].itervalues():481 for archive_config in self.configs[distribution].itervalues():
@@ -631,7 +614,6 @@
631 if not self.options.security_only:614 if not self.options.security_only:
632 self.rsyncBackupDists(distribution)615 self.rsyncBackupDists(distribution)
633 self.publish(distribution, security_only=False)616 self.publish(distribution, security_only=False)
634 self.generateListings(distribution)
635 self.clearEmptyDirs(distribution)617 self.clearEmptyDirs(distribution)
636 self.runFinalizeParts(distribution, security_only=False)618 self.runFinalizeParts(distribution, security_only=False)
637619
638620
=== modified file 'lib/lp/archivepublisher/tests/test_publish_ftpmaster.py'
--- lib/lp/archivepublisher/tests/test_publish_ftpmaster.py 2014-03-11 03:47:50 +0000
+++ lib/lp/archivepublisher/tests/test_publish_ftpmaster.py 2014-04-15 16:50:41 +0000
@@ -314,12 +314,6 @@
314 distro = self.factory.makeDistribution(no_pubconf=True)314 distro = self.factory.makeDistribution(no_pubconf=True)
315 self.makeScript(distro).main()315 self.makeScript(distro).main()
316316
317 def test_produces_listings(self):
318 distro = self.makeDistroWithPublishDirectory()
319 self.makeScript(distro).main()
320 self.assertTrue(
321 path_exists(get_archive_root(get_pub_config(distro)), 'ls-lR.gz'))
322
323 def test_can_run_twice(self):317 def test_can_run_twice(self):
324 test_publisher = SoyuzTestPublisher()318 test_publisher = SoyuzTestPublisher()
325 distroseries = test_publisher.setUpDefaultDistroSeries()319 distroseries = test_publisher.setUpDefaultDistroSeries()
@@ -532,14 +526,6 @@
532 missing_parameters = required_parameters.difference(set(env.keys()))526 missing_parameters = required_parameters.difference(set(env.keys()))
533 self.assertEqual(set(), missing_parameters)527 self.assertEqual(set(), missing_parameters)
534528
535 def test_generateListings_writes_ls_lR_gz(self):
536 distro = self.makeDistroWithPublishDirectory()
537 script = self.makeScript(distro)
538 script.setUp()
539 script.setUpDirs()
540 script.generateListings(distro)
541 pass
542
543 def test_clearEmptyDirs_cleans_up_empty_directories(self):529 def test_clearEmptyDirs_cleans_up_empty_directories(self):
544 distro = self.makeDistroWithPublishDirectory()530 distro = self.makeDistroWithPublishDirectory()
545 script = self.makeScript(distro)531 script = self.makeScript(distro)