#
# 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>
# 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
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
if (/CC=%{__cc} /) {
sub("CC=%{__cc}", "CC=\"%{__cc}\"")
}
-
+
# use PLD Linux macros
$0 = fixedsub("glib-gettextize --copy --force","%{__glib_gettextize}", $0);
$0 = fixedsub("intltoolize --copy --force", "%{__intltoolize}", $0);
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);
}
- if (field ~ /group(\([^)]+\)):/)
+ if (field ~ /group(\([^)]+\)):/) {
next
- if (field ~ /group:/) {
+ }
+
+ if (field == "group:") {
format_preamble()
group = $0;
sub(/^[^ \t]*[ \t]*/, "", group);
did_groups = 1
}
- if (field ~ /prereq:/) {
+ if (field == "prereq:") {
sub(/Pre[Rr]eq:/, "Requires:", $1);
}
}
# BR: tar (and others) is to common (rpm-build requires it)
- if (field ~ /^buildrequires:/) {
+ if (field == "buildrequires:") {
l = substr($0, index($0, $2));
if (l == "awk" ||
l == "binutils" ||
replace_requires(field);
}
- if (field ~ /^requires:/ || field ~ /^requires\(/) {
+ if (field == "requires:" || field ~ /^requires\(/) {
replace_requires(field);
}
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") {
}
sub("%{_defaultdocdir}", "%{_docdir}");
+ sub("%{_datadir}/doc", "%{_docdir}");
sub("%{_bindir}/perl", "%{__perl}");
sub("%{_bindir}/python", "%{__python}");
gsub(perl_vendorlib, "%{perl_vendorlib}")
gsub(perl_vendorarch, "%{perl_vendorarch}")
gsub(perl_sitelib, "%{perl_sitelib}")
-
+
gsub(py_sitescriptdir, "%{py_sitescriptdir}")
gsub(py_sitedir, "%{py_sitedir}")
gsub(py_scriptdir, "%{py_scriptdir}")
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("%{_unitdir}", "%{systemdunitdir}")
gsub(systemdunitdir, "%{systemdunitdir}")
gsub(systemdtmpfilesdir, "%{systemdtmpfilesdir}")
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")
continue;
if ($c ~ sysconfdir "/apm")
continue;
+ if ($c ~ sysconfdir "/modules-load\.d")
+ continue;
gsub(sysconfdir, "%{_sysconfdir}", $c)
}
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"]
php_pear_dir = ENVIRON["php_pear_dir"]
php_data_dir = ENVIRON["php_data_dir"]
# return
# }
- if (field == "requires") {
- if (pkg ~ /^php-(bcmath|bz2|calendar|ctype|curl|dba|dom|enchant|exif|fileinfo|filter|fpm|ftp|gd|gettext|gmp|hash|iconv|imap|interbase|intl|json|ldap|mbstring|mcrypt|mssql|mysql|mysqli|odbc|openssl|pcntl|pcre|pdo|pdo-dblib|pdo-firebird|pdo-mysql|pdo-odbc|pdo-pgsql|pdo-sqlite|pgsql|phar|posix|pspell|readline|recode|session|shmop|simplexml|snmp|soap|sockets|spl|sqlite|sqlite3|sybase-ct|sysvmsg|sysvsem|sysvshm|tidy|tokenizer|wddx|xml|xmlreader|xmlrpc|xmlwriter|xsl|zip|zlib)/) {
+ if (field == "requires:") {
+ if (pkg ~ /^php-(bcmath|bz2|calendar|ctype|curl|dba|date|dom|enchant|exif|fileinfo|filter|fpm|ftp|gd|gettext|gmp|hash|iconv|imap|interbase|intl|json|ldap|mbstring|mcrypt|mssql|mysql|mysqli|odbc|openssl|pcntl|pcre|pdo|pdo-dblib|pdo-firebird|pdo-mysql|pdo-odbc|pdo-pgsql|pdo-sqlite|pgsql|phar|posix|pspell|readline|recode|session|shmop|simplexml|snmp|soap|sockets|spl|sqlite|sqlite3|sybase-ct|sysvmsg|sysvsem|sysvshm|tidy|tokenizer|wddx|xml|xmlreader|xmlrpc|xmlwriter|xsl|zip|zlib)/) {
sub(/^php-/, "php(", pkg);
sub(/$/, ")", pkg);
$2 = pkg
}
}
- if (pkg ~/^php$/) {
- $2 = "webserver(php)";
+ if (pkg == "php" || pkg == "php-common") {
+ $2 = "php(core)";
if ($4 ~ /^[0-9]:/) {
$4 = substr($4, 3);
}
}
- if (pkg ~/^php4$/) {
+ if (pkg == "php4") {
$2 = "webserver(php)";
if ($4 ~ /^[0-9]:/) {
$4 = substr($4, 3);
}
}
+# {{{ 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");
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");
return group;
}
+# }}}
-function replace_requires(field) {
+# {{{ 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";
+ # Getline returns 0 on end-of-file, -1 on error, otherwise 1.
+ if ((cmd | getline line) <= 0) {
+ continue;
+ }
+
+ if (line !~ /No such file or directory/) {
+ # @modifies global $2
+ $2 = line;
+ return
+ }
+ }
+}
+# }}}
+
+# {{{ 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
+ if (match($2, /pkgconfig\(([^)]+)\)/)) {
+ pkg = substr($2, RSTART + 10, RLENGTH - 11);
+ 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);
# bad package.xml, see http://pear.php.net/bugs/bug.php?id=17779
sub(/^php-php-gtk/, "php-gtk2", $2);
- # jpackages / fedora java packages
+ # {{{ jpackages / fedora java packages
sub(/^antlr3$/, "java-antlr3", $2);
sub(/^aqute-bnd$/, "java-bnd", $2);
sub(/^avalon-framework$/, "java-avalon-framework", $2);
sub(/^xml-commons-resolver$/, "java-xml-commons-resolver", $2);
sub(/^xmldb-api$/, "java-xmldb", $2);
sub(/^xmldb-api-sdk$/, "java-xmldb-sdk", $2);
+ # }}}
- # fedora / redhat
+ # {{{ fedora / redhat
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);
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(/^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(/^libcurl-devel$/, "curl-devel", $2);
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);
sub(/^notify-python$/, "python-pynotify", $2);
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-cups$/, "python-pycups", $2);
sub(/^python-enchant$/, "python-pyenchant", $2);
sub(/^python-imaging$/, "python-PIL", $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);
sub(/^webkitgtk3-devel$/, "gtk-webkit3-devel", $2);
sub(/^xapian-bindings-python$/, "python-xapian", $2);
sub(/^xorg-x11-server-sdk$/, "xorg-xserver-server-devel", $2);
+ # }}}
- # mandriva
+ # {{{ mandriva
sub(/^python-gobject-devel$/, "python-pygobject-devel", $2);
sub(/^python-pyrex$/, "python-Pyrex", $2);
sub(/^webkitgtk-devel$/, "gtk-webkit-devel", $2);
sub(/^python-webkitgtk$/, "python-pywebkitgtk", $2);
sub(/^pygtk2.0$/, "python-pygtk-gtk", $2);
sub(/^gnome-python-gconf$/, "python-gnome-gconf", $2);
+ # }}}
- # debian / ubuntu
+ # {{{ debian / ubuntu
sub(/^blkid-dev$/, "libblkid-devel", $2);
sub(/^ext2fs-dev$/, "e2fsprogs-devel", $2);
sub(/^libao-dev$/, "libao-devel", $2);
sub(/^tcp_wrappers-devel$/, "libwrap-devel", $2);
sub(/^vala-tools$/, "vala", $2);
sub(/^vala-devel$/, "vala", $2);
+ # }}}
- # altlinux
+ # {{{ altlinux
sub(/^libatk-devel$/, "atk-devel", $2);
sub(/^libgit-devel$/, "git-core-devel", $2);
sub(/^libgtk\+2-devel$/, "gtk+2-devel", $2);
sub(/^libpcre-devel$/, "pcre-devel", $2);
sub(/^libpopt-devel$/, "popt-devel", $2);
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);
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)
}
-# vim:ts=4:sw=4
+# vim:ts=4:sw=4 fdm=marker