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
1=== modified file 'lib/lp/archivepublisher/publishing.py'
2--- lib/lp/archivepublisher/publishing.py 2014-07-28 01:58:49 +0000
3+++ lib/lp/archivepublisher/publishing.py 2014-07-30 02:05:57 +0000
4@@ -900,8 +900,8 @@
5 self.log.debug("Writing Index file for %s/%s/i18n" % (
6 suite, component))
7
8- i18n_dir = os.path.join(self._config.distsroot, suite, component,
9- "i18n")
10+ i18n_subpath = os.path.join(component, "i18n")
11+ i18n_dir = os.path.join(self._config.distsroot, suite, i18n_subpath)
12 i18n_files = []
13 try:
14 for i18n_file in os.listdir(i18n_dir):
15@@ -923,13 +923,15 @@
16 i18n_index = I18nIndex()
17 for i18n_file in sorted(i18n_files):
18 entry = self._readIndexFileContents(
19- suite, os.path.join(component, "i18n", i18n_file))
20+ suite, os.path.join(i18n_subpath, i18n_file))
21 if entry is None:
22 continue
23 i18n_index.setdefault("SHA1", []).append({
24 "sha1": hashlib.sha1(entry).hexdigest(),
25 "name": i18n_file,
26 "size": len(entry)})
27+ # Schedule i18n files for inclusion in the Release file.
28+ all_series_files.add(os.path.join(i18n_subpath, i18n_file))
29
30 with open(os.path.join(i18n_dir, "Index"), "w") as f:
31 i18n_index.dump(f, "utf-8")
32
33=== modified file 'lib/lp/archivepublisher/tests/test_publisher.py'
34--- lib/lp/archivepublisher/tests/test_publisher.py 2014-07-28 01:58:49 +0000
35+++ lib/lp/archivepublisher/tests/test_publisher.py 2014-07-30 02:05:57 +0000
36@@ -1560,19 +1560,25 @@
37 publisher.C_doFTPArchive(False)
38 publisher.D_writeReleaseFiles(False)
39
40- i18n_index = os.path.join(
41- self.config.distsroot, 'breezy-autotest', 'main', 'i18n', 'Index')
42+ series = os.path.join(self.config.distsroot, 'breezy-autotest')
43+ i18n_index = os.path.join(series, 'main', 'i18n', 'Index')
44
45 # The i18n/Index file has been generated.
46 self.assertTrue(os.path.exists(i18n_index))
47
48 # It is listed correctly in Release.
49- release = self.parseRelease(os.path.join(
50- self.config.distsroot, 'breezy-autotest', 'Release'))
51+ release = self.parseRelease(os.path.join(series, 'Release'))
52 with open(i18n_index) as i18n_index_file:
53 self.assertReleaseContentsMatch(
54 release, 'main/i18n/Index', i18n_index_file.read())
55
56+ components = ['main', 'universe', 'multiverse', 'restricted']
57+ release_path = os.path.join(series, 'Release')
58+ with open(release_path) as release_file:
59+ content = release_file.read()
60+ for component in components:
61+ self.assertIn(component + '/i18n/Translation-en.bz2', content)
62+
63 def testCreateSeriesAliasesNoAlias(self):
64 """createSeriesAliases has nothing to do by default."""
65 publisher = Publisher(
66@@ -1683,10 +1689,14 @@
67 self.assertEqual(str(len(translation_en_contents)),
68 i18n_index['sha1'][0]['size'])
69
70- # i18n/Index is scheduled for inclusion in Release.
71- self.assertEqual(1, len(all_files))
72+ # i18n/Index and i18n/Translation-en.bz2 are scheduled for inclusion
73+ # in Release.
74+ self.assertEqual(2, len(all_files))
75 self.assertEqual(
76 os.path.join('main', 'i18n', 'Index'), all_files.pop())
77+ self.assertEqual(
78+ os.path.join('main', 'i18n', 'Translation-en.bz2'),
79+ all_files.pop())
80
81 def testWriteSuiteI18nMissingDirectory(self):
82 """i18n/Index is not generated when the i18n directory is missing."""