launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #30802
[Merge] ~xnox/launchpad:fixup-i18n-index-publish into launchpad:master
Dimitri John Ledkov has proposed merging ~xnox/launchpad:fixup-i18n-index-publish into launchpad:master.
Commit message:
soyuz: fix up removal of stale i18n/Index upon removal
During qastaging testing it was discovered that i18n/Index publishing
correctly honors publish_i18n_index setting for freshly created suites
in an archive. But existing archives incorrectly left stale i18n/Index
on disk (whilst scheduling byhash symlink removal).
QA Testing:
* create a new archive on qastaging
* publish it once
* verify i18n/Index is published with byhash link to it
* toggle publish_i18n_index off
* publish it again
* verify i18n/Index is gone straight away
* verify deathrow 24h later removed byhash link to it as well
Fixes: 5f90943b2f ("soyuz: Add toggle to turn off I18n/Index publishing")
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~xnox/launchpad/+git/launchpad/+merge/458162
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~xnox/launchpad:fixup-i18n-index-publish into launchpad:master.
diff --git a/lib/lp/archivepublisher/publishing.py b/lib/lp/archivepublisher/publishing.py
index 165c030..b8d1760 100644
--- a/lib/lp/archivepublisher/publishing.py
+++ b/lib/lp/archivepublisher/publishing.py
@@ -1688,6 +1688,11 @@ class Publisher:
# Schedule this for inclusion in the Release file.
all_series_files.add(os.path.join(component, "i18n", "Index"))
+ else:
+ try:
+ os.unlink(os.path.join(i18n_dir, "Index"))
+ except OSError:
+ pass
def _readIndexFileHashes(
self, suite, file_name, subpath=None, real_file_name=None
diff --git a/lib/lp/archivepublisher/tests/test_publisher.py b/lib/lp/archivepublisher/tests/test_publisher.py
index 91a3c0b..45e533b 100644
--- a/lib/lp/archivepublisher/tests/test_publisher.py
+++ b/lib/lp/archivepublisher/tests/test_publisher.py
@@ -2859,6 +2859,16 @@ class TestPublisher(TestPublisherBase):
self.config.distsroot, "breezy-autotest", "main", "i18n"
)
+ # First publish i18n/Index (status quo)
+ publisher._writeSuiteI18n(
+ self.ubuntutest["breezy-autotest"],
+ PackagePublishingPocket.RELEASE,
+ "main",
+ set(),
+ )
+
+ self.assertTrue(os.path.exists(os.path.join(i18n_root, "Index")))
+
self.ubuntu["breezy-autotest"].publish_i18n_index = False
publisher._writeSuiteI18n(
@@ -2868,6 +2878,7 @@ class TestPublisher(TestPublisherBase):
set(),
)
+ # Ensure it is removed, if previously existed
self.assertFalse(os.path.exists(os.path.join(i18n_root, "Index")))
def testReadIndexFileHashesCompression(self):