craigwblake / redline

Pure Java Rpm Library
http://redline-rpm.org
MIT License
128 stars 97 forks source link

Support greater than AND less than for dependencies and conflicts #96

Closed shollander closed 8 years ago

shollander commented 9 years ago

The RPM specs supports multiple requires for a single package. For example: requires: somepackage >= 0.5.0, somepackage < 0.6.0

Unfortunately this does not work with Redline since it stores everything in a Map (in Builder.java ), so having multiple dependencies of the same package will result in the latest value winning.

For example take the following ant script:

<project name="test" default="rpm" xmlns:redline="antlib:org.redline_rpm">
   <target name="rpm">
    <mkdir dir="rpms"/>
     <redline:rpm group="Java Development" name="test" version="1.2.3" destination="rpms">
      <zipfileset prefix="/usr/share/java" file="test-1.2.3.jar"/>
      <link path="/usr/share/java/test.jar" target="/usr/share/java/test-1.2.3.jar"/>
      <depends name="somepackage " version="1.2" comparison="greater|equal" />
      <depends name="somepackage " version="1.3" comparison="less" />
    </redline:rpm>
   </target>
 </project>

It should create an rpm that has two requires entries: somepackage >= 1.2 somepackage < 1.3

But examining the rpm using rpm -qpR test-1.2.3.rpm shows that it only has somepackage < 1.3

Both depends and conflicts should support multiple values for the same name.

craigwblake commented 8 years ago

PR is merged, should be available in new release shortly.