fix build fail

(cherry picked from commit f06273b36484c998fcef9e84eac6a3aa8d7fc415)
This commit is contained in:
zhangpan 2023-08-11 03:46:59 +00:00 committed by openeuler-sync-bot
parent 89ffbc8899
commit ce542d4f73
2 changed files with 108 additions and 4 deletions

View File

@ -0,0 +1,100 @@
From 8a94846b133f12c71f515b0fbaa834b37dd00347 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
<psuarezhernandez@suse.com>
Date: Wed, 17 May 2023 13:33:37 +0100
Subject: [PATCH] Fix package building with Sphinx >= 7.0.0
Sphinx has dropped the integration with setuptools in version 7.0.0:
https://www.sphinx-doc.org/en/master/changes.html#release-7-0-0-released-apr-29-2023
We now build documentation and man pages out of setup.py script
---
Makefile | 3 +++
cobbler.spec | 1 +
setup.py | 22 +---------------------
3 files changed, 5 insertions(+), 21 deletions(-)
diff --git a/Makefile b/Makefile
index 1174062..541865c 100644
--- a/Makefile
+++ b/Makefile
@@ -53,6 +53,9 @@ doc: ## Creates the documentation with sphinx in html form.
@echo "creating: documentation"
@cd docs; make html > /dev/null 2>&1
+man: ## Creates documentation and man pages using Sphinx
+ @${PYTHON} -m sphinx -b man -j auto ./docs ./build/sphinx/man
+
qa: ## If pyflakes and/or pycodestyle is found then they are run.
ifeq ($(strip $(PYFLAKES)),)
@echo "No pyflakes found"
diff --git a/cobbler.spec b/cobbler.spec
index 1235917..e4c482b 100644
--- a/cobbler.spec
+++ b/cobbler.spec
@@ -307,6 +307,7 @@ echo "ERROR: DOCPATH: ${DOCPATH} does not match %{_mandir}"
[ "${TFTPROOT}" != %{tftpboot_dir} ] && echo "ERROR: TFTPROOT: ${TFTPROOT} does not match %{tftpboot_dir}"
%py3_build
+make man
%install
. distro_build_configs.sh
diff --git a/setup.py b/setup.py
index 57d8543..595ffd0 100644
--- a/setup.py
+++ b/setup.py
@@ -16,7 +16,6 @@ from setuptools import dep_util
from distutils.command.build import build as _build
from configparser import ConfigParser
from setuptools import find_packages
-from sphinx.setup_command import BuildDoc
import codecs
from coverage import Coverage
@@ -143,15 +142,6 @@ class build(_build):
def run(self):
_build.run(self)
-#####################################################################
-# # Build man pages using Sphinx ###################################
-#####################################################################
-
-
-class build_man(BuildDoc):
- def initialize_options(self):
- BuildDoc.initialize_options(self)
- self.builder = 'man'
#####################################################################
# # Configure files ##################################################
@@ -279,16 +269,7 @@ def has_configure_files(build):
return bool(build.distribution.configure_files)
-def has_man_pages(build):
- """Check if the distribution has configuration files to work on."""
- return bool(build.distribution.man_pages)
-
-
-build.sub_commands.extend((
- ('build_man', has_man_pages),
- ('build_cfg', has_configure_files)
-))
-
+build.sub_commands.extend((("build_cfg", has_configure_files),))
#####################################################################
# # Modify Install Stage ############################################
@@ -490,7 +471,6 @@ if __name__ == "__main__":
'savestate': savestate,
'restorestate': restorestate,
'build_cfg': build_cfg,
- 'build_man': build_man
},
name="cobbler",
version=VERSION,
--
2.27.0

View File

@ -4,7 +4,7 @@
Name: cobbler
Version: 3.2.0
Release: 3
Release: 4
Summary: Boot server configurator
URL: https://cobbler.github.io/
License: GPLv2+
@ -15,6 +15,7 @@ Patch9000: huawei-adapt-vendor.patch
Patch9001: huawei-repair-switch-condition-error.patch
Patch6000: fix-Give-root-RW-permissions-to-var-lib-cobbler-web.ss.patch
Patch9002: bugfix-change-permission-with-web.ss.patch
Patch6001: backport-Fix-package-building-with-Sphinx.patch
BuildRequires: system-release
BuildRequires: python%{python3_pkgversion}-devel
@ -188,9 +189,6 @@ sed -i -e "s/SECRET_KEY = ''/SECRET_KEY = \'$RAND_SECRET\'/" %{_datadir}/cobbler
%{_datadir}/bash-completion/
%dir %{_datadir}/cobbler
%{_datadir}/cobbler/bin
%{_mandir}/man1/cobbler.1*
%{_mandir}/man5/cobbler.conf.5*
%{_mandir}/man8/cobblerd.8*
%{python3_sitelib}/cobbler/
%{python3_sitelib}/cobbler-*.egg-info
%{_unitdir}/cobblerd.service
@ -211,6 +209,12 @@ sed -i -e "s/SECRET_KEY = ''/SECRET_KEY = \'$RAND_SECRET\'/" %{_datadir}/cobbler
%attr(-,apache,apache) /var/www/cobbler_webui_content/
%changelog
* Fri Aug 11 2023 zhangpan <zhangpan103@h-partners.com> - 3.2.0-4
- Type:bugfix
- ID:NA
- SUG:NA
- DES:fix build fail
* Thu Mar 09 2023 sunhai <sunhai10@huawei.com> - 3.2.0-3
- Type:bugfix
- ID:NA