X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=rpm.macros;h=4fc0798e1b0939eb3be6142a609906b5bd7b81e6;hb=0b39f25d2c9c0c998019c6f0422b32fb97f2c19c;hp=d4c3c586b1485abc98c3d51be5ee07ff294f8b69;hpb=732407b495eabaad3cbe7d7f9ca40be50d9f81ee;p=packages%2Frpm-build-macros.git diff --git a/rpm.macros b/rpm.macros index d4c3c58..4fc0798 100644 --- a/rpm.macros +++ b/rpm.macros @@ -686,6 +686,30 @@ __spec_install_post_check_so() { \ %{!?no_install_post_check_so:return $fail;} \ }; __spec_install_post_check_so }} +#----------------------------------------------------------------- +# Verify that for each directory under /var/run package contains +# tmpfiles.d configuration. Warn and terminate build if config is +# missing. +# +#%no_install_post_check_tmpfiles 1 +# +%__spec_install_post_check_tmpfiles { \ +__spec_install_post_check_tmpfiles() { \ +%{!?debug:set +x;} \ + fail=0; \ + echo "Checking /var/run <-> tmpfiles.d completeness..."; \ + for d in $RPM_BUILD_ROOT/var/run/*; do \ + [ -d "$d" ] || continue; \ + d=${d##$RPM_BUILD_ROOT}; \ + if ! grep -qsF "$d" $RPM_BUILD_ROOT/usr/lib/tmpfiles.d/*.conf $RPM_BUILD_ROOT/etc/tmpfiles.d/*.conf; then\ + echo "No tmpfiles configuration for '$d'";\ + fail=1 ; \ + fi \ + done ; \ + echo " DONE"; \ + %{!?no_install_post_check_tmpfiles:return $fail;} \ +}; __spec_install_post_check_tmpfiles }} + #----------------------------------------------------------------- # Find and gzip all kernel modules # @@ -1003,6 +1027,10 @@ fi \ %py3_ocomp %{__python3} -O -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])" +# node.js libdir +# Requirements: +# BuildRequires: rpmbuild(macros) >= 1.634 +%nodejs_libdir /usr/lib/node_modules # Hardlink binary identical .pyc and .pyo files %__spec_install_post_py_hardlink {\ @@ -1244,8 +1272,7 @@ fi \ # Requires: rc-scripts # -n option: # BuildRequires: rpmbuild(macros) >= 1.450 -%service(qn) {{%(export noop=%{-n:1} quiet=%{-q:1}; /usr/lib/rpm/service_generator.sh %{*}) };} - +%service(qn) {{%(export noop=%{-n:1} quiet=%{-q:1} RPM_BUILD_ROOT=%{buildroot}; /usr/lib/rpm/service_generator.sh %{*}) };} # Java macros. based on jpackage macros.java # @@ -1754,6 +1781,9 @@ __install_kernel_modules \ ) \ %{nil} +# return EXPANDED source url N from current spec +%sourceurl(n:) %(test "$IN_RPM" = 1 && exit 1; export IN_RPM=1; rpmbuild --nodigest --nosignature --nobuild -D "prep %%dump" %{_specdir}/%{name}.spec 2>&1 | awk '$2 ~ /^SOURCEURL%{-n*}/ {print $3}') + # browser plugins v2 # Author: Elan Ruusamäe # @@ -1984,10 +2014,15 @@ else: \ # %cacti_import_template %{resourcedir}/cacti_host_template_varnish.xml # # Requires: cacti >= 0.8.7e-8 -# BuildRequires: rpmbuild(macros) >= 1.554 +# BuildRequires: rpmbuild(macros) >= 1.630 +# Note: 1.1 (cacti-0.8.7h) adds requirement for --with-template-rras or --with-user-rras option %cacti_import_template() {\ -/usr/share/cacti/cli/import_template.php --filename=%1 || :; \ +v=$(%{__sed} -rne 's/.+Add Graphs Script ([0-9\.]+).+/\1/p' /usr/share/cacti/cli/import_template.php); \ +if [ "$v" != "1.0" ]; then \ + rra="--with-template-rras"; \ +fi; \ +/usr/share/cacti/cli/import_template.php --filename=%1 $rra || :; \ }%{nil} # pre/post script for -upstart subpackages @@ -2040,34 +2075,50 @@ else: \ %{nil} -# pre/post script for -systemd subpackages +# pre/post script for packages supporting systemd units # # Author: Bartlomiej Zimon # # Usage: # %systemd_reload # %systemd_post service_name1.service service_name2.service -# %systemd_preun service_name1.service service_name2.service +# %systemd_preun service_name1.service service_name2.service +# %systend_trigger service_name1.service service_name2.service # # Sample: -# %post systemd -# %systemd_reload -# or if service must be enabled by default: -# %post systemd +# %post # %systemd_post %{name}.service # -# %preun systemd +# %preun # %systemd_preun %{name}.service # -# %postun systemd +# %postun # %systemd_reload # +# %triggerpostun -- %{name} < first-version-with-systemd-units +# %systemd_trigger %{name}.service +# # Requirements: # BuildRequires: rpmbuild(macros) >= 1.627 # Requires: systemd-units >= 37-0.10 %systemd_reload /bin/systemd_booted && SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog /bin/systemctl --quiet daemon-reload || : +%systemd_trigger() \ +want_enable_service() { \ + [ -f /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm \ + [ ${RPM_ENABLE_SYSTEMD_SERVICE:-yes} = no ] && return 1 \ + /sbin/chkconfig --list ${1%.service} 2>/dev/null | grep -qsv "[0-6]:on" && return 1 \ + return 0 \ +}\ + export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \ + for s in %{*}; do \ + if want_enable_service $s; then \ + /bin/systemctl --quiet enable $s || : \ + fi \ + done \ +%{nil} + %systemd_post() \ export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \ /bin/systemd_booted && /bin/systemctl --quiet daemon-reload || : \ @@ -2082,7 +2133,7 @@ else: \ %systemd_preun() \ if [ $1 -eq 0 ]; then \ export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog; \ - /bin/systemctl --no-reaload --quiet disable %{*} || : \ + /bin/systemctl --no-reload --quiet disable %{*} || : \ if /bin/systemd_booted; then \ /bin/systemctl --quiet stop %{*} || : \ fi \