1

I'm creating an RPM using the rpm-maven-plugin. I want to have a dependancy on Tomcat version 6 or above, so:-

<requires>
   <require>tomcat &gt;= 6.0</require>
</requires>

So I create a Vagrant initialized VM and try to install Tomcat:-

[vagrant@development ~]$ sudo yum install tomcat
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: www.mirrorservice.org
 * extras: mirror.ukhost4u.com
 * updates: mirror.ukhost4u.com
No package tomcat available.
Error: Nothing to do

So I install via tomcat6 package instead, which is fine. The problem is that tomcat6 install doesn't satisfy my RPM dependency because it's tomcat6 and not tomcat. How do you get around that?

As far as I know there's no way to OR dependencies so I can't do tomcat >= 6 or tomcat6 or tomcat7 or tomcat8 somehow, which would be ugly regardless.

Ross Drew
  • 8,163
  • 2
  • 41
  • 53

1 Answers1

2

You are right. Using boolean in Requires is not possible. It is currently under development and available in devel version of rpm (and called Rich Dependecy). However this is not available in any distribution yet. So it will not help you.

You can workaround it by using virtual package. http://wiki.netbeans.org/Fedora_RPMs_-_Virtual_Packages

Or use conditionals in spec file

%if 0%{?rhel} > 0 && 0%{?rhel} < 7
Requires: tomcat6
%else
Requires: tomcat8
%endif

However this need to be done directly in spec file. I'm not sure how/if this can be done in rpm-maven-plugin.

msuchy
  • 5,162
  • 1
  • 14
  • 26
  • Am I right in thinking that Tomcat rpms then need to specify a `provides` in order for virtual packages to work? http://www.rpm.org/max-rpm/s1-rpm-depend-manual-dependencies.html#S3-RPM-DEPEND-VIRTUAL-PACKAGES – Ross Drew Jan 13 '16 at 11:14