On 6/5/2015 3:09 AM, Peter wrote: > On 06/04/2015 07:49 AM, Tony Schreiner wrote: >> I run R2spec -s tarball to create a spec file, and most of the time it >> works ok, but sometimes (RPostgresSQL, Rcpp for example) the package has >> test or example programs that start with >> >> #!/usr/bin/r >> >> with lower case r, and the resulting package then winds up with a >> dependency on /usr/bin/r, which can't be resolved. >> >> So far I have solved it by editing all the files and replacing with >> /usr/bin/R, recreating the tarball and going through the process again, but >> I have to believe there is an easier way. > Kind of. This is an obvious error in the packaged scripts in the > tarballs. I generally don't recommend modifying the original tarball as > I like it to be a true representation of the tarball source that you get > from upstream. What I do instead is patch it in the spec file. > > In this case it would probably be easier to do one line of perl or awk > that patches the shebang line in all the scripts at build time than it > would be to generate individual patch files for each source tarball. > You would add this to the %prep stage of the spec files, something like > this after the initial %setup macro: > > perl -pi -e 's:^#!/usr/bin/r:#!/usr/bin/R: unless $i++' > path/to/R/scripts/*.R I assume the "unless $i++" is supposed to limit the replace operation to only the first line each file. Unfortunately, since it is a global variable, it is actually limiting it to only the first line of the first file. I'm not sure how you would fix this using the -p option. You would probably have to write out the loop manually in order to localize the variable properly. -- Bowie