Skip to content

Commit 7a7ae70

Browse files
committed
feat: expand RPM sections page
Signed-off-by: Owen-sz <owen@fyralabs.com>
1 parent b3fd4ac commit 7a7ae70

1 file changed

Lines changed: 95 additions & 15 deletions

File tree

content/docs/rpm/sections.mdx

Lines changed: 95 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ Here is a non-exclusive (but nearly exclusive) list of preambles available:
2222
Name: pkgname
2323
Version: 1.2.3
2424
Release: 1%?dist
25-
Summary: Package summary (usually do not add period at the end)
25+
Summary: Package summary (do not add period at the end)
2626
# As opposed to the guidelines given by RPM, we (and also Fedora!) strongly
2727
# recommend using SPDX identifiers.
2828
License: MIT
2929
URL: https://terra.fyralabs.com/
30+
Source0: Link to download the source code. If more then one link is needed,
31+
specify with Source1:, Source2:, etc.
3032
3133
## terra also enforces the following preamble:
3234
@@ -44,6 +46,7 @@ AutoProv: 1
4446
4547
## these fields are optional
4648
49+
Patch:
4750
SourceLicense:
4851
BugURL:
4952
ModularityLabel:
@@ -59,6 +62,8 @@ ExclusiveOS:
5962
BuildArch:
6063
BuildArchitectures:
6164
BuildRequires:
65+
NoSource:
66+
NoPatch:
6267
6368
Group:
6469
Provides:
@@ -78,6 +83,11 @@ RemovePathPostFixes:
7883
7984
BuildSystem:
8085
BuildOption:
86+
87+
Icon: (Obsolete)
88+
Buildroot: (Obsolete)
89+
BuildPrereq: (Obsolete)
90+
Prereq: (Obsolete)
8191
```
8292

8393
<Callout type="warning">
@@ -217,12 +227,11 @@ Step `Executing(%conf)`. Optional. Since `rpm >= 4.18`.
217227
> %configure
218228
> ```
219229
220-
When in doubt, you can always put `%configure{:rpmspec}` and other commands at the start of
221-
`%build{:rpmspec}` instead.
230+
Macros such as `%cmake` and `%meson` should also be placed in this section.
222231
223232
## `%build`
224233
225-
Step `Executing(%build)`. Optional.
234+
Step `Executing(%build)`. If there is nothing to build, you should still declare this step in your spec.
226235
227236
> In `%build`, the unpacked (and configured) sources are compiled to binaries.
228237
>
@@ -254,14 +263,6 @@ install -Dpm755 my_binary -t %{buildroot}/usr/bin/
254263
install -Dpm644 rand_file -t %{buildroot}/usr/share/my_software/
255264
```
256265
257-
## `%doc`
258-
259-
Step `Executing(%doc)`. **Not a section**. See [`%files{:rpmspec}`](#files).
260-
261-
## `%license`
262-
263-
Step `Executing(%license)`. **Not a section**. See [`%files{:rpmspec}`](#files).
264-
265266
## `%check`
266267

267268
Step `Executing(%check)`. Optional.
@@ -271,6 +272,64 @@ Step `Executing(%check)`. Optional.
271272
If you would like to make sure the software actually works properly, you may optionally
272273
choose to execute unit tests here.
273274

275+
## Package scripts
276+
277+
> Package scripts execute before and after the main operation (install/remove etc.) of the package inside a transaction.
278+
>
279+
> Package scripts should only be used for actions that are fundamentally package specific.
280+
> Domain specific registries, databases, caches and such are much better handled centrally
281+
> by file triggers. Similarly, user and group creation should be handled by rpm-sysusers, rather than scripting them.
282+
283+
### `%pre`
284+
> Executed just before unpacking the contents of the package.
285+
> Non-zero exit prevents the installation of the containing package.
286+
287+
### `%post`
288+
> Executed just after unpacking the contents of the package.
289+
290+
### `%preun`
291+
> Executed just before removing the contents of the package.
292+
> Non-zero exit prevents the uninstallation of the containing package.
293+
294+
### `%postun`
295+
> Executed just after removing the contents of the package.
296+
297+
### `%verify`
298+
299+
> Executed when a package is verified using rpm --verify.
300+
>
301+
> Unlike all the other scriptlet types, `%verify` never executes as a part of install/erase etc. operations.
302+
303+
## Transaction scripts
304+
305+
> Transaction scripts run before and after all the other package level
306+
> operations (install/remove etc.) in a transaction.
307+
>
308+
> When multiple transaction scripts for a given slot are present in a transaction,
309+
> they are executed in the order of their install/removal order within the transaction.
310+
311+
### `%pretrans`
312+
> Executed just before an install/update/reinstall transaction on the containing package starts.
313+
>
314+
> No files from the transaction have been installed or removed yet. That is, in a fresh
315+
> installation to an empty system root, there are no files around and no interpreter to run,
316+
> so the only interpreter that can be reliably used in this slot is the embedded rpm-lua(7) interpreter.
317+
>
318+
> Non-zero exit prevents the installation of the containing package.
319+
>
320+
> This is a very special and a dangerous slot, and is best avoided.
321+
322+
### `%posttrans`
323+
> Executed just after an install/update/reinstall transaction on the containing package finishes.
324+
>
325+
> All files from the transaction have been installed or removed at this point.
326+
327+
### `%preuntrans`
328+
> Executed just before an uninstall/updated-from transaction on the containing package starts.
329+
330+
### `%postuntrans`
331+
> Executed just after an uninstall/updated-from transaction on the containing package finishes.
332+
274333
## `%clean`
275334

276335
Step `Executing(%clean)`. Optional. **Obsolete**.
@@ -318,13 +377,16 @@ The following is an exhaustive list of file attributes available:
318377

319378
```rpmspec
320379
%artifact …
321-
# ╰─ mado: personally never seen this used
380+
# ╰─ denote files that are more like side-effects of packaging than actual content
381+
# the user would be interested in. Such files can be easily filtered out on queries.
382+
%caps
383+
# ╰─ sets the given POSIX.1e draft 15 capabilities on the file
322384
%config(…) …
323385
# ╰─ exhaustive list:
324386
# - config(missingok)
325387
# - config(noreplace)
326388
%dir …
327-
# ╰─ specify a directory the package owns
389+
# ╰─ explicitly own the directory itself but not it’s contents
328390
%doc …
329391
# ╰─ store the file into %{_docdir}
330392
%docdir
@@ -346,13 +408,31 @@ The following is an exhaustive list of file attributes available:
346408
# - verify(rdev)
347409
# - verify(mtime)
348410
# - verify(not ...)
411+
%missingok
412+
# ╰─ mark file presence optional
413+
%readme
414+
# ╰─ Obsolete - use %doc
349415
350416
# special:
351417
%attr(…) …
352418
%defattr(…)
353419
```
354420

355-
For more information about `%attr{:rpmspec}` and `%defattr{:rpmspec}`, see: http://ftp.rpm.org/max-rpm/s1-rpm-inside-files-list-directives.html
421+
For more information about `%attr{:rpmspec}` and `%defattr{:rpmspec}`, see: https://rpm-software-management.github.io/rpm/manual/spec.html
422+
423+
## `%changelog`
424+
425+
Metadata section. Optional, but required in Fedora and Terra
426+
427+
Specify a change to the spec.
428+
429+
Must either use `%autochangelog`, or follow this structure:
430+
431+
```
432+
* Day Mon DD YYYY Name <email> - version-release
433+
- Change you made
434+
- Another change, if there's enough to justify two lines
435+
```
356436

357437
[expression]: #rpm-expression
358438
[RPM manual]: https://github.com/rpm-software-management/rpm/blob/b043604b9eb684dc761aeacf55a784632ca0ebcd/docs/manual/macros.md

0 commit comments

Comments
 (0)