X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=rpm.macros;h=02fa5ba02c82a0d942d79e1e94aebece7295c151;hb=dd4e969a9978ffd66b4ac245ef905799f519a8a5;hp=21644391d8330d94a7f7ea4bd2299934d0b84a5b;hpb=31b569b63f1e67842747466011618f92c22f99c4;p=packages%2Frpm.git diff --git a/rpm.macros b/rpm.macros index 2164439..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 @@ -39,6 +40,16 @@ fi; \ %dependencytracking %{nil} +# Relations between package names that cause dependency loops +# with legacy packages that cannot be fixed. Relations are +# specified as +# p>q +# where package p has a Requires: on something that package q Provides: +# +# XXX Note: that there cannot be any whitespace within the string "p>q", +# and that both p and q are package names (i.e. no version/release). +%_dependency_whiteout %{nil} + #----------------------------------------------------------------- %configure2_13 { \ if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \ @@ -64,7 +75,7 @@ fi; \ --sharedstatedir=%{_sharedstatedir} \ --mandir=%{_mandir} \ --infodir=%{_infodir} \ - --x-libraries=/usr/X11R6/%{_lib} \ + --x-libraries=%{?_x_libraries}%{!?_x_libraries:%{_libdir}} \ %{dependencytracking} \ } @@ -95,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}} \ } @@ -177,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) @@ -314,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 # @@ -405,12 +423,22 @@ fi \ %__mono_requires %{nil} # Perl specific macro definitions. -%perl_privlib %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib) -%perl_archlib %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib) -%perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib) +%perl_privlib %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib) +%perl_archlib %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib) +%perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib) %perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch) -%perl_sitelib %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib) -%perl_sitearch %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch) +%perl_sitelib %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib) +%perl_sitearch %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch) + +# Ruby +%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 @@ -623,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 @@ -642,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. @@ -649,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\ @@ -685,6 +716,43 @@ if [ "$1" = "0" ] || [ "$2" = "0" ]; then \ fi \ %{nil} +# 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 +# updated. if you don't need the config for various reason for specific +# webserver, just remove the symlink from config directory using webapp +# program. the trigger will not recreate the symlink on upgrades. In other +# words the config is linked to webserver config directory on first install of +# PACKAGE or WEBSERVER. +# +# 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 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 [-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 [ -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) { \ @@ -723,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; \ - else \ - 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 %{*}) };}