Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Add packit packaging #5094

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .distro/.fmf/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
4 changes: 4 additions & 0 deletions .distro/plans/main.fmf.dist-git
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
discover:
how: fmf
dist-git-source: true
dist-git-extract: scikit_build_core-*/
7 changes: 7 additions & 0 deletions .distro/plans/rpminspect.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plan:
import:
url: https://github.com/packit/tmt-plans
ref: main
name: /plans/rpminspect
environment:
RPMINSPECT_EXCLUDE: metadata,upstream
10 changes: 10 additions & 0 deletions .distro/plans/rpmlint.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
prepare:
- how: shell
script: cp ./*.rpmlintrc $TMT_PLAN_DATA/
discover:
how: fmf
filter: "tag: rpmlint"
url: https://github.com/packit/tmt-plans
ref: main
execute:
how: tmt
Empty file added .distro/pybind11.rpmlintrc
Empty file.
94 changes: 94 additions & 0 deletions .distro/pybind11.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
Name: pybind11
Version: 0.0.0
Release: %autorelease
Summary: Seamless operability between C++11 and Python

# TODO: https://github.com/pybind/pybind11/issues/5093
License: BSD
URL: https://github.com/pybind/pybind11
BuildArch: noarch
Source0: https://github.com/pybind/pybind11/archive/v%{version}/%{name}-%{version}.tar.gz

BuildRequires: python3-devel
BuildRequires: cmake
BuildRequires: ninja-build
BuildRequires: gcc
BuildRequires: gcc-c++
# Project CMake dependencies
BuildRequires: catch-devel
BuildRequires: eigen3-devel
# Test dependencies from tests/requirements.txt
# Cannot include the file because requirements are too constrained
BuildRequires: python3dist(build)
BuildRequires: python3dist(numpy)
BuildRequires: python3dist(pytest)
BuildRequires: python3dist(pytest-timeout)
BuildRequires: python3dist(scipy)

%global _description %{expand:
pybind11 is a lightweight header-only library that exposes C++ types
in Python and vice versa, mainly to create Python bindings of existing
C++ code.
}

%description %_description

%package devel
Summary: Development files for pybind11
BuildRequires: pybind11-devel
Provides: pybind11-static = %{version}-%{release}
%description devel %_description

Development files.

%package -n python3-pybind11
Summary: %{summary}
BuildRequires: pybind11-devel
%description -n python3-pybind11 %_description


%prep
%autosetup -n pybind11-%{version}
# Remove cmake and ninja from buildrequires
sed -i -E 's/,?\s*"cmake[^"]*"//' pyproject.toml
sed -i -E 's/,?\s*"ninja[^"]*"//' pyproject.toml


%generate_buildrequires
%pyproject_buildrequires


%build
%cmake
%cmake_build
# Also running pyproject_wheel to get python metadata files
%pyproject_wheel


%install
%cmake_install
%pyproject_install
%pyproject_save_files pybind11


%check
# %%ctest
# %%pytest
# Cannot use ctest or pytest integration yet. Replicating ci.yaml workflow
# https://github.com/pybind/pybind11/issues/5095
%cmake_build --target check


%files devel
%license LICENSE
%doc README.rst
%{_includedir}/pybind11/
%{_datadir}/cmake/pybind11/
%{_bindir}/pybind11-config
%{_datadir}/pkgconfig/pybind11.pc

%files -n python3-pybind11 -f %{pyproject_files}


%changelog
%autochangelog
70 changes: 70 additions & 0 deletions .packit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
packages:
pybind11:
# Use `path` when upstream issue is clarified
# https://github.com/packit/packit/issues/2272#issuecomment-2033712303
specfile_path: .distro/pybind11.spec
downstream_package_name: pybind11
files_to_sync:
- src: .distro/pybind11.spec
dest: pybind11.spec
- .packit.yaml
- src: .distro/pybind11.rpmlintrc
dest: pybind11.rpmlintrc
# tmt setup
- src: .distro/.fmf/
dest: .fmf/
- src: .distro/plans/
dest: plans/
filters:
- "- main.fmf.dist-git"
- "- rpminspect.fmf"
- "- rpmlint.fmf"
- src: .distro/tests/
dest: tests/
- src: .distro/plans/main.fmf.dist-git
dest: plans/main.fmf

update_release: false
upstream_tag_template: v{version}

jobs:
- &copr
job: copr_build
trigger: release
owner: "@scikit-build"
project: release
targets:
- fedora-all-x86_64
- fedora-all-aarch64
- &tests
job: tests
trigger: release
targets:
- fedora-all-x86_64
- fedora-all-aarch64
fmf_path: .distro
- <<: *copr
trigger: commit
project: nightly
branch: main
- <<: *tests
trigger: commit
- <<: *copr
trigger: pull_request
project: pybind11
update_release: true
release_suffix: "{PACKIT_RPMSPEC_RELEASE}"
- <<: *tests
trigger: pull_request
- job: propose_downstream
trigger: release
dist_git_branches:
- fedora-rawhide
- job: koji_build
trigger: commit
dist_git_branches:
- fedora-all
- job: bodhi_update
trigger: commit
dist_git_branches:
- fedora-branched
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
prune .distro
prune tests
recursive-include pybind11/include/pybind11 *.h
recursive-include pybind11 *.py
Expand Down
Loading