Merge lp:~cjohnston/launchpad/1313576-release-hashes into lp:launchpad

Proposed by Chris Johnston
Status: Merged
Merged at revision: 17139
Proposed branch: lp:~cjohnston/launchpad/1313576-release-hashes
Merge into: lp:launchpad
Diff against target: 82 lines (+21/-9)
2 files modified
lib/lp/archivepublisher/publishing.py (+5/-3)
lib/lp/archivepublisher/tests/test_publisher.py (+16/-6)
To merge this branch: bzr merge lp:~cjohnston/launchpad/1313576-release-hashes
Reviewer Review Type Date Requested Status
William Grant code Approve
Celso Providelo (community) Needs Fixing
Review via email: mp+228744@code.launchpad.net

Commit message

Add hashes for Translation-$lang into the Release file

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

See inline comments

review: Needs Fixing
Revision history for this message
William Grant (wgrant) :
review: Needs Fixing (code)
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/archivepublisher/publishing.py'
--- lib/lp/archivepublisher/publishing.py 2014-07-28 01:58:49 +0000
+++ lib/lp/archivepublisher/publishing.py 2014-07-30 02:05:57 +0000
@@ -900,8 +900,8 @@
900 self.log.debug("Writing Index file for %s/%s/i18n" % (900 self.log.debug("Writing Index file for %s/%s/i18n" % (
901 suite, component))901 suite, component))
902902
903 i18n_dir = os.path.join(self._config.distsroot, suite, component,903 i18n_subpath = os.path.join(component, "i18n")
904 "i18n")904 i18n_dir = os.path.join(self._config.distsroot, suite, i18n_subpath)
905 i18n_files = []905 i18n_files = []
906 try:906 try:
907 for i18n_file in os.listdir(i18n_dir):907 for i18n_file in os.listdir(i18n_dir):
@@ -923,13 +923,15 @@
923 i18n_index = I18nIndex()923 i18n_index = I18nIndex()
924 for i18n_file in sorted(i18n_files):924 for i18n_file in sorted(i18n_files):
925 entry = self._readIndexFileContents(925 entry = self._readIndexFileContents(
926 suite, os.path.join(component, "i18n", i18n_file))926 suite, os.path.join(i18n_subpath, i18n_file))
927 if entry is None:927 if entry is None:
928 continue928 continue
929 i18n_index.setdefault("SHA1", []).append({929 i18n_index.setdefault("SHA1", []).append({
930 "sha1": hashlib.sha1(entry).hexdigest(),930 "sha1": hashlib.sha1(entry).hexdigest(),
931 "name": i18n_file,931 "name": i18n_file,
932 "size": len(entry)})932 "size": len(entry)})
933 # Schedule i18n files for inclusion in the Release file.
934 all_series_files.add(os.path.join(i18n_subpath, i18n_file))
933935
934 with open(os.path.join(i18n_dir, "Index"), "w") as f:936 with open(os.path.join(i18n_dir, "Index"), "w") as f:
935 i18n_index.dump(f, "utf-8")937 i18n_index.dump(f, "utf-8")
936938
=== modified file 'lib/lp/archivepublisher/tests/test_publisher.py'
--- lib/lp/archivepublisher/tests/test_publisher.py 2014-07-28 01:58:49 +0000
+++ lib/lp/archivepublisher/tests/test_publisher.py 2014-07-30 02:05:57 +0000
@@ -1560,19 +1560,25 @@
1560 publisher.C_doFTPArchive(False)1560 publisher.C_doFTPArchive(False)
1561 publisher.D_writeReleaseFiles(False)1561 publisher.D_writeReleaseFiles(False)
15621562
1563 i18n_index = os.path.join(1563 series = os.path.join(self.config.distsroot, 'breezy-autotest')
1564 self.config.distsroot, 'breezy-autotest', 'main', 'i18n', 'Index')1564 i18n_index = os.path.join(series, 'main', 'i18n', 'Index')
15651565
1566 # The i18n/Index file has been generated.1566 # The i18n/Index file has been generated.
1567 self.assertTrue(os.path.exists(i18n_index))1567 self.assertTrue(os.path.exists(i18n_index))
15681568
1569 # It is listed correctly in Release.1569 # It is listed correctly in Release.
1570 release = self.parseRelease(os.path.join(1570 release = self.parseRelease(os.path.join(series, 'Release'))
1571 self.config.distsroot, 'breezy-autotest', 'Release'))
1572 with open(i18n_index) as i18n_index_file:1571 with open(i18n_index) as i18n_index_file:
1573 self.assertReleaseContentsMatch(1572 self.assertReleaseContentsMatch(
1574 release, 'main/i18n/Index', i18n_index_file.read())1573 release, 'main/i18n/Index', i18n_index_file.read())
15751574
1575 components = ['main', 'universe', 'multiverse', 'restricted']
1576 release_path = os.path.join(series, 'Release')
1577 with open(release_path) as release_file:
1578 content = release_file.read()
1579 for component in components:
1580 self.assertIn(component + '/i18n/Translation-en.bz2', content)
1581
1576 def testCreateSeriesAliasesNoAlias(self):1582 def testCreateSeriesAliasesNoAlias(self):
1577 """createSeriesAliases has nothing to do by default."""1583 """createSeriesAliases has nothing to do by default."""
1578 publisher = Publisher(1584 publisher = Publisher(
@@ -1683,10 +1689,14 @@
1683 self.assertEqual(str(len(translation_en_contents)),1689 self.assertEqual(str(len(translation_en_contents)),
1684 i18n_index['sha1'][0]['size'])1690 i18n_index['sha1'][0]['size'])
16851691
1686 # i18n/Index is scheduled for inclusion in Release.1692 # i18n/Index and i18n/Translation-en.bz2 are scheduled for inclusion
1687 self.assertEqual(1, len(all_files))1693 # in Release.
1694 self.assertEqual(2, len(all_files))
1688 self.assertEqual(1695 self.assertEqual(
1689 os.path.join('main', 'i18n', 'Index'), all_files.pop())1696 os.path.join('main', 'i18n', 'Index'), all_files.pop())
1697 self.assertEqual(
1698 os.path.join('main', 'i18n', 'Translation-en.bz2'),
1699 all_files.pop())
16901700
1691 def testWriteSuiteI18nMissingDirectory(self):1701 def testWriteSuiteI18nMissingDirectory(self):
1692 """i18n/Index is not generated when the i18n directory is missing."""1702 """i18n/Index is not generated when the i18n directory is missing."""