I need to create an RPM package from an ANT script that runs on a Windows computer. This package must contain the result classes from the build plus some other, additional resources.
I guess there should be some program somewhere that can be invoked from the command line to create this package.
The reason why I want to do this under windows is that we have a script that builds installers for several different platforms, and everything is already configured for windows so I want to avoid the pain of migrating everything to linux.
Do you know how could this be achieved?
EDIT:
I've used a separate Linux machine to do this. I copy all files using the scp task, then execute the rpm command remotely using the ssh task. If this task returns a success code, I copy the resulting rpm back with scp.
I'm not aware of any packages to do this, but that could just be my ignorance speaking.
Two suggestions:
Set up a Linux machine (separate PC or virtual machine) and kit the rpm remotely via scripts (see ssh/scp/samba). This strikes me as a safe approach that avoids full build environment migration.
A more adventurous approach would be to write your own RPM files using Java. The RPM file format seems to be a header followed by one of a number of standard archive formats. Some analysis of the archive contents would be needed, so this approach might be quite time consuming in the short term (though it would probably result in faster builds).
Also consider the redline-rpm java library & ant task. https://github.com/craigwblake/redline
A possible solution is to use a pure java RPM Manipulation tool, such as the one described in:
http://jrpm.sourceforge.net/rpmspec/index.html
Checking the Ant manual, I found the following optional task:
http://ant.apache.org/manual/Tasks/rpm.html
However, this only runs with linux computers
Freaking Package Management can do this. You should be able to run it both with JRuby and on MRI Ruby.
fpm -s dir -t rpm mydir
-- or another incantation where you provide the rpm keywords. See fpm --help
.
I don't think it is possible, runtime packages built for linux won't work on windows (we don't expect dlls and exes on linux, do we!). Cygwin faces similar challenges and they clearly state that they do it by compiling source files for windows.