From a1215039347b15ba4f63a679f01bf3ba17db53d2 Mon Sep 17 00:00:00 2001 From: Pekka Ristola Date: Sun, 8 Oct 2023 12:39:10 +0300 Subject: [PATCH] r-mvnormtest: use metadata checks Also add support for DESCRIPTION file not having a `NeedsCompilation` value at all. In this case, the `expect_needscompilation` argument for `r_pre_build` should be set to "" (empty string). --- BioArchLinux/r-mvnormtest/PKGBUILD | 20 +++++++++++--------- BioArchLinux/r-mvnormtest/lilac.py | 17 +++++++++++++++++ BioArchLinux/r-mvnormtest/lilac.yaml | 12 +++--------- lilac-extensions/lilac_r_utils.py | 8 +++++--- 4 files changed, 36 insertions(+), 21 deletions(-) create mode 100644 BioArchLinux/r-mvnormtest/lilac.py diff --git a/BioArchLinux/r-mvnormtest/PKGBUILD b/BioArchLinux/r-mvnormtest/PKGBUILD index 11b4b0493a..255179fa44 100644 --- a/BioArchLinux/r-mvnormtest/PKGBUILD +++ b/BioArchLinux/r-mvnormtest/PKGBUILD @@ -1,26 +1,28 @@ -# Maintainer: Kiri +# Maintainer: Pekka Ristola +# Contributor: Kiri _pkgname=mvnormtest _pkgver=0.1-9 pkgname=r-${_pkgname,,} -pkgver=${_pkgver//[:-]/.} +pkgver=${_pkgver//-/.} pkgrel=2 -pkgdesc='Normality test for multivariate variables' -arch=('any') +pkgdesc="Normality test for multivariate variables" +arch=(any) url="https://cran.r-project.org/package=${_pkgname}" -license=('GPL') +license=(GPL) depends=( r ) source=("https://cran.r-project.org/src/contrib/${_pkgname}_${_pkgver}.tar.gz") +md5sums=('e5960fbfc0e69797eec01c16fe74ecb7') sha256sums=('46dab6eb9e7d55b8d4054d14029613b89a308259f86ddc8952b0bf752e975dc5') build() { - R CMD INSTALL ${_pkgname}_${_pkgver}.tar.gz -l "${srcdir}" + mkdir -p build + R CMD INSTALL "$_pkgname" -l build } package() { - install -dm0755 "${pkgdir}/usr/lib/R/library" - cp -a --no-preserve=ownership "${_pkgname}" "${pkgdir}/usr/lib/R/library" + install -d "$pkgdir/usr/lib/R/library" + cp -a --no-preserve=ownership "build/$_pkgname" "$pkgdir/usr/lib/R/library" } -# vim:set ts=2 sw=2 et: diff --git a/BioArchLinux/r-mvnormtest/lilac.py b/BioArchLinux/r-mvnormtest/lilac.py new file mode 100644 index 0000000000..dc94522131 --- /dev/null +++ b/BioArchLinux/r-mvnormtest/lilac.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python3 +from lilaclib import * + +import os +import sys +sys.path.append(os.path.normpath(f'{__file__}/../../../lilac-extensions')) +from lilac_r_utils import r_pre_build + +def pre_build(): + r_pre_build( + _G, + expect_needscompilation = "", + ) + +def post_build(): + git_pkgbuild_commit() + update_aur_repo() diff --git a/BioArchLinux/r-mvnormtest/lilac.yaml b/BioArchLinux/r-mvnormtest/lilac.yaml index 108f740a38..6f42822560 100644 --- a/BioArchLinux/r-mvnormtest/lilac.yaml +++ b/BioArchLinux/r-mvnormtest/lilac.yaml @@ -1,16 +1,10 @@ build_prefix: extra-x86_64 maintainers: -- github: kiri2002 -pre_build_script: | - for line in edit_file('PKGBUILD'): - if line.startswith('_pkgver='): - line = f'_pkgver={_G.newver}' - print(line) - update_pkgver_and_pkgrel(_G.newver.replace(':', '.').replace('-', '.')) -post_build_script: | - git_pkgbuild_commit() +- github: pekkarr + email: pekkarr@protonmail.com update_on: - source: rpkgs pkgname: mvnormtest repo: cran + md5: true - alias: r diff --git a/lilac-extensions/lilac_r_utils.py b/lilac-extensions/lilac_r_utils.py index 3bad04bf90..8b5f5c1e2c 100644 --- a/lilac-extensions/lilac_r_utils.py +++ b/lilac-extensions/lilac_r_utils.py @@ -45,10 +45,10 @@ class Description: self.suggests = self._parse_deps("Suggests") self.systemrequirements = self.desc.get("SystemRequirements", None) self.license = self.desc["License"] - nc = self.desc["NeedsCompilation"] - if nc != "yes" and nc != "no": + nc = self.desc.get("NeedsCompilation", None) + if nc is not None and nc != "yes" and nc != "no": raise Exception(f"Invalid DESCRIPTION file: NeedsCompilation: {nc}") - self.needscompilation = nc == "yes" + self.needscompilation = "" if nc is None else nc == "yes" def _parse_description(self, tar: tarfile.TarFile, name: str) -> dict: """Parse the DESCRIPTION file from the source archive and return it as a dict.""" @@ -333,6 +333,8 @@ def check_arch(pkg: Pkgbuild, desc: Description, cfg: CheckConfig): if desc.needscompilation != cfg.expect_needscompilation: raise CheckFailed(f"NeedsCompilation value has changed: {desc.needscompilation}") else: + if desc.needscompilation == "": + raise CheckFailed("No NeedsCompilation value") expected = "x86_64" if desc.needscompilation else "any" if pkg.arch != [expected]: raise CheckFailed(f"Wrong arch, expected {expected}")