)}%_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
'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 \
}
[ -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 ; \
%{!?debug:set +x;} \
fail=0; \
echo "Checking script shebangs..."; \
- for f in $(find $RPM_BUILD_ROOT -type f -perm -500 -print) ; do \
- shebang=$(sed -e'1s/#! *\(.*\)/\1/;t;d;q' "$f") ; \
- f=${f##$RPM_BUILD_ROOT}; \
+ 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} "* \
#-----------------------------------------------------------------
# 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}} \
%_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
%__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)
# 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
%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 { \
+%py_build { \
LDFLAGS="${LDFLAGS:-%rpmldflags}"; export LDFLAGS; \
CFLAGS="${CFLAGS:-%rpmcppflags %rpmcflags}"; export CFLAGS; \
CXXFLAGS="${CXXFLAGS:-%rpmcppflags %rpmcxxflags}"; export CXXFLAGS; \
build --build-base=build-2 \
}
-%py_install { \
+# "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; \
%{__python} setup.py \
build --build-base=build-2 \
install --skip-build \
- --prefix=%{_prefix} \
- --install-purelib=%{py_sitescriptdir} \
- --install-platlib=%{py_sitedir} \
- --optimize=2 \
+ %{py_install_opts} \
--root=$RPM_BUILD_ROOT \
}
-%py3_build { \
+%py3_build { \
LDFLAGS="${LDFLAGS:-%rpmldflags}"; export LDFLAGS; \
CFLAGS="${CFLAGS:-%rpmcppflags %rpmcflags}"; export CFLAGS; \
CXXFLAGS="${CXXFLAGS:-%rpmcppflags %rpmcxxflags}"; export CXXFLAGS; \
%{__python3} setup.py build --build-base=build-3 \
}
-%py3_install { \
+# "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; \
%{__python3} setup.py \
build --build-base=build-3 \
install --skip-build \
- --prefix=%{_prefix} \
- --install-purelib=%{py3_sitescriptdir} \
- --install-platlib=%{py3_sitedir} \
- --optimize=2 \
+ %{py3_install_opts} \
--root=$RPM_BUILD_ROOT \
}
# 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() { \
# 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 <<EOF'; echo -e 'hi\nEOF') > m; sh -x m
# 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"]
\
# 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\
%{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; \
# pre/post script for packages supporting systemd units
#
-# Author: Bartlomiej Zimon <uzi18@o2.pl>
-# Jan Rękorajski <baggins@mimuw.edu.pl>
+# Authors: Bartlomiej Zimon <uzi18@o2.pl>
+# Jan Rękorajski <baggins@mimuw.edu.pl>
#
# Usage:
# %systemd_reload
# 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}
%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 \
%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 \
%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}
/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