0

I am building an RPM which right now marks openjdk-6 as requirement; I would like to add support for openjdk-7 as well; but I am not sure how would I modify the spec file to look for either openjdk6 or openjdk7 as requirement. I read about the concept of virtual package and I am trying to use it. I am adding

Requires: libjvm.so

in my spec; and checking for either 6 or 7 in my %pre section. But the built RPM package is not recognizing libjvm.so .

error: Failed dependencies:
        libjvm.so is needed by myapp.x86_64

I tried rpm -q --provides java-1.6.0-openjdk and it lists

libjvm.so()(64bit)
libjvm.so(SUNWprivate_1.1)(64bit)

Am I doing the virtual package dep wrong? Is there a more cleaner/obvious way to mention either or JDK6/7 as dependency?

vpram86
  • 5,860
  • 4
  • 28
  • 40

1 Answers1

1

If you're already checking for openjdk 6 or 7 in the pre section, why don't you just set a variable to populate the requires based on the value returned by your check? If openjdk wasn't so poorly named with the value right in the middle, you could use Requires: openjdk >= 1.6, but I don't think that will work because they decided to put the version value right in the middle.

Forrest
  • 1,370
  • 9
  • 20
  • I thought the variable would work at runtime; but to my disappointment they get subtituted at build time. And yes it is very poorly named. For example; the virtual package jre provided by openjdk6 till now is jre7 in openjdk7 :). All components that is listed with --provides in openjdk7 has 7 in their name, jce7, jsse7 etc., Not really sure why they made a decision like that – vpram86 Sep 02 '13 at 07:02
  • Ahh that's a bummer. I should have thought that through better. Could you maybe just make two RPMs? – Forrest Sep 02 '13 at 09:37
  • No :( java is a small part of my package and creating two just for sake of that would not look good. Thanks though – vpram86 Sep 03 '13 at 07:44
  • Yea I'm sorry then man, I don't have a good solution due to how the naming convention is done, unless you can do 'requires: java-1.[1-9].0-openjdk'. I can't think of a great way that will meet your needs. – Forrest Sep 05 '13 at 00:03