pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/R2pkg/files pkgtools/R2pkg: make R2pkg.R test...
details: https://anonhg.NetBSD.org/pkgsrc/rev/e8ab5b330122
branches: trunk
changeset: 415769:e8ab5b330122
user: rillig <rillig%pkgsrc.org@localhost>
date: Sun Oct 13 15:35:48 2019 +0000
description:
pkgtools/R2pkg: make R2pkg.R testable
Placing the code into a main function allows the tests to source the file
without any side effects.
The LC_ALL=C environment variable is necessary on NetBSD/x86_64 8.0 in
the en_US.UTF-8 locale since otherwise R dumps core in the source(...)
call, deep inside towctrans.
diffstat:
pkgtools/R2pkg/files/R2pkg.R | 27 +++++++++++++++------------
pkgtools/R2pkg/files/R2pkg.sh | 5 +++--
2 files changed, 18 insertions(+), 14 deletions(-)
diffs (61 lines):
diff -r d1c2a953034c -r e8ab5b330122 pkgtools/R2pkg/files/R2pkg.R
--- a/pkgtools/R2pkg/files/R2pkg.R Sun Oct 13 13:55:59 2019 +0000
+++ b/pkgtools/R2pkg/files/R2pkg.R Sun Oct 13 15:35:48 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: R2pkg.R,v 1.2 2019/10/13 13:28:45 rillig Exp $
+# $NetBSD: R2pkg.R,v 1.3 2019/10/13 15:35:48 rillig Exp $
#
# Copyright (c) 2014,2015,2016,2017,2018,2019
# Brook Milligan. All rights reserved.
@@ -1249,17 +1249,20 @@
write(DESCR,'DESCR')
}
-set.locale()
+main <- function()
+{
+ set.locale()
-error <- download.file(url=arg.rpkg_description_url,destfile='DESCRIPTION',quiet=arg.quiet_curl,method='curl')
-if (error)
- {
- message('ERROR: Downloading the DESCRIPTION file for ',arg.rpkg,' failed;')
- message(' perhaps the package no longer exists?')
- quit(save='no',status=error)
- }
+ error <- download.file(url=arg.rpkg_description_url,destfile='DESCRIPTION',quiet=arg.quiet_curl,method='curl')
+ if (error)
+ {
+ message('ERROR: Downloading the DESCRIPTION file for ',arg.rpkg,' failed;')
+ message(' perhaps the package no longer exists?')
+ quit(save='no',status=error)
+ }
-metadata <- read.dcf(file='DESCRIPTION', fields=c('Package','Version','Title','Description','License','Imports','Depends'))
+ metadata <- read.dcf(file='DESCRIPTION', fields=c('Package','Version','Title','Description','License','Imports','Depends'))
-create.Makefile(metadata)
-create.DESCR(metadata)
+ create.Makefile(metadata)
+ create.DESCR(metadata)
+}
diff -r d1c2a953034c -r e8ab5b330122 pkgtools/R2pkg/files/R2pkg.sh
--- a/pkgtools/R2pkg/files/R2pkg.sh Sun Oct 13 13:55:59 2019 +0000
+++ b/pkgtools/R2pkg/files/R2pkg.sh Sun Oct 13 15:35:48 2019 +0000
@@ -1,5 +1,5 @@
#!/bin/sh
-# $NetBSD: R2pkg.sh,v 1.8 2019/10/13 13:26:22 rillig Exp $
+# $NetBSD: R2pkg.sh,v 1.9 2019/10/13 15:35:48 rillig Exp $
#
# Copyright (c) 2014,2015,2016,2017,2018,2019
# Brook Milligan. All rights reserved.
@@ -192,7 +192,8 @@
MAINTAINER_EMAIL="${MAINTAINER_EMAIL}" \
RPKG_DESCRIPTION_URL="${RPKG_DESCRIPTION_URL}" \
QUIET_CURL="${QUIET_CURL}" \
- Rscript --no-save "@LIBDIR@/R2pkg.R"
+ LC_ALL="C" \
+ Rscript --no-save -e "source('@LIBDIR@/R2pkg.R'); main()"
retval=${?}
if [ ${retval} -ne 0 ]; then
echo "ERROR: making ${RPKG} package failed." 1>&2
Home |
Main Index |
Thread Index |
Old Index