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

Can't restore git repos (Windows?) #95

Closed
MilesMcBain opened this issue Jun 21, 2019 · 4 comments
Closed

Can't restore git repos (Windows?) #95

MilesMcBain opened this issue Jun 21, 2019 · 4 comments

Comments

@MilesMcBain
Copy link

In current renv my restore process falls over whenever it hits a GitHub/git package, e.g.:

This lockfile entry:

[R/Package/patchwork]
Package=patchwork
Version=0.0.1
Source=GitHub
RemoteType=github
RemoteHost=api.github.com
RemoteRepo=patchwork
RemoteUsername=thomasp85
RemoteRef=master
RemoteSha=fd7958bae3e7a1e30237c751952e412a0a1d1242
Hash=3bb0c960d9fda08b785576d857832649

Fails to restore like so:

Retrieving 'https://api.github.com/repos/thomasp85/patchwork/tarball/fd7958bae3e7a1e30237c751952e412a0a1d1242' ...
	OK [downloaded 391.8 Kb in 4.1 secs]
Error: error decompressing 'patchwork_fd7958bae3e7a1e30237c751952e412a0a1d1242.tar.gz' [error code 127]
In addition: Warning message:
In system2(tar, args, stdout = FALSE, stderr = FALSE) : '""' not found
Traceback (most recent calls first):
  13: stop(sprintf(fmt, ...), call. = call.)
  12: stopf("error decompressing '%s' [error code %i]", basename(path),      status)
  11: renv_archive_decompress_tar(path, exdir = exdir, ...)
  10: renv_archive_decompress(path, files = file, exdir = exdir)
   9: renv_description_read(path)
   8: renv_retrieve_successful(record, path)
   7: renv_retrieve_package(record, url, path)
   6: renv_retrieve_github(record)
   5: renv_retrieve_impl(package)
   4: handler(package, renv_retrieve_impl(package))
   3: renv_retrieve(packages)
   2: renv_restore_run_actions(project, diff, current, lockfile)
   1: renv::restore()

These packages will succeed when installed with remotes::install_github(). E.g.

install_github("thomasp85/patchwork", ref = "fd7958bae3e7a1e30237c751952e412a0a1d1242")

A possibly unrelated issue is failure to restore Azure Devops hosted packages installed with remotes::install_git. For example I have this in my renv.lock:

[R/Package/qfes]
Package=qfes
Version=0.0.0.9000
Source=xgit
Remotes=obrl-soil/h3jsr
RemoteType=xgit
RemoteUrl=https://qfes@dev.azure.com/qfes/pims/_git/qfes
RemoteSha=3f073520268667542517cfbe92881033d3f63b90
Hash=52bcfa3977f1a0ced2969c62c838828b

Which falls over in a different way with:

Error: could not determine source for package 'qfes'
Traceback (most recent calls first):
  9: stop(sprintf(fmt, ...), call. = call.)
  8: stopf(fmt, package)
  7: renv_retrieve_missing_record(record$Package)
  6: renv_retrieve_unknown_source(record)
  5: renv_retrieve_impl(package)
  4: handler(package, renv_retrieve_impl(package))
  3: renv_retrieve(packages)
  2: renv_restore_run_actions(project, diff, current, lockfile)
  1: renv::restore()

Interestingly this could be driven by an issue with remotes since while this fails

>install_git("https://qfes@dev.azure.com/qfes/pims/_git/qfes", ref = "3f073520268667542517cfbe92881033d3f63b90", git = "external" )
Error in read.table(file = file, header = header, sep = sep, quote = quote,  : 
  no lines available in input

This succeeds (no ref):

>install_git("https://qfes@dev.azure.com/qfes/pims/_git/qfes", git = "external" )
Downloading git repo https://qfes@dev.azure.com/qfes/pims/_git/qfes
"C:\PROGRA~1\Git\cmd\git.exe" clone --depth 1 --no-hardlinks https://qfes@dev.azure.com/qfes/pims/_git/qfes C:\Users\msmcbain\AppData\Local\Temp\Rtmp42VfAp\file1357a03fb8680
Cloning into 'C:\Users\msmcbain\AppData\Local\Temp\Rtmp42VfAp\file1357a03fb8680'...
Installing 7 packages: bit, bit64, blob, datastructures, hms, odbc, prettyunits
Installing packages into 'c:/test_repos/demand_forecast_hex_characteristics/renv/library/R-3.6/x86_64-w64-mingw32'
(as 'lib' is unspecified)
> sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 16299)

Matrix products: default

locale:
[1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252   
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C                      
[5] LC_TIME=English_Australia.1252    

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

other attached packages:
[1] remotes_2.0.4

loaded via a namespace (and not attached):
[1] compiler_3.6.0 tools_3.6.0    curl_3.3       renv_0.5.0-27 
@kevinushey
Copy link
Collaborator

Thanks for the bug report! I think I know what's going on and will get a fix shortly. As a workaround, you can set

Sys.setenv(TAR = "internal")

to work around the issue.

@kevinushey
Copy link
Collaborator

Second issue should hopefully be fixed up as well now -- xgit was not being properly recognized as a Git source.

@MilesMcBain
Copy link
Author

Cool! Re second issue, I just opened this: r-lib/remotes#389 so you might want to close it if fixed.

@kevinushey
Copy link
Collaborator

I think this should be resolved now -- please re-open if you're still seeing issues.

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