From minshall at acm.org  Sat Jul  5 07:25:41 2014
From: minshall at acm.org (Greg Minshall)
Date: Sat, 05 Jul 2014 08:25:41 +0300
Subject: [Rd] DESCRIPTION.in file causes R CMD check to fail?
In-Reply-To: Your message of "Fri, 04 Jul 2014 15:42:19 -0400."
	<53B7039B.6060106@gmail.com>
Message-ID: <54337.1404537941@greg-minshalls-mbp.local>

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:
----
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")
----



[Rd] DESCRIPTION.in file causes R CMD check to fail?
Greg Minshall