Skip to content

Commit b11b598

Browse files
committed
feat: clarify %dir and add illegal char guideline
Signed-off-by: Owen-sz <[email protected]>
1 parent c9fe6ed commit b11b598

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

content/docs/rpm/sections.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ The following is an exhaustive list of file attributes available:
324324
# - config(missingok)
325325
# - config(noreplace)
326326
%dir …
327-
# ╰─ specify a directory the package owns
327+
# ╰─ specify a directory the package owns if the files in that directory are not to be owned by the package
328328
%doc …
329329
# ╰─ store the file into %{_docdir}
330330
%docdir

content/docs/terra/guidelines.mdx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,28 @@ It is also acceptable to add more to previous changelogs (for example, adding mi
409409
- If you are unsure if a bump is needed, bump it.
410410
- Follow appropriate changelog procedures outlined in the above section.
411411

412+
#### Illegal Char in Version String
413+
414+
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.
415+
To do this, add the following lines to your spec file (assuming a `-` is used in the upstream version):
416+
417+
```rpmspec
418+
%global ver UPSTREAM-VERSION
419+
%global sanitized_ver %(echo %{ver} | sed 's/-//g')
420+
...
421+
Version: %sanitized_ver # This will expand to UPSTREAMVERSION in this example
422+
```
423+
424+
Then, the `update.rhai` needs to be appended to replace the globaly defined `ver` instead of the usual `Version` tag.
425+
Your `update.rhai` should look like this:
426+
427+
```rhai
428+
rpm.global("ver", gh("upstream/project")); // Remember to change the update function to what your upstream is hosted on, for example, `pypi()` or `hackage()`.
429+
```
430+
431+
If a different illegal character is used, you will need to write a `sed` script to remove this character.
432+
More information on writing these scripts can be found [here](https://linux.die.net/man/1/sed).
433+
412434
#### Patches
413435

414436
- 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).

0 commit comments

Comments
 (0)