Skip to contentSkip to conversation

buildhistory: Fix regex to handle versions without spaces

PATCH In review Richard Purdie 2 participants 2 messages Feb 12, 2016 – Feb 14, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 buildhistory: Fix regex to handle versions without spaces

Its valid to have dependencies like XXX (=2.1) without spaces, as injected by debian.bbclass. The code was breaking these into separate components and destroying them so improve the regex to handle them.

meta/classes/buildhistory.bbclass +1 -1
index 32e096b..52a5f31 100644
@@ -145,7 +145,7 @@ python buildhistory_emit_pkghistory() {
             return None
 
     def sortpkglist(string):
-        pkgiter = re.finditer(r'[a-zA-Z0-9.+-]+( \([><=]+ [^ )]+\))?', string, 0)
+        pkgiter = re.finditer(r'[a-zA-Z0-9.+-]+( \([><=]+[^)]+\))?', string, 0)
         pkglist = [p.group(0) for p in pkgiter]
         pkglist.sort()
         return ' '.join(pkglist)
Acked-by on v1 1/1
#1 lore raw
Quoted 17 lines · On Fri, 12 Feb 2016 11:36:13 Richard Purdie wrote:

Its valid to have dependencies like XXX (=2.1) without spaces, as injected by debian.bbclass. The code was breaking these into separate components and destroying them so improve the regex to handle them.

(quoted diff) +0 -0

b/meta/classes/buildhistory.bbclass index 32e096b..52a5f31 100644

meta/classes/buildhistory.bbclass +1 -1
@@ -145,7 +145,7 @@ python buildhistory_emit_pkghistory() {
             return None
 
     def sortpkglist(string):
-        pkgiter = re.finditer(r'[a-zA-Z0-9.+-]+( \([><=]+ [^ )]+\))?',
 string, 0) 
+        pkgiter = re.finditer(r'[a-zA-Z0-9.+-]+(
Quoted 3 lines

\([><=]+[^)]+\))?', string, 0) pkglist = [p.group(0) for p in pkgiter]
pkglist.sort()
return ' '.join(pkglist)

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre