[packages/adapter: 610/631] replace perl(xxx) mods with actual package name if unversioned

glen glen at pld-linux.org
Mon Sep 12 20:25:34 CEST 2016


commit 1cc6452f25230b1ba4276d413ac4cd0cbfb22272
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/adapter.git/commitdiff/6ca0126d4d0c8c79feb7db10b0a0fade0f3b8885



More information about the pld-cvs-commit mailing list