4

I'm trying to create an rpm package with a dependency on java 11; however, it seems like the openjdk and Oracle java 11 packages don't provide any overlapping java virtual packages.

OpenJDK Java 11 provides:

$ repoquery --provides java-11-openjdk
java-11 = 1:11.0.2.7-0.el7_6
java-11-openjdk = 1:11.0.2.7-0.el7_6
java-11-openjdk(x86-32) = 1:11.0.2.7-0.el7_6
jre-11 = 1:11.0.2.7-0.el7_6
jre-11-openjdk = 1:11.0.2.7-0.el7_6
libjawt.so
java-11 = 1:11.0.2.7-0.el7_6
java-11-openjdk = 1:11.0.2.7-0.el7_6
java-11-openjdk(x86-64) = 1:11.0.2.7-0.el7_6
jre-11 = 1:11.0.2.7-0.el7_6
jre-11-openjdk = 1:11.0.2.7-0.el7_6

The Oracle Java 11 installer provides:

$ rpm -qp --provides /tmp/jdk-11.0.2_linux-x64_bin.rpm 
jdk
jaxp_parser_impl
xml-commons-apis
java
java-11.0.2
java-fonts
jre
jre-11.0.2
jdk-11.0.2 = 2000:11.0.2-ga
jdk-11.0.2(x86-64) = 2000:11.0.2-ga

How do I set my packages' dependencies to be flexible enough to work with either java11?

I thought rpm boolean dependencies might help, but I could find no information about updating rpm to version 4.13. If I set my packages dependencies to: Requires: jre-11 >= 11, rpm >= 4.13 installation fails with:

Error: Package: MYPACKAGE
           Requires: rpm >= 4.13
           Installed: rpm-4.11.3-32.el7.x86_64 (installed)
               rpm = 4.11.3-32.el7
           Available: rpm-4.11.3-35.el7.x86_64 (base)
               rpm = 4.11.3-35.el7

Version 4.13 of rpm just doesn't seem to be available? I'm using CentOS7, but the same happens on RHEL 7.5 too.

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
jenny
  • 227
  • 2
  • 10

1 Answers1

0

So, as you pointed out, the best would be if both packages could be made to have a common "Provides".

Since this is probably not within your reach, another option is to create a pseudo RPM as a proxy for the Oracle Java 11 RPM.

  • Name: java-11-oracle (for example)
  • Provides: java-11 or any other relevant value from the openjdk RPM
  • Requires: java >= 11 (or jdk, or jre...)
  • %files: empty section (you can omit it)

In your own package, add a dependency to the Provides: that is now in common between that proxy RPM and the openjdk one.

Your package would then be installable in one the following situations:

  • OpenJDK 11 is installed or available in the repositories
  • Oracle's Java 11 RPM and your java-11-oracle RPM are installed or available in active repositories.