How can I set an or-require in a rpm spec-file? - rpmbuild

I am trying to create an rpm. It is possible set requires in the spec-file:
Requires: package a when package b is not installed

Related

Install R package with specific version AND tests

I would like to run the package-internal tests with testthat::test_package('httr') on a specific version of a package.
Is there a way to install a R package (e.g. from CRAN) with a specific version AND it's tests?
I know there is
install.packages("httr", INSTALL_opts = "--install-tests")
to install the tests for the given package (without any option to specify a specific package version).
And there is
devtools::install_version("httr", version = "1.4.1") or renv::install("httr#1.4.1")
to install a specific version for a package (without the possibility to specify e.g. the INSTALL_opts).
I don't see any way to combine the specification of the package version and the --install-tests option.
Any help would be appreciated!
Note: The package "httr" was just used as a placeholder here.
renv provides a small extension where these options can be set via the INSTALL_opts R option. So, for example, the following should work with renv 0.14.0:
# set options for renv
options(INSTALL_opts.httr = "--install-tests")
# use 'rebuild = true', in case an older version
# of the package without tests is cached
renv::install("httr#1.4.1", rebuild = TRUE)
If you wanted these options to apply to all package to be installed, you could instead use:
options(INSTALL_opts = "--install-tests")
(renv supports setting these via options mainly so that package installation via renv::restore() can be configured more ergonomically on a per-package basis.)

After building a package, where is its zip file?

I have developed a very simple basic package called : mypackage in windows environment which contains one function
na2zero()
in R-Studio IDE i just did Build --> Clean and Rebuild resulted into below logs
==> Rcmd.exe INSTALL --preclean --no-multiarch --with-keep.source package
* installing to library 'C:/Users/NAME/Documents/R/R-4.0.0/library'
* installing *source* package 'mypackage' ...
** using staged installation
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'mypackage'
finding HTML links ... hello html
na2zero html
done
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (mypackage)
i'm able to invoke the functions which resides in mypackage, but my question is, i want to see the location of the package, i believe the extension will be .zip
so in which folder the package (mypackage) exists.?
In RStudio, the "Install and Restart" menu item in the Build pane will install the package directly into R, without creating an archive file.
If you want to create an archive, there are two kinds of those. Use "Build Source Package" (in the "More..." menu) to create a .tar.gz file, which can be installed in any current version of R, and also some past and future ones, on any supported platform.
Use "Build Binary Package" to create a binary package. On Windows, that would be a .zip file. It is only good for Windows and a very small range of R versions (typically if you build in R version X.Y.Z, you'll be able to use it for different value of Z, but not different values of X or Y). You won't be able to use it on Linux or MacOS.
For a simple package, you should almost always use the "Source Package" format. Only when you have compiled code (C, C++, Fortran) is it a good idea to use the "Binary Package" format: your users may not have the compiler needed to install it themselves. But you'll need to match your users' R versions very carefully.
For both Source and Binary packages, RStudio will put the archive file in the same folder as your package source is in, e.g. if your package version 1.0.0 is in
path/to/mypackage, it will produce path/to/mypackage_1.0.0.zip.

install_bitbucket or install_github and install specific versions of dependencies

I have a package hosted on a bitbucket private repository and would like to install my package along with the specific versions of it's dependencies specified in the Depends section of the DESCRIPTION file:
Depends: R (>= 2.15.0), foo (== 1.17-12)
Is there a way to have devtools automatically find and install foo version 1.17-12 for R 2.15.0?
I like devtools' ability to install different refs (development, master, my-feature-branch, ...etc.) from my bitbucket repo and then install all of it's dependencies, but installing my R package on different servers at different times, means I can easily pick up unwanted dependent package changes and I also need to keep R up to date all of the time in order for it to find all of the packages.

R: how to install this package?

I am trying to install the fpc package. According to
http://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R/Clustering/Density-Based_Clustering
it's easy: just type install.packages("fpc", dependencies = TRUE)
I did that. But after 10-15 minutes of downloading whatever and thousands of lines flushing down my screen, RStudio did not react anymore.
Now I'm trying to install without dependencies = TRUE and get this error:
ERROR: dependencies ‘mclust’, ‘flexmix’ are not available for package ‘fpc’
Then I tried to do install.packages("mclust")
but I get this:
package ‘mclust’ is not available (for R version 2.14.1)
Why can I not just install that package fpc? It seems to be quite prominent, so why is it so complicated to install it?
Upgrade R to ver 3.x and You can install fpc from menubar on Rstudio
Choose Tools >> Install Package >> then type "fpc"
It will then download automatically.
I'm using Rstudio ver 0.98.1002 and R ver 3.1.2

R version 3.0.2 cannot find RCurl package

I'm using R version 3.0.2 on my Windows 7 (32-bit) system and am stumped trying to install rCharts. I've had no problem installing other packages from github (e.g., slidify), but R seems unable to find the dependent RCurl package I installed.
I can submit the following basic lines of code without error:
require(devtools)
library(bitops,lib.loc='c:/R/packages/')
library(RCurl,lib.loc='c:/R/packages/')
require(RCurl) # have also tried the library function without luck*
But, when I submit the command to install rCharts with
install_github('rCharts', 'ramnathv')
I get the following :
Installing github repo(s) rCharts/master from ramnathv
Downloading rCharts.zip from https://github.com/ramnathv/rCharts/archive/master.zip
Installing package from C:\Users\nakamura\AppData\Local\Temp\RtmpwzYzaG/rCharts.zip
Installing rCharts
"C:/PROGRA~1/R/R-30~1.2/bin/i386/R" --vanilla CMD INSTALL \
"C:\Users\nakamura\AppData\Local\temp\RtmpwzYzaG\rCharts-master" \
--library="C:/Program Files/R/R-3.0.2/library" --with-keep.source \
--install-tests
**ERROR: dependency 'RCurl' is not available for package 'rCharts'**
*** removing 'C:/Program Files/R/R-3.0.2/library/rCharts'
Error: Command failed (1)**
I've tried installing libcurl, but am not sure I've unzipped it to the correct folder. (From what I've been able to gather from bits and pieces of other questions about rCurl, it seems having an improper/no installation of libcurl could be a contributing factor?)
Any help would be very much appreciated. I feel like I'm going around in circles.
Ann
Adding the directory "C:/R/packages" to the front of the .libPaths variable will help R find RCurl if it's been installed to a non-standard directory.

Resources