Skip to content
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

insert binary package - bug when detecting pkgname #39

Closed
jangorecki opened this issue Sep 21, 2015 · 4 comments
Closed

insert binary package - bug when detecting pkgname #39

jangorecki opened this issue Sep 21, 2015 · 4 comments

Comments

@jangorecki
Copy link
Contributor

Seems to be a bug in getPackageInfo
In regex in linked line seems that getPackageInfo is not handling dots in package name.

gsub("^([a-zA-Z0-9]*)_.*", "\\1", "my.pkg_1.0.0.zip") # should return "my.pkg"
# [1] "my.pkg_1.0.0.zip"

Which later results in error.
To reproduce take the zip binaries of package with dots in the name and try insertPackage() on it.

R version 3.2.2 (2015-08-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.3 LTS

locale:
 [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C               LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8     LC_MONETARY=en_GB.UTF-8   
 [6] LC_MESSAGES=en_GB.UTF-8    LC_PAPER=en_GB.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] drat_0.1.0

loaded via a namespace (and not attached):
[1] tools_3.2.2  git2r_0.10.1
@eddelbuettel
Copy link
Owner

Can you cook up a patched reg.exp?

Ie some (local) tests would we welcome.

@jangorecki
Copy link
Contributor Author

I'm not good in regex, maybe strsplit?

f = function(file){
    pkgname = strsplit(file, "_", fixed=TRUE)[[1L]]
    paste(pkgname[-length(pkgname)], collapse="_")    
}
sapply(c("my_pkg_1.0.0.zip","my.pkg_1.0.0.zip"), f)
# my_pkg_1.0.0.zip my.pkg_1.0.0.zip 
#         "my_pkg"         "my.pkg" 

@eddelbuettel
Copy link
Owner

Try adding ._ in the first square bracket term here: gsub("^([a-zA-Z0-9]*)_.*", "\\1", "my_pkg_1.0.0.zip")

It may break detection of the package version though.

jangorecki added a commit to jangorecki/drat that referenced this issue Sep 21, 2015
jangorecki added a commit to jangorecki/drat that referenced this issue Sep 21, 2015
eddelbuettel added a commit that referenced this issue Sep 21, 2015
@jangorecki
Copy link
Contributor Author

fix already merged in #40

jdrussell pushed a commit to jdrussell/drat that referenced this issue Jun 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants