[packages/rpm-build-tools] replace perl(xxx) mods with actual package name if unversioned

glen glen at pld-linux.org
Thu Jun 4 10:05:27 CEST 2015


commit 55c49642a4792a09f70be35b2c07188dcb23bf95
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Thu Jun 4 11:05:22 2015 +0300

    replace perl(xxx) mods with actual package name if unversioned

 adapter.awk | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
---
diff --git a/adapter.awk b/adapter.awk
index de742ea..f96ba77 100644
--- a/adapter.awk
+++ b/adapter.awk
@@ -2154,6 +2154,26 @@ function replace_pkgconfig(pkg,    cmd, path, n, i, line) {
 }
 # }}}
 
+# {{{ replace_perlmod(pkg)
+function replace_perlmod(pkg, version,   cmd, line) {
+	# do nothing if version is specified
+	if (version) {
+		return
+	}
+	cmd = "rpm -q --qf '%{N}\n' --whatprovides 'perl(" 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
+	}
+}
+
 # {{{ replace_pythonegg(pkg)
 function replace_pythonegg(pkg,    cmd, line) {
 	cmd = "rpm -q --qf '%{N}' --whatprovides 'pythonegg(" pkg ")'"
@@ -2188,6 +2208,12 @@ function replace_requires(field,   pkg) {
 		replace_pythonegg(pkg)
 	}
 
+	# perl() -> package names
+	if (match($2, /perl\(([^)]+)\)/)) {
+		pkg = substr($2, RSTART + 5, RLENGTH - 6)
+		replace_perlmod(pkg, $3)
+	}
+
 	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/55c49642a4792a09f70be35b2c07188dcb23bf95



More information about the pld-cvs-commit mailing list