Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specifying alternatives in RPM dependencies

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.

like image 567
Mike Avatar asked Jun 16 '11 09:06

Mike


People also ask

How do I get the list of dependencies for a specific RPM file?

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.

What are RPM 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.

How do I write an RPM spec?

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 .

How remove RPM ignore dependencies?

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.


1 Answers

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
like image 149
Mike Avatar answered Sep 20 '22 13:09

Mike