]> git.pld-linux.org Git - packages/adapter.git/blobdiff - adapter.awk
subst docdir, convert requires(hint)
[packages/adapter.git] / adapter.awk
index 4ef5a727e178e651f6fc70cd6414b9143ace9c42..901099c65ea22f58d301847b91285ef2e4457447 100644 (file)
@@ -2,7 +2,7 @@
 #
 # Adapter adapts .spec files for PLD Linux.
 #
-# Copyright (C) 1999-2012 PLD-Team <feedback@pld-linux.org>
+# Copyright (C) 1999-2013 PLD-Team <feedback@pld-linux.org>
 # Authors:
 #      MichaƂ Kuratczyk <kura@pld.org.pl>
 #      Sebastian Zagrodzki <s.zagrodzki@mimuw.edu.pl>
@@ -632,6 +632,16 @@ preamble == 1 {
                release = "0." fixedsub(".%{disttag}.at", "", $4)
        }
 
+       # deprecated. currently just resolves to name in $2
+       if (/^%pyrequires_eq.+/) {
+               $1 = "Requires:";
+       }
+
+       # F<16 had requires(hint)
+       if (/^Requires\(hint\):/) {
+               $1 = "Suggests:";
+       }
+
        field = tolower($1)
        if (field ~ /summary:/ && !/etc\.$/ && !/Inc\.$/) {
                sub(/\.$/, "", $0);
@@ -1058,6 +1068,7 @@ function use_macros()
        }
 
        sub("%{_defaultdocdir}", "%{_docdir}");
+       sub("%{_datadir}/doc", "%{_docdir}");
        sub("%{_bindir}/perl", "%{__perl}");
        sub("%{_bindir}/python", "%{__python}");
 
@@ -1085,6 +1096,7 @@ function use_macros()
        gsub(ruby_sitelibdir, "%{ruby_sitelibdir}")
        gsub(ruby_rdocdir, "%{ruby_rdocdir}")
 
+       gsub("%{_unitdir}", "%{systemdunitdir}")
        gsub(systemdunitdir, "%{systemdunitdir}")
        gsub(systemdtmpfilesdir, "%{systemdtmpfilesdir}")
 
@@ -1893,6 +1905,7 @@ function replace_php_virtual_deps(field) {
        }
 }
 
+# {{{ replace_groupnames(group)
 function replace_groupnames(group) {
        group = replace(group, "Amusements/Games", "Applications/Games");
        group = replace(group, "Amusements/Games/Strategy/Real Time", "X11/Applications/Games/Strategy");
@@ -1932,6 +1945,7 @@ function replace_groupnames(group) {
        group = replace(group, "Productivity/Databases/Servers", "Applications/Databases");
        group = replace(group, "Productivity/Multimedia/Other", "X11/Applications/Multimedia");
        group = replace(group, "Productivity/Networking/Web/Servers", "Networking/Daemons/HTTP");;
+       group = replace(group, "Python/Libraries", "Libraries/Python");
        group = replace(group, "Shells", "Applications/Shells");
        group = replace(group, "System Environment/Base", "Base");
        group = replace(group, "System Environment/Daemons", "Daemons");
@@ -1962,8 +1976,10 @@ function replace_groupnames(group) {
 
        return group;
 }
+# }}}
 
-function replace_pkgconfig(pkg,    cmd, path, n, i, line, r) {
+# {{{ replace_pkgconfig(pkg)
+function replace_pkgconfig(pkg,    cmd, path, n, i, line) {
        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";
@@ -1979,6 +1995,23 @@ function replace_pkgconfig(pkg,    cmd, path, n, i, line, r) {
                }
        }
 }
+# }}}
+
+# {{{ replace_pythonegg(pkg)
+function replace_pythonegg(pkg,    cmd, line) {
+       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) {
+               return;
+       }
+
+       if (line !~ /no package provides/) {
+               # @modifies global $2
+               $2 = line;
+               return;
+       }
+}
+# }}}
 
 function replace_requires(field,   pkg) {
        # pkg-config -> package names
@@ -1987,6 +2020,12 @@ function replace_requires(field,   pkg) {
                replace_pkgconfig(pkg);
        }
 
+       # pythonegg -> package names
+       if (match($2, /pythonegg\(([^)]+)\)/)) {
+               pkg = substr($2, RSTART + 10, RLENGTH - 11);
+               replace_pythonegg(pkg);
+       }
+
        sub(/^python-setuptools-devel$/, "python-distribute", $2);
        sub(/^gcc-g77/, "gcc-fortran", $2);
 
This page took 0.137453 seconds and 4 git commands to generate.