]> git.pld-linux.org Git - packages/rpm-build-tools.git/blobdiff - adapter.awk
spelling
[packages/rpm-build-tools.git] / adapter.awk
index 33144830e08b33d0063705457aba6610c4106de0..4cef263c992e8ac97217fa2a0e10af484dc92955 100644 (file)
@@ -2,7 +2,7 @@
 #
 # Adapter adapts .spec files for PLD Linux.
 #
-# Copyright (C) 1999-2015 PLD-Team <feedback@pld-linux.org>
+# Copyright (C) 1999-2016 PLD-Team <feedback@pld-linux.org>
 # Authors:
 #      MichaƂ Kuratczyk <kura@pld.org.pl>
 #      Sebastian Zagrodzki <s.zagrodzki@mimuw.edu.pl>
@@ -373,7 +373,7 @@ function b_makekey(a, b,    s) {
 ##########
 # %build #
 ##########
-/^%build/, (!/^%build/ && $0 ~ SECTIONS) {
+/^%build([^A-Za-z0-9_]|$)/, (!/^%build/ && $0 ~ SECTIONS) {
        preamble = 0
 
        if (did_prep == 0) {
@@ -1160,6 +1160,11 @@ function use_macros()
        sub("%{_datadir}/doc", "%{_docdir}")
        sub("%{_bindir}/perl", "%{__perl}")
        sub("%{_bindir}/python", "%{__python}")
+       sub("%{__python2}", "%{__python}")
+       sub("%{nodejs_sitelib}", "%{nodejs_libdir}")
+
+       sub("%py2_build", "%py_build")
+       sub("%py2_install", "%py_install")
 
        gsub(infodir, "%{_infodir}")
 
@@ -1329,6 +1334,8 @@ function use_macros()
        gsub(php_pear_dir, "%{php_pear_dir}")
        gsub(php_data_dir, "%{php_data_dir}")
        gsub("%{_datadir}/php", "%{php_data_dir}")
+       gsub("%{php_home}", "%{php_data_dir}")
+       gsub("%{php_extdir}", "%{php_extensiondir}")
 
        # change to %{_datadir}, with some exceptions
        for (c = 1; c <= NF; c++) {
@@ -1530,6 +1537,7 @@ function use_files_macros(        i, n, t, a, l)
        }
 
        sub("^%doc %{_mandir}", "%{_mandir}")
+       sub("^%license", "%doc")
 
        gsub("^%{_sbindir}", "%attr(755,root,root) %{_sbindir}")
        gsub("^%{_bindir}", "%attr(755,root,root) %{_bindir}")
@@ -1776,6 +1784,7 @@ function unify_url(url)
        if (url ~ /sourceforge.net/) {
                sub("[?&]big_mirror=.*$", "", url)
                sub("[?&]modtime=.*$", "", url)
+               sub("[?&]r=.*$", "", url)
                sub("[?]use_mirror=.*$", "", url)
                sub("[?]download$", "", url)
                sub("/download$", "", url)
@@ -2052,6 +2061,10 @@ function replace_php_virtual_deps(field) {
                }
        }
 
+       if (pkg == "php(language)") {
+               $2 = "php(core)"
+       }
+
        if (pkg == "php4") {
                $2 = "webserver(php)"
                if ($4 ~ /^[0-9]:/) {
@@ -2154,6 +2167,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 +2221,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)
 
@@ -2339,6 +2378,7 @@ function replace_requires(field,   pkg) {
        sub(/^libXxf86misc-devel$/, "xorg-lib-libXxf86misc-devel", $2)
        sub(/^libXxf86vm-devel$/, "xorg-lib-libXxf86vm-devel", $2)
        sub(/^libacl-devel$/, "acl-devel", $2)
+       sub(/^libappstream-glib$/, "appstream-glib", $2)
        sub(/^libattr-devel$/, "attr-devel", $2)
        sub(/^libcurl-devel$/, "curl-devel", $2)
        sub(/^libgudev1-devel$/, "udev-glib-devel", $2)
@@ -2359,6 +2399,7 @@ function replace_requires(field,   pkg) {
        sub(/^mod_wsgi$/, "apache-mod_wsgi", $2)
        sub(/^newt-python$/, "python-snack", $2)
        sub(/^notify-python$/, "python-pynotify", $2)
+       sub(/^oxygen-icon-theme$/, "kde4-icons-oxygen", $2)
        sub(/^pcsc-lite-ccid$/, "pcsc-driver-ccid", $2)
        sub(/^pulseaudio-libs-devel$/, "pulseaudio-devel", $2)
        sub(/^pyOpenSSL$/, "python-pyOpenSSL", $2)
@@ -2380,15 +2421,17 @@ function replace_requires(field,   pkg) {
        sub(/^pytalloc$/, "python-talloc", $2)
        sub(/^pytalloc-devel$/, "python-talloc-devel", $2)
        sub(/^pytest$/, "python-pytest", $2)
+       sub(/^python-PyQt4-devel$/, "sip-PyQt4", $2)
        sub(/^python-crypto$/, "python-Crypto", $2)
        sub(/^python-cups$/, "python-pycups", $2)
        sub(/^python-enchant$/, "python-pyenchant", $2)
        sub(/^python-imaging$/, "python-PIL", $2)
        sub(/^python-imaging-tk$/, "python-PIL-tk", $2)
+       sub(/^python-ndg_httpsclient$/, "python-ndg-httpsclient", $2)
        sub(/^python-newt$/, "python-snack", $2)
        sub(/^python-pygtk$/, "python-pygtk-gtk", $2)
        sub(/^python-recaptcha-client$/, "python-recaptcha", $2)
-       sub(/^python-sphinx$/, "python-Sphinx", $2)
+       sub(/^python-sphinx$/, "sphinx-pdg", $2)
        sub(/^python-sqlalchemy$/, "python-SQLAlchemy", $2)
        sub(/^python-twisted$/, "python-TwistedCore", $2)
        sub(/^python-twisted-core$/, "python-TwistedCore", $2)
@@ -2396,7 +2439,10 @@ function replace_requires(field,   pkg) {
        sub(/^python-twisted-web$/, "python-TwistedWeb", $2)
        sub(/^python-unittest2$/, "python-modules", $2)
        sub(/^python-uuid$/, "python-modules", $2)
+       sub(/^python-xlib$/, "python-Xlib", $2)
        sub(/^python-zope-interface$/, "Zope-Interface", $2)
+       sub(/^python-zope.component$/, "Zope-Component", $2)
+       sub(/^python-zope.interface$/, "Zope-Interface", $2)
        sub(/^python2-devel$/, "python-devel", $2)
        sub(/^pytz$/, "python-pytz", $2)
        sub(/^pyxdg$/, "python-pyxdg", $2)
This page took 0.045728 seconds and 4 git commands to generate.