]> git.ipfire.org Git - pakfire.git/commitdiff
Enhancements and tests for the pkg-config code.
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 3 Mar 2011 22:34:06 +0000 (23:34 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 3 Mar 2011 22:34:06 +0000 (23:34 +0100)
pakfire/packages/base.py
pakfire/packages/util.py

index 3645bc528811faa8818f22b762eb580f502615bb..fc6d95ae543eeb0a72ad252e96c7630cfc43d540 100644 (file)
@@ -295,6 +295,11 @@ class Package(object):
                        (r_expr, r_name, r_version) = \
                                util.parse_pkgconfig_expr(requires.requires)
 
+                       # If we get an invalid expression with no name, we
+                       # do not provide this.
+                       if not r_name:
+                               return False
+
                        for provides in self.provides:
                                if not provides.startswith("pkgconfig("):
                                        continue
index bf895f11d752ba64bd8f268536c655f363d34477..3b6bb9d41948c2d0d03b0cf5c46b78f80c12fdec 100644 (file)
@@ -133,7 +133,7 @@ def parse_pkgconfig_expr(s):
 
        (name, exp, version) = (None, None, None)
 
-       m = re.match(r"^([A-Za-z0-9\-\+]+)(=|\<|\>|\>=|\<=)?([A-Za-z0-9\.\-]+)?", s)
+       m = re.match(r"^pkgconfig\(([A-Za-z0-9\.\-\+]+)\)(=|\<|\>|\>=|\<=)?([A-Za-z0-9\.\-]+)?", s)
 
        if m:
                (name, exp, version) = m.groups()
@@ -141,5 +141,16 @@ def parse_pkgconfig_expr(s):
        return (exp, name, version)
 
 
+def test_parse_pkgconfig_expr():
+       strings = (
+               "pkgconfig(libxml-2.0)",
+               "pkgconfig(libxml-2.0)=1.2.3",
+               "pkgconfig(libxml-2.0)>=1.2.3",
+       )
+
+       for s in strings:
+               print s, parse_pkgconfig_expr(s)
+
 if __name__ == "__main__":
        test_parse_pkg_expr()
+       test_parse_pkgconfig_expr()