Tutorial: Fix/add rpm-spec source tags

This commit is contained in:
FeRD (Frank Dana) 2022-04-12 03:49:02 -04:00
parent f6aa83acfe
commit 8a88947330

View file

@ -59,7 +59,7 @@ The fields in our `.spec` file need slight editing.
Please follow https://docs.fedoraproject.org/en-US/quick-docs/creating-rpm-packages/[Creating RPM Packages] for these fields.
In our case, the file might start as follows:
[source, RPMSpec]
[source, rpm-spec]
----
Name: hello
Version: 2.10
@ -164,6 +164,7 @@ so we need to add a row for `+gcc+`.
GNU Hello also uses `+make+`, so a row should be added for it, too.
Add these lines after `Source0`:
[source, rpm-spec]
----
BuildRequires: gcc
BuildRequires: make
@ -198,6 +199,7 @@ https://docs.fedoraproject.org/en-US/packaging-guidelines/RPMMacros/#_macros_for
The macros should always be used when available,
so the executable is listed in `+%files+` as follows:
[source, rpm-spec]
----
%files
%{_bindir}/hello
@ -214,6 +216,7 @@ The Packaging Guidelines have dedicated section for
https://docs.fedoraproject.org/en-US/packaging-guidelines/#_manpages[Manpages].
Following its instructions, manpages are list as follows:
[source, rpm-spec]
----
%{_mandir}/man1/hello.1.*
----
@ -230,6 +233,7 @@ Texinfo pages are handled much in the same way as man pages.
The directory is defined by the default macro `+{_infodir}+`,
so the Texinfo manual can be added as follows:
[source, rpm-spec]
----
%{_infodir}/hello.info.*
----
@ -242,6 +246,7 @@ This is done by calling `+rm+` in `+%install+`.
However, note that files are installed in the _buildroot_ directory,
and thus the removal is done like this:
[source, rpm-spec]
----
%install
rm %{buildroot}/%{_infodir}/dir
@ -276,6 +281,7 @@ and perhaps not copied to the buildroot during installation at all.
Regardless, it can be installed to the standard license directory
by using a relative path:
[source, rpm-spec]
----
%license COPYING
----
@ -289,6 +295,7 @@ Similarly to `+%license+`,
relative paths can be used to include files directly from the source tarball
rather than from the buildroot:
[source, rpm-spec]
----
%doc AUTHORS ChangeLog NEWS README THANKS TODO
----
@ -305,6 +312,7 @@ to specfile `+%check%+` section,
which comes after `+%install+` in order.
In GNU Hello's case:
[source, rpm-spec]
----
%check
make check
@ -367,7 +375,7 @@ iconv --from-code=ISO-8859-1 --to-code=UTF-8 --output=THANKS THANKS.old
Here is the initial version of `hello.spec`:
[source,RPMSpec]
[source, rpm-spec]
----
Name: hello
Version: 2.10