From: Elan Ruusamäe Date: Thu, 4 Jun 2015 08:05:22 +0000 (+0300) Subject: replace perl(xxx) mods with actual package name if unversioned X-Git-Tag: auto/th/rpm-build-tools-4.7-1~4 X-Git-Url: http://git.pld-linux.org/?p=packages%2Frpm-build-tools.git;a=commitdiff_plain;h=55c49642a4792a09f70be35b2c07188dcb23bf95 replace perl(xxx) mods with actual package name if unversioned --- 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)