X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=rpm.macros;h=cec3abb326e8f7546ade1fb1a57d40e40370ee26;hb=e2329ed5e3880f908d164c82ce6cd8ceead37e6f;hp=bd6d04239165c4b684ac6a9e4b41c4d09a810485;hpb=5af2fd898afa5df3ff100e71f856279a17df1794;p=packages%2Frpm-build-macros.git diff --git a/rpm.macros b/rpm.macros index bd6d042..cec3abb 100644 --- a/rpm.macros +++ b/rpm.macros @@ -8,7 +8,6 @@ %epoch 0 %x8664 x86_64 amd64 ia32e -%arm armv3l armv4b armv4l armv5teb armv5tel # compiler version %cc_version %{expand:%%global cc_version %(%{__cc} -dumpversion 2>/dev/null || echo 0.0)}%cc_version @@ -31,10 +30,14 @@ # expands to -jN if %__jobs has a value %_smp_mflags %{expand:%%global _smp_mflags %(jobs=%{__jobs}; echo ${jobs:+-j$jobs}%%{nil})}%_smp_mflags -%__make /usr/bin/make %{?_smp_mflags} +%__make /usr/bin/make %{?_make_opts} %{?_smp_mflags} %__scons /usr/bin/scons %{?_smp_mflags} %__waf /usr/bin/waf %{?_smp_mflags} %__cmake /usr/bin/cmake +%__meson /usr/bin/meson +%__meson_wrap_mode nodownload +%__ninja /usr/bin/ninja +%__ninja_common_opts -v %{?_smp_mflags} %__gettextize { \ if grep -qs 'AM_GNU_GETTEXT.*external' configure.{ac,in} ; then \ @@ -82,7 +85,7 @@ )}%_topdir # if %{_topdir}/SPECS exists, it's old style structure -%_specdir %{expand:%%global _specdir %([ ! -d %{_topdir}/SPECS ] && echo %{_topdir}/%{name} || echo %{_topdir}/SPECS)}%_specdir +%_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 on same level by default as packages dir, if these exist @@ -264,7 +267,21 @@ CPPFLAGS="${CPPFLAGS:-%{rpmcppflags}}" \\\ %{__cmake} \\\ -DCMAKE_VERBOSE_MAKEFILE=ON \\\ -DCMAKE_BUILD_TYPE=%{!?debug:PLD}%{?debug:Debug} \\\ + -DCMAKE_INSTALL_BINDIR:PATH=%{_bindir} \\\ + -DCMAKE_INSTALL_SBINDIR:PATH=%{_sbindir} \\\ + -DCMAKE_INSTALL_LIBEXECDIR:PATH=%{_libexecdir} \\\ + -DCMAKE_INSTALL_SYSCONFDIR:PATH=%{_sysconfdir} \\\ + -DCMAKE_INSTALL_SHAREDSTATEDIRPATH:PATH=%{_sharedstatedir} \\\ + -DCMAKE_INSTALL_LOCALSTATEDIRPATH:PATH=%{_localstatedir} \\\ -DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir} \\\ + -DCMAKE_INSTALL_INCLUDEDIR:PATH=%{_includedir} \\\ + -DCMAKE_INSTALL_OLDINCLUDEDIR:PATH=%{_includedir} \\\ + -DCMAKE_INSTALL_DATAROOTDIR:PATH=%{_datadir} \\\ + -DCMAKE_INSTALL_DATADIR:PATH=%{_datadir} \\\ + -DCMAKE_INSTALL_INFODIR:PATH=%{_infodir} \\\ + -DCMAKE_INSTALL_LOCALEDIR:PATH=%{_localedir} \\\ + -DCMAKE_INSTALL_MANDIR:PATH=%{_mandir} \\\ + -DCMAKE_INSTALL_DOCDIR:PATH=%{_docdir} \\\ -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \\\ -DSYSCONF_INSTALL_DIR:PATH=%{_sysconfdir} \\\ -DCMAKE_CXX_FLAGS_PLD="${CXXFLAGS:-%{rpmcxxflags} -DNDEBUG -DQT_NO_DEBUG}" \\\ @@ -275,6 +292,9 @@ CPPFLAGS="${CPPFLAGS:-%{rpmcppflags}}" \\\ -DCMAKE_MODULE_LINKER_FLAGS_PLD="${LDFLAGS:-%{rpmldflags}}" \\\ %if "%{_lib}" == "lib64" \ -DLIB_SUFFIX=64 \\\ +%endif \ +%if "%{_lib}" == "libx32" \ + -DLIB_SUFFIX=x32 \\\ %endif \ -DBUILD_SHARED_LIBS:BOOL=ON \\\ %{nil} @@ -303,6 +323,40 @@ LINKFLAGS="%{rpmldflags}" \ %{__waf} \ } +# meson +%meson { \ +%{?__cc:CC="${CC:-%{__cc}}"} \ +%{?__cxx:CXX="${CXX:-%{__cxx}}"} \ +CFLAGS="${CFLAGS:-%{rpmcflags}}" \ +CPPFLAGS="${CPPFLAGS:-%{rpmcppflags}}" \ +CXXFLAGS="${CXXFLAGS:-%{rpmcxxflags}}" \ +LDFLAGS="${LDFLAGS:-%{rpmldflags}}" \ +LC_ALL=C.UTF-8 %{__meson} \ + --buildtype=plain \ + --bindir=%{_bindir} \ + --datadir=%{_datadir} \ + --includedir=%{_includedir} \ + --infodir=%{_infodir} \ + --libdir=%{_libdir} \ + --libexecdir=%{_libexecdir} \ + --localedir=%{_localedir} \ + --localstatedir=%{_localstatedir} \ + --mandir=%{_mandir} \ + --prefix=%{_prefix} \ + --sbindir=%{_sbindir} \ + --sharedstatedir=%{_sharedstatedir} \ + --sysconfdir=%{_sysconfdir} \ + --wrap-mode=%{__meson_wrap_mode} \ +} +%meson_build LC_ALL=C.UTF-8 %ninja_build +%meson_install LC_ALL=C.UTF-8 %ninja_install +%meson_test LC_ALL=C.UTF-8 %ninja_test + +# ninja +%ninja_build %{__ninja} %{__ninja_common_opts} +%ninja_install DESTDIR=%{buildroot} %{__ninja} install %{__ninja_common_opts} +%ninja_test %{__ninja} test %{__ninja_common_opts} + #---------------------------------------------------------------- #%configure_cache 0 %configure_cache_file %{buildroot}.configure.cache @@ -436,48 +490,6 @@ LINKFLAGS="%{rpmldflags}" \ # and release 0.zzz.bootstrap if built with bootstrap %bootstrap_release() %{!?with_bootstrap:%{1}%{?2:.%{2}}}%{?with_bootstrap:%{!?2:%(expr %{1} - 1)}%{?2:%{1}.%(expr %{2} - 1)}.zzz.bootstrap} -# Alternative kernel type/version -%_alt_kernel %{nil}%{?alt_kernel:-%{?alt_kernel}} - -# The directory holding Linux kernel sources -%_kernelsrcdir /usr/src/linux%{_alt_kernel} - -# rpm -qf on kernel version.h file -%__kernel_qf() %(R=$(cd %{_kernelsrcdir} 2>/dev/null && LC_ALL=C rpm -q --qf '%*' -f include/linux/version.h 2>/dev/null | grep -v 'is not'); echo ${R:-ERROR}) - -# kernel %{name} and kernel %{epoch}:%{version}-%{release} macro respecing alt_kernel -%kernel_name %(N=%{__kernel_qf %{N}}; echo ${N%%-headers}) -%kernel_version %{__kernel_qf %|E?{%{E}:}|%{V}-%{R}} - -# -n drm to generate kernel%{_alt_kernel}-drm dependency -%releq_kernel(n:) %{kernel_name}%{?-n:-%{-n*}} = %{kernel_version} -%releq_kernel_up(n:) %{kernel_name}-up%{?-n:-%{-n*}} = %{kernel_version} -%releq_kernel_smp(n:) %{kernel_name}-smp%{?-n:-%{-n*}} = %{kernel_version} - -# -s post to generate Requires(post) dependency -%requires_releq_kernel(s:n:) Requires%{-s:(%{-s*})}: %releq_kernel -%requires_releq_kernel_up(s:n:) Requires%{-s:(%{-s*})}: %releq_kernel_up -%requires_releq_kernel_smp(s:n:) Requires%{-s:(%{-s*})}: %releq_kernel_smp - -# kernel version-release handling -%__kernel_ver %( \\ - Z=$([ -f '%{_kernelsrcdir}/include/generated/utsrelease.h' ] && awk -F'"' '/UTS_RELEASE/{print $2}' %{_kernelsrcdir}/include/{linux/version,generated/utsrelease}.h 2>/dev/null || awk -F'"' '/UTS_RELEASE/{print $2}' %{_kernelsrcdir}/include/linux/{version,utsrelease}.h 2>/dev/null); \\ - Z=${Z:-$(awk -F' = ' '/^VERSION/{v=$2} /^PATCHLEVEL/{p=$2} /^SUBLEVEL/{s=$2} /^EXTRAVERSION/{e=$2} END {printf("%d.%d.%d%s", v, p, s, e)}' %{_kernelsrcdir}/Makefile 2>/dev/null)}; \\ - echo ${Z:-ERROR}; \\ -) - -%_kernel_version_code %( \\ - Z=$(awk '/LINUX_VERSION_CODE/{print $3}' %{_kernelsrcdir}/include/linux/version.h 2>/dev/null); \\ - echo ${Z:-ERROR}; \\ -) - -%_kernel_version_magic() %(echo $((%{1} * 65536 + %{2} * 256 + %{3}))) - -# `uname -r` used for building/installing kernel modules -%_kernel_ver %{__kernel_ver}%{!?_without_dist_kernel:%(echo %{__kernel_ver} | grep -q -e - || echo -%{__kernel_qf %{R}})} -# package version OR `uname -r` for non-dist kernel to be used in @release field -%_kernel_ver_str %(echo %{!?_without_dist_kernel:%{__kernel_qf %{V}-%{R}}}%{?_without_dist_kernel:%{__kernel_ver}} | tr '-' '_') - # Requires name = version-release %requires_releq() %{!?1:ERROR}%{?2:ERROR}%{?1:%{!?2:%{expand:%%requires_eq_to -r %1 %1}}} # Requires: name = version @@ -511,7 +523,7 @@ Provides: %{1} = %{?epoch:%{epoch}:}%{?version:%{version}}%{?release:-%{release} 'DTDDECL "-//OASIS//DTD DocBook XML V%2//EN" "../../xml.dcl"' \ ' -- hacks for opensp --' \ 'SYSTEM "file://%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \ -'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \ +'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \ '' \ ; do echo $l; done >> %1 \ } @@ -538,8 +550,8 @@ Provides: %{1} = %{?epoch:%{epoch}:}%{?version:%{version}}%{?release:-%{release} for i in /usr/share/man /usr/X11R6/man; do \ if [ -d "$RPM_BUILD_ROOT$i" ]; then \ echo "Compress man pages: $i"; \ - find "$RPM_BUILD_ROOT$i" -name '*.bz2' -print | xargs -r %{__bzip2} -df; \ - find "$RPM_BUILD_ROOT$i" -name '*.gz' -print | xargs -r %{__gzip} -dnf; \ + find "$RPM_BUILD_ROOT$i" -name '*.bz2' -print0 | xargs -0 -r %{__bzip2} -df; \ + find "$RPM_BUILD_ROOT$i" -name '*.gz' -print0 | xargs -0 -r %{__gzip} -dnf; \ find $RPM_BUILD_ROOT$i -type l | while read a; do \ m=$(readlink "$a"); \ if [[ "$m" = */* ]]; then \ @@ -569,14 +581,14 @@ Provides: %{1} = %{?epoch:%{epoch}:}%{?version:%{version}}%{?release:-%{release} test -e $RPM_BUILD_ROOT$i/$l || test -e $d/$(basename $l) || echo " ${doc#$RPM_BUILD_ROOT} points to inexistent manpage: $l"; \ done); \ test "$err" != "" && { echo >&2 "Man page link errors:"; echo >&2 "$err"; exit 1; }; \ - find "$RPM_BUILD_ROOT$i" -type f -size +%{_min_compress_bytes}c -print | xargs -r %{__gzip} -9nf; \ + find "$RPM_BUILD_ROOT$i" -type f -size +%{_min_compress_bytes}c -print0 | xargs -0 -r %{__gzip} -9nf; \ fi; \ done; \ if [ -d "$RPM_BUILD_ROOT%{_infodir}" ]; then \ echo "Compress info pages: %{_infodir}"; \ - find "$RPM_BUILD_ROOT%{_infodir}" -name '*.bz2' -print | xargs -r %{__bzip2} -df; \ - find "$RPM_BUILD_ROOT%{_infodir}" -name '*.gz' -print | xargs -r %{__gzip} -dnf; \ - find "$RPM_BUILD_ROOT%{_infodir}" -name '*.info*' -type f -size +%{_min_compress_bytes}c -print | xargs -r %{__gzip} -9nf; \ + find "$RPM_BUILD_ROOT%{_infodir}" -name '*.bz2' -print0 | xargs -0 -r %{__bzip2} -df; \ + find "$RPM_BUILD_ROOT%{_infodir}" -name '*.gz' -print0 | xargs -0 -r %{__gzip} -dnf; \ + find "$RPM_BUILD_ROOT%{_infodir}" -name '*.info*' -type f -size +%{_min_compress_bytes}c -print0 | xargs -0 -r %{__gzip} -9nf; \ fi; \ }; __spec_install_post_compress_docs } } @@ -744,7 +756,7 @@ __spec_install_post_check_tmpfiles() { \ [ -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'";\ + echo "No tmpfiles configuration for '$d'";\ fail=1 ; \ fi \ done ; \ @@ -753,25 +765,38 @@ __spec_install_post_check_tmpfiles() { \ }; __spec_install_post_check_tmpfiles }} #----------------------------------------------------------------- -# Find and gzip all kernel modules +# Verify that scripts have reasonable shebangs +# Test spec: see "test/spec_install_post_check_shebangs" branch on packages/test.spec # -# Requires: find +#%no_install_post_check_shebangs 1 # -#%no_install_post_compress_modules 1 -%__spec_install_post_compress_modules { \ -%{!?no_install_post_compress_modules: __spec_install_post_compress_modules() { \ +%__spec_install_post_check_shebangs { \ +__spec_install_post_check_shebangs() { \ %{!?debug:set +x;} \ - if [ -d $RPM_BUILD_ROOT/lib/modules ]; then \ - q=$(find $RPM_BUILD_ROOT/lib/modules -name '*o' -type f -print); \ - if [ "$q" ]; then \ - printf "Compress %d kernel modules..." $(echo "$q" | wc -l); \ - echo "$q" | xargs -r %{__gzip} -9nf; \ - echo "DONE"; \ - find $RPM_BUILD_ROOT/lib/modules -name '*o' -type l -printf "%p %l\n" | \ - while read a b; do ln -sf $b.gz $a.gz; rm -f $a; done; \ - fi; \ - fi; \ -}; __spec_install_post_compress_modules } } + fail=0; \ + echo "Checking script shebangs..."; \ + find $RPM_BUILD_ROOT -type f -perm -500 -print | \ + while read f ; do \ + shebang="$(sed -e'1s/#! *\(.*\)/\1/;t;d;q' "$f")" ; \ + f="${f##$RPM_BUILD_ROOT}"; \ + case "$shebang" in \ + "%{__python}"|"%{__python3}"|"%{__python} "*|"%{__python3} "* \ + |"/usr/bin/python%{py_ver}"|"/usr/bin/python%{py_ver} "* \ + |"/usr/bin/python%{py3_ver}"|"/usr/bin/python%{py3_ver} "*) \ + ;; \ + "/usr/bin/env python"*|"/usr/bin/python"|"/usr/bin/python "*) \ + echo "$f starts with '#!$shebang', should be '#!%{__python}' or '#!%{__python3}'" >&2;\ + fail=1 ; \ + ;; \ + "/usr/bin/env "*) \ + echo "$f starts with '#!$shebang', should be explicit interpreter path" >&2;\ + fail=1 ; \ + ;; \ + *) ;;\ + esac ; \ + done ; \ + echo " DONE" ; \ +}; %{!?no_install_post_check_shebangs:__spec_install_post_check_shebangs} } # Remove common Perl files we don't package %__spec_install_post_perl_clean {\ @@ -779,6 +804,15 @@ __spec_install_post_check_tmpfiles() { \ %{?pdir:rm -f $RPM_BUILD_ROOT{%{perl_archlib}/perllocal.pod,%{perl_vendorarch}/auto/%{pdir}%{?pnam:/%(echo %{pnam} | tr - /)}/.packlist}} \ } } +# Helpers to specify SONAME depdendencies, e.g.: +# Requires: %{_soname_prov libfoo.so.1} +# Requires: %{_soname_prov libfoo.so.1(SOME_SYMVER)} +# +# BuildRequires: rpmbuild(macros) >= 1.721 +# +%_soname_tag %(echo %{_lib} | sed -e 's/^lib//' -e 's/^\\(.\\+\\)$/(\\1bit)/') +%_soname_prov() %(echo "%{1}()%{_soname_tag}" | sed -e 's/^\\([^(]*([^)]\\+)\\)()%{_soname_tag}$/\\1%{_soname_tag}/;s/()$//') + #----------------------------------------------------------------- # Update GConf2 schemas # @@ -819,17 +853,23 @@ fi; \ #----------------------------------------------------------------- # Update shared MIME info database # requires: shared-mime-info +# Note: https://bugs.freedesktop.org/show_bug.cgi?id=70366#c19 +# https://bugzilla.redhat.com/show_bug.cgi?id=1052173 +# TODO: if you want this running with fdatasync(), make sure it's: +# 1. announcing ~minute delay by echoing appropriate message, +# 2. running only once after rpm transaction. # %update_mime_database() {{ \ umask 022; \ + PKGSYSTEM_ENABLE_FSYNC=0 \ /usr/bin/update-mime-database %{_datadir}/mime; \ };} \ %{nil} #----------------------------------------------------------------- # Update icon cache -# BuildRequires: rpmbuild(macros) >= 1.596 -# Requires: hicolor-icon-theme +# BuildRequires: rpmbuild(macros) >= 1.596 +# Requires: hicolor-icon-theme # %update_icon_cache() {{ \ %{!?1:%{error:%{0}: Required theme name missing}} \ @@ -885,6 +925,8 @@ fi; \ %{?_noautoreq_pear: %{__noauto_regexp_helper -p pear %{_noautoreq_pear}}} \ %{?_noautoreq_perl: %{__noauto_regexp_helper -p perl %{_noautoreq_perl}}} \ %{?_noautoreq_java: %{__noauto_regexp_helper -p java %{_noautoreq_java}}} \ + %{?_noautoreq_pyegg: %{__noauto_regexp_helper -p pythonegg %{_noautoreq_pyegg}}} \ + %{?_noautoreq_py3egg: %{__noauto_regexp_helper -p python3egg %{_noautoreq_py3egg}}} \ %{nil} # helper for wrapping _noautoreq between perl() or pear() @@ -895,14 +937,22 @@ fi; \ # %define _noautoreq_perl Apache::.* # BuildRequires: rpmbuild(macros) >= 1.672 # %define _noautoreq_java ClassDataVersion -%__noauto_regexp_helper(p:) %(echo "%*" | awk 'BEGIN{RS=" "}{printf("%{-p*}\\\\\\(%%s\\\\\\) ", $1)}') +# BuildRequires: rpmbuild(macros) >= 1.709 +# %define _noautoreq_pyegg argparse +# %define _noautoreq_py3egg backports.ssl-match-hostname ipaddress +# +%__noauto_regexp_helper(p:) %(echo "%*" | awk 'BEGIN{RS=" "}{printf("%{-p*}%{__qchar}(%%s%{__qchar}) ", $1)}') +# detect quote character runtime +%__qchar_4 \\\\%{nil} +%__qchar_5 \\\\\\%{nil} +%__qchar %{expand:%%global __qchar %%__qchar_%(echo %{_rpmversion} | cut -c1)}%__qchar #%_noautocompressdoc %{nil} # %_missing_doc_files_terminate_build 1%{nil} %_unpackaged_files_terminate_build %{nil} # (X)emacs support -%___emacs_lispdir_helper -batch -q -eval '(while load-path (princ (concat (car load-path) "\\n")) (setq load-path (cdr load-path)))' 2> /dev/null|sed -n '/\\(.*\\/x\\?emacs\\/site-lisp\\)\\/\\?$/{s,,\\1,p;q;}' +%___emacs_lispdir_helper -batch -q -eval '(while load-path (princ (concat (car load-path) "\\n")) (setq load-path (cdr load-path)))' 2> /dev/null|sed -n '/\\(.*\\/x\\?emacs\\/site-lisp\\)\\/\\?$/{s,,\\1,p;q;}' %_emacs_lispdir %{expand:%%global _emacs_lispdir %(Z=$(emacs %___emacs_lispdir_helper); echo ${Z:-ERROR})}%_emacs_lispdir %_xemacs_lispdir %{expand:%%global _xemacs_lispdir %(Z=$(xemacs %___emacs_lispdir_helper); echo ${Z:-ERROR})}%_xemacs_lispdir @@ -924,28 +974,33 @@ fi; \ # Ruby %__ruby /usr/bin/ruby +# Ruby ABI version +# NOTE: %ruby_version may be empty, depending how Ruby was built +%ruby_abi %{expand:%%global ruby_abi %(%{__ruby} -r rbconfig -e 'print [RbConfig::CONFIG["MAJOR"], RbConfig::CONFIG["MINOR"]].join(".")' 2>/dev/null || echo ERROR)}%ruby_abi + # get rbconfig parameter %__ruby_rbconfig() %(%{__ruby} -r rbconfig -e 'print RbConfig::CONFIG["%1"]' 2>/dev/null || echo ERROR) +%__ruby_rbconfig_path() %(%{__ruby} -r rbconfig -r pathname -e 'print Pathname(RbConfig::CONFIG["%1"]).cleanpath' 2>/dev/null || echo ERROR) -%ruby_archdir %{expand:%%global ruby_archdir %{__ruby_rbconfig archdir}}%ruby_archdir +%ruby_archdir %{expand:%%global ruby_archdir %{__ruby_rbconfig_path archdir}}%ruby_archdir %ruby_libdir %{expand:%%global ruby_libdir %{__ruby_rbconfig rubylibdir}}%ruby_libdir %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_rbconfig rubylibdir}}%ruby_rubylibdir +%ruby_rubylibdir %{expand:%%global ruby_rubylibdir %{__ruby_rbconfig_path rubylibdir}}%ruby_rubylibdir %ruby_vendorarchdir %{expand:%%global ruby_vendorarchdir %{__ruby_rbconfig vendorarchdir}}%ruby_vendorarchdir -%ruby_vendorlibdir %{expand:%%global ruby_vendorlibdir %{__ruby_rbconfig vendorlibdir}}%ruby_vendorlibdir +%ruby_vendorlibdir %{expand:%%global ruby_vendorlibdir %{__ruby_rbconfig_path vendorlibdir}}%ruby_vendorlibdir %ruby_sitearchdir %{expand:%%global ruby_sitearchdir %{__ruby_rbconfig sitearchdir}}%ruby_sitearchdir %ruby_sitedir %{expand:%%global ruby_sitedir %{__ruby_rbconfig sitedir}}%ruby_sitedir -%ruby_sitelibdir %{expand:%%global ruby_sitelibdir %{__ruby_rbconfig sitelibdir}}%ruby_sitelibdir +%ruby_sitelibdir %{expand:%%global ruby_sitelibdir %{__ruby_rbconfig_path sitelibdir}}%ruby_sitelibdir %ruby_rdocdir /usr/share/rdoc %ruby_vendordir %{expand:%%global ruby_vendordir %{__ruby_rbconfig vendordir}}%ruby_vendordir -%ruby_version %{expand:%%global ruby_version %{__ruby_rbconfig ruby_version}}%ruby_version +%ruby_version %{expand:%%global ruby_version %(r=%{__ruby_rbconfig ruby_version}; echo ${r:-%%nil})}%ruby_version %ruby_gemdir %{expand:%%global ruby_gemdir %(%{__ruby} -r rubygems -e 'puts Gem.respond_to?(:default_dirs) ? Gem.default_dirs[:system][:gem_dir] : Gem.path.first' 2>/dev/null || echo ERROR)}%{ruby_gemdir} %ruby_specdir %{ruby_gemdir}/specifications -# deprecated, similar functionality autogenerated with rpm5 -%ruby_ver_requires_eq Requires: ruby(ver) = %ruby_version -%ruby_mod_ver_requires_eq Requires: ruby-modules(ver) = %ruby_version +# deprecated, ruby 2.0 noarch packages are versionless and extension dependency is generated by rpm5 +%ruby_ver_requires_eq %{nil} +%ruby_mod_ver_requires_eq %{nil} %php_pear_dir /usr/share/pear %php_data_dir /usr/share/php @@ -978,7 +1033,7 @@ fi; \ %__php /usr/bin/php%{php_versuffix} # helper macro -%__php_api_requires(v:) Requires: %{php_name}(%{expand:%1}) = %{expand:%{%{!?2:%{1}}%{?2}}} +%__php_api_requires() Requires: %{php_name}(%{expand:%1}) = %{expand:%{%{!?2:%{1}}%{?2}}} # macros for public use # for php extensions (php-pecl) @@ -1096,11 +1151,10 @@ fi \ # directories %py3_prefix %{expand:%%global py3_prefix %(%{__python3} -c "import sys; print(sys.prefix)" 2>/dev/null || echo ERROR)}%py3_prefix -%py3_libdir %{expand:%%global py3_libdir %(%{__python3} -c "import sysconfig; print(sysconfig.get_path('platstdlib'))" 2>/dev/null || echo ERROR)}%py3_libdir %py3_incdir %{expand:%%global py3_incdir %(%{__python3} -c "import sysconfig; print(sysconfig.get_path('include'))" 2>/dev/null || echo ERROR)}%py3_incdir -%py3_sitedir %{expand:%%global py3_sitedir %(%{__python3} -c "import sysconfig; print(sysconfig.get_path('platlib'))" 2>/dev/null || echo ERROR)}%py3_sitedir -%py3_sitescriptdir %{expand:%%global py3_sitescriptdir %(%{__python3} -c "import sysconfig; print(sysconfig.get_path('purelib'))" 2>/dev/null || echo ERROR)}%py3_sitescriptdir -%py3_scriptdir %{py3_prefix}/share/python%{py3_ver} +%py3_libdir %{py3_prefix}/%{_lib}/python%{py3_ver} +%py3_sitedir %{py3_libdir}/site-packages +%py3_sitescriptdir %{py3_prefix}/share/python%{py3_ver}/site-packages %py3_dyndir %{py3_libdir}/lib-dynload # pure python modules compilation @@ -1108,6 +1162,69 @@ fi \ %py3_ocomp %{__python3} -O -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])" +%py_build { \ + LDFLAGS="${LDFLAGS:-%rpmldflags}"; export LDFLAGS; \ + CFLAGS="${CFLAGS:-%rpmcppflags %rpmcflags}"; export CFLAGS; \ + CXXFLAGS="${CXXFLAGS:-%rpmcppflags %rpmcxxflags}"; export CXXFLAGS; \ + %{?__cc:CC="%{__cc}"; export CC;} \ + %{?__cxx:CXX="%{__cxx}"; export CXX;} \ + %{__python} setup.py \ + build --build-base=build-2 \ +} + +# "shrink" filter to keep this macro without newlines, +# so it could be used as make arguments +%py_install_opts() %{shrink: \ + --prefix=%{_prefix} \ + --install-purelib=%{py_sitescriptdir} \ + --install-platlib=%{py_sitedir} \ + --optimize=2 \ +} + +%py_install { \ + LDFLAGS="${LDFLAGS:-%rpmldflags}"; export LDFLAGS; \ + CFLAGS="${CFLAGS:-%rpmcppflags %rpmcflags}"; export CFLAGS; \ + CXXFLAGS="${CXXFLAGS:-%rpmcppflags %rpmcxxflags}"; export CXXFLAGS; \ + %{?__cc:CC="%{__cc}"; export CC;} \ + %{?__cxx:CXX="%{__cxx}"; export CXX;} \ + %{__python} setup.py \ + build --build-base=build-2 \ + install --skip-build \ + %{py_install_opts} \ + --root=$RPM_BUILD_ROOT \ +} + +%py3_build { \ + LDFLAGS="${LDFLAGS:-%rpmldflags}"; export LDFLAGS; \ + CFLAGS="${CFLAGS:-%rpmcppflags %rpmcflags}"; export CFLAGS; \ + CXXFLAGS="${CXXFLAGS:-%rpmcppflags %rpmcxxflags}"; export CXXFLAGS; \ + %{?__cc:CC="%{__cc}"; export CC;} \ + %{?__cxx:CXX="%{__cxx}"; export CXX;} \ + %{__python3} setup.py build --build-base=build-3 \ +} + +# "shrink" filter to keep this macro without newlines, +# so it could be used as make arguments +%py3_install_opts() %{shrink: \ + --prefix=%{_prefix} \ + --install-purelib=%{py3_sitescriptdir} \ + --install-platlib=%{py3_sitedir} \ + --optimize=2 \ +} + +%py3_install { \ + LDFLAGS="${LDFLAGS:-%rpmldflags}"; export LDFLAGS; \ + CFLAGS="${CFLAGS:-%rpmcppflags %rpmcflags}"; export CFLAGS; \ + CXXFLAGS="${CXXFLAGS:-%rpmcppflags %rpmcxxflags}"; export CXXFLAGS; \ + %{?__cc:CC="%{__cc}"; export CC;} \ + %{?__cxx:CXX="%{__cxx}"; export CXX;} \ + %{__python3} setup.py \ + build --build-base=build-3 \ + install --skip-build \ + %{py3_install_opts} \ + --root=$RPM_BUILD_ROOT \ +} + # node.js libdir # Requirements: # BuildRequires: rpmbuild(macros) >= 1.634 @@ -1115,10 +1232,20 @@ fi \ # bash-completion 2.0 completions dir # Requirements: -# BuildRequires: rpmbuild(macros) >= 1.673 +# BuildRequires: rpmbuild(macros) >= 1.673 # Requires: bash-completion >= 2.0 %bash_compdir /usr/share/bash-completion/completions +# fish completions dir +# Requirements: +# BuildRequires: rpmbuild(macros) >= 1.720 +%fish_compdir /usr/share/fish/vendor_completions.d + +# zsh completions dir +# Requirements: +# BuildRequires: rpmbuild(macros) >= 1.719 +%zsh_compdir /usr/share/zsh/site-functions + # Hardlink binary identical .pyc and .pyo files %__spec_install_post_py_hardlink {\ %{!?no_install_post_py_hardlink: __spec_install_post_py_hardlink() { \ @@ -1183,9 +1310,6 @@ fi; \ %xmms_effect_plugindir %{expand:%%global xmms_effect_plugindir %(xmms-config --effect-plugin-dir 2>/dev/null || echo ERROR)}%xmms_effect_plugindir %xmms_general_plugindir %{expand:%%global xmms_general_plugindir %(xmms-config --general-plugin-dir 2>/dev/null || echo ERROR)}%xmms_general_plugindir -%_host_base_arch %{expand:%%global _host_base_arch %(echo %{_host_cpu} | sed 's/i.86/i386/;s/athlon/i386/;s/pentium./i386/;s/amd64/x86_64/;s/ia32e/x86_64/;s/sparcv./sparc/;s/arm.*/arm/')}%_host_base_arch -%_target_base_arch %{expand:%%global _target_base_arch %(echo %{_target_cpu} | sed 's/i.86/i386/;s/athlon/i386/;s/pentium./i386/;s/amd64/x86_64/;s/ia32e/x86_64/;s/sparcv./sparc/;s/arm.*/arm/')}%_target_base_arch - # user/group checking macros # # Usage: @@ -1226,11 +1350,11 @@ fi; \ # You can use any form of here-document, <<'EOF' <<-EOT will do. # NOTE: if your use "<<-EOF", then You can actually indent inside here-document. # -# -a - append to the banner -# -e - send to stderr instead of stdout -# -n - no show banner (overrides -t) -# -t - show only, if RPM_SCRIPTVERBOSITY >= n; default n=5 -# -o - show only once, i.e when package is installed for the first time +# -a - append to the banner +# -e - send to stderr instead of stdout +# -n - don't show banner (overrides -t) +# -t - show only, if RPM_SCRIPTVERBOSITY >= n; default n=5 +# -o - show only once, i.e when package is installed for the first time # # Tests: # (rpm -E '%banner -e banner < m; sh -x m @@ -1359,6 +1483,9 @@ 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"] @@ -1442,12 +1569,12 @@ cat > $RPM_BUILD_ROOT%{_bindir}/%5 << 'EOF' \ \ # Source system prefs\ if [ -f %{_sysconfdir}/java/%{name}.conf ]; then\ - . %{_sysconfdir}/java/%{name}.conf\ + . %{_sysconfdir}/java/%{name}.conf\ fi\ \ # Source user prefs\ if [ -f $HOME/.%{name}rc ]; then\ - . $HOME/.%{name}rc\ + . $HOME/.%{name}rc\ fi\ \ # Configuration\ @@ -1694,243 +1821,6 @@ done \ %env_update [ ! -x /sbin/env-update ] || /sbin/env-update -u || : - -# Build modules for kernels 2.6 -# Author: Przemyslaw Iskra -# -# Usage: -# %build_kernel_modules -m -C -# -# remember that proper Makefile is still required -# Options: -# -m (required) -- comma-separated list of modules to save, -# without .ko extension, may be placed in subdirectory -# -C -- change to before doing anything -# -p , -P -- arguments passeed to make scripts -# -c -- do not execute make clean -# -- all additional arguments will be passed to -# make modules -# -# Additional patching supported via here document. Try: -# %build_kernel_modules -m module <<'EOF' -# your patch script here -# EOF -# Don't use it unless patching depends on config options. - -# Developer note: don't touch it unless you know how to handle '\'. -# - \ in script expands to nothing -# - \\\ in script expands to \ -# - \\\ inside definition expands to nothing -# - \\\\\\\ inside definition expands to \ -# - in last line \ has to touch arguments so arguments passing -# in new lines (using \) will be supported - -%build_kernel_modules(p:P:m:C:c) \ -%{!?-m:%{error:%{0}: Required module name/list missing} exit 1} \ - \ -%define Opts \\\\\\\ -%if "%{_target_base_arch}" != "%{_host_base_arch}" \\\ - %if "%{_host_base_arch}" == "x86_64" && "%{_target_base_arch}" == "i386" \\\ - CC="%{__cc}" ARCH=%{_target_base_arch} \\\ - %else \\\ - ARCH=%{_target_base_arch} CROSS_COMPILE=%{_target_cpu}-pld-linux- \\\ - %endif \\\ -%else \\\ - CC="%{__cc}" \\\ -%endif \ -%define MakeOpts HOSTCC="%{__cc}" SYSSRC=%{_kernelsrcdir} SYSOUT=$PWD/o \\\\\\\ - O=$PWD/o %{?with_verbose:V=1} %{Opts} \ - \ -%{?-C:cd %{-C*}} \ -compile() { \ - local L="<" PATCH_SH; \ - [[ '%{*}' != *$L$L* ]] || PATCH_SH="set -x -e;$(cat)" \ - set -e -x \ - \ - [ -r "%{_kernelsrcdir}/.config" ] || exit 1 \ - rm -rf o \ - install -d o/include/linux o/include/generated o/arch/x86/include o/arch/powerpc/lib \ - ln -sf %{_kernelsrcdir}/.config o/.config \ - ln -sf %{_kernelsrcdir}/Module.symvers o/Module.symvers \ - if [ -f %{_kernelsrcdir}/include/generated/autoconf.h ]; then \ - ln -sf %{_kernelsrcdir}/include/generated/autoconf.h o/include/generated/autoconf.h \ - ln -s ../generated/autoconf.h o/include/linux/autoconf.h \ - else \ - ln -sf %{_kernelsrcdir}/include/linux/autoconf.h o/include/linux/autoconf.h \ - fi \ - if [ -d %{_kernelsrcdir}/arch/x86/include/generated ]; then \ - ln -s %{_kernelsrcdir}/arch/x86/include/generated o/arch/x86/include \ - fi \ - \ - set +x \ - [ -z "$PATCH_SH" ] || echo "$PATCH_SH" | %__spec_build_shell \ - set -x \ - \ - install -d o/include/config \ - touch o/include/config/MARKER \ - ln -sf %{_kernelsrcdir}/include/config/auto.conf o/include/config/auto.conf \ - ln -sf %{_kernelsrcdir}/scripts o/scripts \ - \ - %{!?-c:%{__make} -C %{_kernelsrcdir} clean \\\ - RCS_FIND_IGNORE="-name '*.[ks]o' -o" \\\ - ${1+"$@"} \\\ - M=$PWD %{MakeOpts}} \ - \ - %{__make} -C %{_kernelsrcdir} modules \\\ - ${1+"$@"} \\\ - M=$PWD CONSTIFY_PLUGIN="" %{MakeOpts} \ -%{?-C:cd -} \ -} \ -compile %{*} \ -%{nil} - -%build_kernel_modules_compat(p:P:m:C:c) \ -%{!?-m:%{error:%{0}: Required module name/list missing} exit 1} \ - \ -%define Opts \\\\\\\ -%if "%{_target_base_arch}" != "%{_host_base_arch}" \\\ - %if "%{_host_base_arch}" == "x86_64" && "%{_target_base_arch}" == "i386" \\\ - CC="%{__cc}" ARCH=%{_target_base_arch} \\\ - %else \\\ - ARCH=%{_target_base_arch} CROSS_COMPILE=%{_target_cpu}-pld-linux- \\\ - %endif \\\ -%else \\\ - CC="%{__cc}" \\\ -%endif \ -%define MakeOpts HOSTCC="%{__cc}" SYSSRC=%{_kernelsrcdir} SYSOUT=$PWD/o \\\\\\\ - O=$PWD/o %{?with_verbose:V=1} %{Opts} \ - \ -%{?-C:cd %{-C*}} \ -compile() { \ - local L="<" PATCH_SH; \ - [[ '%{*}' != *$L$L* ]] || PATCH_SH="set -x -e;$(cat)" \ - set -e -x \ - local cfgs='%{?with_dist_kernel:%{?with_smp: smp}%{?with_up: up}}%{!?with_dist_kernel: nondist}' \ - \ -for cfg in ${cfgs:-dist}; do \ - [ -r "%{_kernelsrcdir}/config-$cfg" ] || exit 1 \ - \ - rm -rf o \ - install -d o/include/linux o/include/generated o/arch/powerpc/lib \ - ln -sf %{_kernelsrcdir}/config-$cfg o/.config \ - ln -sf %{_kernelsrcdir}/Module.symvers-$cfg o/Module.symvers \ - if [ -f %{_kernelsrcdir}/include/generated/autoconf-$cfg.h ]; then \ - ln -sf %{_kernelsrcdir}/include/generated/autoconf-$cfg.h o/include/generated/autoconf.h \ - ln -s ../generated/autoconf.h o/include/linux/autoconf.h \ - else \ - ln -sf %{_kernelsrcdir}/include/linux/autoconf-$cfg.h o/include/linux/autoconf.h \ - fi \ - \ - set +x \ - [ -z "$PATCH_SH" ] || echo "$PATCH_SH" | %__spec_build_shell \ - set -x \ - \ - %if %{with dist_kernel} || %(test -f %{_kernelsrcdir}/scripts/bin2c ; echo $?) \ - %{__make} -j1 -C %{_kernelsrcdir} prepare scripts \\\ - %{-p*} %{-P*} \\\ - %{MakeOpts} \ - %else \ - install -d o/include/config \ - touch o/include/config/MARKER \ - ln -sf %{_kernelsrcdir}/include/config/auto-$cfg.conf o/include/config/auto.conf \ - ln -sf %{_kernelsrcdir}/scripts o/scripts \ - %endif \ - \ - %{!?-c:%{__make} -C %{_kernelsrcdir} clean \\\ - RCS_FIND_IGNORE="-name '*.[ks]o' -o" \\\ - ${1+"$@"} \\\ - M=$PWD %{MakeOpts}} \ - \ - %{__make} -C %{_kernelsrcdir} modules \\\ - ${1+"$@"} \\\ - M=$PWD CONSTIFY_PLUGIN="" %{MakeOpts} \ - \ - for MODULE in {%{-m*},}; do \ - [ -z "${MODULE}" ] || mv ${MODULE}{,-$cfg}.ko \ - done \ -done \ -%{?-C:cd -} \ -} \ -compile %{*} \ -%{nil} - - -# Install kernel modules built by %build_kernel_modules -# Author: Przemyslaw Iskra -# -# Usage: -# %install_kernel_modules -m -d -# -# Options: -# -m (required) -- comma-separated list of modules to install, -# without .ko extension, may be placed in subdirectory -# -d (required) -- in what subdirectory modules should be -# installed (eg. misc, kernel/drivers/net) -# -s -- suffix to use when installing modules, useful when module -# with same name exists in kernel already -# -n -- name of modprobe config file to use (without .conf extension) -# for defining aliases, only useful with -s -# -D -- DESTDIR, base directory for installed files, -# defaults to RPM_BUILD_ROOT - -%install_kernel_modules(m:d:s:n:D:) \ -%{!?-m:%{error:%{0}: Required module name (-m) missing}exit 1} \ -%{!?-d:%{error:%{0}: Required module directory missing}exit 1} \ -%{?-n:%{!?-s:%{error:%{0}: Modprobe .conf file requires module suffix}exit 1}} \ - \ -INSTALLROOT=%{-D*} \ -[ -n "$INSTALLROOT" ] || INSTALLROOT=$RPM_BUILD_ROOT \ - \ -%define KernelD $INSTALLROOT/lib/modules/%{_kernel_ver} \ -%define ModprobeD $INSTALLROOT%{_sysconfdir}/modprobe.d/%{_kernel_ver} \ - \ -__install_kernel_modules() { \ -%{!?debug:set +x;} \ - \ -for MODULE in {%{-m*},}; do \ - [ -n "${MODULE}" ] || continue \ - MNAME=${MODULE##*/} \ - install -m 644 -D ${MODULE}.ko %{KernelD}/%{-d*}/${MNAME}%{-s:-%{-s*}}.ko \ - %{?-s:install -d %{ModprobeD} \ - echo "alias ${MNAME} ${MNAME}-%{-s*}" >> %{ModprobeD}/%{-n*}.conf} \ -done \ -} \ -__install_kernel_modules \ -unset INSTALLROOT \ -%{nil} - -%install_kernel_modules_compat(m:d:s:n:D:) \ -%{!?-m:%{error:%{0}: Required module name (-m) missing}exit 1} \ -%{!?-d:%{error:%{0}: Required module directory missing}exit 1} \ -%{?-n:%{!?-s:%{error:%{0}: Modprobe .conf file requires module suffix}exit 1}} \ - \ -INSTALLROOT=%{-D*} \ -[ -n "$INSTALLROOT" ] || INSTALLROOT=$RPM_BUILD_ROOT \ - \ -%define KernelD $INSTALLROOT/lib/modules/%{_kernel_ver} \ -%define ModprobeD $INSTALLROOT%{_sysconfdir}/modprobe.d/%{_kernel_ver} \ - \ -__install_kernel_modules() { \ -%{!?debug:set +x;} \ -local cfgs='%{?with_dist_kernel:%{?with_smp: smp}%{?with_up: up}}%{!?with_dist_kernel: nondist}' \ - \ -for MODULE in {%{-m*},}; do \ - [ -n "${MODULE}" ] || continue \ - for cfg in ${cfgs:-dist}; do \ - [ "$cfg" = smp ] && suf=smp || suf= \ - MNAME=${MODULE##*/} \ - install -m 644 -D ${MODULE}-$cfg.ko \\\ - %{KernelD}$suf/%{-d*}/${MNAME}%{-s:-%{-s*}}.ko \ - %{?-s:install -d %{ModprobeD}$suf \ - echo "alias ${MNAME} ${MNAME}-%{-s*}" \\\ - >> %{ModprobeD}$suf/%{-n*}.conf} \ - done \ -done \ -} \ -__install_kernel_modules \ -unset INSTALLROOT \ -%{nil} - # patchset macros # generate SourceX urls from range START STOP # Format can be SINGLE format char of %e, %f, %g, see seq(1) @@ -2301,12 +2191,12 @@ fi; \ %{nil} # Haskell Macros -# BuildRequires: rpmbuild(macros) >= 1.608 +# BuildRequires: rpmbuild(macros) >= 1.608 %ghcdir ghc-%(/usr/bin/ghc --numeric-version 2>/dev/null || echo ERROR) # update /usr/lib*/ghc-*/package.conf.d/package.cache # Requires: ghc -# BuildRequires: rpmbuild(macros) >= 1.607 +# BuildRequires: rpmbuild(macros) >= 1.607 # %ghc_pkg_recache() {{ \ umask 022; \ @@ -2317,8 +2207,8 @@ fi; \ # pre/post script for packages supporting systemd units # -# Author: Bartlomiej Zimon -# Jan Rękorajski +# Authors: Bartlomiej Zimon +# Jan Rękorajski # # Usage: # %systemd_reload @@ -2351,11 +2241,11 @@ fi; \ # BuildRequires: rpmbuild(macros) >= 1.671 # Requires: systemd-units >= 38 -%systemd_reload /bin/systemd_booted && SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog /bin/systemctl --quiet daemon-reload || : +%systemd_reload /bin/systemd_booted && SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog /bin/systemctl daemon-reload || : %systemd_service_enable() \ export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \ - /bin/systemctl --quiet enable %{*} || : \ + /bin/systemctl preset --preset-mode=enable-only %{*} || : \ /bin/systemd_booted && echo 'Run "/bin/systemctl start %{*}" to start %{*}.' || : \ %{nil} @@ -2366,29 +2256,32 @@ fi; \ %systemd_service() \ export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \ - /bin/systemd_booted && /bin/systemctl --quiet %{*} || : \ + /bin/systemd_booted && /bin/systemctl %{*} || : \ %{nil} %systemd_service_start() \ export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \ - /bin/systemd_booted && /bin/systemctl --quiet start %{*} || : \ + /bin/systemd_booted && /bin/systemctl start %{*} || : \ %{nil} %systemd_service_stop() \ export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \ - /bin/systemd_booted && /bin/systemctl --quiet stop %{*} || : \ + /bin/systemd_booted && /bin/systemctl stop %{*} || : \ %{nil} +# NOTE: doesn't honour RPM_SKIP_AUTO_RESTART, avoid using %systemd_service_restart() \ export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \ - /bin/systemd_booted && /bin/systemctl --quiet try-restart %{*} || : \ + /bin/systemd_booted && /bin/systemctl try-restart %{*} || : \ %{nil} +# NOTE: doesn't honour RPM_SKIP_AUTO_RESTART, avoid using %systemd_service_reload() \ export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \ - /bin/systemd_booted && /bin/systemctl --quiet reload %{*} || : \ + /bin/systemd_booted && /bin/systemctl reload %{*} || : \ %{nil} +# NOTE: this trigger disobeys systemd.preset in favour of RPM_ENABLE_SYSTEMD_SERVICE %systemd_trigger() \ want_enable_service() { \ [ -f /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm \ @@ -2399,19 +2292,19 @@ want_enable_service() { \ export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \ for s in %{*}; do \ if want_enable_service $s; then \ - /bin/systemctl --quiet enable $s || : \ + /bin/systemctl enable $s || : \ fi \ done \ %{nil} %systemd_post() \ export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \ - /bin/systemd_booted && /bin/systemctl --quiet daemon-reload || : \ + /bin/systemd_booted && /bin/systemctl daemon-reload || : \ if [ $1 -eq 1 ]; then \ - /bin/systemctl --quiet enable %{*} || : \ + /bin/systemctl preset --preset-mode=enable-only %{*} >/dev/null || : \ /bin/systemd_booted && echo 'Run "/bin/systemctl start %{*}" to start %{*}.' || : \ elif [ -z "$NORESTART" ]; then \ - /bin/systemd_booted && /bin/systemctl --quiet try-restart %{*} || : \ + /bin/systemd_booted && /bin/systemctl try-restart %{*} || : \ else \ /bin/systemd_booted && echo 'Run "/bin/systemctl restart %{*}" to restart %{*}.' || : \ fi \ @@ -2420,7 +2313,7 @@ want_enable_service() { \ %systemd_preun() \ if [ $1 -eq 0 ]; then \ export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \ - /bin/systemd_booted && /bin/systemctl --quiet stop %{*} || : \ + /bin/systemd_booted && /bin/systemctl stop %{*} || : \ /bin/systemctl --quiet disable %{*} || : \ fi \ %{nil} @@ -2429,6 +2322,9 @@ want_enable_service() { \ %systemduserunitdir /usr/lib/systemd/user %systemdtmpfilesdir /usr/lib/tmpfiles.d +# BuildRequires: rpmbuild(macros) >= 1.721 +%journal_catalog_update() [ ! -x /bin/journalctl ] || /bin/journalctl --update-catalog >/dev/null 2>&1 || : + #----------------------------------------------------------------- # Update hardware database index # @@ -2440,4 +2336,15 @@ want_enable_service() { \ /sbin/udevadm hwdb --update >/dev/null 2>&1 || : \ %{nil} +# Generate vim help tags file +# +# Requirements: +# BuildRequires: rpmbuild(macros) >= 1.718 +# Requires(post,postun): /usr/bin/vim +# Requires(post,postun): vim-rt >= 4:7.4.2054-2 +%vim_doc_helptags() \ +umask 022; \ +/usr/bin/vim -c ':helptags /usr/share/vim/doc' -c ':q' 2>/dev/null \ +%{nil} + # EOF