X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=rpm.macros;h=02fa5ba02c82a0d942d79e1e94aebece7295c151;hb=dd4e969a9978ffd66b4ac245ef905799f519a8a5;hp=202256368b366bb3818ac05f8a2a33ba976dfc98;hpb=ba42a82281246afcced7fb3d068ca3499e215ea4;p=packages%2Frpm.git diff --git a/rpm.macros b/rpm.macros index 2022563..02fa5ba 100644 --- a/rpm.macros +++ b/rpm.macros @@ -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\ @@ -703,10 +716,7 @@ if [ "$1" = "0" ] || [ "$2" = "0" ]; then \ fi \ %{nil} -# Add package's webserver config to webserver webapps dir. -# -# Usage: -# %webapp_register HTTPD WEBAPP +# webapp macros # # The config is installed/removed inside trigger, this means that you can any # time install apache1/apache/lighttpd package and the configuration file is @@ -716,43 +726,33 @@ fi \ # words the config is linked to webserver config directory on first install of # PACKAGE or WEBSERVER. # -# should be called in trigger body: -# %triggerin -- apache1 >= 1.3.33-2 -# %apache_config_install -v 1 +# Add package's webserver config to webserver webapps dir. +# Usage: +# %webapp_register WEBSERVER WEBAPP # %webapp_register() \ %{?debug:set -x; echo "webapp_register: %{name}-%{version}-%{release} 1:[$1]; 2:[$2]"} \ if [ "$1" = "1" ] && [ "$2" = "1" ]; then\ /usr/sbin/webapp register %1 %2\ fi\ -# reload webserver if the config symlink is there\ -if [ -L /etc/%1/webapps.d/%2.conf ]; then\ - # additionally don't reload if target package (the webserver) is upgraded, as webserver is restarted anyway in %post \ - if [ "$2" != "2" ] && [ -f /var/lock/subsys/%1 ]; then\ - /etc/rc.d/init.d/%1 reload 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" ]; 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" ]; then \ - if [ -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 \ - 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} - - # see browser-plugins.spec / template-browser-plugin.spec # written by glen@pld-linux.org. %nsplugin_install(d:f) { \ @@ -791,22 +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) -# -%service(q) {{ \ -# we use function, not to globber namespace with useless variables \ -skip_auto_restart() { \ - . /etc/sysconfig/rpm; # global setting \ - [ -f /etc/sysconfig/%1 ] && . /etc/sysconfig/%1; # per service setting \ - echo ${RPM_SKIP_AUTO_RESTART:-no}; \ -}; \ -if [ -f /var/lock/subsys/%1 ]; then \ - if [ $(skip_auto_restart) = no ]; then \ - /etc/rc.d/init.d/%1 %2 1>&2; \ -%{!-q:else} \ - %{!-q:echo 'Run "/etc/rc.d/init.d/%1 %2" to %2 %{!?3:%1 service}%{?3:%(set -- %{*}; echo "$3")}.';} \ - fi \ -%{!-q:else} \ - %{!-q:echo 'Run "/etc/rc.d/init.d/%1 start" to start %{!?3:%1 service}%{?3:%(set -- %{*}; echo "$3")}.';} \ -fi }; } - +# -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 %{*}) };}