diff --git a/BioArchLinux/r-getoptlong/PKGBUILD b/BioArchLinux/r-getoptlong/PKGBUILD index 04440c7c34..9a1352a4cb 100644 --- a/BioArchLinux/r-getoptlong/PKGBUILD +++ b/BioArchLinux/r-getoptlong/PKGBUILD @@ -1,21 +1,25 @@ -# system requirements: Perl, Getopt::Long -# Maintainer: Guoyi Zhang +# Maintainer: Pekka Ristola +# Contributor: Guoyi Zhang _pkgname=GetoptLong _pkgver=1.0.5 pkgname=r-${_pkgname,,} -pkgver=1.0.5 +pkgver=${_pkgver//-/.} pkgrel=6 -pkgdesc='Parsing Command-Line Arguments and Simple Variable Interpolation' -arch=('any') -url="https://cran.r-project.org/package=${_pkgname}" +pkgdesc="Parsing Command-Line Arguments and Simple Variable Interpolation" +arch=(any) +url="https://cran.r-project.org/package=$_pkgname" license=('MIT') depends=( - r + perl-json + perl-json-xs + perl-yaml-syck r-crayon r-globaloptions r-rjson - perl +) +checkdepends=( + r-testthat ) optdepends=( r-knitr @@ -23,16 +27,36 @@ optdepends=( r-rmarkdown r-testthat ) -source=("https://cran.r-project.org/src/contrib/${_pkgname}_${_pkgver}.tar.gz") -sha256sums=('8c237986ed3dfb72d956ad865ef7768644eebf144675ad66140acfd1aca9d701') +source=("https://cran.r-project.org/src/contrib/${_pkgname}_${_pkgver}.tar.gz" + "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() { - 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() { - install -dm0755 "${pkgdir}/usr/lib/R/library" - cp -a --no-preserve=ownership "${_pkgname}" "${pkgdir}/usr/lib/R/library" - install -Dm644 "${_pkgname}/LICENSE" -t "${pkgdir}/usr/share/licenses/${pkgname}" + install -d "$pkgdir/usr/lib/R/library" + cp -a --no-preserve=ownership "build/$_pkgname" "$pkgdir/usr/lib/R/library" + + 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: diff --git a/BioArchLinux/r-getoptlong/fix-tests.patch b/BioArchLinux/r-getoptlong/fix-tests.patch new file mode 100644 index 0000000000..bfedd4cb73 --- /dev/null +++ b/BioArchLinux/r-getoptlong/fix-tests.patch @@ -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 diff --git a/BioArchLinux/r-getoptlong/lilac.py b/BioArchLinux/r-getoptlong/lilac.py index bd219c037c..cfa9a4bee1 100644 --- a/BioArchLinux/r-getoptlong/lilac.py +++ b/BioArchLinux/r-getoptlong/lilac.py @@ -1,12 +1,16 @@ #!/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(): - 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('-', '.')) + r_pre_build( + _G, + expect_systemrequirements = "Perl, Getopt::Long", + ) def post_build(): git_pkgbuild_commit() diff --git a/BioArchLinux/r-getoptlong/lilac.yaml b/BioArchLinux/r-getoptlong/lilac.yaml index 2a4f0cc856..8af2b95034 100644 --- a/BioArchLinux/r-getoptlong/lilac.yaml +++ b/BioArchLinux/r-getoptlong/lilac.yaml @@ -1,13 +1,16 @@ build_prefix: extra-x86_64 maintainers: -- github: starsareintherose - email: kuoi@bioarchlinux.org +- github: pekkarr + email: pekkarr@protonmail.com repo_depends: - r-crayon - r-globaloptions - r-rjson +repo_makedepends: +- r-testthat update_on: -- regex: GetoptLong_([\d._-]+).tar.gz - source: regex - url: https://cran.r-project.org/package=GetoptLong +- source: rpkgs + pkgname: GetoptLong + repo: cran + md5: true - alias: r