]> git.pld-linux.org Git - packages/adapter.git/commitdiff
adapter: replace pythoneggs virtuals with package names if found match
authorElan Ruusamäe <glen@delfi.ee>
Sun, 27 Jan 2013 15:38:17 +0000 (17:38 +0200)
committerElan Ruusamäe <glen@delfi.ee>
Sun, 27 Jan 2013 15:38:17 +0000 (17:38 +0200)
adapter.awk

index d1b1779430c84f6f709baca3f02b88df3ad34519..ab95e4c86689988aa96f7f08de0257b9d8bdde24 100644 (file)
@@ -1964,7 +1964,7 @@ function replace_groupnames(group) {
        return group;
 }
 
-function replace_pkgconfig(pkg,    cmd, path, n, i, line, r) {
+function replace_pkgconfig(pkg,    cmd, path, n, i, line) {
        n = split("/usr/lib64/pkgconfig /usr/lib/pkgconfig /usr/share/pkgconfig", path, / /);
        for (i = 1; i <= n; i++) {
                cmd = "rpm -qf --qf '%{N}' " path[i] "/" pkg ".pc";
@@ -1981,6 +1981,20 @@ function replace_pkgconfig(pkg,    cmd, path, n, i, line, r) {
        }
 }
 
+function replace_pythonegg(pkg,    cmd, line) {
+       cmd = "rpm -q --qf '%{N}' --whatprovides 'pythonegg(" pkg ")'";
+       # Getline returns 0 on end-of-file, -1 on error, otherwise 1.
+       if ((cmd | getline line) <= 0) {
+               return;
+       }
+
+       if (line !~ /no package provides/) {
+               # @modifies global $2
+               $2 = line;
+               return;
+       }
+}
+
 function replace_requires(field,   pkg) {
        # pkg-config -> package names
        if (match($2, /pkgconfig\(([^)]+)\)/)) {
@@ -1988,6 +2002,12 @@ function replace_requires(field,   pkg) {
                replace_pkgconfig(pkg);
        }
 
+       # pythonegg -> package names
+       if (match($2, /pythonegg\(([^)]+)\)/)) {
+               pkg = substr($2, RSTART + 10, RLENGTH - 11);
+               replace_pythonegg(pkg);
+       }
+
        sub(/^python-setuptools-devel$/, "python-distribute", $2);
        sub(/^gcc-g77/, "gcc-fortran", $2);
 
This page took 0.042002 seconds and 4 git commands to generate.