Skip to content

Commit

Permalink
Add packit config to build rpms in Copr
Browse files Browse the repository at this point in the history
  • Loading branch information
r0x0d committed Oct 17, 2024
1 parent ebc7ea9 commit ea3827c
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 4 deletions.
38 changes: 38 additions & 0 deletions .packit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
specfile_path: packaging/shellai.spec
upstream_package_name: shellai
downstream_package_name: shellai
upstream_project_url: https://github.com/rhel-lightspeed/shellai

srpm_build_deps: []

jobs:
# Build RPMs for each pull request
- job: copr_build
trigger: pull_request
owner: "@rhel-lightspeed"
project: shellai
targets:
- epel-8-x86_64
- epel-9-x86_64
actions:
# do not get the version from a tag (git describe) but from the spec file
get-current-version:
- grep -oP '^Version:\s+\K\S+' packaging/shellai.spec

# Build RPMs for main branch
- job: copr_build
trigger: commit
branch: main
owner: "@rhel-lightspeed"
project: shellai
targets:
- epel-8-x86_64
- epel-9-x86_64
actions:
# bump spec so we get release starting with 2 and hence all the default branch builds will
# have higher NVR than all the PR builds
post-upstream-clone:
- rpmdev-bumpspec --comment='latest upstream build' ./packaging/shellai.spec
# do not get the version from a tag (git describe) but from the spec file
get-current-version:
- grep -oP '^Version:\s+\K\S+' packaging/shellai.spec
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ clean: ## Clean project files
@find . -name '__pycache__' -exec rm -fr {} +
@find . -name '*.pyc' -exec rm -f {} +
@find . -name '*.pyo' -exec rm -f {} +
@rm -rf .pdm-build .ruff_cache .coverage .pdm-python
@rm -rf .pdm-build .ruff_cache .coverage .pdm-python dist
43 changes: 43 additions & 0 deletions packaging/shellai.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Name: shellai
Version: 0.1.0
Release: 1.20241017113156923510.add.packaging.with.packit%{?dist}
Summary: A simple wrapper to interact with RAG

License: Apache v2
URL: https://github.com/rhel-lightspeed/shellai
Source0: shellai-0.1.0.tar.gz
BuildArch: x86_64

BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
BuildRequires: pyproject-rpm-macros

Requires: python3-requests
Requires: python3-pyyaml

%description
A simple wrapper to interact with RAG

%prep
%autosetup -n shellai-0.1.0

%build
# Do not include unit tests in the package
rm -rf build/lib/%{name}/tests
%pyproject_wheel

%install
# TODO(r0x0d): Create config file
%pyproject_install

# Here, "shellai" is the name of the importable module.
%pyproject_save_files -l %{name}


%files
%license LICENSE
%doc README.md
%{_bindir}/%{name}

%changelog
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ maintainers = [
{ name = "Major Hayden", email = "mhayden@redhat.com" },
]
dependencies = ["requests", "pyyaml"]
requires-python = ">=3.8,<=3.9"
requires-python = ">=3.6"
readme = "README.md"
license = { file = "LICENSE" }
classifiers = ["Programming Language :: Python :: 3"]
Expand All @@ -23,8 +23,9 @@ Issues = "https://github.com/rhel-lightspeed/shellai/issues"
shellai = "shellai.__main__:main"

[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"
# pdm build is not available in rhel baseos repositories
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

# ----- Tooling specifics

Expand Down
Empty file removed src/shellai/__init__.py
Empty file.

0 comments on commit ea3827c

Please sign in to comment.