From e1833cafe179b7a3052401fc1ea1ea1145d366d5 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Mon, 8 Apr 2024 11:52:46 +0200 Subject: [PATCH 1/5] Add packit packaging --- .distro/.fmf/version | 1 + .distro/plans/main.fmf.dist-git | 4 ++ .distro/plans/rpminspect.fmf | 7 ++++ .distro/plans/rpmlint.fmf | 10 +++++ .distro/pybind11.rpmlintrc | 0 .distro/pybind11.spec | 73 +++++++++++++++++++++++++++++++++ .packit.yaml | 70 +++++++++++++++++++++++++++++++ 7 files changed, 165 insertions(+) create mode 100644 .distro/.fmf/version create mode 100644 .distro/plans/main.fmf.dist-git create mode 100644 .distro/plans/rpminspect.fmf create mode 100644 .distro/plans/rpmlint.fmf create mode 100644 .distro/pybind11.rpmlintrc create mode 100644 .distro/pybind11.spec create mode 100644 .packit.yaml diff --git a/.distro/.fmf/version b/.distro/.fmf/version new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/.distro/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/.distro/plans/main.fmf.dist-git b/.distro/plans/main.fmf.dist-git new file mode 100644 index 000000000..691879a5b --- /dev/null +++ b/.distro/plans/main.fmf.dist-git @@ -0,0 +1,4 @@ +discover: + how: fmf + dist-git-source: true + dist-git-extract: scikit_build_core-*/ diff --git a/.distro/plans/rpminspect.fmf b/.distro/plans/rpminspect.fmf new file mode 100644 index 000000000..94c2a4f0f --- /dev/null +++ b/.distro/plans/rpminspect.fmf @@ -0,0 +1,7 @@ +plan: + import: + url: https://github.com/packit/tmt-plans + ref: main + name: /plans/rpminspect +environment: + RPMINSPECT_EXCLUDE: metadata,upstream diff --git a/.distro/plans/rpmlint.fmf b/.distro/plans/rpmlint.fmf new file mode 100644 index 000000000..1d28ff952 --- /dev/null +++ b/.distro/plans/rpmlint.fmf @@ -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 diff --git a/.distro/pybind11.rpmlintrc b/.distro/pybind11.rpmlintrc new file mode 100644 index 000000000..e69de29bb diff --git a/.distro/pybind11.spec b/.distro/pybind11.spec new file mode 100644 index 000000000..ff5ee9974 --- /dev/null +++ b/.distro/pybind11.spec @@ -0,0 +1,73 @@ +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++ + +%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} + + +%generate_buildrequires +%pyproject_buildrequires + + +%build +%pyproject_wheel + + +%install +%pyproject_install +%pyproject_save_files pybind11 + + +%check +%pytest + + +%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 diff --git a/.packit.yaml b/.packit.yaml new file mode 100644 index 000000000..59b0607ce --- /dev/null +++ b/.packit.yaml @@ -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 From 8fa7374acc25f99db5f3c2047c4a3f59c51842ea Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Mon, 8 Apr 2024 15:32:57 +0200 Subject: [PATCH 2/5] fix manifest --- MANIFEST.in | 1 + 1 file changed, 1 insertion(+) diff --git a/MANIFEST.in b/MANIFEST.in index 7ce83c552..f457184e4 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,4 @@ +prune .distro prune tests recursive-include pybind11/include/pybind11 *.h recursive-include pybind11 *.py From 798fec8c799f2bd90137ed189f16d93e92f1848d Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Mon, 8 Apr 2024 14:09:00 +0200 Subject: [PATCH 3/5] Adjust buildrequires - Remove cmake and ninja from buildrequires - Add the tests/requirements.txt --- .distro/pybind11.spec | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.distro/pybind11.spec b/.distro/pybind11.spec index ff5ee9974..36d65b8f4 100644 --- a/.distro/pybind11.spec +++ b/.distro/pybind11.spec @@ -14,6 +14,13 @@ BuildRequires: cmake BuildRequires: ninja-build BuildRequires: gcc BuildRequires: gcc-c++ +# 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 @@ -39,6 +46,9 @@ BuildRequires: pybind11-devel %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 From cbfcfb8e7b0ad95198c360cc1daa8ea733027b96 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Mon, 8 Apr 2024 14:48:07 +0200 Subject: [PATCH 4/5] Include CMake workflow --- .distro/pybind11.spec | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.distro/pybind11.spec b/.distro/pybind11.spec index 36d65b8f4..a9286d6a1 100644 --- a/.distro/pybind11.spec +++ b/.distro/pybind11.spec @@ -14,6 +14,9 @@ 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) @@ -56,15 +59,20 @@ sed -i -E 's/,?\s*"ninja[^"]*"//' pyproject.toml %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 From dd3c5d2536eacbdf7a911b6f016895e15a1a3765 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Mon, 8 Apr 2024 15:19:04 +0200 Subject: [PATCH 5/5] Use the custom cmake check target --- .distro/pybind11.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.distro/pybind11.spec b/.distro/pybind11.spec index a9286d6a1..7b9d4a675 100644 --- a/.distro/pybind11.spec +++ b/.distro/pybind11.spec @@ -72,8 +72,11 @@ sed -i -E 's/,?\s*"ninja[^"]*"//' pyproject.toml %check -%ctest -%pytest +# %%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