X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=adapter.awk;h=fd5cd795d58d7945ffb3de339c0e2ca91cd30260;hb=c514f1f6ae2d7bcd3d121249c794b51a912d6df2;hp=c12081fb836dcc89c05539108dbbb89a8e931925;hpb=5919d837d6699fae0bc97f5fd6ba56522b84d858;p=packages%2Frpm-build-tools.git diff --git a/adapter.awk b/adapter.awk index c12081f..fd5cd79 100644 --- a/adapter.awk +++ b/adapter.awk @@ -2,7 +2,7 @@ # # Adapter adapts .spec files for PLD Linux. # -# Copyright (C) 1999-2010 PLD-Team +# Copyright (C) 1999-2011 PLD-Team # Authors: # Michał Kuratczyk # Sebastian Zagrodzki @@ -66,7 +66,7 @@ BEGIN { system("[ -d ../PLD-doc ] && cd ../PLD-doc && ([ -f BuildRequires.txt ] || cvs up BuildRequires.txt >/dev/null)"); # Temporary file for changelog section - changelog_file = ENVIRON["HOME"] "/tmp/adapter.changelog" + changelog_file = mktemp("adapter.changelogXXXXXX") } # There should be a comment with CVS keywords on the first line of file. @@ -93,6 +93,12 @@ defattr == 1 { defattr = 0 } +# call mktemp(1) and return the value +function mktemp(template, tmp) { + "mktemp " template | getline tmp + return tmp +} + function b_makekey(a, b, s) { s = a "" b; # kill bcond @@ -354,6 +360,11 @@ function b_makekey(a, b, s) { } sub("^%patch ", "%patch0 "); + # fedora extras + if (/^%apply/) { + sub("^%apply -n", "%patch"); + } + # invalid in %prep sub("^rm -rf \$RPM_BUILD_ROOT.*", ""); } @@ -598,6 +609,19 @@ function b_makekey(a, b, s) { sub(" >/dev/null 2>&1 \|\|:", ""); } + # fedora extras macros + if (/%__fe_useradd/) { + sub("%__fe_useradd", "%useradd -u "); + sub(" 2> /dev/null \|\| :", ""); + sub(" >/dev/null 2>&1 \|\|:", ""); + sub(" &>/dev/null \\|\\| :", ""); + } + + if (/%__fe_groupadd/) { + sub("%__fe_groupadd", "%groupadd -g "); + sub(" &>/dev/null \\|\\| :", ""); + } + # %useradd and %groupadd may not be wrapped if (/%(useradd|groupadd).*\\$/) { a = $0; getline; @@ -609,6 +633,20 @@ function b_makekey(a, b, s) { /^%post/, (!/^%post/ && $0 ~ SECTIONS) { preamble = 0 + + # fedora extras macros + sub("%__chkconfig", "/sbin/chkconfig"); + + sub("update-desktop-database &> /dev/null \\|\\| :", "%update_desktop_database"); + sub("touch --no-create %{_datadir}/icons/hicolor", "%update_icon_cache_post hicolor"); + sub("if \\[ -x %{_bindir}/gtk-update-icon-cache \\]; then\n\t%{_bindir}/gtk-update-icon-cache -q %{_datadir}/icons/hicolor \|\| :\nfi", ""); + + sub("export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`", "") + if (/gconftool-2 --makefile-install-rule/) { + sub("gconftool-2 --makefile-install-rule %{_sysconfdir}/gconf/schemas/", "%gconf_schema_install ") + sub("> /dev/null", ""); + } + use_macros() } /^%preun/, (!/^%preun/ && $0 ~ SECTIONS) { @@ -617,6 +655,14 @@ function b_makekey(a, b, s) { } /^%postun/, (!/^%postun/ && $0 ~ SECTIONS) { preamble = 0 + + # fedora extras macros + if (/%__fe_userdel|%__fe_groupdel/) { + sub("%__fe_groupdel", "%groupremove"); + sub("%__fe_userdel", "%userremove"); + sub(" &>/dev/null \\|\\| :", ""); + } + use_script_macros() } /^%triggerin/, (!/^%triggerin/ && $0 ~ SECTIONS) { @@ -1229,6 +1275,8 @@ function use_macros() continue; if ($c ~ sysconfdir "/inittab") continue; + if ($c ~ sysconfdir "/init") + continue; if ($c ~ sysconfdir "/ppp") continue; if ($c ~ sysconfdir "/dbus-1") @@ -1774,6 +1822,16 @@ function kill_preamble_macros() $2 = demacroize($2); $2 = unify_url($2) } + + # fedora extras + if (/%{\?FE_USERADD_REQ}/) { + $0 = ""; + print "BuildRequires: rpmbuild(macros) >= 1.202" + print "Provides: user(xxx)" + print "Requires(postun): /usr/sbin/userdel" + print "Requires(pre): /bin/id" + print "Requires(pre): /usr/sbin/useradd" + } } function get_epoch(pkg, ver, epoch) @@ -2062,6 +2120,7 @@ function replace_requires() { sub(/^xml-commons-resolver$/, "java-xml-commons-resolver", $2); # fedora / redhat + sub(/^keyutils-libs-devel$/, "keyutils-devel", $2); sub(/^Django$/, "python-django", $2); sub(/^GitPython$/, "python-git", $2); sub(/^PyQt4-devel$/, "python-PyQt4-devel", $2); @@ -2076,17 +2135,28 @@ function replace_requires() { sub(/^gamin-python$/, "python-gamin", $2); sub(/^gcc-c\+\+$/, "libstdc++-devel", $2); sub(/^gnome-python2-extras$/, "python-gnome-extras", $2); + sub(/^gnome-python2-gconf$/, "python-gnome-gconf", $2); + sub(/^gnome-python2-gnomekeyring$/, "python-gnome-desktop-keyring", $2); sub(/^gnome-python2-gtkspell$/, "python-gnome-extras-gtkspell", $2); sub(/^gtk-sharp2-devel$/, "dotnet-gtk-sharp2-devel", $2); sub(/^gtk2$/, "gtk+2", $2); sub(/^gtk2-devel$/, "gtk+2-devel", $2); + sub(/^gtk3-devel$/, "gtk+3-devel", $2); sub(/^initscripts$/, "rc-scripts", $2); sub(/^iproute$/, "iproute2", $2); sub(/^iscsi-initiator-utils$/, "open-iscsi", $2); + sub(/^jakarta-commons-logging$/, "java-commons-logging", $2); sub(/^libXft-devel$/, "xorg-lib-libXft-devel", $2); sub(/^libXrandr-devel$/, "xorg-lib-libXrandr-devel", $2); + sub(/^libacl-devel$/, "acl-devel", $2); sub(/^libcurl-devel$/, "curl-devel", $2); + sub(/^libgudev1-devel$/, "udev-glib-devel", $2); + sub(/^libloader$/, "java-libloader", $2); sub(/^libsrtp-devel$/, "srtp-devel", $2); + sub(/^libtdb$/, "tdb", $2); + sub(/^libtdb-devel$/, "tdb-devel", $2); + sub(/^libtevent$/, "tevent", $2); + sub(/^libtevent-devel$/, "tevent-devel", $2); sub(/^mod_wsgi$/, "apache-mod_wsgi", $2); sub(/^notify-python$/, "python-pynotify", $2); sub(/^pcsc-lite-ccid$/, "pcsc-driver-ccid", $2); @@ -2096,7 +2166,10 @@ function replace_requires() { sub(/^pygobject2$/, "python-pygobject", $2); sub(/^pygtk2$/, "python-pygtk", $2); sub(/^pygtk2-devel$/, "python-pygtk-devel", $2); + sub(/^pygtk2-libglade$/, "python-pygtk-glade", $2); sub(/^pysvn$/, "python-pysvn", $2); + sub(/^pytalloc$/, "python-talloc", $2); + sub(/^pytalloc-devel$/, "python-talloc-devel", $2); sub(/^python-enchant$/, "python-pyenchant", $2); sub(/^python-imaging$/, "python-PIL", $2); sub(/^python-imaging-tk$/, "python-PIL-tk", $2); @@ -2117,7 +2190,6 @@ function replace_requires() { sub(/^tkinter$/, "python-tkinter", $2); sub(/^xapian-bindings-python$/, "python-xapian", $2); sub(/^xorg-x11-server-sdk$/, "xorg-xserver-server-devel", $2); - # mandriva sub(/^python-gobject-devel$/, "python-pygobject-devel", $2); sub(/^python-pyrex$/, "python-Pyrex", $2);