Hugh Parsonage
2017-Sep-22 00:14 UTC
[Rd] R CMD build errors if files cannot be moved, even if they are in Rbuildignore
When a package is built it is first moved to a temporary directory (lines 962-980 in build.R). However, this moves *all* files to the temporary directory, even those in Rbuildignore; only later (lines 997-1024) are Rbuildignore files excluded. The problem with this approach is that some files in the package directory may not be movable. On Windows at least, the full path name to a file must not be overly long (around 250 chars). Attempting to copy such files using `file.copy` is a warning, and ultimately fails. In particular, if a package uses a `data-raw` folder to prepare data, and data-raw/ contains such long files, R CMD build will not work, meaning that the data-raw folder has to be manually stashed before building. I propose that the following line if (!file.copy(pkgname, Tdir, recursive = TRUE, copy.date = TRUE)) should be replaced by something like the following include <- allfiles[!inRbuildignore(allfiles, pkgdir)] # possibly the rest of the exclude conds too mov2Tdir <- function(x) { file.copy(x, file.path(Tdir, x), copy.date = TRUE) } if (any(!vapply(include, mov2Tdir, FUN.VALUE = logical(1)))) This change would preserve the error condition, but not erroneously when failing to copy files which will never be built. This may or may not make the unlink(allfiles[exclude], recursive = TRUE, force = TRUE) line redundant; I'm not sure. Hugh Parsonage Grattan Institute. [[alternative HTML version deleted]]
Possibly Parallel Threads
- dos-style line endings in .Rbuildignore result in files not being excluded
- Building Packages on Windows using .Rbuildignore
- Rbuildignore question
- GNU tar does not ignore files in .Rbuildignore (PR#1339)
- Building Packages on Windows using .Rbuildignore (PR#7379)