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

From: Martin Morgan <mtmorgan_at_fhcrc.org>
Date: Thu 01 Dec 2005 - 17:34:55 GMT

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.

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.

Index: src/scripts/build.in


 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

     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@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@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri Dec 02 05:34:23 2005

This archive was generated by hypermail 2.1.8 : Mon 20 Feb 2006 - 03:21:34 GMT