diff --git a/rpm/BUILT-Fix-builds-on-EPEL8-due-to-outdated-components.patch b/rpm/BUILT-Fix-builds-on-EPEL8-due-to-outdated-components.patch new file mode 100644 index 0000000..764eff3 --- /dev/null +++ b/rpm/BUILT-Fix-builds-on-EPEL8-due-to-outdated-components.patch @@ -0,0 +1,182 @@ +From b4b3faaad0c1d7a3665b0a0709342267f2dc63e7 Mon Sep 17 00:00:00 2001 +From: Ales Nezbeda +Date: Tue, 17 Sep 2024 09:17:24 +0200 +Subject: [PATCH] Fix builds on EPEL8 due to outdated components + +Some of the new functionalities that are present in Fedora and are +needed for distgen to build using the refreshed build system are not +present in EPEL8. + +This means that we have to rollback some changes to allow build on +EPEL8. This shouldn't impact functionality of the application, but +keeping it in the main repository would create mess in the codebase. +It can also be unpredictable how will setuptools work with different +config files, so it's better to just use one config. +--- + distgen/cli_parser.py | 2 +- + pyproject.toml | 47 ------------------------------------------- + setup.cfg | 42 +++++++++++++++++++++++++++++++++++++- + setup.py | 31 ++++++++++++++++++++++++++++ + 4 files changed, 73 insertions(+), 49 deletions(-) + delete mode 100644 pyproject.toml + create mode 100644 setup.py + +diff --git a/distgen/cli_parser.py b/distgen/cli_parser.py +index 676f1ac..3040239 100644 +--- a/distgen/cli_parser.py ++++ b/distgen/cli_parser.py +@@ -2,7 +2,7 @@ + + from argparse import ArgumentParser, RawDescriptionHelpFormatter + +-from importlib.metadata import version, PackageNotFoundError ++from importlib_metadata import version, PackageNotFoundError + + try: + VERSION = version("distgen") +diff --git a/pyproject.toml b/pyproject.toml +deleted file mode 100644 +index 28652c5..0000000 +--- a/pyproject.toml ++++ /dev/null +@@ -1,47 +0,0 @@ +-[build-system] +-requires = ["argparse-manpage[setuptools]"] +-build-backend = "setuptools.build_meta" +-# requires = ["setuptools>=58.5.0"] +-# build-backend = "setuptools.build_meta" +- +-[project] +-name = "distgen" +-version = "2.0" +-dependencies = [ +- "distro", +- "jinja2", +- "pyyaml", +- "setuptools" +-] +-requires-python = ">=3.0" +-authors = [ +- {name = "Red Hat Databases team"}, +-] +-maintainers = [ +- {name = "Ales Nezbeda", email = "anezbeda@redhat.com"} +-] +-description = "Templating system/generator for distributions" +-readme = "README.md" +-license = {file = "LICENSE"} +-classifiers = [ +- "Development Status :: 5 - Production/Stable", +- "Programming Language :: Python :: 3", +- "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)" +-] +- +-[tool.setuptools.cmdclass] +-build_py = "build_manpages.build_py" +-install = "build_manpages.install" +-build_manpages = "build_manpages.build_manpages" +- +-[project.scripts] +-dg = "distgen.__main__:main" +- +-[tool.setuptools.packages.find] +-where = ["."] +-include = ['distgen*'] +- +-[tool.build_manpages] +-manpages = [ +- "man/dg.1:object=parser:pyfile=distgen/cli_parser.py", +-] +diff --git a/setup.cfg b/setup.cfg +index acd96a0..12ff987 100644 +--- a/setup.cfg ++++ b/setup.cfg +@@ -1,8 +1,49 @@ ++[metadata] ++name = distgen ++version = 2.0 ++author = Red Hat Databases team ++description = Templating system/generator for distributions ++long_description = file: README.md ++license = GPLv2+ ++classifiers = ++ Development Status :: 5 - Production/Stable ++ Programming Language :: Python :: 3 ++ License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+) ++ ++[options] ++include_package_data = True ++packages = find: ++python_requires = >=3.0 ++install_requires = ++ importlib-metadata ++ distro ++ jinja2 ++ pyyaml ++ setuptools ++ ++[options.package_data] ++distgen = distconf/*.yaml, distconf/**/*.yaml, templates/*.tpl, templates/**/*.tpl, templates/**/**/*.tpl ++ ++[options.packages.find] ++exclude = ++ rpm* ++ man* ++ build_manpages* ++ ++[options.entry_points] ++console_scripts = ++ dg = distgen.__main__:main ++ ++[build_manpages] ++manpages = ++ man/dg.1:object=parser:pyfile=distgen/cli_parser.py ++ + [flake8] +-ignore = +- E402, +- C0116 +-max-complexity = 15 ++ignore= ++ # E402 module level import not at top of file ++ E402, ++ C0116 ++max-complexity=15 + + [egg_info] + tag_build = +diff --git a/setup.py b/setup.py +new file mode 100644 +index 0000000..fe58d0a +--- /dev/null ++++ b/setup.py +@@ -0,0 +1,26 @@ ++import sys ++ ++from os import path, getcwd ++from setuptools import setup ++ ++from setuptools.command.build_py import build_py ++from setuptools.command.install import install ++ ++project = "distgen" ++datadir = "share" ++pkgdatadir = datadir + "/" + project ++tpldir = pkgdatadir + "/templates" ++distconfdir = pkgdatadir + "/distconf" ++ ++sys.path = [path.join(getcwd(), 'build_manpages')] + sys.path ++from build_manpages.build_manpages import ( ++ build_manpages, get_build_py_cmd, get_install_cmd) ++ ++setup( ++ cmdclass={ ++ 'build_manpages': build_manpages, ++ 'build_py': get_build_py_cmd(build_py), ++ 'install': get_install_cmd(install), ++ }, ++) ++ +-- +2.46.0 + diff --git a/rpm/BUILT-Fix-builds-on-EPEL9-due-to-outdated-components.patch b/rpm/BUILT-Fix-builds-on-EPEL9-due-to-outdated-components.patch new file mode 100644 index 0000000..f581cf9 --- /dev/null +++ b/rpm/BUILT-Fix-builds-on-EPEL9-due-to-outdated-components.patch @@ -0,0 +1,100 @@ +From 59ad66a9f1d94e8fc6ef0cf34293ca7cd8ced590 Mon Sep 17 00:00:00 2001 +From: Ales Nezbeda +Date: Tue, 17 Sep 2024 09:17:24 +0200 +Subject: [PATCH] Fix builds on EPEL9 due to outdated components + +Some of the new functionalities that are present in Fedora and are +needed for distgen to build using the refreshed build system are not +present in EPEL9. + +This means that we have to rollback some changes to allow build on +EPEL9. This shouldn't impact functionality of the application, but +keeping it in the main repository would create mess in the codebase. +It can also be unpredictable how will setuptools work with different +config files, so it's better to just use one config. +--- + setup.cfg | 36 ++++++++++++++++++++++++++++++++++++ + setup.py | 22 ++++++++++++++++++++++ + 2 files changed, 58 insertions(+) + create mode 100644 setup.py + +diff --git a/setup.cfg b/setup.cfg +index acd96a0..3151c89 100644 +--- a/setup.cfg ++++ b/setup.cfg +@@ -1,8 +1,45 @@ ++[metadata] ++name = distgen ++version = 2.0 ++author = Red Hat Databases team ++description = Templating system/generator for distributions ++long_description = file: README.md ++license = GPLv2+ ++classifiers = ++ Development Status :: 5 - Production/Stable ++ Programming Language :: Python :: 3 ++ License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+) ++ ++[options] ++setup_requires = ++ argparse-manpage[setuptools] ++include_package_data = True ++packages = find: ++python_requires = >=3.0 ++ ++[options.package_data] ++distgen = distconf/*.yaml, distconf/**/*.yaml, templates/*.tpl, templates/**/*.tpl, templates/**/**/*.tpl ++ ++[options.packages.find] ++exclude = ++ rpm* ++ man* ++ build_manpages* ++ ++[options.entry_points] ++console_scripts = ++ dg = distgen.__main__:main ++ ++[build_manpages] ++manpages = ++ man/dg.1:object=parser:pyfile=distgen/cli_parser.py ++ + [flake8] +-ignore = +- E402, +- C0116 +-max-complexity = 15 ++ignore= ++ # E402 module level import not at top of file ++ E402, ++ C0116 ++max-complexity=15 + + [egg_info] + tag_build = +diff --git a/setup.py b/setup.py +new file mode 100644 +index 0000000..ac2b9de +--- /dev/null ++++ b/setup.py +@@ -0,0 +1,17 @@ ++from setuptools import setup ++ ++from setuptools.command.build_py import build_py ++from setuptools.command.install import install ++ ++from build_manpages.build_manpages import build_manpages ++from build_manpages import get_build_py_cmd ++from build_manpages import get_install_cmd ++ ++setup( ++ cmdclass={ ++ 'build_manpages': build_manpages, ++ 'build_py': get_build_py_cmd(build_py), ++ 'install': get_install_cmd(install), ++ }, ++) ++ +-- +2.46.0 + diff --git a/rpm/distgen.spec.dg b/rpm/distgen.spec.dg index aeb8640..e11523b 100644 --- a/rpm/distgen.spec.dg +++ b/rpm/distgen.spec.dg @@ -10,43 +10,93 @@ URL: https://github.com/devexp-db/distgen BuildArch: noarch BuildRequires: python3-devel -BuildRequires: pyproject-rpm-macros BuildRequires: python3-pytest +%if 0%{?rhel} != 8 +BuildRequires: pyproject-rpm-macros +%endif + +%if 0%{?rhel} >= 8 +BuildRequires: python3-setuptools +BuildRequires: python3-tomli +BuildRequires: python3-jinja2 +BuildRequires: python3-PyYAML +BuildRequires: python3-distro +%endif + +%if 0%{?rhel} == 8 +BuildRequires: python3-importlib-metadata +%endif + Source0: https://pypi.org/packages/source/d/%name/%name-%version.tar.gz +Patch0: BUILT-Fix-builds-on-EPEL8-due-to-outdated-components.patch +Patch1: BUILT-Fix-builds-on-EPEL9-due-to-outdated-components.patch + %description Based on given template specification (configuration for template), template file and preexisting distribution metadata generate output file. - %prep -%autosetup -p1 +%autosetup -N + +%if 0%{?rhel} == 8 +%patch -p1 -P 0 +%endif + +%if 0%{?rhel} == 9 +%patch -p1 -P 1 +%endif -%generate_buildrequires -%pyproject_buildrequires -x pytest,pytest-catchlog,pytest-cov,coverage,flake8 +%if 0%{?rhel} != 8 +%generate_buildrequires +%pyproject_buildrequires -x pytest,pytest-catchlog,pytest-cov,coverage,flake8,pyyaml +%endif %build +%if 0%{?rhel} == 8 +ls -la +%__python3 setup.py build +%else %pyproject_wheel - +%endif %install +%if 0%{?rhel} == 8 +%__python3 setup.py install --root=%{buildroot} +mkdir -p %{buildroot}%{_datadir}/distgen +mv %{buildroot}%{python3_sitelib}/distgen/{distconf,templates} %{buildroot}%{_datadir}/distgen +%else %pyproject_install %pyproject_save_files distgen - +%endif %check +%if 0%{?rhel} == 8 +%__python3 -m pytest tests/unittests/ +%else %pytest tests/unittests/ +%endif - +%if 0%{?rhel} == 8 +%files +%license LICENSE +%doc NEWS +%doc docs/ +%{_bindir}/dg +%{python3_sitelib}/distgen +%{python3_sitelib}/%{name}-*.egg-info +%{_datadir}/%{name} +%{_mandir}/man1/* +%else %files -f %{pyproject_files} %license LICENSE %doc NEWS %doc docs/ %{_bindir}/dg %{_mandir}/man1/* - +%endif %changelog * Wed Mar 21 2018 Pavel Raiskup - {{ m.VERSION }}-{{ m.RELEASE }}