craigwblake / redline

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

Is it possible to set the dist Tag with redline? #79

Closed renegrob closed 9 years ago

renegrob commented 9 years ago

Is it possible to set the dist tag (https://fedoraproject.org/wiki/Packaging:DistTag)? There is a "distribution" header tag but this seems to be something different.

p120ph37 commented 9 years ago

From my reading of Fedora's documentation that you linked, their %{dist} tag is not output in the resultant RPM directly. Rather, it is a macro used during packaging to incorporate the dist string into the "release" header, and also for use in conditionals when you need to generate things differently for different distros. To emulate this functionality in your use of redline, you can do something like this with Builder:

String dist = ".el6";

builder.setRelease("whatever_base_release"+dist);
if(dist.matches("^\\.el.*$")) {
    // make RHEL-specific adjustments here.
} else if(dist.matches("^\\.fc.*$")) {
    // make Fedora-specific adjustments here.
} // ...etc

If you are using the Ant task, you can do similar string-substitution and branching there with a variable as well.

renegrob commented 9 years ago

Thanks a lot! I wasn't aware that it's so simple.