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 version 0.6.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/0786b43ddbc2
branches:  trunk
changeset: 399385:0786b43ddbc2
user:      brook <brook%pkgsrc.org@localhost>
date:      Thu Aug 08 20:14:26 2019 +0000

description:
Update to version 0.6.

Changes since version 0.5:

* Improve the canonical format of an R package Makefile:

  - Place R_PKGNAME, R_PKGVER, and CATEGORIES in the first stanza.
  - Simplify CATEGORIES by defining common ones in Makefile.extension.
  - Use the default value of HOMEPAGE defined in Makefile.extension.

* Annotate generated comments with [R2pkg] to make them easier to find.

diffstat:

 pkgtools/R2pkg/Makefile       |   4 +-
 pkgtools/R2pkg/files/R2pkg.sh |  90 +++++++++++++++++++++++++++++++-----------
 pkgtools/R2pkg/files/RELEASE  |  13 +++++-
 3 files changed, 79 insertions(+), 28 deletions(-)

diffs (280 lines):

diff -r c21362d2919d -r 0786b43ddbc2 pkgtools/R2pkg/Makefile
--- a/pkgtools/R2pkg/Makefile   Thu Aug 08 19:53:36 2019 +0000
+++ b/pkgtools/R2pkg/Makefile   Thu Aug 08 20:14:26 2019 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.4 2019/08/01 13:11:08 brook Exp $
+# $NetBSD: Makefile,v 1.5 2019/08/08 20:14:26 brook Exp $
 #
 
-VERS=          0.5
+VERS=          0.6
 PKGNAME=       R2pkg-${VERS}
 CATEGORIES=    pkgtools
 
diff -r c21362d2919d -r 0786b43ddbc2 pkgtools/R2pkg/files/R2pkg.sh
--- a/pkgtools/R2pkg/files/R2pkg.sh     Thu Aug 08 19:53:36 2019 +0000
+++ b/pkgtools/R2pkg/files/R2pkg.sh     Thu Aug 08 20:14:26 2019 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $NetBSD: R2pkg.sh,v 1.5 2019/08/01 13:11:08 brook Exp $
+# $NetBSD: R2pkg.sh,v 1.6 2019/08/08 20:14:27 brook Exp $
 #
 # Copyright (c) 2014,2015,2016,2017,2018,2019
 #      Brook Milligan.  All rights reserved.
@@ -198,31 +198,40 @@
 pkg.vers <- function(s) gsub('_','.',s)
 field <- function(key,value) paste(key,'=\t',value,sep='')
 
-base.packages <- c(
+# The list of "recommended packages which are to be included in all
+# binary distributions of R." (R FAQ 5.1.2 2018-10-18)
+#
+base.packages.FAQ.5.1.2 <- c(
+  'KernSmooth',
   'MASS',
   'Matrix',
-  'R',
-  'Rcpp',
   'boot',
   'class',
   'cluster',
   'codetools',
   'foreign',
-  'grDevices',
-  'graphics',
-  'grid',
   'lattice',
-  'methods',
   'mgcv',
   'nlme',
   'nnet',
+  'rpart',
+  'spatial',
+  'survival')
+
+# Other R packages that appear in dependency lists but are included in
+# the R package.
+#
+base.packages.other <- c(
+  'grDevices',
+  'graphics',
+  'grid',
+  'methods',
   'parallel',
-  'rpart',
   'splines',
   'stats',
-  'survival',
   'tools',
   'utils')
+base.packages <- c('R',base.packages.FAQ.5.1.2,base.packages.other)
 
 licenses <- list()
 licenses[['ACM']]                                    <- 'acm-license'
@@ -255,6 +264,7 @@
 licenses[['LGPL-2']]                                 <- 'gnu-lgpl-v2'
 licenses[['LGPL-2.1']]                               <- 'gnu-lgpl-v2.1'
 licenses[['LGPL-3']]                                 <- 'gnu-lgpl-v3'
+licenses[['LGPL-3 + file LICENSE']]                  <- 'gnu-lgpl-v3   # + file LICENSE'
 licenses[['LGPL-2 | LGPL-3']]                        <- 'gnu-lgpl-v2 OR gnu-lgpl-v3'
 licenses[['LGPL (>= 2)']]                            <- 'gnu-lgpl-v2 OR gnu-lgpl-v2.1 OR gnu-lgpl-v3'
 licenses[['LUCENT']]                                 <- 'lucent'
@@ -584,7 +594,7 @@
   license <- pkgsrc.license(s)
   old.license <- read.file.as.value('LICENSE')
   if (old.license != '' && old.license != license)
-    license <- paste0(license,'        # previously: ',old.license)
+    license <- paste0(license,'        # [R2pkg] previously: ',old.license)
   license
 }
 
@@ -671,7 +681,7 @@
   fields
 }
 
-categories <- function() paste(basename(dirname(getwd())),'R')
+categories <- function() basename(dirname(getwd()))
 description <- function(s) strwrap(s,width=71)
 
 filter.imports <- function(s)
@@ -933,7 +943,6 @@
   RCSID             <- '# \$NetBSD\$'
   CATEGORIES        <- makefile.field('CATEGORIES',categories())
   MAINTAINER        <- makefile.field('MAINTAINER',maintainer('${MAINTAINER_EMAIL}'))
-  HOMEPAGE          <- makefile.field('HOMEPAGE','\${R_HOMEPAGE_BASE}/${RPKG}/')
   COMMENT           <- makefile.field('COMMENT',comment(metadata[3]))
   LICENSE           <- makefile.field('LICENSE',license(metadata[5]))
   R_PKGNAME         <- makefile.field('R_PKGNAME',package(metadata[1]))
@@ -948,16 +957,14 @@
   Makefile <- list()
   Makefile <- append(Makefile,RCSID)
   Makefile <- append(Makefile,'')
+  Makefile <- append(Makefile,R_PKGNAME)
+  Makefile <- append(Makefile,R_PKGVER)
   Makefile <- append(Makefile,CATEGORIES)
   Makefile <- append(Makefile,'')
   Makefile <- append(Makefile,MAINTAINER)
-  Makefile <- append(Makefile,HOMEPAGE)
   Makefile <- append(Makefile,COMMENT)
   Makefile <- append(Makefile,LICENSE)
   Makefile <- append(Makefile,'')
-  Makefile <- append(Makefile,R_PKGNAME)
-  Makefile <- append(Makefile,R_PKGVER)
-  Makefile <- append(Makefile,'')
   Makefile <- append(Makefile,DEPENDS)
   Makefile <- append(Makefile,USE_LANGUAGES)
   Makefile <- append(Makefile,INCLUDE.R)
@@ -1003,7 +1010,8 @@
   directory <- basename(dirname(getwd()))
   categories <- unlist(element(df,'CATEGORIES','old_value'))
   categories <- unlist(strsplit(categories,'[[:blank:]]+'))
-  categories <- c(directory,categories,'R')
+  categories <- c(directory,categories)
+  categories <- categories[ categories != 'R' ]
   if (directory != 'wip')
     categories <- categories[ categories != 'wip' ]
   categories <- categories[!duplicated(categories)]
@@ -1025,7 +1033,7 @@
   new.comment <- element(df,'COMMENT','new_value')
   comment <- old.comment
   if (!weakly.equals(old.comment,new.comment))
-    comment <- paste0(comment,'        # updated to: ',new.comment)
+    comment <- paste0(comment,'        # [R2pkg] updated to: ',new.comment)
   comment
 }
 
@@ -1057,23 +1065,23 @@
         }
       else
         {
-          license <- paste0(new_license,'      # previously: ',old_license)
+          license <- paste0(new_license,'      # [R2pkg] previously: ',old_license)
           todo <- old_todo
         }
     }
   else if (license.in.pkgsrc(old_license) && !license.in.pkgsrc(new_license))
     {
-      license <- paste0(old_license,'  # updated to: ',new_license)
+      license <- paste0(old_license,'  # [R2pkg] updated to: ',new_license)
       todo <- '# TODO: '
     }
   else if (!license.in.pkgsrc(old_license) && license.in.pkgsrc(new_license))
     {
-      license <- paste0(new_license,'  # previously: ',old_license)
+      license <- paste0(new_license,'  # [R2pkg] previously: ',old_license)
       todo <- ''
     }
   else if (!license.in.pkgsrc(old_license) && !license.in.pkgsrc(new_license))
     {
-      license <- paste0(new_license,'  # previously: ',old_license)
+      license <- paste0(new_license,'  # [R2pkg] previously: ',old_license)
       todo <- '# TODO: '
     }
 
@@ -1160,7 +1168,7 @@
   pkgver <- sub('^.+_','',value)
   PKGNAME <- paste0('R_PKGNAME=',pkgname)
   PKGVER <- paste0('R_PKGVER=',pkgver)
-  comment <- paste0('  # XXX -- replace this line with ',PKGNAME,' and ',PKGVER,' as third stanza (and rerun R2pkg)')
+  comment <- paste0('  # [R2pkg] replace this line with ',PKGNAME,' and ',PKGVER,' as first stanza')
   df\$new_line[match] <- paste0(line,comment)
   df
 }
@@ -1178,6 +1186,13 @@
   df
 }
 
+remove.homepage.from.Makefile <- function(df)
+{
+  match <- grepl('^[[:blank:]]*HOMEPAGE',df\$new_line)
+  df <- df[!match,]
+  df
+}
+
 remove.buildlink.abi.depends.from.Makefile <- function(df)
 {
   match <- grepl('^[[:blank:]]*BUILDLINK_ABI_DEPENDS',df\$new_line)
@@ -1195,11 +1210,32 @@
 remove.lines.from.Makefile <- function(df)
 {
   df <- remove.master.sites.from.Makefile(df)
+  df <- remove.homepage.from.Makefile(df)
   df <- remove.buildlink.abi.depends.from.Makefile(df)
   df <- remove.buildlink.api.depends.from.Makefile(df)
   df
 }
 
+reassign.order <- function(df)
+{
+  # message('===> reassign.order():')
+  # str(df)
+  # print(df)
+
+  r_pkgname.order <- element(df,'R_PKGNAME','order')
+  categories.order <- element(df,'CATEGORIES','order')
+  if (r_pkgname.order > categories.order)
+    {
+      r_pkgname.index <- df\$key == 'R_PKGNAME'
+      r_pkgname.index[ is.na(r_pkgname.index) ] <- FALSE
+      r_pkgver.index <- df\$key == 'R_PKGVER'
+      r_pkgver.index[ is.na(r_pkgver.index) ] <- FALSE
+      df[r_pkgname.index,'order'] <- categories.order - 0.2
+      df[r_pkgver.index,'order'] <- categories.order - 0.1
+    }
+  df
+}
+
 conflicts <- function(pkg)
 {
   conflict <- paste0('R>=',R_version())
@@ -1214,7 +1250,7 @@
 
 conflicts.order <- function(df)
 {
-  order <- element(df,'R_PKGNAME','order')
+  order <- element(df,'COMMENT','order')
   order
 }
 
@@ -1322,6 +1358,7 @@
   df <- update.Makefile.with.new.line(df)
   df <- annotate.Makefile(df)
   df <- remove.lines.from.Makefile(df)
+  df <- reassign.order(df)
 
   df.conflicts <- make.df.conflicts(df,metadata)
   df.depends <- make.df.depends(df,DEPENDS)
@@ -1442,6 +1479,9 @@
     if [ -f work/*/COPYING ]; then
        cp work/*/COPYING .
     fi
+    if [ -f work/*/COPYING.lib ]; then
+       cp work/*/COPYING.lib .
+    fi
 }
 
 cleanup_DESCR ()
diff -r c21362d2919d -r 0786b43ddbc2 pkgtools/R2pkg/files/RELEASE
--- a/pkgtools/R2pkg/files/RELEASE      Thu Aug 08 19:53:36 2019 +0000
+++ b/pkgtools/R2pkg/files/RELEASE      Thu Aug 08 20:14:26 2019 +0000
@@ -1,4 +1,4 @@
-$NetBSD: RELEASE,v 1.2 2019/08/01 13:11:08 brook Exp $
+$NetBSD: RELEASE,v 1.3 2019/08/08 20:14:27 brook Exp $
 
 RELEASE
 =======
@@ -42,3 +42,14 @@
 
 * Improve support for recursion.
 
+R2pkg v.0.6 (2019-08-08)
+------------------------
+
+* Improve the canonical format of an R package Makefile:
+
+  - Place R_PKGNAME, R_PKGVER, and CATEGORIES in the first stanza.
+  - Simplify CATEGORIES by defining common ones in Makefile.extension.
+  - Use the default value of HOMEPAGE defined in Makefile.extension.
+
+* Annotate generated comments with [R2pkg] to make them easier to find.
+



Home | Main Index | Thread Index | Old Index