X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=rpm.macros;h=08bcc8f8c14ef4d3d735a45609a2f4e78f70a6bf;hb=2809d3619fe4a9812b44c6132316d6df21aa515e;hp=9e895b46244bdb8dd790bd53dd3eb696dfcbc8f8;hpb=b9c59ff92ee4e32c49f468704ac06b3dc5292eda;p=packages%2Frpm-build-macros.git diff --git a/rpm.macros b/rpm.macros index 9e895b4..08bcc8f 100644 --- a/rpm.macros +++ b/rpm.macros @@ -37,7 +37,7 @@ %__cmake /usr/bin/cmake %_smp_mflags %(_NCPUS=$(/usr/bin/getconf _NPROCESSORS_ONLN); \\\ - [ "$_NCPUS" -gt 1 ] && echo "-j$(($_NCPUS * 2))") + [ "$_NCPUS" -gt 2 ] && echo "-j$(($_NCPUS / 2))") %__gettextize { \ if grep -qs 'AM_GNU_GETTEXT.*external' configure.{ac,in} ; then \ @@ -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 || : \ @@ -2077,15 +2128,17 @@ else: \ if [ $1 -gt 1 ] && [ -z "$NORESTART" ]; then \ /bin/systemctl --quiet try-restart %{*} || : \ fi \ +%{nil} %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 \ - fi + fi \ +%{nil} %systemdunitdir /lib/systemd/system