Skip to content

Commit 77b35f7

Browse files
LecrisUTJeromeCCP9
authored andcommitted
Fedora packaging
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
1 parent cb53144 commit 77b35f7

File tree

9 files changed

+294
-0
lines changed

9 files changed

+294
-0
lines changed

.distro/.fmf/version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1

.distro/plans/full.fmf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
summary: Test the bundled ctests
2+
discover+:
3+
how: fmf
4+
path: test-suite
5+
execute:
6+
how: tmt

.distro/plans/main.fmf

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

.distro/wannier90.rpmlintrc

Whitespace-only changes.

.distro/wannier90.spec

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
Name: wannier90
2+
Summary: Maximally-Localised Generalised Wannier Functions Code
3+
Version: 0.0.0
4+
Release: %autorelease
5+
License: GPL-2.0-only
6+
URL: https://www.wannier.org/
7+
8+
Source: https://github.com/wannier-developers/wannier90/archive/refs/tags/v%{version}.tar.gz
9+
10+
BuildRequires: ninja-build
11+
BuildRequires: cmake
12+
BuildRequires: gcc-fortran
13+
BuildRequires: flexiblas-devel
14+
# Required for testing
15+
BuildRequires: gcc-c++
16+
BuildRequires: python3
17+
18+
%global _description %{expand:
19+
Maximally-Localised Generalised Wannier Functions Code.}
20+
21+
%description
22+
%{_description}
23+
24+
%package devel
25+
Summary: Development files for wannier90
26+
Requires: wannier90%{?_isa} = %{version}-%{release}
27+
28+
%description devel
29+
This package contains the development files for the wannier90 library.
30+
31+
%package openmpi
32+
Summary: Maximally-Localised Generalised Wannier Functions Code - OpenMPI version
33+
BuildRequires: openmpi-devel
34+
35+
%description openmpi
36+
%{_description}
37+
38+
This package contains the OpenMPI parallel version.
39+
40+
%package openmpi-devel
41+
Summary: Development files for wannier90 - OpenMPI version
42+
Requires: wannier90-openmpi%{?_isa} = %{version}-%{release}
43+
44+
%description openmpi-devel
45+
This package contains the development files for the wannier90 (OpenMPI) library.
46+
47+
%package mpich
48+
Summary: Maximally-Localised Generalised Wannier Functions Code - MPICH version
49+
BuildRequires: mpich-devel
50+
51+
%description mpich
52+
%{_description}
53+
54+
This package contains the MPICH parallel version.
55+
56+
%package mpich-devel
57+
Summary: Development files for wannier90 - MPICH version
58+
Requires: wannier90-mpich%{?_isa} = %{version}-%{release}
59+
60+
%description mpich-devel
61+
This package contains the development files for the wannier90 (MPICH) library.
62+
63+
64+
%prep
65+
%autosetup -n wannier90-%{version}
66+
67+
# $MPI_SUFFIX will be evaluated in the loops below, set by mpi modules
68+
%global _vpath_builddir %{_vendor}-%{_target_os}-build${MPI_SUFFIX:-_serial}
69+
# We are running the module load/unload manually until there is a macro-like way to expand this
70+
. /etc/profile.d/modules.sh
71+
72+
73+
%build
74+
cmake_common_args=(
75+
"-G Ninja"
76+
"-DWANNIER90_SHARED_LIBS=ON"
77+
"-DWANNIER90_TEST=ON"
78+
)
79+
for mpi in '' mpich openmpi ; do
80+
if [ -n "$mpi" ]; then
81+
module load mpi/${mpi}-%{_arch}
82+
cmake_mpi_args=(
83+
"-DCMAKE_INSTALL_PREFIX=${MPI_HOME}"
84+
"-DWANNIER90_MPI=ON"
85+
"-DCMAKE_INSTALL_MODULEDIR=${MPI_FORTRAN_MOD_DIR}"
86+
"-DCMAKE_INSTALL_LIBDIR=lib"
87+
)
88+
else
89+
cmake_mpi_args=(
90+
"-DWANNIER90_MPI=OFF"
91+
"-DCMAKE_INSTALL_MODULEDIR=%{_fmoddir}"
92+
)
93+
fi
94+
95+
%cmake \
96+
${cmake_common_args[@]} \
97+
${cmake_mpi_args[@]}
98+
%cmake_build
99+
100+
[ -n "$mpi" ] && module unload mpi/${mpi}-%{_arch}
101+
done
102+
103+
104+
%install
105+
for mpi in '' mpich openmpi ; do
106+
[ -n "$mpi" ] && module load mpi/${mpi}-%{_arch}
107+
%cmake_install
108+
[ -n "$mpi" ] && module unload mpi/${mpi}-%{_arch}
109+
done
110+
111+
112+
%check
113+
for mpi in '' mpich %{?with_openmpi:openmpi} ; do
114+
[ -n "$mpi" ] && module load mpi/${mpi}-%{_arch}
115+
%ctest
116+
[ -n "$mpi" ] && module unload mpi/${mpi}-%{_arch}
117+
done
118+
119+
120+
%files
121+
%doc README.rst
122+
%license LICENSE
123+
%{_libdir}/libwannier90.so.*
124+
%{_bindir}/wannier90.x
125+
%{_bindir}/postw90.x
126+
127+
%files devel
128+
%{_includedir}/wannier90.hh
129+
%{_libdir}/libwannier90.so
130+
%{_fmoddir}/Wannier90/
131+
%{_libdir}/cmake/Wannier90
132+
%{_libdir}/pkgconfig/wannier90.pc
133+
134+
%files openmpi
135+
%{_libdir}/openmpi/bin/wannier90.x
136+
%{_libdir}/openmpi/bin/postw90.x
137+
%{_libdir}/openmpi/lib/libwannier90.so.*
138+
139+
%files openmpi-devel
140+
%{_libdir}/openmpi/include/wannier90.hh
141+
%{_libdir}/openmpi/lib/libwannier90.so
142+
%{_fmoddir}/openmpi/Wannier90/
143+
%{_libdir}/openmpi/lib/cmake/Wannier90
144+
%{_libdir}/openmpi/lib/pkgconfig/wannier90.pc
145+
146+
%files mpich
147+
%{_libdir}/mpich/bin/wannier90.x
148+
%{_libdir}/mpich/bin/postw90.x
149+
%{_libdir}/mpich/lib/libwannier90.so.*
150+
151+
%files mpich-devel
152+
%{_libdir}/mpich/include/wannier90.hh
153+
%{_libdir}/mpich/lib/libwannier90.so
154+
%{_fmoddir}/mpich/Wannier90/
155+
%{_libdir}/mpich/lib/cmake/Wannier90
156+
%{_libdir}/mpich/lib/pkgconfig/wannier90.pc
157+
158+
%changelog
159+
%autochangelog

.packit.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
specfile_path: .distro/wannier90.spec
2+
files_to_sync:
3+
- src: .distro/
4+
dest: ./
5+
delete: true
6+
filters:
7+
- "protect .git*"
8+
- "protect sources"
9+
- "protect changelog"
10+
- "protect gating.yaml"
11+
# Temporary workaround until
12+
# https://github.com/packit/packit/pull/2573
13+
- "- wannier90.spec"
14+
- .packit.yaml
15+
16+
upstream_package_name: wannier90
17+
downstream_package_name: wannier90
18+
upstream_tag_template: v{version}
19+
20+
targets:
21+
- fedora-all-x86_64
22+
- fedora-all-aarch64
23+
24+
_:
25+
# Job templates
26+
- &build-in-packit
27+
job: copr_build
28+
- &build-in-lecris
29+
<<: *build-in-packit
30+
owner: lecris
31+
- &tests-downstream
32+
job: tests
33+
fmf_path: .distro
34+
identifier: downstream
35+
36+
jobs:
37+
# Upstream jobs
38+
- <<: *build-in-lecris
39+
trigger: release
40+
project: release
41+
- <<: *tests-downstream
42+
trigger: release
43+
- <<: *build-in-lecris
44+
trigger: commit
45+
branch: main
46+
project: nightly
47+
- <<: *tests-downstream
48+
trigger: commit
49+
branch: main
50+
- <<: *build-in-packit
51+
trigger: pull_request
52+
- <<: *tests-downstream
53+
trigger: pull_request
54+
# Downstream jobs
55+
- job: propose_downstream
56+
trigger: release
57+
dist_git_branches:
58+
- fedora-rawhide
59+
- job: koji_build
60+
trigger: commit
61+
dist_git_branches:
62+
- fedora-all
63+
- job: bodhi_update
64+
trigger: commit
65+
dist_git_branches:
66+
- fedora-branched

test-suite/.fmf/version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1

test-suite/ctest.fmf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
tag: [ cmake ]
2+
require:
3+
- cmake
4+
- rsync
5+
- gcc
6+
- gcc-c++
7+
- gcc-fortran
8+
- pkgconf
9+
- git
10+
# For test-suite
11+
- bzip2
12+
# For testing FetchContent
13+
- flexiblas-devel
14+
framework: beakerlib
15+
path: /
16+
test: ./ctest.sh
17+
18+
/serial:
19+
environment:
20+
MPI_VARIANT: serial
21+
/OpenMPI:
22+
environment:
23+
MPI_VARIANT: openmpi
24+
/MPICH:
25+
environment:
26+
MPI_VARIANT: mpich

test-suite/ctest.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
3+
# shellcheck disable=all
4+
source /usr/share/beakerlib/beakerlib.sh || exit 1
5+
6+
rlJournalStart
7+
rlPhaseStartSetup
8+
rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
9+
rlRun "rsync -rL ./ $tmp" 0 "Copy test-suite project"
10+
rlRun "pushd $tmp"
11+
rlRun "set -o pipefail"
12+
[[ -z "${MPI_VARIANT}" ]] && rlDie "MPI_VARIANT was not provided"
13+
rlPhaseEnd
14+
15+
rlPhaseStartTest
16+
[[ "${MPI_VARIANT}" != "serial" ]] && rlRun "module load mpi/${MPI_VARIANT}" 0 "Load MPI"
17+
rlRun "cmake -B ./build" 0 "CMake configure"
18+
rlRun "cmake --build ./build" 0 "CMake build"
19+
rlRun "ctest --test-dir ./build --output-on-failure" 0 "Run CTest"
20+
rlPhaseEnd
21+
22+
rlPhaseStartCleanup
23+
rlRun "popd"
24+
rlRun "rm -r $tmp" 0 "Remove tmp directory"
25+
rlPhaseEnd
26+
rlJournalEnd

0 commit comments

Comments
 (0)