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).
This commit is contained in:
Pekka Ristola 2023-10-08 12:39:10 +03:00
parent d7f79a450d
commit a121503934
No known key found for this signature in database
GPG key ID: 2C20BE716E05213E
4 changed files with 36 additions and 21 deletions

View file

@ -1,26 +1,28 @@
# Maintainer: Kiri <kiri@vern.cc>
# Maintainer: Pekka Ristola <pekkarr [at] protonmail [dot] com>
# Contributor: Kiri <kiri@vern.cc>
_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:

View file

@ -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()

View file

@ -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

View file

@ -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}")