R CMD check gives an error when a vignette entry %\VignetteDepends{} has any
extra space at the end.
Maybe this is by design, but I found it confusing.

Changing the function "vignetteMetaRE" in tools package could solve the
problem. I.e.

vignetteMetaRE <- function(tag)
    paste("[[:space:]]*%+[[:space:]]*\\\\Vignette", tag,"\\{([^}]*)\\}", sep
= "")

becomes:

vignetteMetaRE <- function(tag)
    paste("[[:space:]]*%+[[:space:]]*\\\\Vignette",
tag,"\\{([^}]*)\\}[[:space:]]*", sep = "")



Details:

The test package I'm using has only one vignette:

\documentclass[oneside,letterpaper,12pt]{book}
%\VignetteIndexEntry{some entry}
%\VignetteDepends{stats}
%\VignetteKeyWords{mymodel}
%\VignettePackage{testpkg}
\begin{document}
<<test>>=
print("test")
@
\end{document}

R CMD build, R CMD check and R CMD INSTALL run successfully.

If I add an extra space after %\VignetteDepends{stats} then "R CMD check"
fails

w5:falimadh [~/work/mypkg]> R CMD check testpkg
* checking for working latex ... OK
* using log directory '/nfs/fs1/home/F/falimadh/work/mypkg/testpkg.Rcheck'
* using R version 2.5.1 (2007-06-27)
* checking for file 'testpkg/DESCRIPTION' ... OK
* checking extension type ... Package
* this is package 'testpkg' version '1.0'
* checking package dependencies ... ERROR
Vignette dependencies not required:
  stats
Vignette dependencies (\VignetteDepends{} entries) must be contained in
the DESCRIPTION Depends/Suggests/Imports entries.

See the information on DESCRIPTION files in the chapter 'Creating R
packages' of the 'Writing R Extensions' manual.
----------------------------------------------------------------------

The error message is from tools:::.check_package_depends() function
which is used by R CMD check.
check_package_depends() calls .build_vignette_index() to get the vignettes
dependency list
For my test package, the result is:

> reqs <-
unique(unlist(tools:::.build_vignette_index("testpkg/inst/doc/")$Depends))
> reqs
[1] "stats "
>

"stats " (with a space at the end) is not in the depend field of my package
description ("stat" is). And that's where the error comes from.


Does this make sense ?

Thanks,
Ferdi


> R.Version()
$platform
[1] "x86_64-redhat-linux-gnu"

$arch
[1] "x86_64"

$os
[1] "linux-gnu"

$system
[1] "x86_64, linux-gnu"

$status
[1] ""

$major
[1] "2"

$minor
[1] "5.1"

$year
[1] "2007"

$month
[1] "06"

$day
[1] "27"

$`svn rev`
[1] "42083"

$language
[1] "R"

$version.string
[1] "R version 2.5.1 (2007-06-27)"

>

	[[alternative HTML version deleted]]

