]> git.pld-linux.org Git - packages/rpm-build-tools.git/blobdiff - adapter.awk
separater parameters and locals
[packages/rpm-build-tools.git] / adapter.awk
index cd088ad58c9c959a35a5f7de1bd78096211960d5..f7f7f38faac432ac7f061a95708480de8496d4aa 100644 (file)
@@ -81,7 +81,8 @@ function mktemp(template, tmp) {
    return tmp
 }
 
-function b_makekey(a, b,       s) {
+function b_makekey(a, b, # parameters
+                                  s) {  # locals
        s = a "" b
        # kill bcond
        gsub(/[#%]+{[!?]+[_a-zA-Z0-9]+:/, "", s)
@@ -431,12 +432,14 @@ function b_makekey(a, b,  s) {
 
        # use PLD Linux macros
        $0 = fixedsub("glib-gettextize --copy --force","%{__glib_gettextize}", $0)
+       $0 = fixedsub("glib-gettextize --force --copy", "%{__glib_gettextize}", $0)
        $0 = fixedsub("intltoolize --copy --force", "%{__intltoolize}", $0)
        $0 = fixedsub("automake --add-missing --copy", "%{__automake}", $0)
        $0 = fixedsub("automake -a --foreign --copy", "%{__automake}", $0)
        $0 = fixedsub("automake -a -c --foreign", "%{__automake}", $0)
        $0 = fixedsub("automake -a -c", "%{__automake}", $0)
        $0 = fixedsub("libtoolize --force --automake --copy", "%{__libtoolize}", $0)
+       $0 = fixedsub("libtoolize --force --copy", "%{__libtoolize}", $0)
        $0 = fixedsub("libtoolize -c -f --automake", "%{__libtoolize}", $0)
 
        sub(/^aclocal$/, "%{__aclocal}")
@@ -1088,7 +1091,8 @@ END {
 }
 
 # substitutes fixed strings (not regexps)
-function fixedsub(s1,s2,t, ind) {
+function fixedsub(s1,s2,t, # parameters
+                                       ind) { # locals
        if (ind = index(t,s1))
                t = substr(t, 1, ind-1) s2 substr(t, ind+length(s1))
        return t
@@ -1187,6 +1191,7 @@ function use_macros()
        gsub("%{python3_sitelib}", "%{py3_sitescriptdir}")
        gsub("%{python3_version}", "%{py3_ver}")
        gsub("%{python2_version}", "%{py_ver}")
+       gsub("%{python3_sitearch}", "%{py3_sitedir}")
 
        gsub(ruby_archdir, "%{ruby_archdir}")
        gsub(ruby_libdir, "%{ruby_libdir}")
@@ -1350,8 +1355,10 @@ function use_macros()
                gsub(datadir, "%{_datadir}", $c)
        }
 
-       # bash completions dir, after datadir change
+       # completions dir, after datadir change
        gsub("%{_datadir}/bash-completion/completions", "%{bash_compdir}")
+       gsub("%{_datadir}/fish/vendor_completions.d", "%{fish_compdir}")
+       gsub("%{_datadir}/zsh/site-functions", "%{zsh_compdir}")
 
        gsub("%{prefix}/share", "%{_datadir}")
        if (prefix"/share" == datadir)
@@ -1483,6 +1490,9 @@ function use_macros()
        gsub(/%__cat/, "cat")
        gsub(/%__chmod/, "chmod")
 
+       gsub(/%desktop_database_postun/, "%update_desktop_database")
+       gsub(/%desktop_database_post/, "%update_desktop_database")
+
        gsub("/usr/src/linux", "%{_kernelsrcdir}")
        gsub("%{_prefix}/src/linux", "%{_kernelsrcdir}")
 
@@ -1505,7 +1515,8 @@ function use_macros()
        }
 }
 
-function format_configure(line,                n, a, s) {
+function format_configure(line, # parameters
+                                       n, a, s) {  # locals
        n = split(line, a, / /)
        s = a[1] " \\\n"
        for (i = 2; i <= n; i++) {
@@ -1517,7 +1528,8 @@ function format_configure(line,           n, a, s) {
 
 # insertion sort of A[1..n]
 # copied from mawk manual
-function isort(A,n,            i,j,hold) {
+function isort(A,n, # parameters
+               i,j,hold) { # locals
        for (i = 2; i <= n; i++) {
                hold = A[j = i]
                while (A[j-1] > hold) {
@@ -1528,9 +1540,9 @@ function isort(A,n,               i,j,hold) {
        # sentinel A[0] = "" will be created if needed
 }
 
+function use_files_macros( # no parameters
+               i, n, t, a, l) {   # locals
 
-function use_files_macros(     i, n, t, a, l)
-{
        use_macros()
 
        # skip comments
@@ -1773,6 +1785,9 @@ function unify_url(url)
        # sourceforge urls
        # Docs about sourceforge mirror system: http://sourceforge.net/apps/trac/sourceforge/wiki/Mirrors
 
+       # 0. strip "#", rpm5 chops it off
+       sub("#.*", "", url)
+
        # 1. unify domains
        sub("^http://prdownloads\.sourceforge\.net/", "http://downloads.sourceforge.net/", url)
        sub("^http://download\.sf\.net/", "http://downloads.sourceforge.net/", url)
@@ -1880,7 +1895,8 @@ function kill_preamble_macros()
        }
 }
 
-function get_epoch(pkg, ver,   epoch)
+function get_epoch(pkg, ver, # parameters
+                                       epoch)   # locals
 {
        return
 # should parse the BR lines more adequately:
@@ -1892,7 +1908,8 @@ function get_epoch(pkg, ver,      epoch)
        return epoch
 }
 
-function format_requires(tag, value,   n, p, i, deps, ndeps) {
+function format_requires(tag, value, # parameters
+                       n, p, i, deps, ndeps) {  # locals
        # skip any formatting for commented out items or some weird macros
        if (/^#/ || /%\(/) {
                return tag "\t" value
@@ -1931,9 +1948,10 @@ function add_br(br)
        BR[BR_count++] = br
 }
 
-# Load rpm macros
+# {{{ Load rpm macros
 # you should update the list also in adapter when making changes here
-function import_rpm_macros(  v) {
+function import_rpm_macros( # no parameters
+                                       v) {    # locals
        # File with rpm groups
        topdir = ENVIRON["_topdir"]
 
@@ -2009,9 +2027,11 @@ function import_rpm_macros(  v) {
        systemduserunitdir = ENVIRON["systemduserunitdir"]
        systemdtmpfilesdir = ENVIRON["systemdtmpfilesdir"]
 }
+# }}}
 
-# replace opam names (caml)
-function replace_opam_deps(field,     name) {
+# {{{ replace opam names (caml)
+function replace_opam_deps(field, # paramters
+                                               name) {   # locals
        name = $2
        if (name ~ "^(cryptokit|extlib|xmlm)$") {
                name = "ocaml-" name
@@ -2035,8 +2055,9 @@ function replace_opam_deps(field,     name) {
                $2 = name
        }
 }
+# }}}
 
-# php virtual deps as discussed in devel-en
+# {{{ php virtual deps as discussed in devel-en
 function replace_php_virtual_deps(field) {
        pkg = $2
 #      if (pkg == "php-program") {
@@ -2074,6 +2095,7 @@ function replace_php_virtual_deps(field) {
                }
        }
 }
+# }}}
 
 # {{{ replace_groupnames(group)
 function replace_groupnames(group) {
@@ -2151,7 +2173,8 @@ function replace_groupnames(group) {
 # }}}
 
 # {{{ replace_pkgconfig(pkg)
-function replace_pkgconfig(pkg,    cmd, path, n, i, line) {
+function replace_pkgconfig(pkg,  # parameters
+               cmd, path, n, i, line) { # locals
        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"
@@ -2170,7 +2193,8 @@ function replace_pkgconfig(pkg,    cmd, path, n, i, line) {
 # }}}
 
 # {{{ replace_perlmod(pkg)
-function replace_perlmod(pkg, version,   cmd, line) {
+function replace_perlmod(pkg, version, # parameters
+                                               cmd, line) {   # locals
        # do nothing if version is specified
        if (version) {
                return
@@ -2188,9 +2212,11 @@ function replace_perlmod(pkg, version,   cmd, line) {
                return
        }
 }
+# }}}
 
 # {{{ replace_pythonegg(pkg)
-function replace_pythonegg(pkg,    cmd, line) {
+function replace_pythonegg(pkg, # parameters
+                               cmd, line) {    # locals
        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) {
@@ -2205,7 +2231,9 @@ function replace_pythonegg(pkg,    cmd, line) {
 }
 # }}}
 
-function replace_requires(field,   pkg) {
+# {{{ replace_requires
+function replace_requires(field, # parameters
+                                               pkg) {   # locals
        # strip %{?_isa}
        if ($2 ~ /_isa/) {
                $2 = fixedsub("%{?_isa}", "", $2);
@@ -2322,11 +2350,10 @@ function replace_requires(field,   pkg) {
 
        # {{{ fedora / redhat
        sub(/^Django$/, "python-django", $2)
+       sub(/^qt5-qtwebkit-devel$/, "Qt5WebKit-devel", $2)
        sub(/^GitPython$/, "python-git", $2)
        sub(/^MySQL-python$/, "python-MySQLdb", $2)
        sub(/^NetworkManager-glib-devel$/, "NetworkManager-devel", $2)
-       sub(/^python-docker-py$/, "python-docker", $2)
-       sub(/^python3-docker-py$/, "python3-docker", $2)
        sub(/^PyQt4-devel$/, "python-PyQt4-devel", $2)
        sub(/^PyQwt-devel$/, "python-PyQwt-devel", $2)
        sub(/^PyYAML$/, "python-PyYAML", $2)
@@ -2361,6 +2388,7 @@ function replace_requires(field,   pkg) {
        sub(/^iscsi-initiator-utils$/, "open-iscsi", $2)
        sub(/^kdelibs4-devel$/, "kde4-kdelibs-devel", $2)
        sub(/^keyutils-libs-devel$/, "keyutils-devel", $2)
+       sub(/^lasso-python$/, "python-lasso", $2)
        sub(/^libICE-devel$/, "xorg-lib-libICE-devel", $2)
        sub(/^libSM-devel$/, "xorg-lib-libSM-devel", $2)
        sub(/^libX11-devel$/, "xorg-lib-libX11-devel", $2)
@@ -2428,6 +2456,7 @@ function replace_requires(field,   pkg) {
        sub(/^python-PyQt4-devel$/, "sip-PyQt4", $2)
        sub(/^python-crypto$/, "python-Crypto", $2)
        sub(/^python-cups$/, "python-pycups", $2)
+       sub(/^python-docker-py$/, "python-docker", $2)
        sub(/^python-enchant$/, "python-pyenchant", $2)
        sub(/^python-imaging$/, "python-PIL", $2)
        sub(/^python-imaging-tk$/, "python-PIL-tk", $2)
@@ -2448,6 +2477,7 @@ function replace_requires(field,   pkg) {
        sub(/^python-zope.component$/, "Zope-Component", $2)
        sub(/^python-zope.interface$/, "Zope-Interface", $2)
        sub(/^python2-devel$/, "python-devel", $2)
+       sub(/^python3-docker-py$/, "python3-docker", $2)
        sub(/^pytz$/, "python-pytz", $2)
        sub(/^pyxdg$/, "python-pyxdg", $2)
        sub(/^qt4-devel$/, "qt4-build", $2)
@@ -2529,6 +2559,9 @@ function replace_requires(field,   pkg) {
 
        # {{{ suse/opensuse
        sub(/^alsa-devel$/, "alsa-lib-devel", $2)
+       sub(/^python-djangorestframework$/, "python-django-rest-framework", $2)
+       sub(/^python-django_compressor$/, "python-django-compressor", $2)
+       sub(/^bitstream-vera$/, "fonts-TTF-bitstream-vera", $2)
        sub(/^gtk-sharp2$/, "dotnet-gtk-sharp2", $2)
        sub(/^gtkmm2-devel$/, "gtkmm-devel", $2)
        sub(/^libexpat-devel$/, "expat-devel", $2)
@@ -2538,6 +2571,9 @@ function replace_requires(field,   pkg) {
        sub(/^libpulse-devel$/, "pulseaudio-devel", $2)
        sub(/^libqt4-devel$/, "qt4-build, qt4-qmake, QtCore-devel", $2)
        sub(/^monodoc-core$/, "mono-monodoc", $2)
+       sub(/^python-Babel$/, "python-babel", $2)
+       sub(/^python-Django$/, "python-django", $2)
+       sub(/^python-Pillow$/, "python-pillow", $2)
        sub(/^python-cairo$/, "python-pycairo", $2)
        sub(/^python-gobject$/, "python-pygobject", $2)
        sub(/^python-gstreamer-0_10$/, "python-gstreamer", $2)
@@ -2549,5 +2585,6 @@ function replace_requires(field,   pkg) {
 
        replace_opam_deps(field)
 }
+# }}}
 
 # vim:ts=4:sw=4 fdm=marker
This page took 0.044945 seconds and 4 git commands to generate.