File obs-service-erlang_changes.spec of Package obs-service-erlang_changes

#
# spec file for package obs-service-erlang_changes
#
# 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 https://bugs.opensuse.org/
#


%define service erlang_changes

%{?sle15_python_module_pythons}
Name:           obs-service-%{service}
Version:        0.3.2
Release:        0
Summary:        An OBS source service: Erlang changelog formatting
License:        GPL-2.0-or-later
Group:          Development/Tools/Building
URL:            https://github.com/matwey/obs-service-%{service}
Source:         %{name}-%{version}.tar.gz
BuildRequires:  python-rpm-macros
Requires:       python-lxml
Requires:       python-mistune
Requires:       python-requests
Requires:       python-rpm
Provides:       obs-service-%{service} = %{version}-%{release}
Obsoletes:      obs-service-%{service} < %{version}-%{release}
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildRequires:  %{python_module freezegun}
BuildRequires:  %{python_module lxml}
BuildRequires:  %{python_module mistune >= 3}
BuildRequires:  %{python_module pip}
BuildRequires:  %{python_module pytest}
BuildRequires:  %{python_module requests}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module six >= 1.10.0}
BuildRequires:  fdupes
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
%python_subpackages

%description
The service looks over notes.xml in Erlang/OTP release tarball and produces
formatted erlang.changes file for RPM packaging.

%prep
%setup -q

%build
%pyproject_wheel

%install
%pyproject_install

mkdir -p %{buildroot}%{_prefix}/lib/obs/service
%python_expand mv %{buildroot}%{$python_sitelib}/usr/lib/obs/service/erlang_changes.service %{buildroot}%{_prefix}/lib/obs/service/erlang_changes.service
mv %{buildroot}%{_bindir}/erlang_changes %{buildroot}%{_prefix}/lib/obs/service/erlang_changes

%python_clone -a %{buildroot}/usr/lib/obs/service/erlang_changes
%python_clone -a %{buildroot}/usr/lib/obs/service/erlang_changes.service

%fdupes %{buildroot}/%{_prefix}

%post
%{python_install_alternative /usr/lib/obs/service/erlang_changes /usr/lib/obs/service/erlang_changes.service}

%postun
%python_uninstall_alternative erlang_changes

%check
%pytest

%files %{python_files}
%doc README.md
%license LICENSE
%dir %{_prefix}/lib/obs
%dir %{_prefix}/lib/obs/service
%python_alternative /usr/lib/obs/service/erlang_changes.service
%python_alternative /usr/lib/obs/service/erlang_changes
%{python_sitelib}/erlang_changes
%{python_sitelib}/obs_service_erlang_changes-*-info

%changelog
openSUSE Build Service is sponsored by