doc: Prebundle docs on RHEL & CentOS

With this we can get rid of asciidoc-py dependency altogether and
instead rely on the docs being prebundled before installation.

Include the built guide and manpages into the release tarball for that.

Fixes #22670
https://issues.redhat.com/browse/COCKPIT-1370

Signed-off-by: Freya Gustavsson <freya@venefilyn.se>
Co-Authored-By: Martin Pitt <mpitt@redhat.com>
This commit is contained in:
Freya Gustavsson 2025-12-16 17:27:08 +01:00
parent 0929533aff
commit 6a0da46280
6 changed files with 36 additions and 9 deletions

View file

@ -142,6 +142,9 @@ GUIDE_PAGES_INST = \
noinst_DATA += $(GUIDE_PAGES_INST)
# Some distros don't have asciidoctor and we need to prebundle the docs, e.g. RHEL & CentOS
EXTRA_DIST += $(GUIDE_PAGES_INST)
GUIDE_ASCIIDOC_ARGS = \
-a cockpit-version=$(VERSION) \
-a toc=left \

View file

@ -10,8 +10,6 @@ EXTRA_DIST += \
doc/man/pages/partials/bugs.adoc \
$(NULL)
if ENABLE_DOC
MANPAGES = \
doc/output/man/cockpit.1 \
doc/output/man/cockpit-bridge.1 \
@ -22,11 +20,16 @@ MANPAGES = \
doc/output/man/pam_ssh_add.8 \
$(NULL)
if ENABLE_DOC
man_MANS += \
$(MANPAGES) \
$(NULL)
CLEANFILES += $(MANPAGES)
# Some distros don't have asciidoctor and we need to prebundle the man pages
EXTRA_DIST += $(MANPAGES)
MAN_ASCIIDOC_ARGS = \
-a doctype="manpage" \
-a manmanual="cockpit" \

View file

@ -19,6 +19,7 @@ actions:
srpm_build_deps:
- automake
- asciidoctor
- gcc
- gettext
- glib2-devel

View file

@ -56,6 +56,11 @@
%define rebuild_bundle 1
%endif
# to avoid using asciidoc-py in RHEL and CentOS we use the prebuilt docs
%if 0%{?rhel}
%define bundle_docs 1
%endif
Name: cockpit
Summary: Web Console for Linux servers
@ -116,12 +121,7 @@ BuildRequires: nodejs
BuildRequires: nodejs-esbuild
%endif
# For documentation
%if 0%{?rhel} || 0%{?centos}
# Only has legacy asciidoc-py and not asciidoctor.
# asciidoc-py includes a2x package which can generate man-pages.
BuildRequires: asciidoc
%else
%if !%{defined bundle_docs}
BuildRequires: asciidoctor
%endif
@ -187,6 +187,9 @@ NODE_ENV=production NODE_PATH=/usr/lib/node_modules:$(echo /usr/lib/node_modules
%if %{enable_multihost}
--enable-multihost \
%endif
%if %{defined bundle_docs}
--disable-doc \
%endif
%make_build
@ -210,6 +213,22 @@ install -p -m 644 %{pamconfig} $RPM_BUILD_ROOT%{pamconfdir}/cockpit
rm -f %{buildroot}/%{_libdir}/cockpit/*.so
install -D -p -m 644 AUTHORS COPYING README.md %{buildroot}%{_docdir}/cockpit/
# We install the upstream pre-built docs as we can't build them
%if %{defined bundle_docs}
%define docbundledir %{_builddir}/%{name}-%{version}/doc/output/html
install -d %{buildroot}%{_docdir}/cockpit/guide
cp -rp %{docbundledir}/* %{buildroot}%{_docdir}/cockpit/guide/
# Install pre-built man pages
%define manbundledir %{_builddir}/%{name}-%{version}/doc/output/man
install -D -p -m 644 %{manbundledir}/cockpit.1 %{buildroot}%{_mandir}/man1/cockpit.1
install -D -p -m 644 %{manbundledir}/cockpit-bridge.1 %{buildroot}%{_mandir}/man1/cockpit-bridge.1
install -D -p -m 644 %{manbundledir}/cockpit-desktop.1 %{buildroot}%{_mandir}/man1/cockpit-desktop.1
install -D -p -m 644 %{manbundledir}/cockpit.conf.5 %{buildroot}%{_mandir}/man5/cockpit.conf.5
install -D -p -m 644 %{manbundledir}/cockpit-ws.8 %{buildroot}%{_mandir}/man8/cockpit-ws.8
install -D -p -m 644 %{manbundledir}/cockpit-tls.8 %{buildroot}%{_mandir}/man8/cockpit-tls.8
install -D -p -m 644 %{manbundledir}/pam_ssh_add.8 %{buildroot}%{_mandir}/man8/pam_ssh_add.8
%endif
# Build the package lists for resource packages
# cockpit-bridge is the basic dependency for all cockpit-* packages, so centrally own the page directory
echo '%dir %{_datadir}/cockpit' > base.list

View file

@ -4,5 +4,7 @@ cockpit source: source-is-missing *src/cockpit/data/fail.html*
cockpit source: source-is-missing *src/common/fail.html*
# upstream release tarballs ship pre-built dist/; package build removes it
cockpit source: source-is-missing *dist/*
# upstream release tarballs ship pre-built asciidoc output; package build removes it
cockpit source: source-is-missing *doc/output/*
# vendored build dependencies from orig-node.tar.xz, also contains pre-bundled files
cockpit source: source-is-missing *node/*

View file

@ -44,7 +44,6 @@ else
../../configure \
CPPFLAGS=-I../../tools/mock-build-env \
PKG_CONFIG_PATH=../../tools/mock-build-env \
--disable-doc \
--enable-prefix-only \
> /dev/null
fi