1- # Copyright 2018 Opening Reproducible Research (https://o2r.info)
1+ # C# Copyright 2018 Opening Reproducible Research (https://o2r.info)
22
33# pkgs is a data.frame of packages with the columns name, version, and source (either "CRAN" or "github")
44# function returns the given Dockerfile object with the required instructions
@@ -34,7 +34,7 @@ add_install_instructions <- function(base_dockerfile,
3434
3535 if (any(skipable ))
3636 addInstruction(base_dockerfile ) <- Comment(text = paste0(" CRAN packages skipped because they are in the base image: " ,
37- skipped_str ))
37+ skipped_str ))
3838
3939 # do not add skippable, add all non-CRAN packages
4040 pkgs <- rbind(cran_packages [! skipable ,], pkgs [pkgs $ source != " CRAN" ,])
@@ -89,7 +89,7 @@ add_install_instructions <- function(base_dockerfile,
8989
9090 if (versioned_packages ) {
9191 futile.logger :: flog.info(" Versioned packages enabled, installing 'versions'" )
92- addInstruction(base_dockerfile ) <- Run_shell(" install2.r" , " versions" )
92+ addInstruction(base_dockerfile ) <- Run_shell(paste( " install2.r" , " versions" ) )
9393 }
9494
9595 # 2. add installation instruction for CRAN packages
@@ -101,7 +101,7 @@ add_install_instructions <- function(base_dockerfile,
101101 } else {
102102 cran_packages <- stringr :: str_sort(as.character(unlist(pkgs_cran $ name ))) # sort, to increase own reproducibility
103103 futile.logger :: flog.info(" Adding CRAN packages: %s" , toString(cran_packages ))
104- addInstruction(base_dockerfile ) <- Run_shell(" install2.r" , cran_packages )
104+ addInstruction(base_dockerfile ) <- Run_shell(paste( " install2.r" , cran_packages ) )
105105 }
106106 } else futile.logger :: flog.debug(" No CRAN packages to add." )
107107
@@ -115,10 +115,15 @@ add_install_instructions <- function(base_dockerfile,
115115 bioc_packages <- stringr :: str_sort(as.character(unlist(pkgs_bioc $ name ))) # sort, to increase own reproducibility
116116 futile.logger :: flog.info(" Adding Bioconductor packages: %s" , toString(bioc_packages ))
117117 repos = as.character(BiocManager :: repositories())
118- addInstruction(base_dockerfile ) <- Run_shell(" install2.r" , params = c(sprintf(" -r %s -r %s -r %s -r %s" ,
119- repos [1 ], repos [2 ],
120- repos [3 ], repos [4 ]),
121- bioc_packages ))
118+ addInstruction(base_dockerfile ) <- Run_shell(
119+ paste(
120+ " install2.r" ,
121+ paste(c(sprintf(" -r %s -r %s -r %s -r %s" ,
122+ repos [1 ], repos [2 ],
123+ repos [3 ], repos [4 ]),
124+ bioc_packages ), collapse = " " )
125+ )
126+ )
122127 } else futile.logger :: flog.debug(" No Bioconductor packages to add." )
123128
124129 # 4. add installation instruction for GitHub packages
@@ -150,7 +155,7 @@ versioned_install_instructions <- function(pkgs) {
150155 ifelse(! is.na(pkg [" version" ]),
151156 paste0(' versions::install.versions(\' ' , pkg [" name" ], ' \' , \' ' , pkg [" version" ], ' \' )' ),
152157 NA )
153- },
158+ },
154159 MARGIN = 1 )
155160 installInstructions <- installInstructions [! is.na(installInstructions )]
156161
@@ -161,7 +166,7 @@ versioned_install_instructions <- function(pkgs) {
161166 unversioned <- pkgs_sorted [is.na(pkgs_sorted $ version ),]
162167 unversioned <- stringr :: str_sort(as.character(unlist(unversioned $ name ))) # sort, to increase own reproducibility
163168 futile.logger :: flog.warn(" No version information found for packages: %s" , toString(unversioned ))
164- instructions <- c(Run_shell(" install2.r" , unversioned ), instructions )
169+ instructions <- c(Run_shell(paste( " install2.r" , unversioned ) ), instructions )
165170 }
166171 return (instructions )
167172}
0 commit comments