Issue
I have installed (in CentOS 7) a program called Rational Software Architect (RSA 9.5) which is a rich client platform that acts just like Eclipse, but without actually installing an RPM. RSA came with an installation bash script which pretty much just dropped eclipse files onto the file system. My Eclipse executable lives at /opt/IBM/SDP/eclipse
with the normal Eclipse folders like "plugins", "features", and "dropins" at the same level.
I had written a spec file for a previous version of the "real" Eclipse that simply installed some java plugins I wrote as jar files, placing them in the "dropins" folder and calling eclipse -clean -initialize
afterwards to sync Eclipse with my new plugins. This still works with RSA.
My question comes down to the fact that before, I would simply have a line in the spec file similar to
Requires: eclipse >= 4.4.2
because Eclipse was installed as an RPM. Now that RSA is installed, taking the place of Eclipse, and has no RPM associated with it, I need to find a way to tell the spec file to require that the "dropins" folder exists before installing the RPM. Perhaps something like this:
Requires: /opt/IBM/SDP/eclipse
I have not had any success with the above approach and wonder if it is even possible to set an RPM requirement based on a file and not a package? I cannot find any documentation on the subject and was hoping you all could help! Thanks in advance.
FYI...I am working in CentOS 7.2 with rpm-build-4.11.3 and rpmdevtools-8.3.
EDIT: Adding error message returned from yum when using absolute path in spec
[root@localhost trunk]# yum localinstall myplugin-1.1.6-rev1255.x86_64.rpm
Loaded plugins: fastestmirror, langpacks, rhnplugin
This system is receiving updates from RHN Classic or Red Hat Satellite.
Examining myplugin-1.1.6-rev1255.x86_64.rpm: myplugin-1.1.6-rev1255.x86_64
Marking myplugin-1.1.6-rev1255.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package myplugin.x86_64 0:1.1.6-rev1255 will be installed
--> Processing Dependency: /opt/IBM/SDP/eclipse for package: myplugin-1.1.6-rev1255.x86_64
Loading mirror speeds from cached hostfile
--> Processing Dependency: /opt/IBM/SDP/eclipse for package: myplugin-1.1.6-rev1255.x86_64
--> Finished Dependency Resolution
Error: Package: myplugin-1.1.6-rev1255.x86_64 (/myplugin-1.1.6-rev1255.x86_64)
Requires: /opt/IBM/SDP/eclipse
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
[root@localhost trunk]# ll /opt/IBM/SDP/eclipse
-rwxr-xr-x. 1 root root 74675 Jan 28 2015 /opt/IBM/SDP/eclipse
Solution
According to the Fedora Packaging Guidelines:
... rpm file dependencies don't work according to what's on the filesystem, they work according to the path specified in the rpm %files section.
So, you can't use Requires:
to require a file that is not owned by an RPM.
A possible alternative is to check for existence of the file in the %pre
section and exit with non-zero status if it is not present. See Paul Rubel's reply to Failing an RPM install programatically in a spec step or ᴳᵁᴵᴰᴼ's reply to How to abort the installation of an rpm package if some conditions are not met in specfile? for examples of how to use the technique.
Note that a non-zero exit status from the %pre
section will cause the RPM to fail to install, but the RPM transaction still appears to succeed, which can cause confusion. See How to exit rpm install in case of an error.
Answered By - pjh Answer Checked By - Candace Johnson (WPSolving Volunteer)