X-Git-Url: https://git.tld-linux.org/?a=blobdiff_plain;ds=sidebyside;f=macros.tld;h=b835fea55a07151d3b76289c2e5c201ba8b4f548;hb=refs%2Fheads%2Frpm-4.5;hp=5f218ad105b2bed0a345631cc42c83fa82940907;hpb=b5115bb76a6795a89fadf5f4e7161f26203c7678;p=packages%2Frpm-tld-macros.git diff --git a/macros.tld b/macros.tld index 5f218ad..b835fea 100644 --- a/macros.tld +++ b/macros.tld @@ -1,7 +1,7 @@ # vim:ts=4 sw=4 noet ft=spec # # TLD Linux rpm macros. -# +# # can be used by builder script to check for version %rpm_build_macros {Revision} @@ -429,6 +429,10 @@ LC_ALL=C.UTF-8 %{__meson} \ %__true_false() %{expand:%%{?with_%{1}:true}%%{!?with_%{1}:false}} %__true_false_not() %{expand:%%{?with_%{1}:false}%%{!?with_%{1}:true}} +# expands to enabled or disabled based on bcond; for use with meson or cmake +%__enabled_disabled() %{expand:%%{?with_%{1}:enabled}%%{!?with_%{1}:disabled}} +%__enabled_disabled_not() %{expand:%%{?with_%{1}:disabled}%%{!?with_%{1}:enabled}} + # for use with cmake: # Usage: cmake_on_off BCOND_NAME [OPTION_NAME] # BuildRequires: rpmbuild(macros) >= 1.742 @@ -516,6 +520,19 @@ LC_ALL=C.UTF-8 %{__meson} \ Obsoletes: %{1} < %{?epoch:%{epoch}:}%{?version:%{version}}%{?release:-%{release}} \ Provides: %{1} = %{?epoch:%{epoch}:}%{?version:%{version}}%{?release:-%{release}} +# for package versions comparison (incl. cc_version or _rpmversion) +# BuildRequires: rpmbuild(macros) >= 1.750 +%_ver_lt() %(test $(rpmvercmp "%{1}" "%{2}" >/dev/null 2>&1; echo $?) -ne 2; echo $?) +%_ver_ge() %(test $(rpmvercmp "%{1}" "%{2}" >/dev/null 2>&1; echo $?) -eq 2; echo $?) + +# noarch subpackage helper +# BuildRequires: rpmbuild(macros) >= 1.752 +%noarchpackage \ +%if %{_ver_ge '%{_rpmversion}' '4.6'} \ +BuildArch: noarch \ +%endif \ +%{nil} + %apache_modules_api %{expand:%%global apache_modules_api %(awk '/#define MODULE_MAGIC_NUMBER_MAJOR/ {print $3}' /usr/include/apache/ap_mmn.h 2>/dev/null || echo ERROR)}%apache_modules_api # sgml macros @@ -775,28 +792,12 @@ __spec_install_post_check_execstack() { \ }; __spec_install_post_check_execstack }} #----------------------------------------------------------------- -# Verify that for each directory under /var/run package contains -# tmpfiles.d configuration. Warn and terminate build if config is -# missing. +# Do not verify if each directory under /var/run contains +# tmpfiles.d configuration. TLD Linux doesn't use tmpfiles.d. # -#%no_install_post_check_tmpfiles 1 +%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 }} +%__spec_install_post_check_tmpfiles %{nil} #----------------------------------------------------------------- # Verify that scripts have reasonable shebangs @@ -941,6 +942,14 @@ fi; \ };} \ %{nil} +# BuildRequires: rpmbuild(macros) >= 1.751 +# Requires(post,postun): /usr/bin/texhash # if you want to ensure cache is updated +%texhash() {{ \ + umask 022; \ + /usr/bin/texhash >&2; \ +};} \ +%{nil} + #----------------------------------------------------------------- # post %install sequence: # - autodeps exceptions @@ -1176,9 +1185,6 @@ fi; # calls usual service restart on package %post, but skips the restart if # administrator has disabled automatic service restarts in either global # /etc/sysconfig/rpm or per service /etc/sysconfig/SERVICE file. -# NOTE: systemd_booted machines do not print -# Run "{command}" to restart {service}. -# message for packages without native systemd unit (not here, no %systemd_post). # # Usage: # %service [-q] [-n] SERVICE ACTION ["SERVICE NICE DESCRIPTION"]