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:
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.
It is a powerful command line package management system for installing uninstalling, verifying, querying, and updating Linux computer software packages. However RPM has in build mechanism to tell you about dependencies. Just try to install package and it will give you list of dependencies.
The RPM database tracks dependencies between packages to better allow you to manage your system. A dependency occurs when one package depends on another. The RPM system ensures that dependencies are honored when upgrading, installing, or removing packages.
Working with SPEC files To package new software, you need to create a new SPEC file. Instead of writing it manually from scratch, use the rpmdev-newspec utility. It creates an unpopulated SPEC file, and you fill in the necessary directives and fields. Place them in ~/rpmbuild/SOURCES .
The first “rpm -qa” lists all RPM packages and the grep finds the package you want to remove. Then you copy the entire name and run the “rpm -e –nodeps” command on that package. It will, without prompting for confirmation, remove that package but none of its dependencies.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With