From 20ecaae633f5a41d3b6b260516ead75e0346aabf Mon Sep 17 00:00:00 2001 From: Stephen Smoogen Date: Tue, 26 Nov 2024 19:17:29 +0000 Subject: [PATCH 1/3] Take in fixes from @churchyard to modernize spec file Pull request was downstream at https://src.fedoraproject.org/rpms/python-ramalama/pull-request/2 and this will make it match with upstream. At that point we will be able to automate with packit. Signed-off-by: Stephen Smoogen --- rpm/python-ramalama.spec | 89 ++++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 44 deletions(-) diff --git a/rpm/python-ramalama.spec b/rpm/python-ramalama.spec index 15d94c5b..d1609a9d 100644 --- a/rpm/python-ramalama.spec +++ b/rpm/python-ramalama.spec @@ -1,51 +1,44 @@ -%global debug_package %{nil} - %global pypi_name ramalama -%global forgeurl https://github.com/containers/%{pypi_name} +%global forgeurl https://github.com/containers/%{pypi_name} # see ramalama/version.py -%global version0 0.2.0 +%global version0 0.2.0 %forgemeta -%global desc RamaLama is a command line tool for working with AI LLM models. +%global summary RamaLama is a command line tool for working with AI LLM models %global _python_dist_allow_version_zero 1 -Name: python-%{pypi_name} +Name: python-%{pypi_name} # DO NOT TOUCH the Version string! # The TRUE source of this specfile is: # https://github.com/containers/ramalama/blob/main/rpm/python-ramalama.spec # If that's what you're reading, Version must be 0, and will be updated by Packit for # copr and koji builds. # If you're reading this on dist-git, the version is automatically filled in by Packit. -Version: 0 -License: MIT -Release: %autorelease -Summary: RESTful API for RamaLama -URL: %{forgeurl} +Version: 0 +License: MIT +Release: %{autorelease} +Summary: %{summary} +URL: %{forgeurl} # Tarball fetched from upstream -Source0: %{forgesource} -BuildArch: noarch - -BuildRequires: git-core -BuildRequires: golang -BuildRequires: golang-github-cpuguy83-md2man -BuildRequires: make -BuildRequires: pyproject-rpm-macros - -BuildRequires: python%{python3_pkgversion}-argcomplete -BuildRequires: python%{python3_pkgversion}-devel -BuildRequires: python%{python3_pkgversion}-pip -BuildRequires: python%{python3_pkgversion}-setuptools -BuildRequires: python%{python3_pkgversion}-wheel -%if 0%{?fedora} >= 40 -BuildRequires: python%{python3_pkgversion}-tqdm -%endif - -Requires: python%{python3_pkgversion}-argcomplete - +Source: %{forgesource} +BuildArch: noarch + +BuildRequires: git-core +BuildRequires: golang +BuildRequires: go-md2man +BuildRequires: make +BuildRequires: pyproject-rpm-macros + +BuildRequires: python%{python3_pkgversion}-argcomplete +BuildRequires: python%{python3_pkgversion}-devel +BuildRequires: python%{python3_pkgversion}-pip +BuildRequires: python%{python3_pkgversion}-setuptools +BuildRequires: python%{python3_pkgversion}-wheel +BuildRequires: python%{python3_pkgversion}-tqdm %description -%desc +%summary On first run RamaLama inspects your system for GPU support, falling back to CPU support if no GPUs are present. It then uses container engines like Podman to @@ -56,39 +49,47 @@ will run the AI Models within a container based on the OCI image. %package -n python%{python3_pkgversion}-%{pypi_name} Requires: podman -%if 0%{?fedora} >= 40 Requires: python%{python3_pkgversion}-tqdm -%else -Recommends: python%{python3_pkgversion}-tqdm -%endif +# Needed as seen by BZ: 2327515 +Requires: python%{python3_pkgversion}-omlmd Summary: %{summary} Provides: %{pypi_name} = %{version}-%{release} -%{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}} %description -n python%{python3_pkgversion}-%{pypi_name} -%desc +%summary + +On first run RamaLama inspects your system for GPU support, falling back to CPU +support if no GPUs are present. It then uses container engines like Podman to +pull the appropriate OCI image with all of the software necessary to run an +AI Model for your systems setup. This eliminates the need for the user to +configure the system for AI themselves. After the initialization, RamaLama +will run the AI Models within a container based on the OCI image. + + +%generate_buildrequires +%pyproject_buildrequires %prep -%forgesetup +%forgeautosetup -p1 %build %pyproject_wheel %install %pyproject_install -%pyproject_save_files %{pypi_name} +%pyproject_save_files -l %{pypi_name} %{__make} DESTDIR=%{buildroot} PREFIX=%{_prefix} install-docs install-shortnames %{__make} DESTDIR=%{buildroot} PREFIX=%{_prefix} install-completions -%files -n python%{python3_pkgversion}-%{pypi_name} -%license LICENSE +%check +%pyproject_check_import + +%files -n python%{python3_pkgversion}-%{pypi_name} -f %{pyproject_files} %doc README.md %{_bindir}/%{pypi_name} %{bash_completions_dir}/%{pypi_name} %{_datadir}/fish/vendor_completions.d/ramalama.fish %{_datadir}/zsh/vendor-completions/_ramalama -%{python3_sitelib}/%{pypi_name} -%{python3_sitelib}/%{pypi_name}-%{version}.dist-info %dir %{_datadir}/%{pypi_name} %{_datadir}/%{pypi_name}/shortnames.conf %{_datadir}/%{pypi_name}/ramalama.conf From 80036811b236c456a6119d0ab7fcfb98e323c616 Mon Sep 17 00:00:00 2001 From: Stephen Smoogen Date: Tue, 26 Nov 2024 20:51:48 +0000 Subject: [PATCH 2/3] Fix problem with building on stream Currently there is no python-tqdm in CentOS Stream 10 so it needs to be not used. Signed-off-by: Stephen Smoogen --- rpm/python-ramalama.spec | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rpm/python-ramalama.spec b/rpm/python-ramalama.spec index d1609a9d..1c02c8ba 100644 --- a/rpm/python-ramalama.spec +++ b/rpm/python-ramalama.spec @@ -35,7 +35,9 @@ BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-pip BuildRequires: python%{python3_pkgversion}-setuptools BuildRequires: python%{python3_pkgversion}-wheel +%if 0%{?fedora} >= 40 BuildRequires: python%{python3_pkgversion}-tqdm +%endif %description %summary @@ -49,9 +51,14 @@ will run the AI Models within a container based on the OCI image. %package -n python%{python3_pkgversion}-%{pypi_name} Requires: podman +%if 0%{?fedora} >= 40 Requires: python%{python3_pkgversion}-tqdm # Needed as seen by BZ: 2327515 Requires: python%{python3_pkgversion}-omlmd +%else +Recommends: python%{python3_pkgversion}-tqdm +Recommends: python%{python3_pkgversion}-omlmd +%endif Summary: %{summary} Provides: %{pypi_name} = %{version}-%{release} From 8eb35c4cd5732881014d428ac08044e0daa20ea7 Mon Sep 17 00:00:00 2001 From: Stephen Smoogen Date: Tue, 26 Nov 2024 21:15:49 +0000 Subject: [PATCH 3/3] Fix spec file to add back License and fix CS10 build The Fedora spec files need to use %python items which pull in build requires. This breaks in CS10 because those packages don't exist and so PR's cant work Signed-off-by: Stephen Smoogen --- rpm/python-ramalama.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rpm/python-ramalama.spec b/rpm/python-ramalama.spec index 1c02c8ba..487d4a7b 100644 --- a/rpm/python-ramalama.spec +++ b/rpm/python-ramalama.spec @@ -73,8 +73,10 @@ configure the system for AI themselves. After the initialization, RamaLama will run the AI Models within a container based on the OCI image. +%if 0%{?fedora} >= 40 %generate_buildrequires %pyproject_buildrequires +%endif %prep %forgeautosetup -p1