pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/R2pkg Update to v0.3.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/f65fde68d33b
branches:  trunk
changeset: 365513:f65fde68d33b
user:      brook <brook%pkgsrc.org@localhost>
date:      Tue Jul 18 17:24:31 2017 +0000

description:
Update to v0.3.

- Add recursive handling of dependencies.
- Simplify updating pre-existing R packages.
- Improve handling of packages that conflict with base R packages.

diffstat:

 pkgtools/R2pkg/Makefile       |    6 +-
 pkgtools/R2pkg/files/R2pkg.8  |   79 ++++++++--
 pkgtools/R2pkg/files/R2pkg.sh |  328 +++++++++++++++++++++++++++++++----------
 3 files changed, 316 insertions(+), 97 deletions(-)

diffs (truncated from 648 to 300 lines):

diff -r 461d04b583e2 -r f65fde68d33b pkgtools/R2pkg/Makefile
--- a/pkgtools/R2pkg/Makefile   Tue Jul 18 15:19:05 2017 +0000
+++ b/pkgtools/R2pkg/Makefile   Tue Jul 18 17:24:31 2017 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.1 2015/04/25 22:06:34 brook Exp $
+# $NetBSD: Makefile,v 1.2 2017/07/18 17:24:31 brook Exp $
 #
 
-VERS=          0.2
+VERS=          0.3
 PKGNAME=       R2pkg-${VERS}
 CATEGORIES=    pkgtools
 
@@ -15,6 +15,8 @@
 USE_LANGUAGES=         # none
 AUTO_MKDIRS=           yes
 
+DEPENDS+=              curl>=7.52.1:../../www/curl
+
 SUBST_CLASSES+=                version
 SUBST_STAGE.version=   pre-configure
 SUBST_MESSAGE.version= Substituting version in R2pkg.sh.
diff -r 461d04b583e2 -r f65fde68d33b pkgtools/R2pkg/files/R2pkg.8
--- a/pkgtools/R2pkg/files/R2pkg.8      Tue Jul 18 15:19:05 2017 +0000
+++ b/pkgtools/R2pkg/files/R2pkg.8      Tue Jul 18 17:24:31 2017 +0000
@@ -1,6 +1,6 @@
-.\"    $NetBSD: R2pkg.8,v 1.1 2015/04/25 22:06:34 brook Exp $
+.\"    $NetBSD: R2pkg.8,v 1.2 2017/07/18 17:24:32 brook Exp $
 .\"
-.\" Copyright (c) 2014,2015
+.\" Copyright (c) 2014,2015,2016,2017
 .\"    Brook Milligan.  All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -28,7 +28,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"
-.Dd April 25, 2015
+.Dd February 23, 2017
 .Dt R2pkg 8
 .Os
 .Sh NAME
@@ -36,8 +36,9 @@
 .Nd create a pkgsrc package for an R package
 .Sh SYNOPSIS
 .Nm
-.Op Fl DVehqv
+.Op Fl DVehqruv
 .Op Fl E Ar editor
+.Op Fl R Ar dependency_file
 .Op Ar package
 .Sh DESCRIPTION
 .Nm
@@ -47,9 +48,11 @@
 .Xr pkgsrc 7
 package in the current directory.  The generated package includes a
 .Pa Makefile
-and a mostly complete set of files to get the package going.  However, the files should be reviewed and perhaps adjusted manually after 
+and a mostly complete set of files to get the package going.  However,
+the files should be reviewed and perhaps adjusted manually after
 .Nm
-has finished its job.  To help with this, the original versions of files created by
+has finished its job.  To help with this, the original versions of
+files created by
 .Nm
 are preserved for reference.
 .Pp
@@ -59,7 +62,8 @@
 .Pp
 The
 .Pa Makefile
-contains all of the variables required for an R package, with information being taken from the package's
+contains all of the variables required for an R package, with
+information being taken from the package's
 .Pa DESCRIPTION
 file on CRAN, which is automatically fetched by
 .Nm .
@@ -73,8 +77,6 @@
 .Nm
 fetches the package and computes its checksum via the
 .Ic makesum
-target.  Then the package is extracted via the
-.Ic extract
 target.
 .Pp
 If the user does not supply the
@@ -88,13 +90,22 @@
 .It Fl D
 Write the package's description into
 .Pa DESCRIPTION .
-This may be useful for verifying the information obtained from CRAN.  However, this file must be removed as it is not part of a
+This may be useful for verifying the information obtained from CRAN.
+However, this file must be removed as it is not part of a
 .Xr pkgsrc 7
 package.
 .It Fl E Ar editor
 Use
 .Ar editor 
 instead of the user's default editor.
+.It Fl R Ar dependency_file
+Process dependency packages recursively using
+.Pa dependency_file
+to record dependency information.  This option is intended for
+internal use only to implement recursion over dependencies.  Instead,
+the
+.Fl r
+option should be used to select recursion.
 .It Fl V
 Print the version.
 .It Fl e
@@ -103,8 +114,39 @@
 Produce a short help message.
 .It Fl q
 Do not produce status messages along the way.
+.It Fl r
+Process dependency packages recursively.  A
+.Pa depends
+file is created that lists the dependencies in
+.Xr tsort 1
+order.  This is likely the best order for testing the resulting
+dependency packages.  In particular, a useful strategy for creating
+packages recursively is to (i) run
+.Nm
+with the
+.Fl r
+option, (ii) fix all the leaf packages, (iii) rerun
+.Nm
+with the
+.Fl r
+option, and (iv) continue until all packages are created.  Repeating
+runs of
+.Nm
+once the leaf dependencies are moved into the correct categories will
+allow the program to capture the correct dependencies in each
+.Pa Makefile .
+.It Fl u
+Update the
+.Xr pkgsrc 7
+package.
+.Nm
+must be run in an R package directory, which is assumed to be named as
+.Pa R-package .
+The name of the package to be updated will be taken from the directory
+name and need not be given on the command line.
 .It Fl v
-Generate verbose output.  This may be repeated to increase the verbosity.
+Generate verbose output.  This may be repeated to increase the
+verbosity.
 .El
 .Sh ENVIRONMENT
 The following environment variables affect the execution of
@@ -129,7 +171,8 @@
 .Dl mkdir R-foo
 .Dl cd R-foo
 .Dl R2pkg foo
-Remember to test the resulting package and remove any extra files created by
+Remember to test the resulting package and remove any extra files
+created by
 .Nm .
 .Sh BUGS
 .Nm
@@ -137,10 +180,14 @@
 However, the resulting files must be reviewed and possibly edited by
 hand.  Although dependencies are included in the generated
 .Pa Makefile ,
-they are only comments; no attempt is made to find corresponding
-packages within 
-.Xr pkgsrc 7 .
-As a consequence, the category of dependencies is also not determined.
+they are not fully analyzed and likely have incorrect category
+information.  Packages created recursively for dependencies are placed
+in a newly created, nonstandard
+.Pa pkgsrc/R
+category directory and must be moved to appropriate category
+directories within
+.Xr pkgsrc 7
+and checked for correctness.
 .Sh SEE ALSO
 .Xr pkgsrc 7
 .Sh AUTHORS
diff -r 461d04b583e2 -r f65fde68d33b pkgtools/R2pkg/files/R2pkg.sh
--- a/pkgtools/R2pkg/files/R2pkg.sh     Tue Jul 18 15:19:05 2017 +0000
+++ b/pkgtools/R2pkg/files/R2pkg.sh     Tue Jul 18 17:24:31 2017 +0000
@@ -1,7 +1,7 @@
 #!/bin/sh
 # R2pkg
 #
-# Copyright (c) 2014,2015
+# Copyright (c) 2014,2015,2016,2017
 #      Brook Milligan.  All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -34,34 +34,43 @@
 NAME="R2pkg"
 VERS="@VERS@"
 
-USAGE="${NAME} [-DVehqv] [-E editor] [package] -- create an R package for pkgsrc"
+USAGE="${NAME} [-DVehqrv] [-E editor] [-R dependency_file] [package] -- create an R package for pkgsrc"
 
 : ${CRAN_URL:=ftp://cran.r-project.org}
 : ${PKGEDITOR:=${EDITOR:=vi}}
 
 # Substituted by pkgsrc at pre-configure time.
 MAKE=@MAKE@
-ECHO=echo
 EDIT=1
 QUIET=0
+RECURSIVE=0
+TOP_LEVEL=1
+UPDATE=0
 VERBOSE=0
 
-while getopts DE:Vehqv f
+DESCRIPTION_CONNECTION=connection
+
+while getopts DE:R:Vehqruv f
 do
     case $f in
-       D) DESCRIPTION=yes;;
-       E) PKGEDITOR=${OPTARG};;
+       D) DESCRIPTION=yes; DESCRIPTION_CONNECTION="'DESCRIPTION'"; ARGS="${ARGS} -D";;
+       E) PKGEDITOR=${OPTARG}; ARGS="${ARGS} -E ${PKGEDITOR}";;
+       R) DEPENDENCY_LIST=${OPTARG}; RECURSIVE=1; TOP_LEVEL=0; ARGS="${ARGS} -R ${DEPENDENCY_LIST}";;
        V) echo "${NAME} v${VERS}"; exit 0;;
-       e) EDIT=0;;
+       e) EDIT=0; ARGS="${ARGS} -e";;
        h) echo ${USAGE}; exit 0;;
-       q) ECHO=":"; QUIET=1;;
-       v) VERBOSE=$((${VERBOSE}+1));;
+       q) QUIET=1; ARGS="${ARGS} -q";;
+       r) RECURSIVE=1; RECURSIVE_MESSAGE=1; ARGS="${ARGS} -r";;
+       u) UPDATE=1;;
+       v) VERBOSE=$((${VERBOSE}+1)); ARGS="${ARGS} -v";;
         \?) echo ${USAGE}; exit 1;;
     esac
 done
 shift `expr ${OPTIND} - 1`
 
-if [ ${#} -eq 0 ]; then
+if [ ${UPDATE} -eq 1 ]; then
+    RPKG=$(echo $(basename $(pwd)) | sed -e 's/^R-//');
+elif [ ${#} -eq 0 ]; then
     read -p "package: " RPKG TAIL
     if [ "X${TAIL}" != "X" ]; then
        echo "Error: multiple package names given."
@@ -75,15 +84,52 @@
     exit 1
 fi
 
-if [ ${VERBOSE} -eq 0 ]; then
-    STDOUT=">/dev/null 2>&1"
-    STDOUT2=">/dev/null 2>&1"
+R_FILE=${TMPDIR}/R2pkg.$$.R
+
+if [ ${TOP_LEVEL} -eq 1 ]; then
+    BANNER_MSG="===> Creating R package: R-${RPKG}"
+else
+    BANNER_MSG="===> Creating dependency package: R-${RPKG}"
+fi
+if [ "X${DEPENDENCY_LIST}" = "X" ]; then
+    DEPENDENCY_LIST=${TMPDIR}/R2pkg.depends.$$
+    ARGS="${ARGS} -R ${DEPENDENCY_LIST}"
+fi
+if [ ${QUIET} -eq 1 ]; then
+    STDOUT_MAKESUM=">/dev/null"
+    STDOUT_EXTRACT=">/dev/null"
+    QUIET_CURL="TRUE"
+    ECHO_BANNER=":"
+    ECHO_DONE=":"
+    ECHO_FETCH=":"
+    ECHO_EXTRACT=":"
+    if [ ${TOP_LEVEL} -eq 0 ]; then
+       ECHO=":"
+    fi
+elif [ ${VERBOSE} -eq 0 ]; then
+    STDOUT_MAKESUM=">/dev/null"
+    STDOUT_EXTRACT=">/dev/null"
+    QUIET_CURL="TRUE"
+    ECHO_BANNER="echo"
+    ECHO_DONE=":"
+    ECHO_FETCH=":"
+    ECHO_EXTRACT="echo"
 elif [ ${VERBOSE} -eq 1 ]; then
-    STDOUT=""
-    STDOUT2=">/dev/null 2>&1"
+    STDOUT_MAKESUM=">/dev/null"
+    STDOUT_EXTRACT=">/dev/null"
+    QUIET_CURL="TRUE"
+    ECHO_BANNER="echo"
+    ECHO_DONE="echo"
+    ECHO_FETCH="echo"
+    ECHO_EXTRACT="echo"
 else
-    STDOUT=""
-    STDOUT2=""
+    STDOUT_MAKESUM=""
+    STDOUT_EXTRACT=""
+    QUIET_CURL="FALSE"
+    ECHO_BANNER="echo"



Home | Main Index | Thread Index | Old Index