From 7c35b1f653a16f3b246f3d5f064e0c29758dd3d9 Mon Sep 17 00:00:00 2001
From: Frank Dana (FeRD) <ferdnyc@gmail.com>
Date: Apr 27 2023 16:40:57 +0000
Subject: [PATCH 1/6] Alternatives: Tag specfile code blocks as rpm-spec


Enables syntax highlighting
---

diff --git a/guidelines/modules/ROOT/pages/Alternatives.adoc b/guidelines/modules/ROOT/pages/Alternatives.adoc
index a3aba3f..a56bb9a 100644
--- a/guidelines/modules/ROOT/pages/Alternatives.adoc
+++ b/guidelines/modules/ROOT/pages/Alternatives.adoc
@@ -83,7 +83,8 @@ Using %ghost for this purpose allows using globs and generated file lists.
 
 Example from antlr.spec:
 
-....
+[source, rpm-spec]
+----
 Requires(post): %{_sbindir}/update-alternatives
 Requires(postun): %{_sbindir}/update-alternatives
 ...
@@ -104,12 +105,13 @@ fi
 ...
 %ghost %{_bindir}/antlr
 %{_bindir}/antlr-java
-....
+----
 
 And a more complex example of alternatives invocation from sendmail.spec,
 slightly edited:
 
-....
+[source, rpm-spec]
+----
 Requires(post): %{_sbindir}/update-alternatives
 Requires(postun): %{_sbindir}/update-alternatives
 Requires(preun): %{_sbindir}/update-alternatives
@@ -185,4 +187,4 @@ fi
 %{_mandir}/man5/aliases.sendmail.5.gz
 
 %attr(0755,root,root) %{_initrddir}/sendmail
-....
+----

From cde06d717eab1f65ee9e339da3a7bbe97613cdc8 Mon Sep 17 00:00:00 2001
From: FeRD (Frank Dana) <ferdnyc@gmail.com>
Date: Apr 27 2023 16:40:57 +0000
Subject: [PATCH 2/6] Filtering: Tag specfile code blocks as rpm-spec


Enables syntax highlighting

---

diff --git a/guidelines/modules/ROOT/pages/AutoProvidesAndRequiresFiltering.adoc b/guidelines/modules/ROOT/pages/AutoProvidesAndRequiresFiltering.adoc
index f054df8..7060d99 100644
--- a/guidelines/modules/ROOT/pages/AutoProvidesAndRequiresFiltering.adoc
+++ b/guidelines/modules/ROOT/pages/AutoProvidesAndRequiresFiltering.adoc
@@ -58,10 +58,11 @@ and that list contains `+libfoo.so+`
 you'll have to use `+libfoo\\.so+` to escape the ("`+.+`").
 Example:
 
-....
+[source, rpm-spec]
+----
 %global to_exclude libfoo\\.so
 %global __requires_exclude_from ^%{_datadir}/%{to_exclude}$
-....
+----
 
 === Preventing files/directories from being scanned for deps (pre-scan filtering)
 
@@ -72,14 +73,15 @@ These macros should be defined with a regular expression
 that matches all of the directories or files.
 For instance:
 
-....
+[source, rpm-spec]
+----
 # Do not check any files in docdir for requires
 %global __requires_exclude_from ^%{_docdir}/.*$
 
 # Do not check .so files in an application-specific library directory
 # or any files in the application's data directory for provides
 %global __provides_exclude_from ^(%{_libdir}/%{name}/.*\\.so.*|%{_datadir}/myapp/.*)$
-....
+----
 
 Note that this macro replaces the `+%filter_provides_in+` macro
 from the old filtering guidelines but it does not do the same thing.
@@ -110,14 +112,15 @@ matches the regular expression
 then it will be filtered out of the requires or provides.
 For example:
 
-....
+[source, rpm-spec]
+----
 # This might be useful if plugins are being picked up by the dependency generator
 %global __provides_exclude ^libfoo-plugin\\.so.*$
 
 # Something like this could be used to prevent excess deps from an
 # example python script in %doc
 %global __requires_exclude ^/usr/bin/python$
-....
+----
 
 These macros serves a similar purpose to the old
 `+%filter_from_provides+` macro
@@ -138,9 +141,10 @@ you still have the option to use the macros listed above.
 
 Perl extension modules can be filtered using this macro:
 
-....
+[source, rpm-spec]
+----
 %{?perl_default_filter}
-....
+----
 
 Essentially, this filters dependencies arising from `+%doc+` files,
 from non-Linux-related modules,
@@ -151,14 +155,15 @@ then define your filters first and call `+%perl_default_filter+` afterwards.
 The default filter macro will preserve the filters you previously defined.
 For example:
 
-....
+[source, rpm-spec]
+----
 # Filter all provides from some directory
 %global __provides_exclude_from %{_libexecdir}/autoinst
 # Filter some specific requires by name
 %global __requires_exclude ^perl\\((autotest|basetest)
 # All of the default filters
 %{?perl_default_filter}
-....
+----
 
 == Examples
 
@@ -173,9 +178,10 @@ and as such must not be exposed globally by RPM.
 
 To filter this out, we could use:
 
-....
+[source, rpm-spec]
+----
 %global __provides_exclude_from ^%{_libdir}/purple-2/.*\\.so$
-....
+----
 
 === Private Libraries
 
@@ -211,13 +217,14 @@ so your regex needs to capture both.
 +
 * Add the excludes to the spec file for both requires and provides:
 
-....
+[source, rpm-spec]
+----
 [...]
 %global _privatelibs libprivate[.]so.*
 %global __provides_exclude ^(%{_privatelibs})$
 %global __requires_exclude ^(%{_privatelibs})$
 [...]
-....
+----
 
 You can take a look at a
 https://lists.fedoraproject.org/pipermail/devel/2012-June/169190.html[more complex example]
@@ -235,10 +242,11 @@ e.g. to ensure an arch-specific `perl-*` package won't provide
 or require things that it shouldn't,
 we could use an invocation as such:
 
-....
+[source, rpm-spec]
+----
 # we don't want to provide private Perl extension libs
 %{?perl_default_filter}
-....
+----
 
 === `+%{_docdir}+` filtering
 
@@ -247,11 +255,12 @@ to either "provide" or "require" anything.
 We can prevent this from happening
 by preventing anything under `+%{_docdir}+` from being scanned:
 
-....
+[source, rpm-spec]
+----
 # we don't want to either provide or require anything from _docdir, per policy
 %global __provides_exclude_from ^%{_docdir}/.*$
 %global __requires_exclude_from ^%{_docdir}/.*$
-....
+----
 
 == Additional Information
 

From 59c0f861c607f85cd99aa926c53e5d7320b32152 Mon Sep 17 00:00:00 2001
From: FeRD (Frank Dana) <ferdnyc@gmail.com>
Date: Apr 27 2023 16:40:57 +0000
Subject: [PATCH 3/6] CMake: Tag specfile blocks as rpm-spec


---

diff --git a/guidelines/modules/ROOT/pages/CMake.adoc b/guidelines/modules/ROOT/pages/CMake.adoc
index b2c0602..1acccb4 100644
--- a/guidelines/modules/ROOT/pages/CMake.adoc
+++ b/guidelines/modules/ROOT/pages/CMake.adoc
@@ -10,9 +10,10 @@ in Fedora packages.
 
 You *MUST* add following BuildRequires:
 
-....
+[source, rpm-spec]
+----
 BuildRequires: cmake
-....
+----
 
 == Available Macros
 
@@ -71,7 +72,8 @@ It may be removed in the future.
 
 == Example Usage
 
-....
+[source, rpm-spec]
+----
 %build
 %cmake
 %cmake_build
@@ -81,7 +83,7 @@ It may be removed in the future.
 
 %check
 %ctest
-....
+----
 
 == Notes
 

From bf1c6220b098764fa66aaaea928143f0408cec76 Mon Sep 17 00:00:00 2001
From: FeRD (Frank Dana) <ferdnyc@gmail.com>
Date: Apr 27 2023 16:40:57 +0000
Subject: [PATCH 4/6] Conflicts: Tag specfile blocks as rpm-spec


---

diff --git a/guidelines/modules/ROOT/pages/Conflicts.adoc b/guidelines/modules/ROOT/pages/Conflicts.adoc
index d852b13..38b1179 100644
--- a/guidelines/modules/ROOT/pages/Conflicts.adoc
+++ b/guidelines/modules/ROOT/pages/Conflicts.adoc
@@ -60,9 +60,10 @@ above the `+Conflicts:+` field:
 
 *Example:*
 
-....
+[source, rpm-spec]
+----
 Conflicts: unrar < 2.0
-....
+----
 
 If the software links to the libraries of another package,
 it must use `+Requires:+` instead of `+Conflicts:+` to mark that dependency.
@@ -98,19 +99,21 @@ between the files in the new package and the original package.
 Where the new package depends on the original package,
 this can be resolved with a versioned Requires:
 
-....
+[source, rpm-spec]
+----
 # In the new package's spec file:
 Requires: original-package > EVR_BEFORE_SPLIT
-....
+----
 
 If the new package should be installable
 independently of whether the original package is installed,
 a versioned conflict is allowed:
 
-....
+[source, rpm-spec]
+----
 # In the new package's spec file:
 Conflicts: original-package <= EVR_BEFORE_SPLIT
-....
+----
 
 In both of these cases,
 the new version of the original package should be updated

From 51483e40e9779f95fdd2bd8a7ae8a3b0cd8af419 Mon Sep 17 00:00:00 2001
From: FeRD (Frank Dana) <ferdnyc@gmail.com>
Date: Apr 27 2023 16:40:57 +0000
Subject: [PATCH 5/6] CronFiles: Tag specfile blocks as rpm-spec


---

diff --git a/guidelines/modules/ROOT/pages/CronFiles.adoc b/guidelines/modules/ROOT/pages/CronFiles.adoc
index b6a5609..9f62791 100644
--- a/guidelines/modules/ROOT/pages/CronFiles.adoc
+++ b/guidelines/modules/ROOT/pages/CronFiles.adoc
@@ -83,19 +83,20 @@ and all cron daemon packages create (and own) that directory,
 
 === Example of cron job packaging
 
-....
+[source, rpm-spec]
+----
 Name:
-.....
+...
 Source1: %{name}.cron
 Requires: crontabs
 
-.....
+...
 
 %install 
-.....
+...
 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/cron.monthly
 %{__install} -p -D -m 0750 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/cron.monthly/%{name}
 
 %files
 %config(noreplace) %{_sysconfdir}/cron.monthly/%{name}
-....
+----

From 9ea194db0c596d92ac2d347354b14dc8c55c8b93 Mon Sep 17 00:00:00 2001
From: FeRD (Frank Dana) <ferdnyc@gmail.com>
Date: Apr 27 2023 16:40:57 +0000
Subject: [PATCH 6/6] TmpFiles: Tag specfile blocks as rpm-spec


---

diff --git a/guidelines/modules/ROOT/pages/Tmpfiles.d.adoc b/guidelines/modules/ROOT/pages/Tmpfiles.d.adoc
index d915937..93032b8 100644
--- a/guidelines/modules/ROOT/pages/Tmpfiles.d.adoc
+++ b/guidelines/modules/ROOT/pages/Tmpfiles.d.adoc
@@ -35,7 +35,8 @@ Information on other options is available on the https://www.freedesktop.org/sof
 
 In the spec file, the packager needs to install the tmpfiles.d conf file into the `+%{_tmpfilesdir}+` directory and also make sure the directory is included in the rpm.
 
-....
+[source, rpm-spec]
+----
 # For the _tmpfilesdir macro.
 BuildRequires: systemd-rpm-macros
 
@@ -62,7 +63,7 @@ chmod 0644 %{buildroot}/run/%{name}.pid
 %dir /run/%{name}/
 %verify(not size mtime md5) /run/%{name}.pid
 %{_tmpfilesdir}/%{name}.conf
-....
+----
 
 `+%{_tmpfilesdir}+` expands to `+%{_prefix}/lib/tmpfiles.d+` which is the location that the package's default tmpfile creation scripts should install into. `+%{_tmpfilesdir}/%{name}.conf+` is *not* marked as a `+%config+` file because it is not supposed to be edited by administrators. Administrators can override the package's `+%{name}.conf+` by placing an identically named file in `+/etc/tmpfiles.d/+`, but this should very rarely be needed.
 

