r-getoptlong: use metadata checks

This commit is contained in:
Pekka Ristola 2024-04-11 18:47:19 +03:00
parent c65dbdadf7
commit ced4b2314e
No known key found for this signature in database
GPG key ID: 2C20BE716E05213E
4 changed files with 69 additions and 25 deletions

View file

@ -1,21 +1,25 @@
# system requirements: Perl, Getopt::Long # Maintainer: Pekka Ristola <pekkarr [at] protonmail [dot] com>
# Maintainer: Guoyi Zhang <guoyizhang at malacology dot net> # Contributor: Guoyi Zhang <guoyizhang at malacology dot net>
_pkgname=GetoptLong _pkgname=GetoptLong
_pkgver=1.0.5 _pkgver=1.0.5
pkgname=r-${_pkgname,,} pkgname=r-${_pkgname,,}
pkgver=1.0.5 pkgver=${_pkgver//-/.}
pkgrel=6 pkgrel=6
pkgdesc='Parsing Command-Line Arguments and Simple Variable Interpolation' pkgdesc="Parsing Command-Line Arguments and Simple Variable Interpolation"
arch=('any') arch=(any)
url="https://cran.r-project.org/package=${_pkgname}" url="https://cran.r-project.org/package=$_pkgname"
license=('MIT') license=('MIT')
depends=( depends=(
r perl-json
perl-json-xs
perl-yaml-syck
r-crayon r-crayon
r-globaloptions r-globaloptions
r-rjson r-rjson
perl )
checkdepends=(
r-testthat
) )
optdepends=( optdepends=(
r-knitr r-knitr
@ -23,16 +27,36 @@ optdepends=(
r-rmarkdown r-rmarkdown
r-testthat r-testthat
) )
source=("https://cran.r-project.org/src/contrib/${_pkgname}_${_pkgver}.tar.gz") source=("https://cran.r-project.org/src/contrib/${_pkgname}_${_pkgver}.tar.gz"
sha256sums=('8c237986ed3dfb72d956ad865ef7768644eebf144675ad66140acfd1aca9d701') "fix-tests.patch")
md5sums=('859f5b437ccf1eda9fe0e99eb80b2def'
'2973d9109d39fe8fb5f1d3b93b7cb481')
b2sums=('e33d5c05f4a597144881cefdfcc1c96698136de1559797ac58a0e4f16cf92498e41407d3675fdebafef205379d17fba76f3354c25bbe509444c0afd0dc4e6b59'
'fa9093742756bbc717c4702230155ff18358d209aa04bdce99940f717e19acdfe64bbfd5a46c7f9bda6ca767a376d5b9388c8c6029352ed27e2c539a4387e22d')
prepare() {
# fix tests
patch -Np1 -i fix-tests.patch
# use system perl modules
cd "$_pkgname/inst/extdata"
rm -r perl_lib
}
build() { build() {
R CMD INSTALL ${_pkgname}_${_pkgver}.tar.gz -l "${srcdir}" mkdir build
R CMD INSTALL -l build "$_pkgname"
}
check() {
cd "$_pkgname/tests"
R_LIBS="$srcdir/build" NOT_CRAN=true GETOPTLONG_TESTING=true Rscript --vanilla test-all.R
} }
package() { package() {
install -dm0755 "${pkgdir}/usr/lib/R/library" install -d "$pkgdir/usr/lib/R/library"
cp -a --no-preserve=ownership "${_pkgname}" "${pkgdir}/usr/lib/R/library" cp -a --no-preserve=ownership "build/$_pkgname" "$pkgdir/usr/lib/R/library"
install -Dm644 "${_pkgname}/LICENSE" -t "${pkgdir}/usr/share/licenses/${pkgname}"
install -d "$pkgdir/usr/share/licenses/$pkgname"
ln -s "/usr/lib/R/library/$_pkgname/LICENSE" "$pkgdir/usr/share/licenses/$pkgname"
} }
# vim:set ts=2 sw=2 et:

View file

@ -0,0 +1,13 @@
diff --git a/GetoptLong/R/get_options.R b/GetoptLong/R/get_options.R
index a01c65e..97a80ef 100644
--- a/GetoptLong/R/get_options.R
+++ b/GetoptLong/R/get_options.R
@@ -45,7 +45,7 @@ GetoptLong = function(..., help_head = NULL, help_foot = NULL, envir = parent.fr
argv_str = NULL, template_control = list(),
help_style = GetoptLong.options$help_style) {
- if(is.null(get_scriptname())) {
+ if(is.null(get_scriptname()) || identical(Sys.getenv("GETOPTLONG_TESTING"), "true")) {
IS_UNDER_COMMAND_LINE = FALSE
} else {
IS_UNDER_COMMAND_LINE = TRUE

View file

@ -1,12 +1,16 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from lilaclib import * 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(): def pre_build():
for line in edit_file('PKGBUILD'): r_pre_build(
if line.startswith('_pkgver='): _G,
line = f'_pkgver={_G.newver}' expect_systemrequirements = "Perl, Getopt::Long",
print(line) )
update_pkgver_and_pkgrel(_G.newver.replace(':', '.').replace('-', '.'))
def post_build(): def post_build():
git_pkgbuild_commit() git_pkgbuild_commit()

View file

@ -1,13 +1,16 @@
build_prefix: extra-x86_64 build_prefix: extra-x86_64
maintainers: maintainers:
- github: starsareintherose - github: pekkarr
email: kuoi@bioarchlinux.org email: pekkarr@protonmail.com
repo_depends: repo_depends:
- r-crayon - r-crayon
- r-globaloptions - r-globaloptions
- r-rjson - r-rjson
repo_makedepends:
- r-testthat
update_on: update_on:
- regex: GetoptLong_([\d._-]+).tar.gz - source: rpkgs
source: regex pkgname: GetoptLong
url: https://cran.r-project.org/package=GetoptLong repo: cran
md5: true
- alias: r - alias: r