Skip to content

Commit 666d28c

Browse files
authored
Fedora packaging (#15)
* Remove `ref-names` Signed-off-by: Cristian Le <[email protected]> * Initial Fedora packaging Signed-off-by: Cristian Le <[email protected]> * Add pure CMake tests Signed-off-by: Cristian Le <[email protected]> * Split the rpm package Signed-off-by: Cristian Le <[email protected]> * Add rpmlint exceptions Signed-off-by: Cristian Le <[email protected]> * Disable epel-10 packaging for now Signed-off-by: Cristian Le <[email protected]> --------- Signed-off-by: Cristian Le <[email protected]>
1 parent f41e5ec commit 666d28c

16 files changed

+228
-1
lines changed

.distro/.fmf/version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1

.distro/f2py-cmake.rpmlintrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
addFilter("E: devel-dependency python3-devel")
2+
addFilter("dangling-relative-symlink .*/UseF2Py\.cmake")

.distro/f2py-cmake.spec

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
Name: f2py-cmake
2+
Version: 0.0.0
3+
Release: %autorelease
4+
Summary: F2Py helpers for CMake
5+
6+
License: Apache-2.0
7+
URL: https://github.com/scikit-build/f2py-cmake
8+
Source: %{pypi_source f2py_cmake}
9+
BuildArch: noarch
10+
11+
BuildRequires: python3-devel
12+
BuildRequires: python3-numpy-f2py
13+
# Testing dependences
14+
BuildRequires: cmake
15+
BuildRequires: gfortran
16+
Requires: cmake
17+
Requires: python3-devel
18+
Requires: python3-numpy-f2py
19+
20+
%global _description %{expand:
21+
This provides helpers for using F2Py. Use:
22+
23+
include(UseF2Py)
24+
}
25+
26+
%description %_description
27+
28+
CMake module files.
29+
30+
%package -n python3-f2py-cmake
31+
Summary: %{summary}
32+
Requires: f2py-cmake = %{version}-%{release}
33+
%description -n python3-f2py-cmake %_description
34+
35+
Python package.
36+
37+
38+
%prep
39+
%autosetup -n f2py_cmake-%{version}
40+
41+
42+
%generate_buildrequires
43+
%pyproject_buildrequires -x test
44+
45+
46+
%build
47+
%pyproject_wheel
48+
49+
50+
%install
51+
%pyproject_install
52+
%pyproject_save_files -l f2py_cmake
53+
# Move the actual CMake modules to /usr/share/cmake
54+
mkdir -p %{buildroot}%{_datadir}/cmake/Modules
55+
mv %{buildroot}%{python3_sitelib}/f2py_cmake/cmake/*.cmake %{buildroot}%{_datadir}/cmake/Modules/
56+
ln -rs %{buildroot}%{_datadir}/cmake/Modules/*.cmake %{buildroot}%{python3_sitelib}/f2py_cmake/cmake/
57+
58+
59+
%check
60+
%pyproject_check_import
61+
%pytest
62+
63+
64+
%files
65+
%{_datadir}/cmake/Modules/*.cmake
66+
%license LICENSE
67+
%doc README.md
68+
69+
%files -n python3-f2py-cmake -f %{pyproject_files}
70+
%{_bindir}/f2py-cmake
71+
72+
73+
%changelog
74+
%autochangelog

.distro/plans/cmake.fmf

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
summary: Test CMake only modules
2+
discover+:
3+
how: fmf
4+
filter: "tag: cmake"
5+
prepare:
6+
- name: Install additional test packages
7+
how: install
8+
package:
9+
- gfortran
10+
execute:
11+
how: tmt

.distro/plans/main.fmf

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
discover:
2+
how: fmf
3+
path: .
4+
5+
adjust+:
6+
# Cannot use initiator: fedora-ci reliably yet
7+
when: initiator is not defined or initiator != packit
8+
discover+:
9+
how: fmf
10+
dist-git-source: true
11+
dist-git-extract: f2py_cmake-*/

.distro/plans/rpmlint.fmf

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
prepare:
2+
- how: shell
3+
script: cp ./*.rpmlintrc $TMT_PLAN_DATA/
4+
discover:
5+
how: fmf
6+
filter: "tag: rpmlint"
7+
url: https://github.com/packit/tmt-plans
8+
ref: main
9+
execute:
10+
how: tmt

.distro/plans/smoke.fmf

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
summary: Basic smoke tests
2+
discover+:
3+
filter: "tag: smoke"
4+
execute:
5+
how: tmt

.distro/tests/smoke.fmf

Whitespace-only changes.

.fmf/version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1

.git_archival.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
node: $Format:%H$
22
node-date: $Format:%cI$
33
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
4-
ref-names: $Format:%D$

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,8 @@ Thumbs.db
156156
# Common editor files
157157
*~
158158
*.swp
159+
160+
# Fedora packaging
161+
*.rpm
162+
*.tar.gz
163+
!.distro/*.spec

.packit.yaml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
files_to_sync:
2+
- src: .distro/
3+
dest: ./
4+
delete: true
5+
filters:
6+
- "protect .git*"
7+
- "protect sources"
8+
- "protect changelog"
9+
- "- plans/rpmlint.fmf"
10+
- .packit.yaml
11+
12+
upstream_package_name: f2py-cmake
13+
specfile_path: .distro/f2py-cmake.spec
14+
downstream_package_name: f2py-cmake
15+
upstream_tag_template: v{version}
16+
17+
targets: &targets
18+
- fedora-all-x86_64
19+
- fedora-all-aarch64
20+
# TODO: Package for epel-10 once scikit-build-core is packaged there
21+
# - epel-10-x86_64
22+
# - epel-10-aarch64
23+
24+
jobs:
25+
- &copr_build
26+
job: copr_build
27+
trigger: pull_request
28+
- &tests
29+
job: tests
30+
trigger: pull_request
31+
fmf_path: .distro
32+
- <<: *copr_build
33+
trigger: release
34+
owner: "@scikit-build"
35+
project: release
36+
- <<: *tests
37+
trigger: release
38+
- <<: *copr_build
39+
trigger: commit
40+
branch: main
41+
owner: "@scikit-build"
42+
project: nightly
43+
- <<: *tests
44+
trigger: commit
45+
branch: main
46+
- job: propose_downstream
47+
trigger: release
48+
dist_git_branches:
49+
- fedora-rawhide
50+
- job: koji_build
51+
trigger: commit
52+
dist_git_branches:
53+
- fedora-all
54+
- job: bodhi_update
55+
trigger: commit
56+
dist_git_branches:
57+
- fedora-branched

tests/main.fmf

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
path: /
2+
test: ./tests/test_pure_cmake.sh
3+
framework: beakerlib
4+
tag: [ cmake ]

tests/packages/f77/main.fmf

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
summary: Minimal f77 example

tests/smoke.fmf

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/:
2+
inherit: false
3+
4+
tag: [ smoke ]
5+
tier: 0
6+
path: /
7+
8+
/python-version:
9+
test: |
10+
python3 -c "import f2py_cmake; print(f2py_cmake.__version__)"
11+
12+
/cmake-modules:
13+
test: |
14+
cat <<-EOF > test_modules.cmake
15+
find_package(Python REQUIRED COMPONENTS NumPy)
16+
include(UseF2Py RESULT_VARIABLE UseF2Py_PATH)
17+
message("UseF2Py_PATH=\${UseF2Py_PATH}")
18+
EOF
19+
cmake -P test_modules.cmake
20+
adjust:
21+
enabled: false
22+
because: |
23+
Cannot test inside script-mode because targets are not propagated

tests/test_pure_cmake.sh

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
3+
# shellcheck disable=all
4+
. /usr/share/beakerlib/beakerlib.sh || exit 1
5+
6+
rlJournalStart
7+
rlPhaseStartSetup
8+
rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
9+
rlRun "root=\$(pwd)" 0 "Save the tmt root path"
10+
rlRun "pushd $tmp"
11+
rlRun "set -o pipefail"
12+
rlPhaseEnd
13+
14+
rlPhaseStartTest
15+
rlRun "cmake -S $root$TMT_TEST_NAME -B ./build" 0 "Configure project"
16+
rlRun "cmake --build ./build" 0 "Build project"
17+
rlPhaseEnd
18+
19+
rlPhaseStartCleanup
20+
rlRun "popd"
21+
rlRun "rm -r $tmp" 0 "Remove tmp directory"
22+
rlPhaseEnd
23+
rlJournalEnd

0 commit comments

Comments
 (0)