]> git.pld-linux.org Git - packages/rpm-build-tools.git/blobdiff - adapter.awk
- release 3 (by relup.sh)
[packages/rpm-build-tools.git] / adapter.awk
index a5d53d2afd1c9b460b386b4ef3003ea86af81a89..738c25d7f99663266e77b761453b11bc608e66fb 100644 (file)
@@ -12,7 +12,7 @@
 #      Jakub Bogusz <qboosh@pld-linux.org>
 #      Elan Ruusamäe <glen@pld-linux.org>
 #
-# See cvs log adapter{,.awk} for list of contributors
+# See git log adapter{,.awk} for list of contributors
 #
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 
@@ -255,6 +255,11 @@ function b_makekey(a, b,   s) {
        next
 }
 
+# %package part
+/^%package/, (!/^%package/ && $0 ~ SECTIONS) {
+       gsub(/\t/, " ");
+}
+
 ################
 # %description #
 ################
@@ -492,6 +497,10 @@ function b_makekey(a, b,   s) {
        if (/^install/ && /-m[ \t]*[0-9]+/)
                gsub(/-m[ \t]*[0-9]+ /, "")
 
+       # install without options -> cp -p
+       if (/^install [^-]/)
+               gsub(/^install/, "cp -p")
+
        # No lines contain 'chown' or 'chgrp' if owner/group is 'root'
        if (($1 ~ /chown/ && $2 ~ /root\.root/) || ($1 ~ /chgrp/ && $2 ~ /root/))
                next
@@ -632,6 +641,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);
@@ -741,7 +760,15 @@ preamble == 1 {
                if (l == "Python Software Foundation License") {
                        l = "PSF"
                }
-               if (l == "Apache License 2.0" || l == "Apache 2.0" || l == "Apache License Version 2.0" || l == "Apache License, Version 2.0" || l == "Apache Software License v2") {
+               if (l == "Apache License 2.0" || \
+                          l == "Apache 2.0" || \
+                          l == "Apache 2" || \
+                          l == "Apache License (2.0)" ||
+                          l == "Apache License Version 2.0" || \
+                          l == "Apache License, Version 2.0" || \
+                          l == "Apache Software License v2" || \
+                          l == "ASL 2.0" \
+                       ) {
                        l = "Apache v2.0"
                }
                if (l == "Apache Group License" || l == "Apache Software License" || l == "Apache License") {
@@ -756,6 +783,9 @@ preamble == 1 {
                if (l == "GPLv2") {
                        l = "GPL v2"
                }
+               if (l == "The BSD 3-Clause License") {
+                       l = "BSD"
+               }
                if (l == "GPLv2+") {
                        l = "GPL v2+"
                }
@@ -1058,6 +1088,7 @@ function use_macros()
        }
 
        sub("%{_defaultdocdir}", "%{_docdir}");
+       sub("%{_datadir}/doc", "%{_docdir}");
        sub("%{_bindir}/perl", "%{__perl}");
        sub("%{_bindir}/python", "%{__python}");
 
@@ -1077,14 +1108,24 @@ function use_macros()
        gsub(py3_sitescriptdir, "%{py3_sitescriptdir}")
        gsub(py3_sitedir, "%{py3_sitedir}")
        gsub(py3_scriptdir, "%{py3_scriptdir}")
+       gsub("%{python3_sitelib}", "%{py3_sitescriptdir}")
+       gsub("%{python3_version}", "%{py3_ver}")
 
        gsub(ruby_archdir, "%{ruby_archdir}")
-       gsub(ruby_ridir, "%{ruby_ridir}")
-       gsub(ruby_rubylibdir, "%{ruby_rubylibdir}")
+       gsub(ruby_libdir, "%{ruby_libdir}")
+
        gsub(ruby_sitearchdir, "%{ruby_sitearchdir}")
        gsub(ruby_sitelibdir, "%{ruby_sitelibdir}")
+       gsub(ruby_sitedir, "%{ruby_sitedir}")
+       gsub(ruby_vendorarchdir, "%{ruby_vendorarchdir}")
+       gsub(ruby_vendorlibdir, "%{ruby_vendorlibdir}")
+       gsub(ruby_vendordir, "%{ruby_vendordir}")
+       gsub(ruby_rubylibdir, "%{ruby_rubylibdir}") # deprecated
        gsub(ruby_rdocdir, "%{ruby_rdocdir}")
+       gsub(ruby_ridir, "%{ruby_ridir}")
+       gsub(ruby_specdir, "%{ruby_specdir}")
 
+       gsub("%{_unitdir}", "%{systemdunitdir}")
        gsub(systemdunitdir, "%{systemdunitdir}")
        gsub(systemdtmpfilesdir, "%{systemdtmpfilesdir}")
 
@@ -1149,6 +1190,8 @@ function use_macros()
                        continue;
                if ($c ~ sysconfdir "/{?pam.d")
                        continue;
+               if ($c ~ sysconfdir "/{?apparmor.d")
+                       continue;
                if ($c ~ sysconfdir "/{?profile.d")
                        continue;
                if ($c ~ sysconfdir "/{?rc.d")
@@ -1175,6 +1218,12 @@ function use_macros()
                        continue;
                if ($c ~ sysconfdir "/{?xdg")
                        continue;
+               if ($c ~ sysconfdir "/{?NetworkManager")
+                       continue;
+               if ($c ~ sysconfdir "/{?default")
+                       continue;
+               if ($c ~ sysconfdir "/{?pm")
+                       continue;
                if ($c ~ sysconfdir "/shells")
                        continue;
                if ($c ~ sysconfdir "/inittab")
@@ -1803,7 +1852,7 @@ function import_rpm_macros(  v) {
        }
 
        # update this version dep each time some new macro export is added
-       v = 1.49
+       v = 1.51
        if (!ENVIRON["ADAPTER_REVISION"] || ENVIRON["ADAPTER_REVISION"] < v) {
                printf("adapter shell script is outdated: Need %s, got %s. Please update it.\n", v, ENVIRON["ADAPTER_REVISION"]) > "/dev/stderr"
                do_not_touch_anything = 1
@@ -1848,11 +1897,17 @@ function import_rpm_macros(  v) {
        py3_ver = ENVIRON["py3_ver"]
 
        ruby_archdir = ENVIRON["ruby_archdir"]
-       ruby_ridir = ENVIRON["ruby_ridir"]
-       ruby_rubylibdir = ENVIRON["ruby_rubylibdir"]
+       ruby_libdir = ENVIRON["ruby_libdir"]
+       ruby_sitedir = ENVIRON["ruby_sitedir"]
        ruby_sitearchdir = ENVIRON["ruby_sitearchdir"]
        ruby_sitelibdir = ENVIRON["ruby_sitelibdir"]
+       ruby_vendordir = ENVIRON["ruby_vendordir"]
+       ruby_vendorarchdir = ENVIRON["ruby_vendorarchdir"]
+       ruby_vendorlibdir = ENVIRON["ruby_vendorlibdir"]
+       ruby_rubylibdir = ENVIRON["ruby_rubylibdir"] # deprecated
        ruby_rdocdir = ENVIRON["ruby_rdocdir"]
+       ruby_ridir = ENVIRON["ruby_ridir"]
+       ruby_specdir = ENVIRON["ruby_specdir"]
 
        php_pear_dir = ENVIRON["php_pear_dir"]
        php_data_dir = ENVIRON["php_data_dir"]
@@ -1862,6 +1917,32 @@ function import_rpm_macros(  v) {
        systemdtmpfilesdir = ENVIRON["systemdtmpfilesdir"]
 }
 
+# replace opam names (caml)
+function replace_opam_deps(field,     name) {
+       name = $2
+       if (name ~ "^(cryptokit|extlib|xmlm)$") {
+               name = "ocaml-" name;
+       } else if (name ~ "^(biniou|easy-format|yojson|gapi-ocaml)$") {
+               name = "ocaml-" name "-devel";
+       } else if (name == "ocamlfind") {
+               name = "ocaml-findlib"
+       } else if (name == "sqlite3-ocaml") {
+               name = "ocaml-sqlite"
+       } else if (name == "ocamlnet") {
+               name = "ocaml-net"
+       } else if (name == "ocurl") {
+               name = "ocaml-curl-devel"
+       } else if (name == "ocamlfuse") {
+               name = "ocaml-fuse-devel"
+       } else if (name == "camlidl") {
+               name = "ocaml-idl-devel"
+       }
+
+       if (name != $2) {
+               $2 = name;
+       }
+}
+
 # php virtual deps as discussed in devel-en
 function replace_php_virtual_deps(field) {
        pkg = $2
@@ -1893,6 +1974,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 +2014,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 +2045,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 +2064,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 +2089,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);
 
@@ -2018,11 +2126,14 @@ function replace_requires(field,   pkg) {
        sub(/^jakarta-ant$/, "ant", $2);
        sub(/^jakarta-commons-codec$/, "java-commons-codec", $2);
        sub(/^jakarta-commons-httpclient$/, "java-commons-httpclient", $2);
+       sub(/^jakarta-commons-lang24$/, "java-commons-lang", $2);
        sub(/^jakarta-commons-logging$/, "java-commons-logging", $2);
+       sub(/^jakarta-commons-net$/, "java-commons-net", $2);
        sub(/^jakarta-log4j$/, "java-log4j", $2);
        sub(/^jakarta-oro$/, "java-oro", $2);
        sub(/^jakarta-servletapi$/, "java(servlet)", $2);
        sub(/^java-devel$/, "jdk", $2);
+       sub(/^java-dom$/, "java-dom4j", $2);
        sub(/^java\(JSP\)$/, "java(jsp)", $2);
        sub(/^java\(JavaServerFaces\)$/, "java(javaserverfaces)", $2);
        sub(/^java\(Portlet\)$/, "java(portlet)", $2);
@@ -2077,13 +2188,17 @@ function replace_requires(field,   pkg) {
        sub(/^Django$/, "python-django", $2);
        sub(/^GitPython$/, "python-git", $2);
        sub(/^MySQL-python$/, "python-MySQLdb", $2);
+       sub(/^NetworkManager-glib-devel$/, "NetworkManager-devel", $2);
        sub(/^PyQt4-devel$/, "python-PyQt4-devel", $2);
        sub(/^PyQwt-devel$/, "python-PyQwt-devel", $2);
+       sub(/^PyYAML$/, "python-PyYAML", $2);
        sub(/^ccid$/, "pcsc-driver-ccid", $2);
        sub(/^chkconfig$/, "/sbin/chkconfig", $2);
        sub(/^db4-devel$/, "db-devel", $2);
        sub(/^dbus-python$/, "python-dbus", $2);
        sub(/^desktop-notification-daemon$/, "dbus(org.freedesktop.Notifications)", $2);
+       sub(/^device-mapper-multipath$/, "multipath-tools", $2);
+       sub(/^django-tagging$/, "python-django_tagging", $2);
        sub(/^elfutils-libelf-devel$/, "elfutils-devel", $2);
        sub(/^file-devel$/, "libmagic-devel", $2);
        sub(/^freetype2-devel$/, "freetype-devel", $2);
@@ -2098,9 +2213,11 @@ function replace_requires(field,   pkg) {
        sub(/^gtk-sharp2-devel$/, "dotnet-gtk-sharp2-devel", $2);
        sub(/^gtk2$/, "gtk+2", $2);
        sub(/^gtk2-devel$/, "gtk+2-devel", $2);
+       sub(/^gtk3$/, "gtk+3", $2);
        sub(/^gtk3-devel$/, "gtk+3-devel", $2);
        sub(/^initscripts$/, "rc-scripts", $2);
        sub(/^iproute$/, "iproute2", $2);
+       sub(/^iptables-ipv6$/, "iptables", $2);
        sub(/^iscsi-initiator-utils$/, "open-iscsi", $2);
        sub(/^keyutils-libs-devel$/, "keyutils-devel", $2);
        sub(/^libSM-devel$/, "xorg-lib-libSM-devel", $2);
@@ -2115,10 +2232,13 @@ function replace_requires(field,   pkg) {
        sub(/^libXinerama-devel$/, "xorg-lib-libXinerama-devel", $2);
        sub(/^libXrandr-devel$/, "xorg-lib-libXrandr-devel", $2);
        sub(/^libXrender-devel$/, "xorg-lib-libXrender-devel", $2);
+       sub(/^libXt-devel$/, "xorg-lib-libXt-devel", $2);
        sub(/^libXtst-devel$/, "xorg-lib-libXtst-devel", $2);
        sub(/^libXv-devel$/, "xorg-lib-libXv-devel", $2);
+       sub(/^libXxf86misc-devel$/, "xorg-lib-libXxf86misc-devel", $2);
        sub(/^libXxf86vm-devel$/, "xorg-lib-libXxf86vm-devel", $2);
        sub(/^libacl-devel$/, "acl-devel", $2);
+       sub(/^libattr-devel$/, "attr-devel", $2);
        sub(/^libcurl-devel$/, "curl-devel", $2);
        sub(/^libgudev1-devel$/, "udev-glib-devel", $2);
        sub(/^libmx-devel$/, "mx-devel", $2);
@@ -2129,6 +2249,7 @@ function replace_requires(field,   pkg) {
        sub(/^libtevent$/, "tevent", $2);
        sub(/^libtevent-devel$/, "tevent-devel", $2);
        sub(/^libusb1-devel$/, "libusb-devel", $2);
+       sub(/^libuser-python$/, "python-libuser", $2);
        sub(/^libxkbfile-devel$/, "xorg-lib-libxkbfile", $2);
        sub(/^mod_wsgi$/, "apache-mod_wsgi", $2);
        sub(/^newt-python$/, "python-snack", $2);
@@ -2139,13 +2260,19 @@ function replace_requires(field,   pkg) {
        sub(/^pycairo$/, "python-pycairo", $2);
        sub(/^pyflakes$/, "python-pyflakes", $2);
        sub(/^pygobject2$/, "python-pygobject", $2);
+       sub(/^pygobject3$/, "python-pygobject3", $2);
        sub(/^pygobject3-devel$/, "python-pygobject3-common-devel", $2);
        sub(/^pygtk2$/, "python-pygtk", $2);
        sub(/^pygtk2-devel$/, "python-pygtk-devel", $2);
        sub(/^pygtk2-libglade$/, "python-pygtk-glade", $2);
+       sub(/^pykickstart$/, "python-pykickstart", $2);
+       sub(/^pyparsing$/, "python-pyparsing", $2);
+       sub(/^pyparted$/, "python-parted", $2);
        sub(/^pysvn$/, "python-pysvn", $2);
        sub(/^pytalloc$/, "python-talloc", $2);
        sub(/^pytalloc-devel$/, "python-talloc-devel", $2);
+       sub(/^pytest$/, "python-pytest", $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);
@@ -2153,11 +2280,13 @@ function replace_requires(field,   pkg) {
        sub(/^python-newt$/, "python-snack", $2);
        sub(/^python-pygtk$/, "python-pygtk-gtk", $2);
        sub(/^python-recaptcha-client$/, "python-recaptcha", $2);
-       sub(/^python-twisted-core$/, "python-TwistedCore", $2);
+       sub(/^python-sphinx$/, "python-Sphinx", $2);
+       sub(/^python-twisted$/, "python-TwistedCore", $2);
        sub(/^python-twisted-core$/, "python-TwistedCore", $2);
        sub(/^python-twisted-names$/, "python-TwistedNames", $2);
        sub(/^python2-devel$/, "python-devel", $2);
        sub(/^pytz$/, "python-pytz", $2);
+       sub(/^pyxdg$/, "python-pyxdg", $2);
        sub(/^qt4-devel$/, "qt4-build", $2);
        sub(/^qt4-webkit-devel$/, "QtWebKit-devel", $2);
        sub(/^qtlockedfile-devel$/, "QtLockedFile-devel", $2);
@@ -2233,7 +2362,7 @@ function replace_requires(field,   pkg) {
        sub(/^libssl-devel$/, "openssl-devel", $2);
        # }}}
 
-       # {{{ suse
+       # {{{ suse/opensuse
        sub(/^alsa-devel$/, "alsa-lib-devel", $2);
        sub(/^gtk-sharp2$/, "dotnet-gtk-sharp2", $2);
        sub(/^gtkmm2-devel$/, "gtkmm-devel", $2);
@@ -2242,10 +2371,16 @@ function replace_requires(field,   pkg) {
        sub(/^libopenssl-devel$/, "openssl-devel", $2);
        sub(/^libpulse-devel$/, "pulseaudio-devel", $2);
        sub(/^monodoc-core$/, "mono-monodoc", $2);
+       sub(/^python-cairo$/, "python-pycairo", $2);
+       sub(/^python-gobject$/, "python-pygobject", $2);
+       sub(/^python-gstreamer-0_10$/, "python-gstreamer", $2);
        sub(/^python-gtk$/, "python-pygtk-gtk", $2);
+       sub(/^python-xdg$/, "python-pyxdg", $2);
        # }}}
 
        replace_php_virtual_deps(field)
+
+       replace_opam_deps(field)
 }
 
 # vim:ts=4:sw=4 fdm=marker
This page took 1.898952 seconds and 4 git commands to generate.