В Wed, 20 Mar 2024 19:26:53 +0000
Jorgen Harmse <jhar...@roku.com> пишет:

> Thank you. tools:::.install_packages works.

I'm glad it works, but it shouldn't be necessary to use (and is not
part of the API: not documented to keep working this way).

Since you're already using devtools, perhaps devtools::install will
succeed. But it's not obvious why utils::install.packages() is failing,
and it should still be called by devtools::install().

> It happens that one of the functions in my package is a utility to
> build packages. I guess I should change the install step.

Try setting a breakpoint in system2 before launching your function:

debugonce(system2)
build.package('/path/to/the/source/tree')

This should land you in R's "browser" (see help(browser) for how to use
it). At this point, what is `command` and what are the `args`? If you
remove c("CMD", "INSTALL") from the `args` vector and give the rest as
the argument to .install_packages() in a fresh process, will it break
in a similar manner?

Browse[2]> command
[1] "/usr/lib/R/bin/R"
Browse[2]> args
[1] "CMD" "INSTALL" "-l"
"'/home/ivan/R/x86_64-pc-linux-gnu-library/4.2'"
"'/home/ivan/path/to/package_1.0.tar.gz'"

# (start a new process)

tools:::.install_packages(c(
 '-l',
 # you'll have to manually unquote the file paths:
 # the strings above are for both R and the command line shell
 # to interpret, but here we're only giving them to R, not the shell
 "/home/ivan/R/x86_64-pc-linux-gnu-library/4.2",
 "/home/ivan/path/to/package_1.0.tar.gz"
))

-- 
Best regards,
Ivan

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to