Skip to content

build_install_test: use fields in read.dcf to explicitely read the package name#87

Merged
markvanderloo merged 1 commit into
markvanderloo:masterfrom
cstepper:fix_build_install_test
Jun 24, 2021
Merged

build_install_test: use fields in read.dcf to explicitely read the package name#87
markvanderloo merged 1 commit into
markvanderloo:masterfrom
cstepper:fix_build_install_test

Conversation

@cstepper
Copy link
Copy Markdown

Hi,

just stumbled across this, as I tried to use build_install_test on a package with a DESCRIPTION file being formatted like this:

Type: Package
Package: jap
Title: Just another package
Version: 0.0.1
...

Running tinytest::build_install_test() locally resulted in the following error:

> tinytest::build_install_test()
* checking for file ‘/home/christoph/packages/jap/DESCRIPTION’ ... OK
* preparing ‘jap’:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building ‘jap_0.0.1.tar.gz’

Error in library(pkgname, lib.loc = tdir, character.only = TRUE) : 
  there is no package called ‘Package’
Calls: suppressPackageStartupMessages -> withCallingHandlers -> library
Execution halted
Warning in gzfile(file, "rb") :
  cannot open compressed file '/tmp/RtmplJlFgQ/file37c317b5bbcf/output.RDS', probable reason 'No such file or directory'
Error in gzfile(file, "rb") : cannot open the connection
Backtrace:
    █
 1. └─tinytest::build_install_test()
 2.   └─base::readRDS(file.path(tdir, "output.RDS"))
 3.     └─base::gzfile(file, "rb")

I know that the Type field in the DESCRIPTION file is optional. But if it is listed on top, pkgname <- read.dcf(file.path(pkg, "DESCRIPTION"))[1], just returns Package.

To make this more robust, I suggest to rather make use of the fields argument in read.dcf for querying the package name.

use fields in read.dcf to explicitely read the package name
@markvanderloo
Copy link
Copy Markdown
Owner

Thanks!! good point.

@markvanderloo markvanderloo merged commit 5565156 into markvanderloo:master Jun 24, 2021
@cstepper cstepper deleted the fix_build_install_test branch June 28, 2021 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants