release() should check new package version against CRAN package version #209

Closed
wch opened this Issue Dec 12, 2012 · 2 comments

2 participants

@wch
Collaborator

This comes out of #181.

The function that does the version checking is tools:::.check_package_CRAN_incoming(), which is called from tools:::.check_packages(). When I call it, though, the behavior is slightly different: it throws an error if there's no Maintainer field in the DESCRIPTION file. For example, the DESCRIPTION for devtools doesn't have this field, and running R CMD check --as-cran works fine, but running the function directly fails:

d> tools:::.check_package_CRAN_incoming('../devtools')
Error in if (!all(m_m_1 == m_d_1)) { : 
  missing value where TRUE/FALSE needed

Running it on another package that has a Maintainer field works fine. This is what happens when the new package version is insufficient:

d> z <- tools:::.check_package_CRAN_incoming('../downloader')
d> z
Maintainer: 'Winston Chang <winston@stdout.org>'
Insufficient package version (submitted: 0.1, existing: 0.1)
d> str(z)
List of 2
 $ Maintainer : Named chr "Winston Chang <winston@stdout.org>"
  ..- attr(*, "names")= chr "Maintainer"
 $ bad_version:List of 2
  ..$ :List of 1
  .. ..$ Version:Classes 'package_version', 'numeric_version'  hidden list of 1
  .. .. ..$ : int [1:2] 0 1
  .. ..- attr(*, "class")= chr [1:2] "package_version" "numeric_version"
  ..$ :List of 1
  .. ..$ Version:Classes 'package_version', 'numeric_version'  hidden list of 1
  .. .. ..$ : int [1:2] 0 1
  .. ..- attr(*, "class")= chr [1:2] "package_version" "numeric_version"
 - attr(*, "class")= chr "check_package_CRAN_incoming"

And this is what happens when the new package version is sufficient (greater than the CRAN version):

d> z <- tools:::.check_package_CRAN_incoming('../downloader')
d> z
Maintainer: 'Winston Chang <winston@stdout.org>'
d> str(z)
List of 1
 $ Maintainer: Named chr "Winston Chang <winston@stdout.org>"
  ..- attr(*, "names")= chr "Maintainer"
 - attr(*, "class")= chr "check_package_CRAN_incoming"
@hadley
Owner

That's probably because .check_packages() probably runs the authors code somewhere.

@wch wch closed this in 6f54ac8 Dec 12, 2012
@wch
Collaborator

Fixed in 6f54ac8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment