From 116942c6f3069241279e5d248433b1d0d03b4343 Mon Sep 17 00:00:00 2001 From: Frank Dana (FeRD) Date: Jan 23 2025 23:10:47 +0000 Subject: [PATCH 1/2] Syntax highlighting for Golang_templates specfile listings --- diff --git a/guidelines/modules/ROOT/pages/Golang_templates.adoc b/guidelines/modules/ROOT/pages/Golang_templates.adoc index 7f1a017..d3b4a15 100644 --- a/guidelines/modules/ROOT/pages/Golang_templates.adoc +++ b/guidelines/modules/ROOT/pages/Golang_templates.adoc @@ -4,7 +4,7 @@ == Minimal source package .spectemplate-go-0-source-minimal.spec -[source,RPMSpec] +[source,rpm-spec] ---- include::{examplesdir}/golang/spectemplate-go-0-source-minimal.spec[] ---- @@ -12,7 +12,7 @@ include::{examplesdir}/golang/spectemplate-go-0-source-minimal.spec[] == Full source package .spectemplate-go-1-source-full.spec -[source,RPMSpec] +[source,rpm-spec] ---- include::{examplesdir}/golang/spectemplate-go-1-source-full.spec[] ---- @@ -20,7 +20,7 @@ include::{examplesdir}/golang/spectemplate-go-1-source-full.spec[] == Minimal alternative import path .spectemplate-go-2-alternative-import-path-minimal.spec -[source,RPMSpec] +[source,rpm-spec] ---- include::{examplesdir}/golang/spectemplate-go-2-alternative-import-path-minimal.spec[] ---- @@ -28,7 +28,7 @@ include::{examplesdir}/golang/spectemplate-go-2-alternative-import-path-minimal. == Full alternative import path .spectemplate-go-3-alternative-import-path-full.spec -[source,RPMSpec] +[source,rpm-spec] ---- include::{examplesdir}/golang/spectemplate-go-3-alternative-import-path-full.spec[] ---- @@ -36,7 +36,7 @@ include::{examplesdir}/golang/spectemplate-go-3-alternative-import-path-full.spe == Minimal binary .spectemplate-go-4-binary-minimal.spec -[source,RPMSpec] +[source,rpm-spec] ---- include::{examplesdir}/golang/spectemplate-go-4-binary-minimal.spec[] ---- @@ -44,7 +44,7 @@ include::{examplesdir}/golang/spectemplate-go-4-binary-minimal.spec[] == Full binary .spectemplate-go-5-binary-full.spec -[source,RPMSpec] +[source,rpm-spec] ---- include::{examplesdir}/golang/spectemplate-go-5-binary-full.spec[] ---- @@ -52,7 +52,7 @@ include::{examplesdir}/golang/spectemplate-go-5-binary-full.spec[] == Multi package .spectemplate-go-6-multi.spec -[source,RPMSpec] +[source,rpm-spec] ---- include::{examplesdir}/golang/spectemplate-go-6-multi.spec[] ---- @@ -60,7 +60,7 @@ include::{examplesdir}/golang/spectemplate-go-6-multi.spec[] == Manual package (deprecated) .spectemplate-go-7-manual.spec -[source,RPMSpec] +[source,rpm-spec] ---- include::{examplesdir}/golang/spectemplate-go-7-manual.spec[] ---- From 4350a99db1483f4ab96abfcbebf55e0b50638270 Mon Sep 17 00:00:00 2001 From: FeRD (Frank Dana) Date: Jan 23 2025 23:10:47 +0000 Subject: [PATCH 2/2] Fix all remaining RPMSpec syntax tags --- diff --git a/guidelines/modules/ROOT/pages/Ansible_collections.adoc b/guidelines/modules/ROOT/pages/Ansible_collections.adoc index a6d534a..2d3e84e 100644 --- a/guidelines/modules/ROOT/pages/Ansible_collections.adoc +++ b/guidelines/modules/ROOT/pages/Ansible_collections.adoc @@ -204,7 +204,7 @@ allowed licenses and determining the `+License:+` field. == Example Specfile -[source,RPMSpec] +[source,rpm-spec] ---- # Only run tests where the dependencies are available %if %{defined fedora} @@ -302,7 +302,7 @@ Here is a short breakdown of exactly what each macro included in *Usage:* -[source,RPMSpec] +[source,rpm-spec] ---- URL: %{ansible_collection_url NAMESPACE NAME} ---- @@ -324,7 +324,7 @@ See the link:#legacy_macros[Legacy Macros] section for more information. *Usage:* -[source,RPMSpec] +[source,rpm-spec] ---- %build %ansible_collection_build @@ -338,7 +338,7 @@ This macro simply runs `+ansible-galaxy collection build+`. *Usage:* -[source,RPMSpec] +[source,rpm-spec] ---- %install %ansible_collection_install @@ -355,7 +355,7 @@ metadata it previously extracted *Usage:* -[source,RPMSpec] +[source,rpm-spec] ---- %check %ansible_test_unit @@ -371,7 +371,7 @@ script runs ansible-test units with the provided arguments. *Usage:* -[source,RPMSpec] +[source,rpm-spec] ---- %files -f %{ansible_collection_filelist} %doc ... @@ -397,7 +397,7 @@ Packagers are expected to use `+%ansible_collection_install+` and ===== `+%{collection_namepsace}+` *Usage:* -[source,RPMSpec] +[source,rpm-spec] ---- %global collection_namespace NAMESPACE ---- @@ -412,7 +412,7 @@ Now, the macros extract the collection namespace from the `galaxy.yml`. *Usage:* -[source,RPMSpec] +[source,rpm-spec] ---- %global collection_name NAME ---- @@ -427,7 +427,7 @@ Now, the macros extract the collection name from the `galaxy.yml`. *Usage:* -[source,RPMSpec] +[source,rpm-spec] ---- %files %doc ... diff --git a/guidelines/modules/ROOT/pages/Golang.adoc b/guidelines/modules/ROOT/pages/Golang.adoc index 769ca15..c1969d9 100644 --- a/guidelines/modules/ROOT/pages/Golang.adoc +++ b/guidelines/modules/ROOT/pages/Golang.adoc @@ -16,7 +16,7 @@ In Golang, packages are referenced by full URLs. Since this URL is referenced in several places throughout the rpmspec, set the base import path as a global define at the top of the spec file -[source,RPMSpec] +[source,rpm-spec] ---- %global goipath github.com/kr/pretty ---- @@ -105,7 +105,7 @@ Packages that ship Go code in `+%{goipath}+` should be named `+%{goname}-devel+`. If your source package is already named `+%{goname}+` then: -[source,RPMSpec] +[source,rpm-spec] ---- %package devel […] @@ -122,7 +122,7 @@ described in the <> section below. If your source package is named something other than `+%{goname}+`, you SHOULD use: -[source,RPMSpec] +[source,rpm-spec] ---- %package -n %{goname}-devel […] @@ -136,7 +136,7 @@ use: And, finally, if you wish to split the project Go code in multiple packages, you can compute the corresponding names with: -[source,RPMSpec] +[source,rpm-spec] ---- %global goname1 %gorpmname importpath1 […] @@ -171,7 +171,7 @@ changed (but please make sure with upstream). The new import path SHOULD be reflected in `+%{goipath}+` and compatibility import paths MUST be declared with the `+goaltipaths+` macro: -[source,RPMSpec] +[source,rpm-spec] ---- # A space-separated list of import paths to simulate. %global goaltipaths @@ -183,7 +183,7 @@ path. The packager SHOULD thus request a renaming of his package with a new import path and a compatibility import path: -[source,RPMSpec] +[source,rpm-spec] ---- %global goipath github.com/sirupsen/logrus %global goaltipaths github.com/Sirupsen/logrus @@ -214,7 +214,7 @@ Of course these package MUST NOT be noarch. For example we can create the package bbolt that will contain the binary of the same name: -[source,RPMSpec] +[source,rpm-spec] ---- %package -n bbolt […] @@ -238,7 +238,7 @@ the release number yourself. You first specify either a Version, tag or commit in the header. -[source,RPMSpec] +[source,rpm-spec] ---- Version: %global tag @@ -301,7 +301,7 @@ These provides are automatically deduced from import paths. Binary builds that include these imports will use them in BuildRequires, for example: -[source,RPMSpec] +[source,rpm-spec] ---- BuildRequires: golang(github.com/gorilla/context) ---- @@ -347,7 +347,7 @@ BuildRequires: golang(golang.org/x/crypto/ssh/terminal) If automatic buildrequires are available on your build target, you can use the `+%go_generate_buildrequires+` macro in `+%generate_buildrequires+`: -[source,RPMSpec] +[source,rpm-spec] ---- %generate_buildrequires %go_generate_buildrequires @@ -443,7 +443,7 @@ Most of the computed variables are both overridable and optional. Now we can add the remaining elements of the preamble. First, we can define a multiline description block shared between subpackages: -[source,RPMSpec] +[source,rpm-spec] ---- %global common_description %{expand: cmux is a generic Go library to multiplex connections based on their payload. @@ -488,7 +488,7 @@ these should not be provided. We can declare the usual rpm headers, using the values computed by `+%gometa+`: -[source,RPMSpec] +[source,rpm-spec] ---- Name: %{goname} # If not set before @@ -512,7 +512,7 @@ maintenance-intensive discrepancies in the distribution. If they are not automatically generated, you can now add the dependencies needed for package building and unit testings: -[source,RPMSpec] +[source,rpm-spec] ---- BuildRequires: golang(github.com/stretchr/testify/assert) BuildRequires: golang(github.com/stretchr/testify/require) @@ -525,7 +525,7 @@ See <> on how to get the BuildRequires list manually. Now add the main package description: -[source,RPMSpec] +[source,rpm-spec] ---- %description %{common_description} @@ -591,7 +591,7 @@ xref:Golang_advanced.adoc#_dealing_with_cyclic_dependencies[Dealing with cyclic If BuildRequires generator are supported, you can now add them to your build: -[source,RPMSpec] +[source,rpm-spec] ---- %generate_buildrequires %go_generate_buildrequires @@ -609,7 +609,7 @@ put those in `+cmd+` subdirectories named after the command that will be built, which is what we will document here, but it is not a general rule. Sometimes the whole `+%goipath+` builds as a single binary. -[source,RPMSpec] +[source,rpm-spec] ---- for cmd in cmd/* ; do %gobuild -o %{gobuilddir}/bin/$(basename $cmd) %{goipath}/$cmd @@ -633,7 +633,7 @@ If you only need to install Go devel subpackages without compat, use: For binaries, we simply create the `+%{_bindir}+` directory in the buildroot and install the commands as executable in it: -[source,RPMSpec] +[source,rpm-spec] ---- install -m 0755 -vd %{buildroot}%{_bindir} install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/ @@ -683,7 +683,7 @@ the necessary license and documentation files: Binaries are usually shipped in the main package. This package MUST include legal files and documentation associated with those binaries. -[source,RPMSpec] +[source,rpm-spec] ---- %files %license LICENSE @@ -696,7 +696,7 @@ legal files and documentation associated with those binaries. === Simple source package .golang-github-stretchr-testify.spec -[source,RPMSpec] +[source,rpm-spec] ---- include::{examplesdir}/golang/golang-github-stretchr-testify.spec[] ---- @@ -704,7 +704,7 @@ include::{examplesdir}/golang/golang-github-stretchr-testify.spec[] === Handling package renames .golang-github-sirupsen-logrus.spec -[source,RPMSpec] +[source,rpm-spec] ---- include::{examplesdir}/golang/golang-github-sirupsen-logrus.spec[] ---- @@ -712,7 +712,7 @@ include::{examplesdir}/golang/golang-github-sirupsen-logrus.spec[] === Simple binary package .golang-github-boltdb-bolt.spec -[source,RPMSpec] +[source,rpm-spec] ---- include::{examplesdir}/golang/golang-gopkg-square-jose-2.spec[] ---- diff --git a/guidelines/modules/ROOT/pages/Golang_advanced.adoc b/guidelines/modules/ROOT/pages/Golang_advanced.adoc index 0ce8c79..f9272e9 100644 --- a/guidelines/modules/ROOT/pages/Golang_advanced.adoc +++ b/guidelines/modules/ROOT/pages/Golang_advanced.adoc @@ -17,7 +17,7 @@ the following macros in the preamble: For example, if you have glide files to ship: -[source,RPMSpec] +[source,rpm-spec] ---- %global gosupfiles glide.yaml glide.lock ---- @@ -28,7 +28,7 @@ Use `+%godevelheader+` to add specific subpackage declarations. For example, you might want to require the main package containing the binaries, or Obsoletes/Provides another package in case of renaming. -[source,RPMSpec] +[source,rpm-spec] ---- %global godevelheader %{expand: Requires: @@ -138,7 +138,7 @@ into a separate devel subpackage to resolve our cyclic dependency graph. To achieve this, we use multiple `+goipaths+` in the preamble: -[source,RPMSpec] +[source,rpm-spec] ---- %global goipaths0 cloud.google.com/go %global goipathsex0 cloud.google.com/go/compute @@ -290,7 +290,7 @@ depend separately on `+golang-cloud-google-compute-devel+`. Here is the full example: .golang-cloud-google-go.spec -[source,RPMSpec] +[source,rpm-spec] ---- include::{examplesdir}/golang/golang-cloud-google-go.spec[] ----