File patchtools.spec of Package patchtools
#
# spec file for package patchtools
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# do not build for python2
%define skip_python2 1
Name: patchtools
Version: 2.5.3
Release: 0
License: Apache-2.0
Summary: A set of tools for working with SUSE kernel patches
Group: Development/Tools
URL: https://github.com/jeffmahoney/patchtools
Source: %{name}-%{version}.tar.xz
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module devel}
BuildRequires: %{python_module wheel}
BuildRequires: %{pythons}
BuildRequires: python-rpm-macros
BuildRequires: xz
BuildRequires: asciidoc
BuildRequires: xmlto
BuildRequires: git
BuildRequires: fdupes
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires: %{name}-common
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildArch: noarch
%python_subpackages
%description
This package contains several tools for working with SUSE kernel patches.
The rules for including patches in the SUSE kernel trees can be cumbersome
and this set of tools automates much of the tedious work.
%package -n %{name}-common
Summary: Common patchtools package for any flavor of python
Provides: %{python_module patchtools}
%description -n %{name}-common
The patchtools-common package is the common invariant base
package, used by any of the python-version-specific packages,
such as python3*-patchtools.
%prep
%autosetup -p1
%build
%pyproject_wheel
%install
%pyproject_install
%python_clone -a %{buildroot}%{_bindir}/exportpatch
%python_clone -a %{buildroot}%{_bindir}/fixpatch
make install DESTDIR=${RPM_BUILD_ROOT}
%fdupes ${RPM_BUILD_ROOT}
%post
%python_install_alternative exportpatch
%python_install_alternative fixpatch
%postun
%python_uninstall_alternative exportpatch
%python_uninstall_alternative fixpatch
%files %{python_files}
%defattr(-,root,root)
%python_alternative %{_bindir}/exportpatch
%python_alternative %{_bindir}/fixpatch
%{python_sitelib}/patchtools*
%files -n %{name}-common
%license COPYING
%doc AUTHORS README.md
%doc %{_mandir}/man5/patchtools.cfg.5%{ext_man}
%doc %{_mandir}/man1/exportpatch.1%{ext_man}
%doc %{_mandir}/man1/fixpatch.1%{ext_man}
%changelog