Issue
I've got a Java app that I am packaging as an RPM. Ideally I would like to specify Java as a dependency. I need to install in both Fedora and RHEL environments. The problem is RHEL Java is called 'java', while Fedora doesn't provide Oracle/Sun's distribution, leaving one to manually download from Oracle's website. Oracles distribution of Java is called either 'jre' or 'jdk' depending on which package you select.
Normally in a RPM SPEC file I would write:
Depends: java >= 1.6
But since the RHEL provides 'java', and Fedora via Sun/Oracle provides 'jre' or 'jdk' (and I can't use OpenJDK), I'm in a bit of a bind. Documentation so far hasn't shown a way to do 'java >= 1.6 || jre >= 1.6 || jdk >= 1.6' etc. Because the Java packages aren't under my control I can't just change one or the other to specify a 'Provides: Java'.
At present I see only two options:
- Omit Java as a dependency
- Create one RPM for Fedora, one for RHEL
I'm not keen on either option. Are there any other ways to achieve Java dependency where the providers all have different names?
Edit: A third option - create my own Java virtual package for Fedora that has a dependency on Sun's JDK RPM.
Solution
I've gone with creating my own java virtual package for Fedora that has a dependency on sun's jdk rpm.
Relevant portion of SPEC file in case it helps anyone else:
Name: fedora-virtual-java
Version: 1.6
Provides: java
Requires: jdk > 1.6
Answered By - Mike Answer Checked By - Katrina (WPSolving Volunteer)