]> git.pld-linux.org Git - packages/adapter.git/blobdiff - adapter.awk
- Networking/Daemons/HTTP
[packages/adapter.git] / adapter.awk
index 3d6c776dc937e319322ad6d6e1ee26ab13c41370..d2403cb1c8985bc182d8816db4df93069a8122cb 100644 (file)
@@ -1,7 +1,6 @@
 #!/usr/bin/gawk -f
 #
-# This is adapter v0.30. Adapter adapts .spec files for PLD Linux.
-# $Id$
+# Adapter adapts .spec files for PLD Linux.
 #
 # Copyright (C) 1999-2007 PLD-Team <feedback@pld-linux.org>
 # Authors:
@@ -30,6 +29,10 @@ BEGIN {
        RPM_SECTIONS = "package|build|changelog|clean|description|install|post|posttrans|postun|pre|prep|pretrans|preun|triggerin|triggerpostun|triggerun|verifyscript|check"
        SECTIONS = "^%(" RPM_SECTIONS ")"
 
+       RCSID = "$Id$"
+       rev = RCSID # TODO: parse from RCSID
+       VERSION = "0.31/" rev
+
        PREAMBLE_TAGS = "(R|BR|Summary|Name|Version|Release|Epoch|License|Group|URL|BuildArch|BuildRoot|Obsoletes|Conflicts|Provides|ExclusiveArch|ExcludeArch|Pre[Rr]eq|(Build)?Requires|Suggests)"
 
        usedigest = 0   # Enable to switch to rpm 4.4.6+ md5 digests
@@ -77,6 +80,7 @@ BEGIN {
        "rpm --eval %_examplesdir"      | getline examplesdir
        "rpm --eval %_defaultdocdir"    | getline docdir
        "rpm --eval %_kdedocdir"        | getline kdedocdir
+       "rpm --eval %_gtkdocdir"        | getline gtkdocdir
        "rpm --eval %_desktopdir" | getline desktopdir
        "rpm --eval %_pixmapsdir" | getline pixmapsdir
        "rpm --eval %_javadir" | getline javadir
@@ -91,6 +95,7 @@ BEGIN {
        "rpm --eval %py_sitescriptdir 2>/dev/null" | getline py_sitescriptdir
        "rpm --eval %py_sitedir 2>/dev/null" | getline py_sitedir
        "rpm --eval %py_scriptdir 2>/dev/null" | getline py_scriptdir
+       "rpm --eval %py_ver 2>/dev/null" | getline py_ver
 
        "rpm --eval %ruby_archdir" | getline ruby_archdir
        "rpm --eval %ruby_ridir" | getline ruby_ridir
@@ -99,6 +104,7 @@ BEGIN {
        "rpm --eval %ruby_sitelibdir" | getline ruby_sitelibdir
 
        "rpm --eval %php_pear_dir" | getline php_pear_dir
+       "rpm --eval %php_data_dir" | getline php_data_dir
        "rpm --eval %tmpdir" | getline tmpdir
 }
 
@@ -528,7 +534,9 @@ function b_makekey(a, b,    s) {
        if ($0 ~ /^%files/)
                defattr = 1
 
-       use_files_macros()
+       if (!use_files_macros()) {
+               next
+       }
 }
 
 ##############
@@ -1179,12 +1187,20 @@ function use_macros()
                        continue;
                if ($c ~ sysconfdir "/dbus-1")
                        continue;
+               if ($c ~ sysconfdir "/tmpwatch")
+                       continue;
                gsub(sysconfdir, "%{_sysconfdir}", $c)
        }
 
-       gsub(kdedocdir, "%{_kdedocdir}")
        gsub(docdir, "%{_docdir}")
+
+       gsub(kdedocdir, "%{_kdedocdir}")
+
+       gsub(gtkdocdir, "%{_gtkdocdir}")
+       gsub("%{_docdir}/gtk-doc/html", "%{_gtkdocdir}")
+
        gsub(php_pear_dir, "%{php_pear_dir}")
+       gsub(php_data_dir, "%{php_data_dir}")
 
        for (c = 1; c <= NF; c++) {
                if ($c ~ datadir "/automake")
@@ -1324,6 +1340,8 @@ function use_macros()
                add_br("BuildRequires:  rpmbuild(macros) >= 1.300");
        }
 
+       $0 = fixedsub("%(%{__cc} -dumpversion)", "%{cc_version}", $0);
+       $0 = fixedsub("%(%{__cxx} -dumpversion)", "%{cxx_version}", $0);
 }
 
 function format_configure(line,                n, a, s) {
@@ -1350,13 +1368,13 @@ function isort(A,n,             i,j,hold) {
 }
 
 
-function use_files_macros(     i, n, t, a)
+function use_files_macros(     i, n, t, a, l)
 {
        use_macros()
 
        # skip comments
        if (/^#/) {
-               return;
+               return 1;
        }
 
        sub("^%doc %{_mandir}", "%{_mandir}")
@@ -1387,6 +1405,8 @@ function use_files_macros(        i, n, t, a)
        gsub("%{_sysconfdir}/certs", "/etc/certs")
        gsub("%{_sysconfdir}/init.d", "/etc/init.d")
        gsub("%{_sysconfdir}/dbus-1", "/etc/dbus-1")
+       gsub("%{_sysconfdir}/pki", "/etc/pki")
+       gsub("%{_sysconfdir}/tmpwatch", "/etc/tmpwatch")
 
        # /etc/init.d -> /etc/rc.d/init.d
        if (!/^\/etc\/init\.d$/) {
@@ -1474,6 +1494,32 @@ function use_files_macros(       i, n, t, a)
                $(NF + 1) = "# FIXME consider using %find_lang"
        }
 
+       # python egg-infos
+       if (match($0, "^%{py_site(script)?dir}/.+-py"py_ver".egg-info$")) {
+               # tests:
+               #%{py_sitedir}/*-py2.4.egg-info
+               #%{py_sitescriptdir}/GnuPGInterface-%{version}-py2.4.egg-info
+               #%{py_sitescriptdir}/python_mpd-%{version}-py2.4.egg-info
+               #%{py_sitescriptdir}/mechanize-0.1.6b-py2.4.egg-info
+
+               l = index($0, "/");
+               t = substr($0, 0, l);
+               s = substr($0, l + 1, RLENGTH - l - length("-py"py_ver".egg-info"));
+               if (match(s, "[^-]+$")) {
+#printf("s[%s]; start[%d]; length[%d]\n", s, RSTART, RLENGTH);
+                       if (RSTART > 1) {
+                               s = substr(s, 0, RSTART - 1);
+                       }
+#printf("s2[%s]\n", s);
+                       print "%if \"%{py_ver}\" > \"2.4\""
+#print t "/.+.egg-info"
+                       gsub(t "/.+.egg-info", t "/" s "-*.egg-info");
+                       print
+                       print "%endif"
+                       return 0;
+               }
+       }
+
        # atrpms
        $0 = fixedsub("%{perl_man1dir}", "%{_mandir}/man1", $0);
        $0 = fixedsub("%{perl_man3dir}", "%{_mandir}/man3", $0);
@@ -1486,6 +1532,10 @@ function use_files_macros(       i, n, t, a)
        gsub("%{_datadir}/applications", "%{_desktopdir}");
        gsub("%{_datadir}/icons", "%{_iconsdir}");
        gsub("%{_datadir}/pixmaps", "%{_pixmapsdir}");
+       gsub("%{_datadir}/pear", "%{php_pear_dir}");
+       gsub("%{_datadir}/php", "%{php_data_dir}");
+
+       return 1
 }
 
 function use_script_macros()
@@ -1775,6 +1825,12 @@ function replace_groupnames(group)
        sub(/^Development\/Python$/, "Development/Languages/Python", group)
        sub(/^System\/Kernel and hardware$/, "Base/Kernel", group)
        sub(/^Application\/System$/, "Applications/System", group)
+       sub(/^Productivity\/Databases\/Servers$/, "Applications/Databases", group)
+       sub(/^Development\/Libraries\/Python$/, "Development/Languages/Python", group)
+       sub(/^Development\/Languages\/Ruby$/, "Development/Languages", group)
+       sub(/^Development\/Libraries\/TCL$/, "Development/Languages/Tcl", group);
+       sub(/^Development\/Languages\/Other$/, "Development/Languages", group);
+       sub(/^Productivity\/Networking\/Web\/Servers$/, "Networking/Daemons/HTTP", group);
 
        return group;
 }
This page took 0.145499 seconds and 4 git commands to generate.