[R] what folder to run write_PACKAGES in?

Paul Johnson pauljohn32 at gmail.com
Tue May 8 23:47:09 CEST 2012


I set up a local repo for testing packages. My packages are not
showing up from the repository when viewed by Linux clients. I suspect
this is a web administrator/firewall issue, but it could be I created
the repo wrongly.  I am supposed to run write_PACKAGES separately in
each R-version folder. Right?

Maybe other novices can use these scripts, if they are not wrong :)

Here's the file structure. On the file space that the Web server can
see, I create a folder "/tools/kran" and directories

 bin
    macosx
         leopard
              contrib
                2.13
                2.14
                2.15

    windows
         contrib
               2.13
               2.14
               2.15
src
    contrib
               2.13
               2.14
               2.15

That's created by this:
#############################################
create_repo_tree <- function(local.repos, rversions){

    folders  <-  c("/bin/windows/contrib",
"/bin/macosx/leopard/contrib", "/src/contrib")
    for(dir in folders){
        dirs <- paste(local.repos, dir, "/", rversions, sep='')
        lapply(dirs, dir.create, recursive = TRUE, showWarnings = TRUE)
    }
}

create_repo_tree("/tools/kran", c(2.13, 2.14, 2.15))
###########################################

My CRAN mirror is in a sister folder /tools/cran and that works
properly to be served at the address http://rweb.quant.ku.edu/cran.

I want our local testing thing to show at similar
http://rweb.quant.ku.edu/kran.  Supposing the Apache web server magic
is done, I *believe* the following should work.

I dropped packages in the right version folders, and I wrote a script
that goes separately to each version number folder and runs
write_PACKAGES.

### Researchers can upload
### packages into the approrpriate folder.
### Administratively, we schedule this run run every night
write_PACKAGES_wrapper <- function(local.repos) {
    require(tools)

    rversions <-  dir(path = paste(local.repos,
"/bin/windows/contrib", sep=""), full.names = TRUE)
    for (i in rversions) write_PACKAGES(dir = i, subdirs=TRUE,
type="win.binary")

#repeat
    rversions <-  dir(path = paste(local.repos,
"/bin/macosx/leopard/contrib", sep=""), full.names = TRUE)
    for (i in rversions) write_PACKAGES(dir = i, subdirs=TRUE,
type="mac.binary")

    rversions <-  dir(path = paste(local.repos, "/src/contrib",
sep=""), full.names = TRUE)
    for (i in rversions) write_PACKAGES(dir = i, subdirs=TRUE, type="source")
}


write_PACKAGES_wrapper("/tools/kran")

#############################

Right?

After running that, I do see the PACKAGES files appear under the
version number directories.

However, from the linux clients I see this:

> install.packages("rockchalk", repos="http://rweb.quant.ku.edu/kran")
Installing package(s) into ‘/home/pauljohn/R/x86_64-pc-linux-gnu-library/2.15’
(as ‘lib’ is unspecified)
Warning: unable to access index for repository
http://rweb.quant.ku.edu/kran/src/contrib
Warning message:
package ‘rockchalk’ is not available (for R version 2.15.0)

The Web administrator here suggests I've done the write_PACKAGES
incorrectly because there is no PACKAGES file in
/tools/kran/src/contrib.  But I do have PACKAGES files in the
subfolders 2.15.


However, on a windows system, it does work.

> install.packages("rockchalk", repos="http://rweb.quant.ku.edu/kran")
trying URL 'http://rweb.quant.ku.edu/kran/bin/windows/contrib/2.15/rockchalk_1.5.5.06.zip'
Content type 'application/zip' length 486682 bytes (475 Kb)
opened URL
downloaded 475 Kb

package ‘rockchalk’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
        C:\Users\pauljohn32\AppData\Local\Temp\Rtmpq0m3Id\downloaded_packages

The Web admin folks say to me, "if we did it wrong, nothing would
work. Some does, so it is your fault."

-- 
Paul E. Johnson
Professor, Political Science    Assoc. Director
1541 Lilac Lane, Room 504     Center for Research Methods
University of Kansas               University of Kansas
http://pj.freefaculty.org            http://quant.ku.edu



More information about the R-help mailing list