From 0eb62159bb739a0e5c4dded2a7b323feb93bf52a Mon Sep 17 00:00:00 2001 From: Frank Dana (FeRD) Date: Mar 31 2023 06:22:18 +0000 Subject: EPEL Guidelines: Tag specfile code blocks as rpm-spec Enables syntax highlighting --- diff --git a/modules/ROOT/pages/epel-packaging.adoc b/modules/ROOT/pages/epel-packaging.adoc index 0eeced0..fefa369 100644 --- a/modules/ROOT/pages/epel-packaging.adoc +++ b/modules/ROOT/pages/epel-packaging.adoc @@ -103,7 +103,8 @@ regenerate the dynamic linker's cache. If the package or subpackage has no existing `+%post+` or `+%postun+` scriptlets, simply include the `+%ldconfig_scriptlets+` macro on its own line before the %files list. -.... +[source, rpm-spec] +---- [...] %install # Install the program @@ -113,7 +114,7 @@ no existing `+%post+` or `+%postun+` scriptlets, simply include the %files libs %license GPL [...] -.... +---- Using the `+%ldconfig_scriptlets+` macro will automatically generate a dependency on ldconfig where necessary. The macro will do nothing at all @@ -150,7 +151,8 @@ which is created by running the glib-compile-schemas utility. /usr/bin/glib-compile-schemas must be run whenever the set of installed schemas changes. -.... +[source, rpm-spec] +---- %postun if [ $1 -eq 0 ] ; then /usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || : @@ -158,7 +160,7 @@ fi %posttrans /usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || : -.... +---- [[gdk_pixbuf_loaders]] == gdk-pixbuf loaders @@ -177,7 +179,8 @@ us to install the binary in -32 and -64 variants. The scriptlets to maintain the cache file are: -.... +[source, rpm-spec] +---- %postun /usr/bin/gdk-pixbuf-query-loaders-%{__isa_bits} --update-cache &> /dev/null || : @@ -186,7 +189,7 @@ if [ $1 -eq 1 ] ; then # For upgrades, the cache will be regenerated by the new package's %postun /usr/bin/gdk-pixbuf-query-loaders-%{__isa_bits} --update-cache &> /dev/null || : fi -.... +---- Note the use of %\{__isa_bits}, which is an rpm macro that expands to either 32 or 64, depending on the architecture of the package. @@ -206,7 +209,8 @@ install the binary in -32 and -64 variants. The scriptlets to maintain the cache file are: -.... +[source, rpm-spec] +---- %postun /usr/bin/gtk-query-immodules-3.0-%{__isa_bits} --update-cache &> /dev/null || : @@ -215,7 +219,7 @@ if [ $1 -eq 1 ] ; then # For upgrades, the cache will be regenerated by the new package's %postun /usr/bin/gtk-query-immodules-3.0-%{__isa_bits} --update-cache &> /dev/null || : fi -.... +---- The 3.0 in the binary name is there because gtk2 has its own utility for the same purpose, called gtk-query-immodules-2.0. Note the use of @@ -238,7 +242,8 @@ considerations force us to install the binary in -32 and -64 variants. The scriptlets to maintain the cache file are: -.... +[source, rpm-spec] +---- %postun /usr/bin/gio-querymodules-%{__isa_bits} %{_libdir}/gio/modules &> /dev/null || : @@ -246,7 +251,7 @@ The scriptlets to maintain the cache file are: # We run this after every install or upgrade because of a cornercase # when installing the second architecture of a multilib package /usr/bin/gio-querymodules-%{__isa_bits} %{_libdir}/gio/modules || : -.... +---- Note the use of %\{__isa_bits}, which is an rpm macro that expands to either 32 or 64, depending on the architecture of the package. @@ -255,7 +260,8 @@ either 32 or 64, depending on the architecture of the package. Use this when a package drops an XML file in %\{_datadir}/mime/packages. -.... +[source, rpm-spec] +---- %post /bin/touch --no-create %{_datadir}/mime/packages &>/dev/null || : @@ -266,7 +272,7 @@ fi %posttrans /usr/bin/update-mime-database %{?fedora:-n} %{_datadir}/mime &> /dev/null || : -.... +---- Note that similarly to the gtk-update-icon-cache code, these scriptlets should be run only if the user has update-mime-info installed and @@ -280,22 +286,24 @@ shared-mime-info package is installed. Use this when a desktop entry has a *MimeType* key. -.... +[source, rpm-spec] +---- %post /usr/bin/update-desktop-database &> /dev/null || : %postun /usr/bin/update-desktop-database &> /dev/null || : -.... +---- Note: This scriptlet follows the same convention as mimeinfo files and gtk-icon-cache. Namely, the spec file should not Require desktop-file-utils for this. For older releases, one should -.... +[source, rpm-spec] +---- Requires(post): desktop-file-utils Requires(postun): desktop-file-utils -.... +---- (See http://bugzilla.redhat.com/180898 and http://bugzilla.redhat.com/180899) @@ -325,7 +333,8 @@ systems where it's not available nor needed, such as older distro versions or (very) trimmed down installations, and generally results in less entries in specfiles, rpmdb, and repo metadatas. -.... +[source, rpm-spec] +---- %post /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || : @@ -337,4 +346,4 @@ fi %posttrans /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : -.... +----