Files
osc-ld-plugin/osc-ld-plugin.spec
2025-08-22 10:00:21 +02:00

90 lines
2.9 KiB
RPMSpec

#
# spec file for package osc_ld_plugin
#
# 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/
#
%global pythons python3
%if %(if test -d %{_prefix}/lib/osc-plugins; then echo 1; else echo 0; fi)
%define oscplugindir %{_prefix}/lib/osc-plugins
%else
%define oscplugindir %{_localstatedir}/lib/osc-plugins
%endif
Name: osc-ld-plugin
Version: 1.0.0
Release: 0
Summary: An osc plugin to analyze failed build logs using logdetective
License: MIT
URL: https://github.com/openSUSE/logdetective-obs
Source: https://github.com/openSUSE/logdetective-obs/archive/%{version}.tar.gz#/osc_ld_plugin-%{version}.tar.gz
BuildRequires: python-rpm-macros
BuildRequires: %{python_module pip}
BuildRequires: %{python_module poetry-core >= 2.0.0}
BuildRequires: osc
# SECTION test requirements
BuildRequires: %{python_module osc >= 1.17.0}
BuildRequires: %{python_module requests}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module pytest-vcr}
# /SECTION
BuildRequires: fdupes
Requires: python-osc >= 1.17.0
Requires: python-requests
Requires: osc
Provides: osc-plugin-ld = %{version}
# logdetective package doesn't exits
# Suggests: python-logdetective >= 1.7.0
BuildArch: noarch
%python_subpackages
%description
This is an osc plugin that uses logdetective to analyze failed Open
Build Service (OBS) builds or local build logs.
%prep
%autosetup -p1 -n logdetective-obs-%{version}
%build
pushd osc_plugin
%pyproject_wheel
popd
%install
pushd osc_plugin
%pyproject_install
rm %{buildroot}%{_bindir}/osc-ld-install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
mkdir -p %{buildroot}%{oscplugindir}
ln -s %{python_sitelib}/osc_ld_plugin/plugin.py %{buildroot}%{oscplugindir}/osc-ld.py
popd
%check
pushd osc_plugin
# Fix python-vcr looking for cassettes path
cp tests/cassettes/test_plugin/test_package_remote.yaml tests/cassettes/test_package_remote.yaml
if [ ! -f build/xdgflavorconfig/osc/oscrc ]; then
printf "abuild\n\n\n" | osc --config build/xdgflavorconfig/osc/oscrc config || echo "osc configured"
fi
%pytest --vcr-record=none
popd
%files %{python_files}
%doc README.md
%{oscplugindir}/osc-ld.py
%{python_sitelib}/osc_ld_plugin
%{python_sitelib}/osc_ld_plugin-%{version}.dist-info
%changelog