Patchwork [7/7] buildhistory_analysis: correctly split RDEPENDS/RRECOMMENDS

login
register
mail settings
Submitter Paul Eggleton
Date Feb. 14, 2012, 1:40 p.m.
Message ID <2d65e8dffd534a58514d0b6521961284000a047b.1329226672.git.paul.eggleton@linux.intel.com>
Download mbox | patch
Permalink /patch/21257/
State Accepted
Commit d974ed4330f33c4f8dfd635a83c61a0d44e688b6
Headers show

Comments

Paul Eggleton - Feb. 14, 2012, 1:40 p.m.
Split RDEPENDS and RRECOMMENDS correctly (which may contain version
number specifications after each item).

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 meta/lib/oe/buildhistory_analysis.py |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

Patch

diff --git a/meta/lib/oe/buildhistory_analysis.py b/meta/lib/oe/buildhistory_analysis.py
index bef6cd4..4f3e635 100644
--- a/meta/lib/oe/buildhistory_analysis.py
+++ b/meta/lib/oe/buildhistory_analysis.py
@@ -12,6 +12,7 @@  import sys
 import os.path
 import difflib
 import git
+import re
 
 
 # How to display fields
@@ -53,9 +54,18 @@  class ChangeRecord:
         else:
             prefix = ''
 
+        def pkglist_split(pkgs):
+            pkgit = re.finditer(r'[a-zA-Z0-9.+-]+( \([><=]+ [^ )]+\))?', pkgs, 0)
+            pkglist = [p.group(0) for p in pkgit]
+            return pkglist
+
         if self.fieldname in list_fields or self.fieldname in list_order_fields:
-            aitems = self.oldvalue.split()
-            bitems = self.newvalue.split()
+            if self.fieldname in ['RDEPENDS', 'RRECOMMENDS']:
+                aitems = pkglist_split(self.oldvalue)
+                bitems = pkglist_split(self.newvalue)
+            else:
+                aitems = self.oldvalue.split()
+                bitems = self.newvalue.split()
             removed = list(set(aitems) - set(bitems))
             added = list(set(bitems) - set(aitems))
             if removed or added: