[packages/rpm-build-tools] adapter: replace pythoneggs virtuals with package names if found match

glen glen at pld-linux.org
Mon Jan 28 20:38:39 CET 2013


commit bc893777cace5ac732f855cdd8a125f3dbbb2e30
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Sun Jan 27 17:38:17 2013 +0200

    adapter: replace pythoneggs virtuals with package names if found match

 adapter.awk | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)
---
diff --git a/adapter.awk b/adapter.awk
index d1b1779..ab95e4c 100644
--- a/adapter.awk
+++ b/adapter.awk
@@ -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);
 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rpm-build-tools.git/commitdiff/a2ade87c113b54948873ccd5910586d8874b28e4



More information about the pld-cvs-commit mailing list