This is not specifically a CentOS question, but I am creating RPMS for CentOS 6 from some CRAN tarballs.
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.
Is there a option to not create the dependency?
Thanks Tony Schreiner
If I may add
The created spec file does not list the dependency on /usr/bin/r, something in rpmbuild creates it.
On Wed, Jun 3, 2015 at 3:49 PM, Tony Schreiner anthony.schreiner@bc.edu wrote:
This is not specifically a CentOS question, but I am creating RPMS for CentOS 6 from some CRAN tarballs.
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.
Is there a option to not create the dependency?
Thanks Tony Schreiner
Am 03.06.2015 um 21:49 schrieb Tony Schreiner anthony.schreiner@bc.edu:
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.
Is there a option to not create the dependency?
can't test it here right now - but try adding following line at the top of your spec file:
%define __os_install_post %{nil}
-- LF
Thanks for the suggestion, but after putting that at the top of the spec and running rpmbuild, I still get
Resolving Dependencies
--> Running transaction check
---> Package R-RPostgreSQL.x86_64 0:0.4-1.el6 will be installed
--> Processing Dependency: /usr/bin/r for package: R-RPostgreSQL-0.4-1.el6.x86_64
--> Processing Dependency: /usr/bin/r for package: R-RPostgreSQL-0.4-1.el6.x86_64
--> Finished Dependency ResolutionError: Package: R-RPostgreSQL-0.4-1.el6.x86_64 (/R-RPostgreSQL-0.4-1.el6.x86_64)
Requires: /usr/bin/r
when trying to install the resulting RPM
and
$ rpm -qp --requires ../RPMS/x86_64/R-RPostgreSQL-0.4-1.el6.x86_64.rpm
/bin/bash
/usr/bin/env
/usr/bin/r
R-DBI
R-methods
libR.so()(64bit)
libc.so.6()(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.3)(64bit)
libc.so.6(GLIBC_2.3.4)(64bit)
libc.so.6(GLIBC_2.4)(64bit)
libpq.so.5()(64bit)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rtld(GNU_HASH)
rpmlib(PayloadIsXz) <= 5.2-1
On Thu, Jun 4, 2015 at 5:47 AM, Leon Fauster leonfauster@googlemail.com wrote:
Am 03.06.2015 um 21:49 schrieb Tony Schreiner anthony.schreiner@bc.edu:
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.
Is there a option to not create the dependency?
can't test it here right now - but try adding following line at the top of your spec file:
%define __os_install_post %{nil}
-- LF _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Am 04.06.2015 um 18:03 schrieb Tony Schreiner anthony.schreiner@bc.edu:
Thanks for the suggestion, but after putting that at the top of the spec and running rpmbuild, I still get
Resolving Dependencies --> Running transaction check ---> Package R-RPostgreSQL.x86_64 0:0.4-1.el6 will be installed --> Processing Dependency: /usr/bin/r for package: R-RPostgreSQL-0.4-1.el6.x86_64 --> Processing Dependency: /usr/bin/r for package: R-RPostgreSQL-0.4-1.el6.x86_64 --> Finished Dependency ResolutionError: Package: R-RPostgreSQL-0.4-1.el6.x86_64 (/R-RPostgreSQL-0.4-1.el6.x86_64) Requires: /usr/bin/r when trying to install the resulting RPM
Oh, I was a bit lazy/busy to look closer. The r-scripts are parsed by /usr/lib/rpm/find-requires that is defined via __find_requires. You can "disable" this build-step with
%define __find_requires %{nil}
AFAIK this will disable the generation of dependencies for all files (e.g. deps like libc.so.6(GLIBC_2.3)(64bit)).
I suggest a custom script for a specific handling (filtering r-scripts out).
BTW - why is /usr/bin/r not packaged (symlink to /usr/bin/R)? Then the above approach would be obsolete and you would stay closer to the standard build process.
-- LF
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
Peter
On Fri, Jun 5, 2015 at 3:09 AM, Peter peter@pajamian.dhs.org 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
Peter _______________________________________________
Peter and Leon
The %define __find_requires %{nil} sounds too disruptive. I'll look at scripting the corrections.
Maybe I will request at EPEL to see they would consider making a link to /usr/bin/r. However I checked a Debian installation, and it's not there either. So I don't know what the creators of the CRAN package are targeting.
Thanks again Tony
Am 05.06.2015 um 15:56 schrieb Tony Schreiner anthony.schreiner@bc.edu:
The %define __find_requires %{nil} sounds too disruptive. I'll look at scripting the corrections.
Maybe I will request at EPEL to see they would consider making a link to /usr/bin/r. However I checked a Debian installation, and it's not there either. So I don't know what the creators of the CRAN package are targeting.
I'm not a R-expert but its seems that #!/usr/bin/R is the valid shebang. So, IMO the example programs should be corrected ... (as suggested via patch files).
-- LF
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.
On 06/05/2015 04:11 PM, Bowie Bailey wrote:
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.
just replace it everywhere, /usr/bin/r doesn't exist anyways, but make sure there's nothing after the r: perl -pi -e 's:^#!/usr/bin/r\s*$:#!/usr/bin/R:' whatever/*.R
On 06/06/2015 03:21 AM, Nicolas Thierry-Mieg wrote:
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.
Yeah, it was untested code off the top of my head and you are correct.
just replace it everywhere, /usr/bin/r doesn't exist anyways, but make sure there's nothing after the r: perl -pi -e 's:^#!/usr/bin/r\s*$:#!/usr/bin/R:' whatever/*.R
This should work.
Peter