Skip to content

Commit

Permalink
Fedora packaging
Browse files Browse the repository at this point in the history
Signed-off-by: Cristian Le <[email protected]>
  • Loading branch information
LecrisUT committed Feb 22, 2024
1 parent bf954ab commit 541910d
Show file tree
Hide file tree
Showing 10 changed files with 211 additions and 0 deletions.
1 change: 1 addition & 0 deletions .distro/.fmf/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
7 changes: 7 additions & 0 deletions .distro/plans/full.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
summary:
Test the bundled ctests and pytest
discover+:
how: fmf
path: test-suite
execute:
how: tmt
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: wannier90-*/
5 changes: 5 additions & 0 deletions .distro/plans/rpminspect.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
plan:
import:
url: https://github.com/packit/tmt-plans
ref: main
name: /plans/rpminspect
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/wannier90.rpmlintrc
Empty file.
69 changes: 69 additions & 0 deletions .distro/wannier90.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
Name: wannier90
Summary: The Maximally-Localised Generalised Wannier Functions Code
Version: 0.0.0
Release: %autorelease
License: GPLv2
URL: https://www.wannier.org/

Source: https://github.com/wannier-developers/wannier90/archive/refs/tags/v%{version}.tar.gz

BuildRequires: ninja-build
BuildRequires: cmake
BuildRequires: gcc-fortran
BuildRequires: flexiblas-devel
# Required for testing
BuildRequires: gcc-c++
BuildRequires: python3

%global _description %{expand:
Maximally-Localised Generalised Wannier Functions Code.}

%description
%{_description}

%package devel
Summary: Development files for wannier90
Requires: wannier90%{?_isa} = %{version}-%{release}

%description devel
This package contains the development files for the wannier90 library.

%prep
%autosetup -n wannier90-%{version}


%build
%cmake \
-G Ninja \
-DWANNIER90_MPI=OFF \
-DWANNIER90_SHARED_LIBS=ON \
-DWANNIER90_TEST=ON \
-DCMAKE_INSTALL_MODULEDIR=%{_fmoddir}

%cmake_build


%install
%cmake_install


%check
%ctest


%files
%doc README.rst
%license LICENSE
%{_libdir}/libwannier90.so.*
%{_bindir}/wannier90.x
%{_bindir}/postw90.x

%files devel
%{_includedir}/wannier90.hh
%{_libdir}/libwannier90.so
%{_fmoddir}/Wannier90/
%{_libdir}/cmake/Wannier90
%{_libdir}/pkgconfig/wannier90.pc

%changelog
%autochangelog
79 changes: 79 additions & 0 deletions .packit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
specfile_path: .distro/wannier90.spec
files_to_sync:
- src: .distro/
dest: ./
filters:
- "- plans/main.fmf.dist-git"
- "- plans/rpminspect.fmf"
- "- plans/rpmlint.fmf"
- src: .distro/plans/main.fmf.dist-git
dest: plans/main.fmf
- .packit.yaml

upstream_package_name: wannier90
downstream_package_name: wannier90
update_release: false
upstream_tag_template: v{version}

jobs:
- job: copr_build
trigger: pull_request
owner: lecris
project: wannier90
update_release: true
release_suffix: "{PACKIT_RPMSPEC_RELEASE}"
targets:
- fedora-all-x86_64
- fedora-all-aarch64
- job: tests
trigger: pull_request
targets:
- fedora-all-x86_64
- fedora-all-aarch64
fmf_path: .distro
- job: copr_build
trigger: commit
branch: develop
owner: lecris
project: nightly
additional_repos:
- copr://@scikit-build/release
targets:
- fedora-all-x86_64
- fedora-all-aarch64
- job: tests
trigger: commit
branch: develop
targets:
- fedora-all-x86_64
- fedora-all-aarch64
fmf_path: .distro
- job: copr_build
trigger: release
owner: lecris
project: release
targets:
- fedora-all-x86_64
- fedora-all-aarch64
- job: tests
trigger: release
targets:
- fedora-all-x86_64
- fedora-all-aarch64
fmf_path: .distro
- job: propose_downstream
trigger: release
dist_git_branches:
# TODO: Switch to fedora-development and fedora-latest
# There is an issue that the commits diverge on different PRs. In the meantime will create PRs on branched fedora
# manually
# https://github.com/packit/packit/issues/1724
- fedora-rawhide
- job: koji_build
trigger: commit
dist_git_branches:
- fedora-all
- job: bodhi_update
trigger: commit
dist_git_branches:
- fedora-branched
12 changes: 12 additions & 0 deletions test-suite/ctest.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
tag: [ cmake ]
require:
- cmake
- rsync
- gcc
- gcc-c++
- gcc-fortran
- pkgconf
- git
framework: beakerlib
path: /
test: ./ctest.sh
24 changes: 24 additions & 0 deletions test-suite/ctest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# shellcheck disable=all
source /usr/share/beakerlib/beakerlib.sh || exit 1

rlJournalStart
rlPhaseStartSetup
rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
rlRun "rsync -rL ./ $tmp" 0 "Copy test-suite project"
rlRun "pushd $tmp"
rlRun "set -o pipefail"
rlPhaseEnd

rlPhaseStartTest
rlRun "cmake -B ./build -DSPGLIB_WITH_Fortran=ON" 0 "CMake configure"
rlRun "cmake --build ./build" 0 "CMake build"
rlRun "ctest --test-dir ./build --output-on-failure" 0 "Run CTest"
rlPhaseEnd

rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $tmp" 0 "Remove tmp directory"
rlPhaseEnd
rlJournalEnd

0 comments on commit 541910d

Please sign in to comment.