From b3a1c655f174bc159f216fc6e7f7bf1213c68d65 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Wed, 25 Sep 2024 10:46:32 +0200 Subject: [PATCH 1/6] Remove `ref-names` --- .git_archival.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/.git_archival.txt b/.git_archival.txt index 8fb235d..7c51009 100644 --- a/.git_archival.txt +++ b/.git_archival.txt @@ -1,4 +1,3 @@ node: $Format:%H$ node-date: $Format:%cI$ describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$ -ref-names: $Format:%D$ From af7ba77a3ce563def96ef2e0fea899c38d22c47b Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Wed, 25 Sep 2024 10:58:51 +0200 Subject: [PATCH 2/6] Initial Fedora packaging --- .distro/.fmf/version | 1 + .distro/plans/main.fmf | 7 +++ .distro/plans/rpmlint.fmf | 10 +++++ .distro/plans/smoke.fmf | 7 +++ .distro/python-cython-cmake.rpmlintrc | 0 .distro/python-cython-cmake.spec | 64 +++++++++++++++++++++++++++ .distro/tests/smoke.fmf | 7 +++ .gitignore | 5 +++ .packit.yaml | 56 +++++++++++++++++++++++ 9 files changed, 157 insertions(+) create mode 100644 .distro/.fmf/version create mode 100644 .distro/plans/main.fmf create mode 100644 .distro/plans/rpmlint.fmf create mode 100644 .distro/plans/smoke.fmf create mode 100644 .distro/python-cython-cmake.rpmlintrc create mode 100644 .distro/python-cython-cmake.spec create mode 100644 .distro/tests/smoke.fmf create mode 100644 .packit.yaml diff --git a/.distro/.fmf/version b/.distro/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.distro/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/.distro/plans/main.fmf b/.distro/plans/main.fmf new file mode 100644 index 0000000..bdfc6ff --- /dev/null +++ b/.distro/plans/main.fmf @@ -0,0 +1,7 @@ +adjust+: + # Cannot use initiator: fedora-ci reliably yet + when: initiator is not defined or initiator != packit + discover+: + how: fmf + dist-git-source: true + dist-git-extract: cython_cmake-*/ diff --git a/.distro/plans/rpmlint.fmf b/.distro/plans/rpmlint.fmf new file mode 100644 index 0000000..1d28ff9 --- /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/plans/smoke.fmf b/.distro/plans/smoke.fmf new file mode 100644 index 0000000..57874e5 --- /dev/null +++ b/.distro/plans/smoke.fmf @@ -0,0 +1,7 @@ +summary: + Basic smoke tests +discover: + how: fmf + filter: "tag: smoke" +execute: + how: tmt diff --git a/.distro/python-cython-cmake.rpmlintrc b/.distro/python-cython-cmake.rpmlintrc new file mode 100644 index 0000000..e69de29 diff --git a/.distro/python-cython-cmake.spec b/.distro/python-cython-cmake.spec new file mode 100644 index 0000000..b04040a --- /dev/null +++ b/.distro/python-cython-cmake.spec @@ -0,0 +1,64 @@ +# Main package is arched in order to run tests on all arches +%global debug_package %{nil} + +Name: python-cython-cmake +Version: 0.0.0 +Release: %autorelease +Summary: CMake helpers for building Cython modules + +License: Apache-2.0 +URL: https://github.com/scikit-build/cython-cmake +Source: %{pypi_source cython_cmake} + +BuildRequires: python3-devel +# Testing dependences +BuildRequires: cmake +BuildRequires: gcc +BuildRequires: g++ + +%global _description %{expand: +This provides helpers for using Cython. Use + +find_package(Cython MODULE REQUIRED VERSION 3.0) +include(UseCython) +} + +%description %_description + +%package -n python3-cython-cmake +Summary: %{summary} +Requires: cmake +Requires: python3-devel +BuildArch: noarch +%description -n python3-cython-cmake %_description + + +%prep +%autosetup -n cython_cmake-%{version} + + +%generate_buildrequires +%pyproject_buildrequires -x test + + +%build +%pyproject_wheel + + +%install +%pyproject_install +%pyproject_save_files -l cython_cmake + + +%check +%pyproject_check_import +%pytest + + +%files -n python3-cython-cmake -f %{pyproject_files} +%{_bindir}/cython-cmake +%doc README.md + + +%changelog +%autochangelog diff --git a/.distro/tests/smoke.fmf b/.distro/tests/smoke.fmf new file mode 100644 index 0000000..de0a6a7 --- /dev/null +++ b/.distro/tests/smoke.fmf @@ -0,0 +1,7 @@ +tag: [ smoke ] +tier: 0 +path: / + +/version: + test: | + python3 -c "import cython_cmake; print(cython_cmake.__version__)" diff --git a/.gitignore b/.gitignore index 25cf9a4..f41e0f9 100644 --- a/.gitignore +++ b/.gitignore @@ -156,3 +156,8 @@ Thumbs.db # Common editor files *~ *.swp + +# Fedora packaging +*.rpm +*.tar.gz +!.distro/*.spec diff --git a/.packit.yaml b/.packit.yaml new file mode 100644 index 0000000..f90dfca --- /dev/null +++ b/.packit.yaml @@ -0,0 +1,56 @@ +files_to_sync: + - src: .distro/ + dest: ./ + delete: true + filters: + - "protect .git*" + - "protect sources" + - "protect changelog" + - "- plans/rpmlint.fmf" + - .packit.yaml + +upstream_package_name: cython-cmake +specfile_path: .distro/python-cython-cmake.spec +downstream_package_name: python-cython-cmake +upstream_tag_template: v{version} + +targets: &targets + - fedora-all-x86_64 + - fedora-all-aarch64 + - epel-10-x86_64 + - epel-10-aarch64 + +jobs: + - &copr_build + job: copr_build + trigger: pull_request + - &tests + job: tests + trigger: pull_request + fmf_path: .distro + - <<: *copr_build + trigger: release + owner: "@scikit-build" + project: release + - <<: *tests + trigger: release + - <<: *copr_build + trigger: commit + branch: main + owner: "@scikit-build" + project: nightly + - <<: *tests + trigger: commit + branch: main + - 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 e7e7ca00cb1855ad655dbb523022788951a750f5 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Wed, 2 Oct 2024 11:17:41 +0200 Subject: [PATCH 3/6] Add pure CMake tests --- .distro/plans/cmake.fmf | 12 ++++++++++++ .distro/plans/main.fmf | 4 ++++ .distro/plans/smoke.fmf | 6 ++---- .distro/tests/smoke.fmf | 7 ------- .fmf/version | 1 + tests/main.fmf | 4 ++++ tests/packages/multiple_packages/main.fmf | 1 + tests/packages/simple/main.fmf | 1 + tests/smoke.fmf | 19 +++++++++++++++++++ tests/test_pure_cmake.sh | 23 +++++++++++++++++++++++ 10 files changed, 67 insertions(+), 11 deletions(-) create mode 100644 .distro/plans/cmake.fmf delete mode 100644 .distro/tests/smoke.fmf create mode 100644 .fmf/version create mode 100644 tests/main.fmf create mode 100644 tests/packages/multiple_packages/main.fmf create mode 100644 tests/packages/simple/main.fmf create mode 100644 tests/smoke.fmf create mode 100755 tests/test_pure_cmake.sh diff --git a/.distro/plans/cmake.fmf b/.distro/plans/cmake.fmf new file mode 100644 index 0000000..4dafc56 --- /dev/null +++ b/.distro/plans/cmake.fmf @@ -0,0 +1,12 @@ +summary: Test CMake only modules +discover+: + how: fmf + filter: "tag: cmake" +prepare: + - name: Install additional test packages + how: install + package: + - gcc + - g++ +execute: + how: tmt diff --git a/.distro/plans/main.fmf b/.distro/plans/main.fmf index bdfc6ff..165b0fa 100644 --- a/.distro/plans/main.fmf +++ b/.distro/plans/main.fmf @@ -1,3 +1,7 @@ +discover: + how: fmf + path: . + adjust+: # Cannot use initiator: fedora-ci reliably yet when: initiator is not defined or initiator != packit diff --git a/.distro/plans/smoke.fmf b/.distro/plans/smoke.fmf index 57874e5..f545373 100644 --- a/.distro/plans/smoke.fmf +++ b/.distro/plans/smoke.fmf @@ -1,7 +1,5 @@ -summary: - Basic smoke tests -discover: - how: fmf +summary: Basic smoke tests +discover+: filter: "tag: smoke" execute: how: tmt diff --git a/.distro/tests/smoke.fmf b/.distro/tests/smoke.fmf deleted file mode 100644 index de0a6a7..0000000 --- a/.distro/tests/smoke.fmf +++ /dev/null @@ -1,7 +0,0 @@ -tag: [ smoke ] -tier: 0 -path: / - -/version: - test: | - python3 -c "import cython_cmake; print(cython_cmake.__version__)" diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/tests/main.fmf b/tests/main.fmf new file mode 100644 index 0000000..1a57587 --- /dev/null +++ b/tests/main.fmf @@ -0,0 +1,4 @@ +path: / +test: ./tests/test_pure_cmake.sh +framework: beakerlib +tag: [ cmake ] diff --git a/tests/packages/multiple_packages/main.fmf b/tests/packages/multiple_packages/main.fmf new file mode 100644 index 0000000..4d9b5e4 --- /dev/null +++ b/tests/packages/multiple_packages/main.fmf @@ -0,0 +1 @@ +summary: Multiple packages diff --git a/tests/packages/simple/main.fmf b/tests/packages/simple/main.fmf new file mode 100644 index 0000000..f342447 --- /dev/null +++ b/tests/packages/simple/main.fmf @@ -0,0 +1 @@ +summary: Simplest project diff --git a/tests/smoke.fmf b/tests/smoke.fmf new file mode 100644 index 0000000..970dd29 --- /dev/null +++ b/tests/smoke.fmf @@ -0,0 +1,19 @@ +/: + inherit: false + +tag: [ smoke ] +tier: 0 +path: / + +/python-version: + test: | + python3 -c "import cython_cmake; print(cython_cmake.__version__)" + +/cmake-modules: + # Cannot test for FindCython because it uses `add_executable` + test: | + cat <<-EOF > test_modules.cmake + include(UseCython RESULT_VARIABLE UseCython_PATH) + message("UseCython_PATH=\${UseCython_PATH}") + EOF + cmake -P test_modules.cmake diff --git a/tests/test_pure_cmake.sh b/tests/test_pure_cmake.sh new file mode 100755 index 0000000..c2f0e25 --- /dev/null +++ b/tests/test_pure_cmake.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# shellcheck disable=all +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +rlJournalStart + rlPhaseStartSetup + rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory" + rlRun "root=\$(pwd)" 0 "Save the tmt root path" + rlRun "pushd $tmp" + rlRun "set -o pipefail" + rlPhaseEnd + + rlPhaseStartTest + rlRun "cmake -S $root$TMT_TEST_NAME -B ./build" 0 "Configure project" + rlRun "cmake --build ./build" 0 "Build project" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $tmp" 0 "Remove tmp directory" + rlPhaseEnd +rlJournalEnd From f759c436014f4470cc8d63c91a0f3f6c59b2f153 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Wed, 2 Oct 2024 14:00:04 +0200 Subject: [PATCH 4/6] Split the rpm package --- ...cmake.rpmlintrc => cython-cmake.rpmlintrc} | 0 ...on-cython-cmake.spec => cython-cmake.spec} | 29 +++++++++++++------ .packit.yaml | 4 +-- 3 files changed, 22 insertions(+), 11 deletions(-) rename .distro/{python-cython-cmake.rpmlintrc => cython-cmake.rpmlintrc} (100%) rename .distro/{python-cython-cmake.spec => cython-cmake.spec} (64%) diff --git a/.distro/python-cython-cmake.rpmlintrc b/.distro/cython-cmake.rpmlintrc similarity index 100% rename from .distro/python-cython-cmake.rpmlintrc rename to .distro/cython-cmake.rpmlintrc diff --git a/.distro/python-cython-cmake.spec b/.distro/cython-cmake.spec similarity index 64% rename from .distro/python-cython-cmake.spec rename to .distro/cython-cmake.spec index b04040a..30389ef 100644 --- a/.distro/python-cython-cmake.spec +++ b/.distro/cython-cmake.spec @@ -1,7 +1,4 @@ -# Main package is arched in order to run tests on all arches -%global debug_package %{nil} - -Name: python-cython-cmake +Name: cython-cmake Version: 0.0.0 Release: %autorelease Summary: CMake helpers for building Cython modules @@ -9,15 +6,19 @@ Summary: CMake helpers for building Cython modules License: Apache-2.0 URL: https://github.com/scikit-build/cython-cmake Source: %{pypi_source cython_cmake} +BuildArch: noarch BuildRequires: python3-devel # Testing dependences BuildRequires: cmake BuildRequires: gcc BuildRequires: g++ +Requires: cmake +Requires: python3-devel +Requires: python3dist(cython) %global _description %{expand: -This provides helpers for using Cython. Use +This provides helpers for using Cython. Use: find_package(Cython MODULE REQUIRED VERSION 3.0) include(UseCython) @@ -25,13 +26,15 @@ include(UseCython) %description %_description +CMake module files. + %package -n python3-cython-cmake Summary: %{summary} -Requires: cmake -Requires: python3-devel -BuildArch: noarch +Requires: cython-cmake = %{version}-%{release} %description -n python3-cython-cmake %_description +Python package. + %prep %autosetup -n cython_cmake-%{version} @@ -48,6 +51,10 @@ BuildArch: noarch %install %pyproject_install %pyproject_save_files -l cython_cmake +# Move the actual CMake modules to /usr/share/cmake +mkdir -p %{buildroot}%{_datadir}/cmake/Modules +mv %{buildroot}%{python3_sitelib}/cython_cmake/cmake/*.cmake %{buildroot}%{_datadir}/cmake/Modules/ +ln -rs %{buildroot}%{_datadir}/cmake/Modules/*.cmake %{buildroot}%{python3_sitelib}/cython_cmake/cmake/ %check @@ -55,9 +62,13 @@ BuildArch: noarch %pytest +%files +%{_datadir}/cmake/Modules/*.cmake +%license LICENSE +%doc README.md + %files -n python3-cython-cmake -f %{pyproject_files} %{_bindir}/cython-cmake -%doc README.md %changelog diff --git a/.packit.yaml b/.packit.yaml index f90dfca..6aa6867 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -10,8 +10,8 @@ files_to_sync: - .packit.yaml upstream_package_name: cython-cmake -specfile_path: .distro/python-cython-cmake.spec -downstream_package_name: python-cython-cmake +specfile_path: .distro/cython-cmake.spec +downstream_package_name: cython-cmake upstream_tag_template: v{version} targets: &targets From ca4da2747954fb0e5fa3ce63ccb726978fef35a8 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Mon, 21 Oct 2024 17:49:08 +0200 Subject: [PATCH 5/6] Add rpmlint exceptions --- .distro/cython-cmake.rpmlintrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.distro/cython-cmake.rpmlintrc b/.distro/cython-cmake.rpmlintrc index e69de29..7019023 100644 --- a/.distro/cython-cmake.rpmlintrc +++ b/.distro/cython-cmake.rpmlintrc @@ -0,0 +1,3 @@ +addFilter("E: devel-dependency python3-devel") +addFilter("dangling-relative-symlink .*/FindCython\.cmake") +addFilter("dangling-relative-symlink .*/UseCython\.cmake") From afdf9874dacaea51f8bc630f2e3f2d741998768e Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Mon, 21 Oct 2024 17:51:06 +0200 Subject: [PATCH 6/6] Disable epel-10 packaging for now --- .packit.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.packit.yaml b/.packit.yaml index 6aa6867..c847c67 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -17,8 +17,9 @@ upstream_tag_template: v{version} targets: &targets - fedora-all-x86_64 - fedora-all-aarch64 - - epel-10-x86_64 - - epel-10-aarch64 + # TODO: Package for epel-10 once scikit-build-core is packaged there +# - epel-10-x86_64 +# - epel-10-aarch64 jobs: - &copr_build