From 71aad8f4262607e05018336610416596cbcf41b5 Mon Sep 17 00:00:00 2001
From: CoprDistGit <infra@openeuler.org>
Date: Fri, 14 Feb 2025 07:27:04 +0000
Subject: automatic import of koji

---
 koji.spec | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 108 insertions(+)
 create mode 100644 koji.spec

(limited to 'koji.spec')

diff --git a/koji.spec b/koji.spec
new file mode 100644
index 0000000..d68b8ea
--- /dev/null
+++ b/koji.spec
@@ -0,0 +1,108 @@
+# This package depends on selective manual byte compilation
+# https://fedoraproject.org/wiki/Changes/No_more_automagic_Python_bytecompilation_phase_2
+%global _python_bytecompile_extra 0
+%global _unpackaged_files_terminate_build 0
+
+%define __python %{__python3}
+%define py_byte_compile() \
+python_binary="%1" \
+bytecode_compilation_path="%2" \
+[ -d $bytecode_compilation_path ] && find $bytecode_compilation_path -type f -a -name "*.py" -exec $python_binary -O -m py_compile {} \\\; \
+[ -d $bytecode_compilation_path ] && find $bytecode_compilation_path -type f -a -name "*.py" -exec $python_binary -m py_compile {} \\\; 
+
+# If the definition isn't available for python3_pkgversion, define it
+%{?!python3_pkgversion:%global python3_pkgversion 3}
+
+Name: koji
+Version: 1.32.0
+Release: 1%{?dist}
+# the included arch lib from yum's rpmUtils is GPLv2+
+License: LGPLv2 and GPLv2+
+Summary: Build system tools
+URL: https://pagure.io/koji/
+Source0: https://releases.pagure.org/koji/koji-%{version}.tar.bz2
+
+
+BuildArch: noarch
+Requires: python%{python3_pkgversion}-%{name} = %{version}-%{release}
+Requires: python%{python3_pkgversion}-libcomps
+Requires: python3-libcomps
+BuildRequires: systemd
+BuildRequires: pkgconfig
+BuildRequires: sed
+
+%description
+Koji is a system for building and tracking RPMS.  The base package
+contains shared libraries and the command-line interface.
+
+%package -n python%{python3_pkgversion}-%{name}
+Summary: Build system tools python library
+%{?python_provide:%python_provide python%{python3_pkgversion}-%{name}}
+BuildRequires: python%{python3_pkgversion}-devel
+BuildRequires: python%{python3_pkgversion}-setuptools
+BuildRequires: make
+BuildRequires: python3-pip
+BuildRequires: python3-wheel
+Requires: python%{python3_pkgversion}-rpm
+Requires: python%{python3_pkgversion}-requests
+Requires: python%{python3_pkgversion}-requests-gssapi
+Requires: python%{python3_pkgversion}-dateutil
+Requires: python%{python3_pkgversion}-six
+
+%description -n python%{python3_pkgversion}-%{name}
+Koji is a system for building and tracking RPMS.
+This subpackage provides python functions and libraries.
+
+%prep
+%autosetup -p1
+# we'll be packaging these separately and don't want them registered
+# to the wheel we will produce.
+sed -e '/util\/koji/g' -e '/koji_cli_plugins/g' -i setup.py
+
+%build
+%py3_build_wheel
+
+%install
+%py3_install_wheel %{name}-%{version}-py3-none-any.whl
+mkdir -p %{buildroot}/etc/koji.conf.d
+cp cli/koji.conf %{buildroot}/etc/koji.conf
+for D in kojihub builder plugins util www vm ; do
+    pushd $D
+    make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python3} %{?install_opt} install
+    popd
+done
+
+# alter python interpreter in koji CLI
+scripts='%{_bindir}/koji %{_sbindir}/kojid %{_sbindir}/kojira %{_sbindir}/koji-shadow
+         %{_sbindir}/koji-gc %{_sbindir}/kojivmd %{_sbindir}/koji-sweep-db
+         %{_sbindir}/koji-sidetag-cleanup'
+for fn in $scripts ; do
+    sed -i 's|#!/usr/bin/python2|#!/usr/bin/python3|' $RPM_BUILD_ROOT$fn
+done
+
+# handle extra byte compilation
+extra_dirs='
+    %{_prefix}/lib/koji-builder-plugins
+    %{_prefix}/koji-hub-plugins
+    %{_datadir}/koji-hub
+    %{_datadir}/koji-web/lib/kojiweb
+    %{_datadir}/koji-web/scripts'
+for fn in $extra_dirs ; do
+    %py_byte_compile %{__python3} %{buildroot}$fn
+done
+
+%files
+%{_bindir}/*
+%config(noreplace) /etc/koji.conf
+%dir /etc/koji.conf.d
+%doc docs Authors COPYING LGPL
+
+%files -n python%{python3_pkgversion}-koji
+%{python3_sitelib}/%{name}
+%{python3_sitelib}/%{name}-%{version}.*-info
+%{python3_sitelib}/koji_cli
+
+
+%changelog
+* Thu Mar 23 2023 lichaoran <pkwarcraft@hotmail.com> - 1.32.0-1
+- init package
-- 
cgit v1.2.3