]> git.pld-linux.org Git - packages/rpm.git/blobdiff - rpm.macros
- fix %releq_kernel_* macros to return anything, to prevent spec parse errors
[packages/rpm.git] / rpm.macros
index 8defa3dd61fda9a606f70ea36af09e449d1c9309..02fa5ba02c82a0d942d79e1e94aebece7295c151 100644 (file)
@@ -1,10 +1,11 @@
+# $Revision$, $Date$
 # PLD rpm macros
 
 %epoch         0
 %x8664         x86_64 amd64 ia32e
 
 # kernel compiler
-%kgcc          gcc
+%kgcc          %{__cc}
 %kgcc_package  gcc
 
 %_source_payload       w9.gzdio
@@ -74,7 +75,7 @@ fi; \
        --sharedstatedir=%{_sharedstatedir} \
        --mandir=%{_mandir} \
        --infodir=%{_infodir} \
-       --x-libraries=/usr/X11R6/%{_lib} \
+       --x-libraries=%{?_x_libraries}%{!?_x_libraries:%{_libdir}} \
        %{dependencytracking} \
 }
 
@@ -105,7 +106,7 @@ fi; \
        --sharedstatedir=%{_sharedstatedir} \
        --mandir=%{_mandir} \
        --infodir=%{_infodir} \
-       --x-libraries=/usr/X11R6/%{_lib} \
+       --x-libraries=%{?_x_libraries}%{!?_x_libraries:%{_libdir}} \
        %{dependencytracking} \
        %{?configure_cache:--cache-file=%{configure_cache_file:-%{buildroot}.configure.cache}} \
 }
@@ -187,11 +188,12 @@ unset LINGUAS ||:\
 # Requires name = version-release
 %requires_releq()              %(echo '%*' | LC_ALL="C" xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}-%%{release}\\n' | sed -e 's/ (none):/ /' | grep -v "is not")
 
-%releq_kernel_up()             %(LC_ALL="C" rpm -qf --qf '%%{name}-up = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | sed -e 's:-headers::' | grep -vE "(is not|no such)")
-%releq_kernel_smp()            %(LC_ALL="C" rpm -qf --qf '%%{name}-smp = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | sed -e 's:-headers::' | grep -vE "(is not|no such)")
-%requires_releq_kernel_up()    %(LC_ALL="C" rpm -qf --qf 'PreReq: %%{name}-up = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | sed -e 's:-headers::' | grep -vE "(is not|no such)")
-%requires_releq_kernel_smp()   %(LC_ALL="C" rpm -qf --qf 'PreReq: %%{name}-smp = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | sed -e 's:-headers::' | grep -vE "(is not|no such)")
+%releq_kernel_up()             %(LC_ALL="C" rpm -qf --qf '%%{name}-up = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h 2>/dev/null || echo ERROR | sed -e 's/ (none):/ /' | sed -e 's:-headers::' | grep -vE "(is not|no such)")
+%releq_kernel_smp()            %(LC_ALL="C" rpm -qf --qf '%%{name}-smp = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h 2>/dev/null || echo ERROR | sed -e 's/ (none):/ /' | sed -e 's:-headers::' | grep -vE "(is not|no such)")
+%requires_releq_kernel_up(s:)          Requires%{-s:(%{-s*})}: %releq_kernel_up
+%requires_releq_kernel_smp(s:)         Requires%{-s:(%{-s*})}: %releq_kernel_smp
 
+%requires_eq()         %(echo '%*' | LC_ALL="C" xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}\\n' | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not")
 %requires_eq_to() %(LC_ALL="C" rpm -q --qf 'Requires: %1 = %%{epoch}:%%{version}\\n' %2 | sed -e 's/ (none):/ /' | grep -v "is not")
 
 %apache_modules_api %(awk '/#define MODULE_MAGIC_NUMBER_MAJOR/ {print $3}' /usr/include/apache/ap_mmn.h 2>/dev/null || echo ERROR)
@@ -324,6 +326,12 @@ fi; } \
        fi; \
 } }
 
+# Remove common Perl files we don't package
+%__spec_install_post_perl_clean {\
+%{!?no_install_post_perl_clean: \
+%{?pdir:rm -f $RPM_BUILD_ROOT{%{perl_archlib}/perllocal.pod,%{perl_vendorarch}/auto/%{pdir}%{?pnam:/%(echo %{pnam} | tr - /)}/.packlist}} \
+} }
+
 #-----------------------------------------------------------------
 # Update GConf2 schemas
 #
@@ -423,12 +431,14 @@ fi \
 %perl_sitearch         %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch)
 
 # Ruby
-%ruby_archdir          %(ruby -r rbconfig -e 'print Config::CONFIG["archdir"]')
-%ruby_rubylibdir               %(ruby -r rbconfig -e 'print Config::CONFIG["rubylibdir"]')
-%ruby_ridir            %(ruby -r rbconfig -e 'include Config; print File.join(CONFIG["datadir"], "ri", CONFIG["ruby_vers
-ion"], "system")')
-%ruby_sitearchdir      %(ruby -r rbconfig -e 'print Config::CONFIG["sitearchdir"]')
-%ruby_version          %(ruby -r rbconfig -e 'print Config::CONFIG["ruby_version"]')
+%ruby_archdir          %(ruby -r rbconfig -e 'print Config::CONFIG["archdir"]' 2>/dev/null || echo ERROR)
+%ruby_ridir            %(ruby -r rbconfig -e 'include Config; print File.join(CONFIG["datadir"], "ri", CONFIG["ruby_version"], "system")' 2>/dev/null || echo ERROR)
+%ruby_rubylibdir       %(ruby -r rbconfig -e 'print Config::CONFIG["rubylibdir"]' 2>/dev/null || echo ERROR)
+%ruby_sitearchdir      %(ruby -r rbconfig -e 'print Config::CONFIG["sitearchdir"]' 2>/dev/null || echo ERROR)
+%ruby_sitelibdir       %(ruby -r rbconfig -e 'print Config::CONFIG["sitelibdir"]' 2>/dev/null || echo ERROR)
+%ruby_version          %(ruby -r rbconfig -e 'print Config::CONFIG["ruby_version"]' 2>/dev/null || echo ERROR)
+%ruby_ver_requires_eq  Requires:       ruby(ver) = %ruby_version
+%ruby_mod_ver_requires_eq      Requires:       ruby-modules(ver) = %ruby_version
 
 %php_pear_dir  %{_datadir}/pear
 
@@ -641,6 +651,8 @@ fi;
 # apache_config_{install/uninstall} macros written by glen@pld-linux.org.
 # All rights reserved. Permission to copy is hereby granted.. yada, yada, yada
 #
+# You should use webapp macros instead. these are here until single piece of them is gone from specs ;)
+#
 # The config is installed/removed inside trigger, this means that you can any
 # time install apache1 or apache package and the configuration file is updated.
 # if you don't need the config for various reason for specific apache, just
@@ -660,6 +672,7 @@ fi;
 #  -v REQUIRED: specify apache version. can be 1 or 2.
 #  -c OPTIONAL: specify full path to PACKAGE's config. Defaults to %{_sysconfdir}/apache-%{name}.conf.
 #  -n OPTIONAL: specify config "slot". defaults to 99
+#  -f OPTIONAL: force symlink creation regardless if package was upraded. useful in triggers
 #
 # Internal macros. don't use ;).
 # expands apache config dir by apache version at build time.
@@ -667,10 +680,10 @@ fi;
 # expands apache service name by apache version at build time.
 %__apache_svcname() %(if [ %{1} = 1 ]; then echo apache; elif [ %{1} = 2 ]; then echo httpd; else echo >&2 Unknown apache version specified; fi)
 
-%apache_config_install(v:c:n:) \
+%apache_config_install(fv:c:n:) \
 %{!-v:%{error:apache_config_install: Required argument -v missing}} \
 %{?debug:set -x; echo "apache_config_install:%{-v*} %{name}-%{version}-%{release} 1:[$1]; 2:[$2]"} \
-if [ "$1" = "1" ] && [ "$2" = "1" ] && [ -d %{__apache_confdir %{-v*}} ]; then\
+if [ -n "%{-f:1}" ] || ([ "$1" = "1" ] && [ "$2" = "1" ]) && [ -d %{__apache_confdir %{-v*}} ]; then\
        ln -sf %{-c*}%{!-c:%{_sysconfdir}/apache-%{name}.conf} %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf\
 fi\
 # reload apache if the config symlink is there\
@@ -715,7 +728,7 @@ fi \
 #
 # Add package's webserver config to webserver webapps dir.
 # Usage:
-#   %webapp_register HTTPD WEBAPP
+#   %webapp_register WEBSERVER WEBAPP
 #
 %webapp_register() \
 %{?debug:set -x; echo "webapp_register: %{name}-%{version}-%{release} 1:[$1]; 2:[$2]"} \
@@ -723,22 +736,20 @@ if [ "$1" = "1" ] && [ "$2" = "1" ]; then\
        /usr/sbin/webapp register %1 %2\
 fi\
 # reload webserver if the config symlink is there and skip reload if webserver is upgraded\
-if [ -L /etc/%1/webapps.d/%2.conf ] && [ "$2" -lt "2" ] && [ -f /var/lock/subsys/%1 ]; then\
-       /etc/rc.d/init.d/%1 reload 1>&2\
+if [ -L /etc/%1/webapps.d/%2.conf ] && [ "$2" -lt "2" ]; then\
+       %{expand:%service -q %%1 reload}\
 fi\
 %{nil}
 
 # Remove package's config from webserver webapps dir.
 # Usage:
-#   %webapp_register HTTPD WEBAPP
-%webapp_unregister() \
+#   %webapp_register [-f] WEBSERVER WEBAPP
+%webapp_unregister(f) \
 %{?debug:set -x; echo "webapp_unregister: %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"} \
 # remove link if either of the packages are gone \
-if [ "$1" = "0" ] || [ "$2" = "0" ] && [ -L /etc/%1/webapps.d/%2.conf ]; then \
-       rm -f /etc/%1/webapps.d/%2.conf \
-       if [ -f /var/lock/subsys/%1 ]; then \
-               /etc/rc.d/init.d/%1 reload 1>&2 \
-       fi \
+if [ -n "%{-f:1}" ] || [ "$1" = "0" ] || [ "$2" = "0" ] && [ -L /etc/%1/webapps.d/%2.conf ]; then \
+       /usr/sbin/webapp unregister %1 %2\
+       %{expand:%service -q %%1 reload}\
 fi \
 %{nil}
 
@@ -780,6 +791,6 @@ if [ "$1" = "0" ] || [ "$2" = "0" ]; then \
 # Usage:
 #   %service [-q] SERVICE ACTION ["SERVICE NICE DESCRIPTION"]
 #
-#  -q be silent when service isn't started (for postun scriplets)
+#  -q be silent when service isn't started (for scriplets restaring other package's services)
 #
 %service(q) {{%(export quiet=%{-q:1}; /usr/lib/rpm/service_generator.sh %{*}) };}
This page took 0.077111 seconds and 4 git commands to generate.