From b11b598bf03f32397e8f26842daf61b7a46c4be5 Mon Sep 17 00:00:00 2001 From: Owen-sz Date: Fri, 23 Jan 2026 04:40:54 -0600 Subject: [PATCH 1/4] feat: clarify %dir and add illegal char guideline Signed-off-by: Owen-sz --- content/docs/rpm/sections.mdx | 2 +- content/docs/terra/guidelines.mdx | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/content/docs/rpm/sections.mdx b/content/docs/rpm/sections.mdx index cca3dc09..2fee803d 100644 --- a/content/docs/rpm/sections.mdx +++ b/content/docs/rpm/sections.mdx @@ -324,7 +324,7 @@ The following is an exhaustive list of file attributes available: # - config(missingok) # - config(noreplace) %dir … -# ╰─ specify a directory the package owns +# ╰─ specify a directory the package owns if the files in that directory are not to be owned by the package %doc … # ╰─ store the file into %{_docdir} %docdir diff --git a/content/docs/terra/guidelines.mdx b/content/docs/terra/guidelines.mdx index a1cf4005..fa1b2169 100644 --- a/content/docs/terra/guidelines.mdx +++ b/content/docs/terra/guidelines.mdx @@ -409,6 +409,28 @@ It is also acceptable to add more to previous changelogs (for example, adding mi - If you are unsure if a bump is needed, bump it. - Follow appropriate changelog procedures outlined in the above section. +#### Illegal Char in Version String + +In the case of an 'illegal character' in a `Version:{:rpmspec}` tag (such as a `-` or `/`), you will need to define a `%sanitized_ver:{:rpmspec}` macro. +To do this, add the following lines to your spec file (assuming a `-` is used in the upstream version): + +```rpmspec +%global ver UPSTREAM-VERSION +%global sanitized_ver %(echo %{ver} | sed 's/-//g') +... +Version: %sanitized_ver # This will expand to UPSTREAMVERSION in this example +``` + +Then, the `update.rhai` needs to be appended to replace the globaly defined `ver` instead of the usual `Version` tag. +Your `update.rhai` should look like this: + +```rhai +rpm.global("ver", gh("upstream/project")); // Remember to change the update function to what your upstream is hosted on, for example, `pypi()` or `hackage()`. +``` + +If a different illegal character is used, you will need to write a `sed` script to remove this character. +More information on writing these scripts can be found [here](https://linux.die.net/man/1/sed). + #### Patches - Packages SHOULD apply patches (usually via the `-p*` flag) in `%autosetup{:rpmspec}`. If this is not possible (typically when `%autosetup{:rpmspec}` is not used), you SHOULD use [%autopatch](../rpm/macros#autopatch). From af146a1b694a17c50b31e25052f36db6a913e8bd Mon Sep 17 00:00:00 2001 From: Owen-sz Date: Fri, 23 Jan 2026 05:47:02 -0600 Subject: [PATCH 2/4] expand some section macro info Signed-off-by: Owen-sz --- content/docs/rpm/sections.mdx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/content/docs/rpm/sections.mdx b/content/docs/rpm/sections.mdx index 2fee803d..dbf16bce 100644 --- a/content/docs/rpm/sections.mdx +++ b/content/docs/rpm/sections.mdx @@ -320,15 +320,13 @@ The following is an exhaustive list of file attributes available: %artifact … # ╰─ mado: personally never seen this used %config(…) … -# ╰─ exhaustive list: -# - config(missingok) -# - config(noreplace) +# ╰─ flag the specified file as being a configuration file. RPM performs additional processing for config files when packages are erased, and during installations and upgrades. %dir … # ╰─ specify a directory the package owns if the files in that directory are not to be owned by the package %doc … # ╰─ store the file into %{_docdir} %docdir -# ╰─ mado: personally never seen this used +# ╰─ Define a directory as a documentation-only directory. Can be used when a package defines its own documentation folder and contains a large number of doc files. %ghost … # ╰─ mark a file as owned by the package, but don't actually install the file %license … From 6cf750be4b0bebb0ec46d38b5cbf9665c5406786 Mon Sep 17 00:00:00 2001 From: Owen-sz Date: Fri, 23 Jan 2026 05:49:34 -0600 Subject: [PATCH 3/4] caps Signed-off-by: Owen-sz --- content/docs/rpm/sections.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/rpm/sections.mdx b/content/docs/rpm/sections.mdx index dbf16bce..bb2fa227 100644 --- a/content/docs/rpm/sections.mdx +++ b/content/docs/rpm/sections.mdx @@ -311,7 +311,7 @@ Alternatively, disable `debuginfo` and `debugsource` packages by: Files can be specified with globs (`*` and `?`). -### File derivatives +### File Derivatives Files can be specified with optionally an attribute[^3] (aka. a file directive[^4]). The following is an exhaustive list of file attributes available: From f7bc35ad11547c56022c7c927065f156240dd0c6 Mon Sep 17 00:00:00 2001 From: Owen Zimmerman <123591347+Owen-sz@users.noreply.github.com> Date: Fri, 23 Jan 2026 21:05:39 -0600 Subject: [PATCH 4/4] use better %ver example --- content/docs/terra/guidelines.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/docs/terra/guidelines.mdx b/content/docs/terra/guidelines.mdx index fa1b2169..d64108b9 100644 --- a/content/docs/terra/guidelines.mdx +++ b/content/docs/terra/guidelines.mdx @@ -415,10 +415,10 @@ In the case of an 'illegal character' in a `Version:{:rpmspec}` tag (such as a ` To do this, add the following lines to your spec file (assuming a `-` is used in the upstream version): ```rpmspec -%global ver UPSTREAM-VERSION +%global ver 2005-05-14 %global sanitized_ver %(echo %{ver} | sed 's/-//g') ... -Version: %sanitized_ver # This will expand to UPSTREAMVERSION in this example +Version: %sanitized_ver # This will expand to 20250514 in this example ``` Then, the `update.rhai` needs to be appended to replace the globaly defined `ver` instead of the usual `Version` tag.