[PATCH v2][kteam-tools] ktl/tracking_bug.py: fix snap tasks lookup

Kleber Sacilotto de Souza kleber.souza at canonical.com
Tue Oct 17 08:52:56 UTC 2017


The layout of the snap-related information has been changed on
kernel-series-info.yaml. So change ktl/tracking_bug.py for the new
layout.

Signed-off-by: Kleber Sacilotto de Souza <kleber.souza at canonical.com>
---
 ktl/tracking_bug.py | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/ktl/tracking_bug.py b/ktl/tracking_bug.py
index 426d39b0..20fa8466 100644
--- a/ktl/tracking_bug.py
+++ b/ktl/tracking_bug.py
@@ -16,6 +16,7 @@ class TrackingBug:
         self.wf = Workflow()
         self.ub = Ubuntu()
         self.__dependency_list = None
+        self.__dependency_snaps = None
         self._targeted_series_name = None
         self._series_specified = None
         self._series_target = None
@@ -40,6 +41,21 @@ class TrackingBug:
         retval = dependent_package in self.__dependency_list
         return retval
 
+    # get_dependent_snap
+    def get_dependent_snap(self, series, main_package):
+        '''
+        Return the name of the dependent snap for the specified series/package.
+        Return None if not found.
+        '''
+        if self.__dependency_snaps is None:
+            try:
+                record = self.ub.lookup(series)
+                self.__dependency_snaps = record['dependent-snaps'][main_package]
+            except KeyError:
+                self.__dependency_snaps = {}
+
+        return self.__dependency_snaps.get('snap')
+
     # valid_series
     #
     def valid_series(s, lp_series, series_specified, targeted_series_name, package):
@@ -64,7 +80,7 @@ class TrackingBug:
             if lp_series.name == 'prepare-package-signed' and not s.has_dependent_package(targeted_series_name, package, 'signed'):
                 cdebug('    no prepare-package-signed', 'yellow')
                 break
-            if not s.has_dependent_package(targeted_series_name, package, 'snap'):
+            if s.get_dependent_snap(targeted_series_name, package) is None:
                 if lp_series.name == 'snap-release-to-edge':
                     cdebug('    no snap-release-to-edge', 'yellow')
                     break
-- 
2.14.1





More information about the kernel-team mailing list