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
=== modified file 'lib/lp/archivepublisher/publishing.py'
--- lib/lp/archivepublisher/publishing.py 2016-02-05 20:28:29 +0000
+++ lib/lp/archivepublisher/publishing.py 2016-02-12 01:43:06 +0000
@@ -991,7 +991,7 @@
991 i18n_index = I18nIndex()991 i18n_index = I18nIndex()
992 for i18n_file in sorted(i18n_files):992 for i18n_file in sorted(i18n_files):
993 hashes = self._readIndexFileHashes(993 hashes = self._readIndexFileHashes(
994 suite, os.path.join(i18n_subpath, i18n_file))994 suite, i18n_file, subpath=i18n_subpath)
995 if hashes is None:995 if hashes is None:
996 continue996 continue
997 i18n_index.setdefault("SHA1", []).append(hashes["sha1"])997 i18n_index.setdefault("SHA1", []).append(hashes["sha1"])
@@ -1004,19 +1004,25 @@
1004 # Schedule this for inclusion in the Release file.1004 # Schedule this for inclusion in the Release file.
1005 all_series_files.add(os.path.join(component, "i18n", "Index"))1005 all_series_files.add(os.path.join(component, "i18n", "Index"))
10061006
1007 def _readIndexFileHashes(self, distroseries_name, file_name):1007 def _readIndexFileHashes(self, distroseries_name, file_name,
1008 subpath=None):
1008 """Read an index file and return its hashes.1009 """Read an index file and return its hashes.
10091010
1010 :param distroseries_name: Distro series name1011 :param distroseries_name: Distro series name
1011 :param file_name: Filename relative to the parent container directory.1012 :param file_name: Filename relative to the parent container directory.
1013 :param subpath: Optional subpath within the distroseries root.
1014 Generated indexes will not include this path. If omitted,
1015 filenames are assumed to be relative to the distroseries
1016 root.
1012 :return: A dictionary mapping hash field names to dictionaries of1017 :return: A dictionary mapping hash field names to dictionaries of
1013 their components as defined by debian.deb822.Release (e.g.1018 their components as defined by debian.deb822.Release (e.g.
1014 {"md5sum": {"md5sum": ..., "size": ..., "name": ...}}), or None1019 {"md5sum": {"md5sum": ..., "size": ..., "name": ...}}), or None
1015 if the file could not be found.1020 if the file could not be found.
1016 """1021 """
1017 open_func = open1022 open_func = open
1018 full_name = os.path.join(self._config.distsroot,1023 full_name = os.path.join(
1019 distroseries_name, file_name)1024 self._config.distsroot, distroseries_name, subpath or '.',
1025 file_name)
1020 if not os.path.exists(full_name):1026 if not os.path.exists(full_name):
1021 if os.path.exists(full_name + '.gz'):1027 if os.path.exists(full_name + '.gz'):
1022 open_func = gzip.open1028 open_func = gzip.open
10231029
=== modified file 'lib/lp/archivepublisher/tests/test_publisher.py'
--- lib/lp/archivepublisher/tests/test_publisher.py 2016-02-05 20:28:29 +0000
+++ lib/lp/archivepublisher/tests/test_publisher.py 2016-02-12 01:43:06 +0000
@@ -1997,6 +1997,9 @@
1997 i18n_index['sha1'][1]['sha1'])1997 i18n_index['sha1'][1]['sha1'])
1998 self.assertEqual(str(len(translation_en_contents)),1998 self.assertEqual(str(len(translation_en_contents)),
1999 i18n_index['sha1'][1]['size'])1999 i18n_index['sha1'][1]['size'])
2000 self.assertContentEqual(
2001 ['Translation-en', 'Translation-en.gz', 'Translation-en.bz2'],
2002 [hash['name'] for hash in i18n_index['sha1']])
20002003
2001 # i18n/Index and i18n/Translation-en.bz2 are scheduled for inclusion2004 # i18n/Index and i18n/Translation-en.bz2 are scheduled for inclusion
2002 # in Release. Checksums of the uncompressed version are included2005 # in Release. Checksums of the uncompressed version are included