| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: R2pkg.R,v 1.7 2019/10/13 19:34:13 rillig Exp $ | | 1 | # $NetBSD: R2pkg.R,v 1.8 2019/10/15 18:44:21 rillig Exp $ |
2 | # | | 2 | # |
3 | # Copyright (c) 2014,2015,2016,2017,2018,2019 | | 3 | # Copyright (c) 2014,2015,2016,2017,2018,2019 |
4 | # Brook Milligan. All rights reserved. | | 4 | # Brook Milligan. All rights reserved. |
5 | # | | 5 | # |
6 | # Redistribution and use in source and binary forms, with or without | | 6 | # Redistribution and use in source and binary forms, with or without |
7 | # modification, are permitted provided that the following conditions | | 7 | # modification, are permitted provided that the following conditions |
8 | # are met: | | 8 | # are met: |
9 | # 1. Redistributions of source code must retain the above copyright | | 9 | # 1. Redistributions of source code must retain the above copyright |
10 | # notice, this list of conditions and the following disclaimer. | | 10 | # notice, this list of conditions and the following disclaimer. |
11 | # 2. Redistributions in binary form must reproduce the above copyright | | 11 | # 2. Redistributions in binary form must reproduce the above copyright |
12 | # notice, this list of conditions and the following disclaimer in the | | 12 | # notice, this list of conditions and the following disclaimer in the |
13 | # documentation and/or other materials provided with the distribution. | | 13 | # documentation and/or other materials provided with the distribution. |
14 | # 3. Neither the name of the author nor the names of any contributors | | 14 | # 3. Neither the name of the author nor the names of any contributors |
| @@ -434,53 +434,26 @@ license <- function(s) | | | @@ -434,53 +434,26 @@ license <- function(s) |
434 | if (old.license != '' && old.license != license) | | 434 | if (old.license != '' && old.license != license) |
435 | license <- paste0(license,' # [R2pkg] previously: ',old.license) | | 435 | license <- paste0(license,' # [R2pkg] previously: ',old.license) |
436 | license | | 436 | license |
437 | } | | 437 | } |
438 | | | 438 | |
439 | maintainer <- function(email) | | 439 | maintainer <- function(email) |
440 | { | | 440 | { |
441 | MAINTAINER <- read.file.as.value('MAINTAINER') | | 441 | MAINTAINER <- read.file.as.value('MAINTAINER') |
442 | if (MAINTAINER == '') | | 442 | if (MAINTAINER == '') |
443 | MAINTAINER <- email | | 443 | MAINTAINER <- email |
444 | MAINTAINER | | 444 | MAINTAINER |
445 | } | | 445 | } |
446 | | | 446 | |
447 | make.sed.command <- function(key,value) | | | |
448 | { | | | |
449 | address <- paste0('/^[[:blank:]]*',key,'/') | | | |
450 | match <- paste0('(',key,'[[:blank:]]*=[[:blank:]]*).*$') | | | |
451 | replacement <- paste0('\\1',value) | | | |
452 | command <- paste0(' -e "',address,'s/',match,'/',replacement,'/"') | | | |
453 | command | | | |
454 | } | | | |
455 | | | | |
456 | sed.categories <- function(categories) make.sed.command('CATEGORIES',categories) | | | |
457 | sed.comment <- function(comment) | | | |
458 | { | | | |
459 | old.comment <- read.file.as.value('COMMENT') | | | |
460 | if (weakly.equals(old.comment,comment)) | | | |
461 | comment <- old.comment | | | |
462 | make.sed.command('COMMENT',comment) | | | |
463 | } | | | |
464 | sed.maintainer <- function(email) | | | |
465 | { | | | |
466 | make.sed.command('MAINTAINER',maintainer(email)) | | | |
467 | } | | | |
468 | sed.license <- function(license) | | | |
469 | { | | | |
470 | make.sed.command('LICENSE',license) | | | |
471 | } | | | |
472 | sed.r_pkgver <- function(r_pkgver) make.sed.command('R_PKGVER',r_pkgver) | | | |
473 | | | | |
474 | find.Rcpp <- function(imps, deps) grepl('Rcpp', paste(imps, deps)) | | 447 | find.Rcpp <- function(imps, deps) grepl('Rcpp', paste(imps, deps)) |
475 | | | 448 | |
476 | buildlink3.mk <- function(imps,deps) | | 449 | buildlink3.mk <- function(imps,deps) |
477 | { | | 450 | { |
478 | BUILDLINK3.MK <- data.frame() | | 451 | BUILDLINK3.MK <- data.frame() |
479 | buildlink3.mk.list <- read.file.as.list('BUILDLINK3.MK') | | 452 | buildlink3.mk.list <- read.file.as.list('BUILDLINK3.MK') |
480 | for (line in buildlink3.mk.list) | | 453 | for (line in buildlink3.mk.list) |
481 | { | | 454 | { |
482 | fields <- strsplit(line[[1]],'/',fixed=TRUE) | | 455 | fields <- strsplit(line[[1]],'/',fixed=TRUE) |
483 | key <- fields[[1]][3] | | 456 | key <- fields[[1]][3] |
484 | value <- line | | 457 | value <- line |
485 | BUILDLINK3.MK <- rbind(BUILDLINK3.MK,data.frame(key=key,value=value)) | | 458 | BUILDLINK3.MK <- rbind(BUILDLINK3.MK,data.frame(key=key,value=value)) |
486 | } | | 459 | } |