X-Git-Url: https://git.tld-linux.org/?a=blobdiff_plain;f=macros.tld;h=d993c2bc70e0b8805dce3095540a53b271fcad66;hb=refs%2Fheads%2Fmaster;hp=5f218ad105b2bed0a345631cc42c83fa82940907;hpb=b5115bb76a6795a89fadf5f4e7161f26203c7678;p=packages%2Frpm-tld-macros.git diff --git a/macros.tld b/macros.tld index 5f218ad..d993c2b 100644 --- a/macros.tld +++ b/macros.tld @@ -1,13 +1,233 @@ # vim:ts=4 sw=4 noet ft=spec # # TLD Linux rpm macros. -# +# + +%distribution TLD Linux +%vendor tld +%bugurl https://tld-linux.org/ +%disturl https://tld-linux.org/ +%disttag tld + +# TLD Linux Release for backward compatibility with PLD spec files +%pld_release ti # can be used by builder script to check for version %rpm_build_macros {Revision} %epoch 0 -%x8664 x86_64 amd64 ia32e + +#============================================================================== +# ---- configure macros. note that most of these are inherited +# from the defaults. +# +%_sharedstatedir /var/lib +%_localstatedir /var +%_localedir %{_datadir}/locale +%_lispdir %{_datadir}/emacs/site-lisp +%_initddir %{_sysconfdir}/rc.d/init.d + +%_metainfodir %{_datadir}/metainfo + +%_defaultdocdir %{_usr}/share/doc + +%_fmoddir %{_libdir}/gfortran/modules + +# Location of autoconf macros +%_aclocaldir %{expand:%%global _aclocaldir %(aclocal --print-ac-dir 2>/dev/null || echo ERROR)}%_aclocaldir + +# Location of omf files +%_omf_dest_dir %{expand:%%global _omf_dest_dir %(scrollkeeper-config --omfdir || echo ERROR)}%_omf_dest_dir + +# Location of pkgconfig files +%_pkgconfigdir /usr/%{_lib}/pkgconfig +# noarch pkgconfig files (since 1.446) +%_npkgconfigdir /usr/share/pkgconfig + +# Location of desktop files +%_desktopdir /usr/share/applications +%_applnkdir ERROR:_applnkdir_is_obsolete_use_desktopdir_instead + +# Location of pixmaps for applnk/desktop files +%_pixmapsdir /usr/share/pixmaps + +# Location of themable icons for applnk/desktop files +%_iconsdir /usr/share/icons + +# Location of fonts directories +%_fontsdir /usr/share/fonts + +# Location of Gtk and associated libraries documentation (since 1.98) +%_gtkdocdir %{_defaultdocdir}/gtk-doc/html + +# Common subdirectory for gi-docgen generated libraries documentation (since 2.029) +%_gidocdir %{_defaultdocdir}/gi-doc + +# Location of KDE documentation (since 1.129) +%_kdedocdir %{_defaultdocdir}/kde/HTML + +# unsermake script +%__unsermake /usr/share/unsermake/unsermake + +# Current date +%date %(LC_ALL=C date +"%a %b %d %Y") + +# Example files, programs, scripts... +%_examplesdir /usr/src/examples + +# SysV-style initscripts dir +%_initddir /etc/rc.d/init.d + +# Executed at after copying %doc to DOCDIR, with $DOCDIR set +# TODO: teach rpm.org that compressed %doc is the same thing as uncompressed +#__compress_doc %{_rpmconfigdir}/compress-doc%{?_noautocompressdoc: --noautocompressdoc='%{_noautocompressdoc}'} + +%__os_install_post \ +%{__spec_install_post_strip}\ +%{__spec_install_post_chrpath}\ +%{__spec_install_post_compress_modules}\ +%{__spec_install_post_check_so}\ +%{__spec_install_post_check_shebangs}\ +%{__spec_install_post_compress_docs}\ +%{__spec_install_post_py_hardlink}\ +%{__spec_install_post_perl_clean}\ +%{__arch_install_post}\ +%{nil} + +%__spec_install_post\ +%{expand:%%define __sip_%{?_enable_debug_packages} 1}%{?__sip_1:%{?__debug_package:%{__debug_install_post}}}%{expand:%%undefine __sip_%{?_enable_debug_packages}}\ +%{__arch_install_post}\ +%{__os_install_post}\ +%{nil} + +#--------------------------------------------------------------------- +# Template for debug information sub-package. +%_enable_debug_packages 1 + +%_debuginfo_template \ +%package debuginfo\ +Summary: Debug information for package %{name}\ +Summary(pl.UTF-8): Informacje dla debuggera dla pakietu %{name}\ +Group: Development/Debug\ +Requires: filesystem-debuginfo >= 3.0-16\ +AutoReqProv: 0\ +%description debuginfo\ +This package provides debug information for package %{name}.\ +Debug information is useful when developing applications that use this\ +package or when debugging this package.\ +%description debuginfo -l pl.UTF-8\ +Ten pakiet dostarcza informacje dla debuggera dla pakietu %{name}.\ +Informacje te są przydatne przy rozwijaniu aplikacji używających tego\ +pakietu oraz przy odpluskwianiu samego pakietu.\ +%files debuginfo -f debugfiles.list\ +%defattr(-,root,root)\ +%{nil} + +%_debugsource_template \ +%package debugsource\ +Summary: Debug sources for package %{name}\ +Summary(pl.UTF-8): Źródła dla debuggera dla pakietu %{name}\ +Group: Development/Debug\ +AutoReqProv: 0\ +%description debugsource\ +This package provides debug sources for package %{name}.\ +Debug sources are useful when developing applications that use this\ +package or when debugging this package.\ +%description debugsource -l pl.UTF-8\ +Ten pakiet dostarcza źródła dla debuggera dla pakietu %{name}.\ +Źródła te są przydatne przy rozwijaniu aplikacji używających tego\ +pakietu oraz przy odpluskwianiu samego pakietu.\ +%files debugsource -f debugsourcefiles.list\ +%{nil} + +%debug_package \ +%ifnarch noarch\ +%global __debug_package 1\ +%_debuginfo_template\ +%if 0%{?_debugsource_packages}\ +%_debugsource_template\ +%endif\ +%endif\ +%{nil} + +#--------------------------------------------------------------------- +# Overwrite RPM macros with TLD specific one here. + +%__find /usr/bin/find +%__lua %{_bindir}/lua +%__rc %{_bindir}/rc +%__xar %{_bindir}/xar + +%_source_payload w9.gzdio +%_binary_payload w6.xzdio + +%_rpmfc_magic_path /usr/share/file/magic + +# provides don't obsolete +%_upgrade_tag name + +# Disable automatic dependencies on symlinks for now (debuginfo packages pull too many deps) +%_check_symlink_deps 0 + +# Do not generate executable() dependencies for scriptlets, +# as it may give false positives, for example: +# [ ! -x /bin/prog ] || /bin/prog +# will generate R:/bin/prog and we don't want that as /bin/prog is optional in this case +# 0 - Use external generator +# 1 - Use internal generator if available +# 2 - Use __scriptlet_requires to process scriptlet dependencies +%_use_internal_dependency_generator 1 + +%_duplicate_files_terminate_build 1 +%_files_listed_twice_terminate_build 1 +%_unpackaged_files_terminate_build 0 +%_unpackaged_subdirs_terminate_build 0 + +# +# Export package NEVRA (stamped with install tid) info for HRMIB on this path. +# +# XXX Note: escaped %% for use in headerSprintf() +%_hrmib_path /var/cache/hrmib/%{___NVRA} + +#----------------------------------------------------------------- +# CFLAGS and LDFLAGS used to build + +%debuginfocflags %{expand:%%define __dic_%{?_enable_debug_packages} 1}%{?__dic_1: -gdwarf-4 -fno-debug-types-section -fvar-tracking-assignments -g2}%{expand:%%undefine __dic_%{?_enable_debug_packages}} +# -feliminate-dwarf2-dups disabled until PR ld/3290 is fixed. + +%debugcflags -O0 -g -Wall +%debugcppflags %{nil} +%debugldflags %{nil} + +%optldflags -Wl,--as-needed -Wl,--no-copy-dt-needed-entries -Wl,-z,relro -Wl,-z,combreloc %{?use_ld:-Wl,-fuse-ld=%{use_ld}} +%optcppflags %{nil} + +# common compilation flags +%_fortify_cflags -Wp,-D_FORTIFY_SOURCE=2 + +# cf http://wiki.mandriva.com/en/Development/Packaging/Problems#format_not_a_string_literal_and_no_format_arguments +%Werror_cflags -Wformat -Werror=format-security + +# Use -Werror=trampolines to prevent GCC from generating code that require executable stack +%_ssp_cflags -fstack-protector-strong --param=ssp-buffer-size=4 -Werror=trampolines +%__common_cflags -O2 -fwrapv -pipe %{Werror_cflags} %{debuginfocflags} %{?_fortify_cflags} %{!?nospecflags:%{?specflags}} +%__common_cflags_with_ssp %{__common_cflags} %{?_ssp_cflags} + +# arch macros +%ix86 i386 i486 i586 i686 pentium3 pentium4 athlon geode +%x8664 x86_64 amd64 ia32e +%ppc ppc ppc7400 ppc7450 + +# avoid fdatasync syscall flood during database operations. +%__nofsync nofsync + +#--------------------------------------------------------------------- +# Expanded at end of %prep +# +%__chown_Rhf %{__chown} -Rhf +%__chgrp_Rhf %{__chgrp} -Rhf +%_fixowner [ `%{__id_u}` = '0' ] && %{__chown_Rhf} root +%_fixgroup [ `%{__id_u}` = '0' ] && %{__chgrp_Rhf} root # compiler version %cc_version %{expand:%%global cc_version %(%{__cc} -dumpversion 2>/dev/null || echo 0.0)}%cc_version @@ -16,9 +236,11 @@ %__rm /bin/rm --interactive=never # Build system path macros. -%__autoconf autoconf %{?debug:-Wall} -%__automake automake -a -c -f --foreign +%__autoconf autoconf %{?debug:-Wall} +%__automake automake -a -c -f --foreign %__autopoint autopoint --force +%__aclocal aclocal +%__autoheader autoheader # add parallel build flags: -jN # jobs macro is available since 1.657 @@ -33,7 +255,7 @@ %__make /usr/bin/make %{?_make_opts} %{?_smp_mflags} %__scons /usr/bin/scons %{?_smp_mflags} %__waf /usr/bin/waf %{?_smp_mflags} -%__cmake /usr/bin/cmake -Wno-dev +%__cmake /usr/bin/cmake %__meson /usr/bin/meson %__meson_wrap_mode nodownload %__ninja /usr/bin/ninja @@ -65,10 +287,10 @@ elif [ -d $HOME/rpm/SPECS -a -d $HOME/rpm/SOURCES ]; then \ # if old style rpm dir exist, go with it echo $HOME/rpm; \ - elif [ -x ../builder -a ! -d ../builder ]; then + elif [ -x ../builder -a ! -d ../builder ] && [ "$(realpath -s ../builder)" != "/usr/bin/builder" ]; then # relative new style rpmdir: in package dir cd ..; pwd - elif [ -x builder -a ! -d builder ]; then + elif [ -x builder -a ! -d builder ] && [ "$(realpath -s builder)" != "/usr/bin/builder" ]; then # relative new style rpmdir: in packages pwd elif [ -x packages/builder -a ! -d packages/builder ]; then @@ -80,6 +302,12 @@ fi; \ )}%_topdir +%_tmppath %(echo "${TMPDIR:-/var/tmp}") +%tmpdir %{_tmppath} + +%_buildrootdir %{_tmppath} +%buildroot %{_buildrootdir}/%{name}-%{version}-%{_arch}-root-%(id -u -n) + # if %{_topdir}/SPECS exists, it's old style structure %_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 @@ -261,8 +489,16 @@ %{?__cxx:CXX="${CXX:-%{__cxx}}"} \\\ CPPFLAGS="${CPPFLAGS:-%{rpmcppflags}}" \\\ %{__cmake} \\\ - -DCMAKE_VERBOSE_MAKEFILE=ON \\\ + -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \\\ -DCMAKE_BUILD_TYPE=%{!?debug:TLD}%{?debug:Debug} \\\ + -DCMAKE_SYSTEM_NAME=Linux \\\ + -DCMAKE_SYSTEM_VERSION="%(uname -r)" \\\ + -DCMAKE_CROSSCOMPILING:BOOL=FALSE \\\ +%ifarch x32\ + -DCMAKE_SYSTEM_PROCESSOR=x86_64 \\\ +%else\ + -DCMAKE_SYSTEM_PROCESSOR=%{_target_cpu} \\\ +%endif\ -DCMAKE_INSTALL_BINDIR:PATH=%{_bindir} \\\ -DCMAKE_INSTALL_SBINDIR:PATH=%{_sbindir} \\\ -DCMAKE_INSTALL_LIBEXECDIR:PATH=%{_libexecdir} \\\ @@ -295,6 +531,7 @@ CPPFLAGS="${CPPFLAGS:-%{rpmcppflags}}" \\\ -DBUILD_SHARED_LIBS:BOOL=ON \\\ %{nil} +# scons (since 1.385) %scons { \ %{__scons} \ LDFLAGS="${LDFLAGS:-%rpmldflags}" \ @@ -308,7 +545,7 @@ CPPFLAGS="${CPPFLAGS:-%{rpmcppflags}}" \\\ prefix=%{_prefix} \ } -# waf. see waf.spec +# waf. see waf.spec (since 1.336) %waf { \ CC="%{__cc}" \ CXX="%{__cxx}" \ @@ -319,7 +556,7 @@ LINKFLAGS="%{rpmldflags}" \ %{__waf} \ } -# meson +# meson (since 1.727) %meson { \ %{?__cc:CC="${CC:-%{__cc}}"} \ %{?__cxx:CXX="${CXX:-%{__cxx}}"} \ @@ -327,6 +564,8 @@ CFLAGS="${CFLAGS:-%{rpmcflags}}" \ CPPFLAGS="${CPPFLAGS:-%{rpmcppflags}}" \ CXXFLAGS="${CXXFLAGS:-%{rpmcxxflags}}" \ LDFLAGS="${LDFLAGS:-%{rpmldflags}}" \ +RUSTC="${RUSTC:-%{__rustc}}" \ +RUSTFLAGS="${RUSTFLAGS:-%{rpmrustflags} --target %rust_target}" \ LC_ALL=C.UTF-8 %{__meson} \ --buildtype=plain \ --bindir=%{_bindir} \ @@ -351,7 +590,7 @@ LC_ALL=C.UTF-8 %{__meson} \ %meson_install %___meson_deprecate meson_install ninja_install %meson_test %___meson_deprecate meson_test ninja_test -# ninja +# ninja (since 1.736) %ninja_build LC_ALL=C.UTF-8 %{__ninja} %{__ninja_common_opts} %ninja_install LC_ALL=C.UTF-8 DESTDIR=%{buildroot} %{__ninja} install %{__ninja_common_opts} %ninja_test LC_ALL=C.UTF-8 %{__ninja} test %{__ninja_common_opts} @@ -425,10 +664,14 @@ LC_ALL=C.UTF-8 %{__meson} \ %__without_if() %{expand:%%{?with_%{1}:--without-%{?2}%{!?2:%{1}}}} %__with_without_not() %{expand:%%{!?with_%{1}:--with-%{?2}%{!?2:%{1}}%{?3:=%{3}}}%%{?with_%{1}:--without-%{?2}%{!?2:%{1}}}} -# expands to true or false based on bcond; for use with meson or cmake +# expands to true or false based on bcond; for use with meson or cmake (since 1.729) %__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 (since 2.000) +%__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 @@ -444,47 +687,7 @@ LC_ALL=C.UTF-8 %{__meson} \ %%prep\ %{nil} -# Location of autoconf macros -%_aclocaldir %{expand:%%global _aclocaldir %(aclocal --print-ac-dir 2>/dev/null || echo ERROR)}%_aclocaldir - -# Location of omf files -%_omf_dest_dir %{expand:%%global _omf_dest_dir %(scrollkeeper-config --omfdir || echo ERROR)}%_omf_dest_dir - -# Location of pkgconfig files -%_pkgconfigdir /usr/%{_lib}/pkgconfig -# noarch pkgconfig files -%_npkgconfigdir /usr/share/pkgconfig - -# Location of desktop files -%_desktopdir /usr/share/applications -%_applnkdir ERROR:_applnkdir_is_obsolete_use_desktopdir_instead - -# Location of pixmaps for applnk/desktop files -%_pixmapsdir /usr/share/pixmaps - -# Location of themable icons for applnk/desktop files -%_iconsdir /usr/share/icons - -# Location of fonts directories -%_fontsdir /usr/share/fonts - -# Location of Gtk and associated libraries documentation -%_gtkdocdir %{_defaultdocdir}/gtk-doc/html - -# Location of KDE documentation -%_kdedocdir %{_defaultdocdir}/kde/HTML - -# unsermake script -%__unsermake /usr/share/unsermake/unsermake - -# Current date -%date %(LC_ALL=C date +"%a %b %d %Y") - -# Example files, programs, scripts... -%_examplesdir /usr/src/examples - -# SysV-style initscripts dir -%_initddir /etc/rc.d/init.d +%_build_id_links %{expand:%%define __dic_%{?_enable_debug_packages} 1}%{?__dic_1:alldebug}%{?__dic_0:none}%{expand:%%undefine __dic_%{?_enable_debug_packages}} # If non-empty "debug" macro defined, add "dbg" suffix to release number %_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm @@ -503,12 +706,12 @@ LC_ALL=C.UTF-8 %{__meson} \ # Requires: name = version %requires_eq() %{!?1:ERROR}%{?2:ERROR}%{?1:%{!?2:%{expand:%%requires_eq_to %1 %1}}} # Requires: name = version (version based on querying package %2) -%requires_eq_to(r) %{!?2:ERROR}%{?3:ERROR}%{?2:%{!?3:%(if ! LC_ALL=C rpm -q --qf 'Requires: %1 = %|E?{%{E}:}|%{V}%{?-r:-%{R}}\\n' %2 | grep '^Requires:'; then echo "BuildRequires: %2"; fi)}} +%requires_eq_to(r) %{!?2:ERROR}%{?3:ERROR}%{?2:%{!?3:%(if ! LC_ALL=C rpm -q --whatprovides --qf 'Requires: %1 = %|E?{%{E}:}|%{V}%{?-r:-%{R}}\\n' %2 | grep '^Requires:'; then echo "BuildRequires: %2"; fi)}} # Requires: name >= version %requires_ge() %{!?1:ERROR}%{?2:ERROR}%{?1:%{!?2:%{expand:%%requires_ge_to %1 %1}}} # Requires: name >= version (version based on querying package %2) -%requires_ge_to(r) %{!?2:ERROR}%{?3:ERROR}%{?2:%{!?3:%(if ! LC_ALL=C rpm -q --qf 'Requires: %1 >= %|E?{%{E}:}|%{V}%{?-r:-%{R}}\\n' %2 | grep '^Requires:'; then echo "BuildRequires: %2"; fi)}} +%requires_ge_to(r) %{!?2:ERROR}%{?3:ERROR}%{?2:%{!?3:%(if ! LC_ALL=C rpm -q --whatprovides --qf 'Requires: %1 >= %|E?{%{E}:}|%{V}%{?-r:-%{R}}\\n' %2 | grep '^Requires:'; then echo "BuildRequires: %2"; fi)}} # helper for renaming packages # %rename old-package @@ -516,6 +719,17 @@ 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.749 +%_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 \ +BuildArch: noarch \ +%{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 @@ -626,7 +840,7 @@ if [ -d "$RPM_BUILD_ROOT" ]; then \ echo "DONE"; \ fi; \ fi; \ - filelist=$(find $RPM_BUILD_ROOT -type f ! -regex ".*/usr/lib[x0-9]*/debug/.*\.debug" ! -regex ".*/usr/lib[x0-9]*.*/guile/.*\.go" ! -regex ".*/lib/modules/.*" ! -regex ".*%{_docdir}/.*" ! -regex ".*%{_includedir}/.*" %{?_noautostrip:! -regex "%{_noautostrip}"} %{?_autostripall:! -regex "%{_autostripall}"} %{?_autostripunneeded:! -regex "%{_autostripunneeded}"} %{?_autostripdebug:! -regex "%{_autostripdebug}"}); \ + filelist=$(find $RPM_BUILD_ROOT ! \( -path "*/usr/src/debug" -prune \) -type f ! -regex ".*/usr/lib[x0-9]*/debug/.*\.debug" ! -regex ".*/usr/lib[x0-9]*.*/guile/.*\.go" ! -regex ".*/lib/modules/.*" ! -regex ".*%{_docdir}/.*" ! -regex ".*%{_includedir}/.*" %{?_noautostrip:! -regex "%{_noautostrip}"} %{?_autostripall:! -regex "%{_autostripall}"} %{?_autostripunneeded:! -regex "%{_autostripunneeded}"} %{?_autostripdebug:! -regex "%{_autostripdebug}"}); \ if [ -n "$filelist" ]; then \ filetypes=`echo "$filelist" | xargs -r -d'\\n' file`; \ elfexelist=`echo "$filetypes" | awk -F: '/ELF.*executable/ {print $1}'`; \ @@ -774,30 +988,6 @@ __spec_install_post_check_execstack() { \ %{!?no_install_post_check_execstack:return $fail;} \ }; __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. -# -#%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 }} - #----------------------------------------------------------------- # Verify that scripts have reasonable shebangs # Test spec: see "test/spec_install_post_check_shebangs" branch on packages/test.spec @@ -850,7 +1040,7 @@ __spec_install_post_check_shebangs() { \ %_soname_prov() %(echo "%{1}()%{_soname_tag}" | sed -e 's/^\\([^(]*([^)]\\+)\\)()%{_soname_tag}$/\\1%{_soname_tag}/;s/()$//') #----------------------------------------------------------------- -# Update GConf2 schemas +# Update GConf2 schemas (since 1.198) # # Requires: GConf2 # @@ -869,7 +1059,7 @@ fi; \ %{nil} #----------------------------------------------------------------- -# Update desktop MIME database +# Update desktop MIME database (since 1.198) # requires: desktop-file-utils %update_desktop_database() {{ \ umask 022; \ @@ -887,7 +1077,7 @@ fi; \ %{nil} #----------------------------------------------------------------- -# Update shared MIME info database +# Update shared MIME info database (since 1.311) # requires: shared-mime-info # Note: https://bugs.freedesktop.org/show_bug.cgi?id=70366#c19 # https://bugzilla.redhat.com/show_bug.cgi?id=1052173 @@ -918,7 +1108,7 @@ fi; \ %{nil} #----------------------------------------------------------------- -# Update scrollkeeper database +# Update scrollkeeper database (since 1.198) # requires: scrollkeeper # %scrollkeeper_update_post() \ @@ -932,7 +1122,7 @@ fi; \ %{nil} #----------------------------------------------------------------- -# Compile GSettings schemas +# Compile GSettings schemas (since 1.592) # requires: glib2 >= 1:2.26.0 # %glib_compile_schemas() {{ \ @@ -941,6 +1131,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 @@ -954,7 +1152,6 @@ fi; \ # %__noautoreqfiles %(sed -e s'/#.*//' /etc/rpm/noautoreqfiles)%{?_noautoreqfiles: %{_noautoreqfiles}} %__noautoprovfiles %(sed -e s'/#.*//' /etc/rpm/noautoprovfiles)%{?_noautoprovfiles: %{_noautoprovfiles}} -%__noautoreqdep %(sed -e s'/#.*//' /etc/rpm/noautoreqdep)%{?_noautoreqdep: %{_noautoreqdep}} %__noautoprov %(sed -e s'/#.*//' /etc/rpm/noautoprov) \ %{?_noautoprov: %{_noautoprov}} \ %{?_noautoprov_java: %{__noauto_regexp_helper -p java %{_noautoprov_java}}} \ @@ -966,6 +1163,7 @@ fi; \ %{nil} %__noautoreq %(sed -e s'/#.*//' /etc/rpm/noautoreq) \ %{?_noautoreq: %{_noautoreq}} \ + %{?_noautoreqdep: %{_noautoreqdep}} \ %{?_noautoreq_java: %{__noauto_regexp_helper -p java %{_noautoreq_java}}} \ %{?_noautoreq_mono: %{__noauto_regexp_helper -p mono %{_noautoreq_mono}}} \ %{?_noautoreq_pear: %{__noauto_regexp_helper -p pear %{_noautoreq_pear}}} \ @@ -974,6 +1172,29 @@ fi; \ %{?_noautoreq_py3egg: %{__noauto_regexp_helper -p python3egg %{_noautoreq_py3egg}}} \ %{nil} +%__noautodep_helper() %(echo '%*' | awk 'BEGIN { + RS = "\n([ \t]+\n)+"; + FS = " "; +} +{ + split($0, F); + if (length(F) > 0) { + printf("("); + for (i=1; i<=length(F); i++) { + s = F[i]; + sub(/#.*/, "z&z", s); + if (s ~ /^$/) { continue; }; + printf(s); + if (i != length(F)) { printf("|"); }; + }; + printf(")"); + } +}') +%__requires_exclude_from %{__noautodep_helper %{__noautoreqfiles}}%{nil} +%__provides_exclude_from %{__noautodep_helper %{__noautoprovfiles}}%{nil} +%__requires_exclude %{__noautodep_helper %{__noautoreq}}%{nil} +%__provides_exclude %{__noautodep_helper %{__noautoprov}}%{nil} + # helper for wrapping _noautoreq between perl() or pear() # Author: Elan Ruusamäe # Usage: @@ -995,7 +1216,7 @@ fi; \ # %define _noautoprov_pyegg excluded # %define _noautoprov_py3egg excluded3 # -%__noauto_regexp_helper(p:) %(echo "%*" | awk 'BEGIN{RS=" "}{printf("%{-p*}%{__qchar}(%%s%{__qchar}) ", $1)}') +%__noauto_regexp_helper(p:) %(echo '%*' | awk 'BEGIN{RS=" "}{printf("%{-p*}%{__qchar}(%%s%{__qchar}) ", $1)}') # detect quote character runtime %__qchar_4 \\\\%{nil} %__qchar_5 \\\\\\%{nil} @@ -1027,7 +1248,7 @@ fi; \ # BuildRequires: rpmbuild(macros) >= 1.719 %zsh_compdir /usr/share/zsh/site-functions -# depmod macro +# depmod macro (since 1.184) %depmod() { \ umask 022; \ if [ -e /boot/System.map-%1 ]; then \ @@ -1041,7 +1262,7 @@ else \ fi; \ } -# user/group checking macros +# user/group checking macros (since 1.202) # # Usage: # %userremove myuser @@ -1071,7 +1292,7 @@ fi; \ %addusertogroup(q) quiet=%{-q:1} /usr/lib/rpm/user_group.sh user addtogroup %*; \ %{nil} -# banner support (useful in {pre,post}{,un} and triggers) +# banner support (useful in {pre,post}{,un} and triggers) (since 1.194) # # Usage: # %banner name [-a] [-e] [-n] [-tn] [-o] <= n; default n=5 -# -o - show only once, i.e when package is installed for the first time +# -o - show only once, i.e when package is installed for the first time (since 1.595) # # Tests: # (rpm -E '%banner -e banner < m; sh -x m @@ -1105,7 +1326,7 @@ fi \ eval $CMD %{?2:%2}%{?3: %3})%{-o:)} \ %{nil} -# useradd/groupadd macros +# useradd/groupadd macros (since 1.202) # Author: Elan Ruusamäe # # Usage: @@ -1176,9 +1397,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"] @@ -1237,10 +1455,10 @@ fi; start=$(expr $base + %1); end=$(expr $base + %{?2}%{!?2:%{1}}); # we need to call seq twice as it doesn't allow two formats - seq -f 'Patch%g:' $start $end > %{tmpdir}/__ps1; - seq -f '%{-f*}' %1 %{?2}%{!?2:%{1}} > %{tmpdir}/__ps2; - paste %{tmpdir}/__ps{1,2}; - rm -f %{tmpdir}/__ps{1,2}; + seq -f 'Patch%g:' $start $end > %{_tmppath}/__ps1; + seq -f '%{-f*}' %1 %{?2}%{!?2:%{1}} > %{_tmppath}/__ps2; + paste %{_tmppath}/__ps{1,2}; + rm -f %{_tmppath}/__ps{1,2}; } ) \ %{nil} @@ -1411,5 +1629,3 @@ end\ umask 022; \ /usr/bin/vim -c ':helptags /usr/share/vim/doc' -c ':q' 2>/dev/null \ %{nil} - -# EOF