1
0
forked from rpms/pcs

package licenses and docs for pcs-web-ui

Pcs-web-ui added a changelog upstream, so I'm adding it downstream as
well. It turns out that I forgot to package the readme and license
before, so adding them too.

For pcs, readme and changelog are installed via automake variable
`dist_doc_DATA` [1] which gets automatically converted to its own target
ran during `make install`. The target installs it to %docdir/%TARNAME
(automake variables). This happens to align with RPM default of
%_docdir/%name (spec macros). This is rendered completely useless as
these later get replaced by RPM anyway. The path is therefore
/usr/share/doc/pcs.

RPM %doc directive has two modes. If there is a relative path, the %doc
directive runs a script that goes into builddir/BUILD/<Source0> and
copies the file to %_docdir. If there is an absolute path, the file is
only marked as a doc file in the RPM database. The same goes for
%license directive, except for it getting copied to %_defaultlicensedir.
[2][3]

The problem arises for pcs-web-ui files as they neither come from the
pcs tarball nor are to be owned by the pcs package. Additionally, the
package name changes for different downstreams. Because the package name
changes, it is not desirable to install the files in the upstream
Makefile which is not aware of RPM package names. I made a decision to
handle file copying entirely in the specfile for these reasons. It seems
like for relative paths, RPM searches the Source0 tarball, but ours are
located in Source100. Therefore, I explicitly used %_docdir and
%_defaultlicensedir in %install and %files.

Resolves: RHEL-86232

[1]: https://www.gnu.org/software/automake/manual/html_node/amhello_0027s-Makefile_002eam-Setup-Explained.html
[2]: https://docs.fedoraproject.org/en-US/packaging-guidelines/LicensingGuidelines/
[3]: https://web.archive.org/web/20160927094629/https://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch09s05s03.html
This commit is contained in:
Michal Pospíšil 2025-07-08 19:12:08 +02:00
parent a338e92793
commit 068706c859

View File

@ -441,6 +441,13 @@ pwd
cd ../%{ui_src_name}
%make_install
# prepare pcs-web-ui files (not needed for pcs as pcs installs them in Makefile)
mkdir -p %{buildroot}/%{_defaultlicensedir}/%{pkg_cockpit_ha_cluster}
mv COPYING %{buildroot}/%{_defaultlicensedir}/%{pkg_cockpit_ha_cluster}/COPYING_WUI.md
mkdir -p %{buildroot}/%{_docdir}/%{pkg_cockpit_ha_cluster}
mv CHANGELOG.md %{buildroot}/%{_docdir}/%{pkg_cockpit_ha_cluster}/CHANGELOG_WUI.md
mv README.md %{buildroot}/%{_docdir}/%{pkg_cockpit_ha_cluster}/README_WUI.md
# Install pcs
cd ../%{pcs_source_name}
@ -654,6 +661,9 @@ run_all_tests
%license pyagentx_LICENSE.txt
%files -n %{pkg_cockpit_ha_cluster}
%doc %{_docdir}/%{pkg_cockpit_ha_cluster}/CHANGELOG_WUI.md
%doc %{_docdir}/%{pkg_cockpit_ha_cluster}/README_WUI.md
%license %{_defaultlicensedir}/%{pkg_cockpit_ha_cluster}/COPYING_WUI.md
%{cockpit_dir}
%{ui_metainfo}