← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/publisher-debug-noise into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/publisher-debug-noise into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/publisher-debug-noise/+merge/289888

Be a bit more selective about adding files to the Release data set: only add files that exist and their uncompressed variants.  This should have no effect on the generated files (hence no test changes), but eliminates a significant amount of "Failed to find" debug noise.

While I'm here, add debug messages when writing/signing the top-level Release file.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/publisher-debug-noise into lp:launchpad.
=== modified file 'lib/lp/archivepublisher/publishing.py'
--- lib/lp/archivepublisher/publishing.py	2016-03-17 17:08:49 +0000
+++ lib/lp/archivepublisher/publishing.py	2016-03-23 12:38:19 +0000
@@ -847,6 +847,7 @@
             return
 
         suite = distroseries.getSuite(pocket)
+        suite_dir = os.path.join(self._config.distsroot, suite)
         all_components = [
             comp.name for comp in
             self.archive.getComponentsForSeries(distroseries)]
@@ -870,8 +871,7 @@
                     distroseries, pocket, component, architecture, core_files)
             self._writeSuiteI18n(
                 distroseries, pocket, component, core_files)
-            dep11_dir = os.path.join(
-                self._config.distsroot, suite, component, "dep11")
+            dep11_dir = os.path.join(suite_dir, component, "dep11")
             try:
                 for dep11_file in os.listdir(dep11_dir):
                     if (dep11_file.startswith("Components-") or
@@ -886,7 +886,9 @@
         for architecture in all_architectures:
             for contents_path in get_suffixed_indices(
                     'Contents-' + architecture):
-                extra_files.add(contents_path)
+                if os.path.exists(os.path.join(suite_dir, contents_path)):
+                    extra_files.add(remove_suffix(contents_path))
+                    extra_files.add(contents_path)
         all_files = core_files | extra_files
 
         drsummary = "%s %s " % (self.distro.displayname,
@@ -896,6 +898,7 @@
         else:
             drsummary += pocket.name.capitalize()
 
+        self.log.debug("Writing Release file for %s" % suite)
         release_file = Release()
         release_file["Origin"] = self._getOrigin()
         release_file["Label"] = self._getLabel()
@@ -926,6 +929,7 @@
 
         if self.archive.signing_key is not None:
             # Sign the repository.
+            self.log.debug("Signing Release file for %s" % suite)
             IArchiveSigningKey(self.archive).signRepository(suite)
             core_files.add("Release.gpg")
             core_files.add("InRelease")
@@ -944,6 +948,7 @@
         # XXX kiko 2006-08-24: Untested method.
 
         suite = distroseries.getSuite(pocket)
+        suite_dir = os.path.join(self._config.distsroot, suite)
         self.log.debug("Writing Release file for %s/%s/%s" % (
             suite, component, arch_path))
 
@@ -951,7 +956,10 @@
         # the suite's architectures
         file_stub = os.path.join(component, arch_path, file_stub)
 
-        all_series_files.update(get_suffixed_indices(file_stub))
+        for path in get_suffixed_indices(file_stub):
+            if os.path.exists(os.path.join(suite_dir, path)):
+                all_series_files.add(remove_suffix(path))
+                all_series_files.add(path)
         all_series_files.add(os.path.join(component, arch_path, "Release"))
 
         release_file = Release()
@@ -962,7 +970,7 @@
         release_file["Label"] = self._getLabel()
         release_file["Architecture"] = arch_name
 
-        with open(os.path.join(self._config.distsroot, suite,
+        with open(os.path.join(suite_dir,
                                component, arch_path, "Release"), "w") as f:
             release_file.dump(f, "utf-8")
 
@@ -976,6 +984,9 @@
     def _writeSuiteArch(self, distroseries, pocket, component,
                         arch_name, all_series_files):
         """Write out a Release file for an architecture in a suite."""
+        suite = distroseries.getSuite(pocket)
+        suite_dir = os.path.join(self._config.distsroot, suite)
+
         file_stub = 'Packages'
         arch_path = 'binary-' + arch_name
 
@@ -983,7 +994,10 @@
             # Set up the subcomponent paths.
             sub_path = os.path.join(component, subcomp, arch_path)
             sub_file_stub = os.path.join(sub_path, file_stub)
-            all_series_files.update(get_suffixed_indices(sub_file_stub))
+            for path in get_suffixed_indices(sub_file_stub):
+                if os.path.exists(os.path.join(suite_dir, path)):
+                    all_series_files.add(remove_suffix(path))
+                    all_series_files.add(path)
         self._writeSuiteArchOrSource(
             distroseries, pocket, component, 'Packages', arch_name, arch_path,
             all_series_files)


Follow ups