From murdoch.duncan at gmail.com  Sat Jul  5 13:45:55 2014
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Sat, 05 Jul 2014 07:45:55 -0400
Subject: [Rd] DESCRIPTION.in file causes R CMD check to fail?
In-Reply-To: <54337.1404537941@greg-minshalls-mbp.local>
References: <54337.1404537941@greg-minshalls-mbp.local>
Message-ID: <53B7E573.9010308@gmail.com>

On 05/07/2014, 1:25 AM, Greg Minshall wrote:
> hi, Duncan,
> 
> thanks for the reply, and the pointer to the XML package.
> 
>> I don't understand why configure needs access to DESCRIPTION.in. What
>> is it reading there?
> 
> actually, ./configure is setting the version number in DESCRIPTION,
> using DESCRIPTION.in as a template.  in configure.ac, i have:
> ----

Okay, I misunderstood.

> AC_INIT([image2k],[0.1])
> ----
> which says that i'm building the "image2k" package, with version 0.1.
> 
> my DESCRIPTION.in file has a line
> ----
> Version: @VERSION@
> ----
> 
> back in configure.ac, i tell autoconf to do substitutions in
> DESCRIPTION.in to create DESCRIPTION (among other files):
> ----
> AC_CONFIG_FILES([
>         DESCRIPTION
>         Makefile
>         src/Makefile
> ])
> ----
> 
> so, ./configure will copy DESCRIPTION.in to DESCRIPTION, but will
> substitute its idea of the version.  (i'm always a big fan of second
> normal form.)
> 
> i looked at XML's package.  thanks, i'm new to the autotools world, so
> it's good to be able to look at other examples, especially when used
> with R (at which i'm also not so proficient, ignorance squared).
> 
> it *looks* like my problem probably comes from some code in
> ----
> ./src/library/tools/R/check.R
> ----
> from ./src/library/tools/R/check.R:
>         ## Package sources from the R distribution are special.  They
>         ## have a 'DESCRIPTION.in' file (instead of 'DESCRIPTION'),
>         ## with Version and License fields containing '@VERSION@' for
>         ## substitution by configure.  Earlier bundles had packages
>         ## containing DESCRIPTIION.in, hence the extra check for
>         ## Makefile.in.
> 
>         is_base_pkg <- is_rec_pkg <- FALSE
>         if (file.exists(f <- file.path(pkgdir, "DESCRIPTION.in")) &&
>             file.exists(file.path(pkgdir, "Makefile.in"))) {
>             desc <- try(read.dcf(f))
>             if (inherits(desc, "try-error") || !length(desc)) {
>                 resultLog(Log, "EXISTS but not correct format")
>                 do_exit(1L)
>             }
>             desc <- desc[1L, ]
>             if (desc["Priority"] == "base") {
>                 messageLog(Log, "looks like ", sQuote(pkgname0),
>                            " is a base package")
>                 messageLog(Log, "skipping installation test")
>                 is_base_pkg <- TRUE
>                 pkgname <- desc["Package"] # should be same as pkgname0
>             }
>         }
> ----
> (i'm looking at R-3.1.0.)  XML doesn't run into this because although it
> has a DESCRIPTION.in, it does *not* have Makefile.in, so the suspect
> code isn't run.
> 
> it seems like maybe something like the below patch might fix my
> problem.  (but, it also seems like adding a "Priority: other" should,
> and indeed does, fix my problem.)
> 
> sorry if this was overly wordy.
> 
> cheers, Greg
> 
> ----
> --- orig-check.R        2014-03-29 01:15:03.000000000 +0200
> +++ new-check.R 2014-07-05 08:22:01.000000000 +0300
> @@ -4270,7 +4270,7 @@
>                  do_exit(1L)
>              }
>              desc <- desc[1L, ]
> -            if (desc["Priority"] == "base") {
> +            if ((!is.na(desc["Priority"]) && desc["Priority"] == "base")) {
>                  messageLog(Log, "looks like ", sQuote(pkgname0),
>                             " is a base package")
>                  messageLog(Log, "skipping installation test")
> ----
> 

That looks like a good fix in any case.  I'll put it in.  (It's too late
to make it into 3.1.1, but I'll try to remember to backport it to
R-patched after the release.)

Duncan Murdoch

Duncan Murdoch



[Rd] DESCRIPTION.in file causes R CMD check to fail?
Duncan Murdoch