]> git.pld-linux.org Git - packages/rpm-build-macros.git/blobdiff - rpm.macros
1.692: fix ruby_ridir not to use deprecated CONFIG (removed in 2.0)
[packages/rpm-build-macros.git] / rpm.macros
index b7370d9b5b6d4b301c69e0e32362cd0e334bbcb1..fb44ba49b4492d80ddf696d04c427b16f9661d96 100644 (file)
 %_specdir       %{expand:%%global _specdir %([ ! -d %{_topdir}/SPECS ] && echo %{_topdir}/%{name} || echo %{_topdir}/SPECS)}%_specdir
 %_sourcedir            %{expand:%%global _sourcedir %([ ! -d %{_topdir}/SOURCES ] && echo %{_specdir} || echo %{_topdir}/SOURCES)}%_sourcedir
 
-# BUILD/RPMS/SRPMS are one same level by default as packages dir, if these exist
+# BUILD/RPMS/SRPMS are on same level by default as packages dir, if these exist
 # if they don't exist assume we are having custom topdir (which is not named as
 # "packages", i.e ~/rpm/kde/{kdelibs,BUILD/RPMS/SRPMS})
-# NOTE: readlink fails if some parent dir is not readable (/home/services/builder for example can't read /home/services), therfore the extra echo
+# NOTE: readlink fails if some parent dir is not readable (/home/services/builder for example can't read /home/services), therefore the extra echo
 %_builddir             %{expand:%%global _builddir %(if [ -d %{_topdir}/BUILD ]; then echo %{_topdir}/BUILD; else readlink -m %{_topdir}/../BUILD || echo %{_topdir}/../BUILD; fi)}%_builddir
 %_rpmdir               %{expand:%%global _rpmdir %(if [ -d %{_topdir}/RPMS ]; then echo %{_topdir}/RPMS; else readlink -m %{_topdir}/../RPMS || echo readlink -m %{_topdir}/../RPMS; fi)}%_rpmdir
 %_srcrpmdir            %{expand:%%global _srcrpmdir %(if [ -d %{_topdir}/SRPMS ]; then echo %{_topdir}/SRPMS; else readlink -m %{_topdir}/../SRPMS || echo readlink -m %{_topdir}/../SRPMS; fi)}%_srcrpmdir
@@ -926,7 +926,7 @@ fi; \
 
 %ruby_archdir          %{expand:%%global ruby_archdir %(%{__ruby} -r rbconfig -e 'print RbConfig::CONFIG["archdir"]' 2>/dev/null || echo ERROR)}%ruby_archdir
 %ruby_libdir           %{expand:%%global ruby_libdir %(%{__ruby} -r rbconfig -e 'print RbConfig::CONFIG["rubylibdir"]' 2>/dev/null || echo ERROR)}%ruby_libdir
-%ruby_ridir                    %{expand:%%global ruby_ridir %(%{__ruby} -r rbconfig -e 'include Config; print File.join(CONFIG["datadir"], "ri", CONFIG["ruby_version"], "system")' 2>/dev/null || echo ERROR)}%ruby_ridir
+%ruby_ridir                    %{expand:%%global ruby_ridir %(%{__ruby} -r rbconfig -e 'print File.join(RbConfig::CONFIG["datadir"], "ri", RbConfig::CONFIG["ruby_version"], "system")' 2>/dev/null || echo ERROR)}%ruby_ridir
 %ruby_rubylibdir       %{expand:%%global ruby_rubylibdir %(%{__ruby} -r rbconfig -e 'print RbConfig::CONFIG["rubylibdir"]' 2>/dev/null || echo ERROR)}%ruby_rubylibdir
 %ruby_vendorarchdir    %{expand:%%global ruby_vendorarchdir %(%{__ruby} -r rbconfig -e 'print RbConfig::CONFIG["vendorarchdir"]' 2>/dev/null || echo ERROR)}%ruby_vendorarchdir
 %ruby_vendorlibdir     %{expand:%%global ruby_vendorlibdir %(%{__ruby} -r rbconfig -e 'print RbConfig::CONFIG["vendorlibdir"]' 2>/dev/null || echo ERROR)}%ruby_vendorlibdir
@@ -2260,6 +2260,7 @@ fi; \
 # pre/post script for -upstart subpackages
 #
 # Author: Jacek Konieczny <jajcus@jajcus.net>
+# Author: Elan Ruusamäe <glen@pld-linux.org>
 #
 # Usage:
 #      %upstart_post service_name
@@ -2273,15 +2274,16 @@ fi; \
 # %upstart_postun %{name}
 #
 # Requirements:
-# BuildRequires:       rpmbuild(macros) >= 1.560
+# BuildRequires:       rpmbuild(macros) >= 1.690
 # Requires:                    rc-scripts >= 0.4.3
 
 # migrate from init script to upstart job
 %upstart_post() \
-       if [ -f /var/lock/subsys/%1 ]; then \
+       if [ -x /sbin/initctl ] && [ -f /var/lock/subsys/%1 ]; then \
                /sbin/service --no-upstart %1 stop \
                /sbin/service %1 start \
-       fi
+       fi \
+%{nil}
 
 # restart the job after upgrade or migrate to init script on removal
 # cannot be stopped with 'service' as /etc/init/$name.conf may be missing
@@ -2290,7 +2292,8 @@ fi; \
        if [ -x /sbin/initctl ] && /sbin/initctl status %1 2>/dev/null | grep -q 'running' ; then \
                /sbin/initctl stop %1 >/dev/null 2>&1 \
                [ -f /etc/rc.d/init.d/%1 -o -f /etc/init/%1.conf ] && { echo -n "Re-"; /sbin/service %1 start; }; \
-       fi
+       fi \
+%{nil}
 
 # Haskell Macros
 # BuildRequires:  rpmbuild(macros) >= 1.608
@@ -2421,4 +2424,15 @@ want_enable_service() { \
 %systemduserunitdir /usr/lib/systemd/user
 %systemdtmpfilesdir /usr/lib/tmpfiles.d
 
+#-----------------------------------------------------------------
+# Update hardware database index
+#
+# Requirements:
+# BuildRequires:       rpmbuild(macros) >= 1.691
+# Requires:            udev-core >= 1:196
+
+%udev_hwdb_update() \
+/sbin/udevadm hwdb --update >/dev/null 2>&1 || : \
+%{nil}
+
 # EOF
This page took 0.034466 seconds and 4 git commands to generate.