]> git.pld-linux.org Git - packages/rpm-build-macros.git/blobdiff - rpm.macros
- add force (-f) option to %webapp_unregister
[packages/rpm-build-macros.git] / rpm.macros
index c3d9d15c7565a77567b6823b9a8bc44fc1abbb06..f2dc07b4dd73aeec3d9a5ab7bb666468e81532e2 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
@@ -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; \
@@ -405,12 +416,20 @@ 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"]')
+%ruby_ridir            %(ruby -r rbconfig -e 'include Config; print File.join(CONFIG["datadir"], "ri", CONFIG["ruby_version"], "system")')
+%ruby_rubylibdir       %(ruby -r rbconfig -e 'print Config::CONFIG["rubylibdir"]')
+%ruby_sitearchdir      %(ruby -r rbconfig -e 'print Config::CONFIG["sitearchdir"]')
+%ruby_sitelibdir       %(ruby -r rbconfig -e 'print Config::CONFIG["sitelibdir"]')
+%ruby_version          %(ruby -r rbconfig -e 'print Config::CONFIG["ruby_version"]')
 
 %php_pear_dir  %{_datadir}/pear
 
@@ -685,6 +704,45 @@ 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" ] && [ -f /var/lock/subsys/%1 ]; then\
+       /etc/rc.d/init.d/%1 reload 1>&2\
+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\
+       if [ -f /var/lock/subsys/%1 ]; then \
+               /etc/rc.d/init.d/%1 reload 1>&2 \
+       fi \
+fi \
+%{nil}
+
 # see browser-plugins.spec / template-browser-plugin.spec
 # written by glen@pld-linux.org.
 %nsplugin_install(d:f) { \
@@ -725,20 +783,4 @@ if [ "$1" = "0" ] || [ "$2" = "0" ]; then \
 #
 #  -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 }; }
-
+%service(q) {{%(export quiet=%{-q:1}; /usr/lib/rpm/service_generator.sh %{*}) };}
This page took 0.043822 seconds and 4 git commands to generate.