Code cleanup for oscapi
authorEd Bartosh <eduard.bartosh@intel.com>
Tue, 26 Mar 2013 17:46:19 +0000 (19:46 +0200)
committerZhang Qiang <qiang.z.zhang@intel.com>
Thu, 28 Mar 2013 01:46:37 +0000 (09:46 +0800)
Change-Id: Ib4825596ee1e0b8c19c628539b4b7fe4e18b2e99
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
gitbuildsys/oscapi.py

index 23d48740eb51b45eabead0bc9b521264012e2df2..f2f05ecb0d26d78e3f3115a1449dd2bd4d033347 100644 (file)
@@ -225,7 +225,7 @@ class OSC(object):
         changed, not changed and new are lists of local filepaths
         """
         # Get list of files from the OBS
-        rfiles = core.meta_get_filelist(self.apiurl, prj, pkg, verbose=True,\
+        rfiles = core.meta_get_filelist(self.apiurl, prj, pkg, verbose=True,
                                         expand=True)
 
         old, not_changed, changed, new = [], [], [], []
@@ -306,14 +306,15 @@ class OSC(object):
             raise ObsError("can't get %s/%s build results: %s" \
                            % (prj, pkg, str(err)))
 
-        for res in build_status:
-            # This regular expression is created for parsing the
-            # results of of core.get_results()
-            stat_re = re.compile(r'^(?P<repo>\S+)\s+(?P<arch>\S+)\s+'
+        # This regular expression is created for parsing the
+        # results of of core.get_results()
+        stat_re = re.compile(r'^(?P<repo>\S+)\s+(?P<arch>\S+)\s+'
                                   '(?P<status>\S*)$')
-            mo = stat_re.match(res)
-            if mo:
-                results[mo.group('repo')][mo.group('arch')] = mo.group('status')
+        for res in build_status:
+            match = stat_re.match(res)
+            if match:
+                results[match.group('repo')][match.group('arch')] = \
+                    match.group('status')
             else:
                 logger.warning('not valid build status received: %s' % res)