← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/dep11-release into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/dep11-release into lp:launchpad with lp:~cjwatson/launchpad/generalise-publisher-staging as a prerequisite.

Commit message:
Include DEP-11 metadata in Release file if it is present.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/dep11-release/+merge/282630

Include DEP-11 metadata in Release file if it is present.  This gives clients a trust path to it.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/dep11-release into lp:launchpad.
=== modified file 'lib/lp/archivepublisher/publishing.py'
--- lib/lp/archivepublisher/publishing.py	2015-09-26 01:14:24 +0000
+++ lib/lp/archivepublisher/publishing.py	2016-01-14 16:59:43 +0000
@@ -825,6 +825,17 @@
                     distroseries, pocket, component, architecture, all_files)
             self._writeSuiteI18n(
                 distroseries, pocket, component, all_files)
+            dep11_dir = os.path.join(
+                self._config.distsroot, suite, component, "dep11")
+            try:
+                for dep11_file in os.listdir(dep11_dir):
+                    if (dep11_file.startswith("Components-") or
+                            dep11_file.startswith("icons-")):
+                        all_files.add(
+                            os.path.join(component, "dep11", dep11_file))
+            except OSError as e:
+                if e.errno != errno.ENOENT:
+                    raise
         for architecture in all_architectures:
             for contents_path in get_suffixed_indices(
                     'Contents-' + architecture):

=== modified file 'lib/lp/archivepublisher/tests/test_publisher.py'
--- lib/lp/archivepublisher/tests/test_publisher.py	2015-09-26 01:14:24 +0000
+++ lib/lp/archivepublisher/tests/test_publisher.py	2016-01-14 16:59:43 +0000
@@ -1848,6 +1848,37 @@
             self.assertReleaseContentsMatch(
                 release, 'Contents-i386.gz', contents_file.read())
 
+    def testReleaseFileForDEP11(self):
+        # Test Release file writing for DEP-11 metadata.
+        publisher = Publisher(
+            self.logger, self.config, self.disk_pool,
+            self.ubuntutest.main_archive)
+
+        # Put some DEP-11 metadata files in place, and force the publisher
+        # to republish that suite.
+        series_path = os.path.join(self.config.distsroot, 'breezy-autotest')
+        dep11_path = os.path.join(series_path, 'main', 'dep11')
+        dep11_names = ('Components-amd64.yml.gz', 'Components-i386.yml.gz',
+                       'icons-64x64.tar.gz', 'icons-128x128.tar.gz')
+        os.makedirs(dep11_path)
+        for name in dep11_names:
+            with gzip.GzipFile(os.path.join(dep11_path, name), 'wb') as f:
+                f.write(name)
+        publisher.markPocketDirty(
+            self.ubuntutest.getSeries('breezy-autotest'),
+            PackagePublishingPocket.RELEASE)
+
+        publisher.A_publish(False)
+        publisher.C_doFTPArchive(False)
+        publisher.D_writeReleaseFiles(False)
+
+        # The metadata files are listed correctly in Release.
+        release = self.parseRelease(os.path.join(series_path, 'Release'))
+        for name in dep11_names:
+            with open(os.path.join(dep11_path, name), 'rb') as f:
+                self.assertReleaseContentsMatch(
+                    release, os.path.join('main', 'dep11', name), f.read())
+
     def testReleaseFileTimestamps(self):
         # The timestamps of Release and all its entries match.
         publisher = Publisher(


Follow ups