[Rd] (not just!) Windows R CMD build <pkg> leftovers

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Dec 2 11:28:19 CET 2005


On Thu, 1 Dec 2005, Martin Morgan wrote:

> Perhaps this earlier post slipped through the cracks? My apologies if
> it's still 'in process', or I missed a response, or if the
> contribution isn't helpful.

Have patience, it is `in process'.  But if you consider such things 
important (and clearly you do enough to pester) you should file a bug 
report, not post to R-devel.  This one appears to be a minor infelicity in 
a procedure only for packages with broken vignettes.  (It _would_ have 
helped to have a clearer description of the problem being addressed: 
INSTALL --build is nothing to do with vignettes, and not many CRAN 
packages have vignettes and AFAIK none are broken.  Think abut supplying 
a NEWS entry to describe the fix.)

R.exe CMD is just a roundabout way of doing what Rcmd.exe does. Don't 
confuse `necessary' with `recommended' or `efficient'.

> At any rate, I realized that the problem is not windows-specific.
>
> Also, generating $libdir by calling (a sligthly modified) R_tempfile
> might give installation more of a fighting chance in a cluttered TMPDIR.

Not sure we should be encouraging such bad housekeeping!

> Index: src/scripts/build.in
> ===================================================================
> --- src/scripts/build.in        (revision 36565)
> +++ src/scripts/build.in        (working copy)
> @@ -76,7 +76,7 @@
> my $R_platform = R_getenv("R_PLATFORM", "unknown-binary");
> my $gzip = R_getenv("R_GZIPCMD", "gzip");
> my $tar = R_getenv("TAR", "tar");
> -my $libdir = &file_path(${R::Vars::TMPDIR}, "Rinst.$$");
> +my $libdir = R_tempfile("Rinst.");
>
> my $INSTALL_opts = "";
> $INSTALL_opts .= " --use-zip" if $opt_use_zip;
> @@ -434,6 +434,8 @@
>            if($doit && R_system($cmd)) {
>                $log->error();
>                $log->print("Installation failed.\n");
> +               $log->print("Removing '$libdir'\n");
> +               rmtree($libdir);
>                exit(1);
>            }
>            my $R_LIBS = $ENV{'R_LIBS'};
> Index: share/perl/R/Utils.pm
> ===================================================================
> --- share/perl/R/Utils.pm       (revision 36565)
> +++ share/perl/R/Utils.pm       (working copy)
> @@ -75,7 +75,7 @@
>                           $pat . $$ . sprintf("%05d", rand(10**5)));
>
>     my $n=0;
> -    while(-f $retval){
> +    while(-e $retval){
>        $retval = file_path($R::Vars::TMPDIR,
>                            $pat . $$ . sprintf("%05d", rand(10**5)));
>        croak "Cannot find unused name for temporary file"
>
>
> Martin Morgan <mtmorgan at fhcrc.org> writes:
>
>> A command
>>
>> R CMD build  <pkg>
>>
>> that fails, e.g., because of C code compilation errors, leaves a
>> directory %TMPDIR%/Rinst.xxx containing the file R.css. Although R
>> CMD INSTALL --build cleans up after itself, build does not. A fix is
>> below. Also, build.in references Rcmd.exe, which I thought was no
>> longer necessary?
>>
>> Index: build.in
>> ===================================================================
>> --- build.in	(revision 36450)
>> +++ build.in	(working copy)
>> @@ -434,6 +434,8 @@
>>  	    if($doit && R_system($cmd)) {
>>  		$log->error();
>>  		$log->print("Installation failed.\n");
>> +		$log->print("Removing '$libdir'\n");
>> +		rmtree($libdir);
>>  		exit(1);
>>  	    }
>>  	    my $R_LIBS = $ENV{'R_LIBS'};
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list