From 541910dbda929d8de6e06a65027347b412815fde Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Tue, 18 Apr 2023 17:55:58 +0200 Subject: [PATCH] Fedora packaging Signed-off-by: Cristian Le --- .distro/.fmf/version | 1 + .distro/plans/full.fmf | 7 +++ .distro/plans/main.fmf.dist-git | 4 ++ .distro/plans/rpminspect.fmf | 5 +++ .distro/plans/rpmlint.fmf | 10 +++++ .distro/wannier90.rpmlintrc | 0 .distro/wannier90.spec | 69 ++++++++++++++++++++++++++++ .packit.yaml | 79 +++++++++++++++++++++++++++++++++ test-suite/ctest.fmf | 12 +++++ test-suite/ctest.sh | 24 ++++++++++ 10 files changed, 211 insertions(+) create mode 100644 .distro/.fmf/version create mode 100644 .distro/plans/full.fmf 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/wannier90.rpmlintrc create mode 100644 .distro/wannier90.spec create mode 100644 .packit.yaml create mode 100644 test-suite/ctest.fmf create mode 100755 test-suite/ctest.sh 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/full.fmf b/.distro/plans/full.fmf new file mode 100644 index 000000000..94db25743 --- /dev/null +++ b/.distro/plans/full.fmf @@ -0,0 +1,7 @@ +summary: + Test the bundled ctests and pytest +discover+: + how: fmf + path: test-suite +execute: + how: tmt diff --git a/.distro/plans/main.fmf.dist-git b/.distro/plans/main.fmf.dist-git new file mode 100644 index 000000000..6c85efeb6 --- /dev/null +++ b/.distro/plans/main.fmf.dist-git @@ -0,0 +1,4 @@ +discover: + how: fmf + dist-git-source: true + dist-git-extract: wannier90-*/ diff --git a/.distro/plans/rpminspect.fmf b/.distro/plans/rpminspect.fmf new file mode 100644 index 000000000..59e9b248b --- /dev/null +++ b/.distro/plans/rpminspect.fmf @@ -0,0 +1,5 @@ +plan: + import: + url: https://github.com/packit/tmt-plans + ref: main + name: /plans/rpminspect 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/wannier90.rpmlintrc b/.distro/wannier90.rpmlintrc new file mode 100644 index 000000000..e69de29bb diff --git a/.distro/wannier90.spec b/.distro/wannier90.spec new file mode 100644 index 000000000..1e0327458 --- /dev/null +++ b/.distro/wannier90.spec @@ -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 diff --git a/.packit.yaml b/.packit.yaml new file mode 100644 index 000000000..5f8744d15 --- /dev/null +++ b/.packit.yaml @@ -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 diff --git a/test-suite/ctest.fmf b/test-suite/ctest.fmf new file mode 100644 index 000000000..24bb55155 --- /dev/null +++ b/test-suite/ctest.fmf @@ -0,0 +1,12 @@ +tag: [ cmake ] +require: + - cmake + - rsync + - gcc + - gcc-c++ + - gcc-fortran + - pkgconf + - git +framework: beakerlib +path: / +test: ./ctest.sh diff --git a/test-suite/ctest.sh b/test-suite/ctest.sh new file mode 100755 index 000000000..13e0ca796 --- /dev/null +++ b/test-suite/ctest.sh @@ -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