Merge lp:~wgrant/launchpad/bug-1544806 into lp:launchpad

Proposed by William Grant
Status: Merged
Merged at revision: 17925
Proposed branch: lp:~wgrant/launchpad/bug-1544806
Merge into: lp:launchpad
Diff against target: 55 lines (+13/-4)
2 files modified
lib/lp/archivepublisher/publishing.py (+10/-4)
lib/lp/archivepublisher/tests/test_publisher.py (+3/-0)
To merge this branch: bzr merge lp:~wgrant/launchpad/bug-1544806
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+285821@code.launchpad.net

Commit message

Fix i18n/Index publishing to use i18n-relative paths. Regressed in r17912.

Description of the change

Fix i18n/Index publishing to use i18n-relative paths.

r17912 caused Soyuz to publish i18n/Index using distroseries-relative
paths, but the index lives under i18n so they should be i18n-relative,
eg. "Translation-en" instead of "main/i18n/Translation-en".

To post a comment you must log in.
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 2016-02-05 20:28:29 +0000
3+++ lib/lp/archivepublisher/publishing.py 2016-02-12 01:43:06 +0000
4@@ -991,7 +991,7 @@
5 i18n_index = I18nIndex()
6 for i18n_file in sorted(i18n_files):
7 hashes = self._readIndexFileHashes(
8- suite, os.path.join(i18n_subpath, i18n_file))
9+ suite, i18n_file, subpath=i18n_subpath)
10 if hashes is None:
11 continue
12 i18n_index.setdefault("SHA1", []).append(hashes["sha1"])
13@@ -1004,19 +1004,25 @@
14 # Schedule this for inclusion in the Release file.
15 all_series_files.add(os.path.join(component, "i18n", "Index"))
16
17- def _readIndexFileHashes(self, distroseries_name, file_name):
18+ def _readIndexFileHashes(self, distroseries_name, file_name,
19+ subpath=None):
20 """Read an index file and return its hashes.
21
22 :param distroseries_name: Distro series name
23 :param file_name: Filename relative to the parent container directory.
24+ :param subpath: Optional subpath within the distroseries root.
25+ Generated indexes will not include this path. If omitted,
26+ filenames are assumed to be relative to the distroseries
27+ root.
28 :return: A dictionary mapping hash field names to dictionaries of
29 their components as defined by debian.deb822.Release (e.g.
30 {"md5sum": {"md5sum": ..., "size": ..., "name": ...}}), or None
31 if the file could not be found.
32 """
33 open_func = open
34- full_name = os.path.join(self._config.distsroot,
35- distroseries_name, file_name)
36+ full_name = os.path.join(
37+ self._config.distsroot, distroseries_name, subpath or '.',
38+ file_name)
39 if not os.path.exists(full_name):
40 if os.path.exists(full_name + '.gz'):
41 open_func = gzip.open
42
43=== modified file 'lib/lp/archivepublisher/tests/test_publisher.py'
44--- lib/lp/archivepublisher/tests/test_publisher.py 2016-02-05 20:28:29 +0000
45+++ lib/lp/archivepublisher/tests/test_publisher.py 2016-02-12 01:43:06 +0000
46@@ -1997,6 +1997,9 @@
47 i18n_index['sha1'][1]['sha1'])
48 self.assertEqual(str(len(translation_en_contents)),
49 i18n_index['sha1'][1]['size'])
50+ self.assertContentEqual(
51+ ['Translation-en', 'Translation-en.gz', 'Translation-en.bz2'],
52+ [hash['name'] for hash in i18n_index['sha1']])
53
54 # i18n/Index and i18n/Translation-en.bz2 are scheduled for inclusion
55 # in Release. Checksums of the uncompressed version are included