New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install_bitbucket not working #148

Closed
lwaldron opened this Issue Aug 24, 2012 · 1 comment

Comments

Projects
None yet
2 participants
@lwaldron

lwaldron commented Aug 24, 2012

I am so excited to see this function in devtools, but it does not seem to work. The examples in ?install_bitbucket don't work:

install_bitbucket("paulhiemstra")
Error in paste(username, collapse = ", ") :
argument "username" is missing, with no default
install_bitbucket(c("testrepo", "testrepo2")

  • )
    Error in paste(username, collapse = ", ") :
    argument "username" is missing, with no default

Or for another example, I have a buildable R library at:

https://bitbucket.org/lwaldron/hgnchelper

But I don't seem to be able to install it using install_bitbucket:

library(devtools)
install_bitbucket("hgnchelper")
Error in paste(username, collapse = ", ") :
argument "username" is missing, with no default
install_bitbucket("hgnchelper", username="lwaldron")
Installing bitbucket repo(s) hgnchelper/master from lwaldron
Installing master.zip from https://bitbucket.org/lwaldron/hgnchelper/get/master.zip
Error: http client error (404)
sessionInfo()
R version 2.15.0 (2012-03-30)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=C LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] devtools_0.7.1

loaded via a namespace (and not attached):
[1] digest_0.5.2 httr_0.1.1 memoise_0.1 plyr_1.7.1 RCurl_1.91-1
[6] stringr_0.6.1 tools_2.15.0

@wch

This comment has been minimized.

Member

wch commented Aug 24, 2012

It looks like this may be because of a difference between how hg repositories are zipped up vs. git repositories.

To install this repo, I think you need to specify a branch other than the default master (which is the name of the main branch in a git repo). But this currently gives an error:

install_bitbucket("hgnchelper", username="lwaldron", ref="default")
# Error: Does not appear to be an R package

The problem is that in decompress(), the outdir() function takes the first item in the zip file and uses that for the directory name. This works with a devtools zip file downloaded from github, but not the hg zip file here. This is the outdir function for zip files, as defined in decompress:

outdir <- function() {
      basename(as.character(expand(src, list = TRUE)$Name[1]))
    }

Here's what the file list looks like for devtools:

d> z <- unzip(zipfile, list=TRUE)
d> z$Name
  [1] hadley-devtools-c6fe626/                                          
  [2] hadley-devtools-c6fe626/DESCRIPTION                               
  [3] hadley-devtools-c6fe626/NAMESPACE                                 
  [4] hadley-devtools-c6fe626/NEWS                                      
  [5] hadley-devtools-c6fe626/R/
...

And here's what it looks like for hgnchelper:

d> z$Name
 [1] lwaldron-hgnchelper-69a750601835/.hg_archival.txt           
 [2] lwaldron-hgnchelper-69a750601835/.hgtags                    
 [3] lwaldron-hgnchelper-69a750601835/CHANGELOG                  
 [4] lwaldron-hgnchelper-69a750601835/DESCRIPTION                
 [5] lwaldron-hgnchelper-69a750601835/NAMESPACE                  
...

I think a possible solution is to take the first item in the name list and drop everything after the last slash (though Windows may require something slightly different).

@wch wch closed this in e0c1745 Aug 27, 2012

@lock lock bot locked and limited conversation to collaborators Sep 19, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.