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: refactoring



details:   https://anonhg.NetBSD.org/pkgsrc/rev/c6e0c9947c07
branches:  trunk
changeset: 403034:c6e0c9947c07
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sat Oct 19 21:32:02 2019 +0000

description:
pkgtools/R2pkg: refactoring

diffstat:

 pkgtools/R2pkg/files/R2pkg.R      |  21 +++------------------
 pkgtools/R2pkg/files/R2pkg_test.R |  11 +----------
 2 files changed, 4 insertions(+), 28 deletions(-)

diffs (102 lines):

diff -r 63da96fac059 -r c6e0c9947c07 pkgtools/R2pkg/files/R2pkg.R
--- a/pkgtools/R2pkg/files/R2pkg.R      Sat Oct 19 21:20:38 2019 +0000
+++ b/pkgtools/R2pkg/files/R2pkg.R      Sat Oct 19 21:32:02 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: R2pkg.R,v 1.24 2019/10/19 21:12:18 rillig Exp $
+# $NetBSD: R2pkg.R,v 1.25 2019/10/19 21:32:02 rillig Exp $
 #
 # Copyright (c) 2014,2015,2016,2017,2018,2019
 #      Brook Milligan.  All rights reserved.
@@ -532,12 +532,6 @@
 use_languages <- function(imps, deps)
   if (find.Rcpp(imps, deps)) 'c c++' else '# none'
 
-copy.description <- function(connection)
-{
-  description <- readLines(connection)
-  writeLines(description,con='DESCRIPTION')
-}
-
 write.Makefile <- function(orig_mklines, metadata)
 {
   maintainer    <- mklines.get_value(orig_mklines, 'MAINTAINER', arg.maintainer_email)
@@ -649,8 +643,6 @@
   df
 }
 
-make.r_pkgver <- function(df) element(df,'R_PKGVER','new_value')
-
 find.order <- function(df,key,field)
 {
   x <- df[,key]
@@ -681,7 +673,7 @@
   df$value[df$key == 'CATEGORIES'] <- make.categories(df)
   df$value[df$key == 'MAINTAINER'] <- make.maintainer(df)
   df$value[df$key == 'COMMENT'] <- make.comment(df)
-  df$value[df$key == 'R_PKGVER'] <- make.r_pkgver(df)
+  df$value[df$key == 'R_PKGVER'] <- element(df, 'R_PKGVER', 'new_value')
   df
 }
 
@@ -747,12 +739,6 @@
   conflicts
 }
 
-conflicts.order <- function(df)
-{
-  order <- element(df,'COMMENT','order')
-  order
-}
-
 make.df.conflicts <- function(df,metadata)
 {
   df.conflicts <- data.frame()
@@ -760,8 +746,7 @@
   if (!conflicts.exist)
     {
       c <- conflicts(metadata$Package)
-      order <- conflicts.order(df)
-      order <- order + 2.5
+      order <- element(df, 'COMMENT', 'order') + 2.5
       i <- 0
       for (conflict in c)
         {
diff -r 63da96fac059 -r c6e0c9947c07 pkgtools/R2pkg/files/R2pkg_test.R
--- a/pkgtools/R2pkg/files/R2pkg_test.R Sat Oct 19 21:20:38 2019 +0000
+++ b/pkgtools/R2pkg/files/R2pkg_test.R Sat Oct 19 21:32:02 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: R2pkg_test.R,v 1.19 2019/10/19 21:12:18 rillig Exp $
+# $NetBSD: R2pkg_test.R,v 1.20 2019/10/19 21:32:02 rillig Exp $
 #
 # Copyright (c) 2019
 #      Roland Illig.  All rights reserved.
@@ -576,9 +576,6 @@
     expect_equal(languages, 'c c++')
 })
 
-# test_that('copy.description', {
-# })
-
 test_that('write.Makefile', {
     tmpdir <- paste(tempdir(), 'category', 'pkgdir', sep = '/')
     dir.create(tmpdir, recursive = TRUE)
@@ -701,9 +698,6 @@
     expect_equal(updated$todo, '# TODO: ')
 })
 
-# test_that('make.r_pkgver', {
-# })
-
 test_that('find.order', {
     mklines <- make_mklines(
         'CATEGORIES=',
@@ -877,9 +871,6 @@
         list('CONFLICTS=\tR>=3.6.1', ''))
 })
 
-# test_that('conflicts.order', {
-# })
-
 # test_that('make.df.conflicts', {
 # })
 



Home | Main Index | Thread Index | Old Index