views:

2149

answers:

5

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.

A: 

Checking the Ant manual, I found the following optional task:

http://ant.apache.org/manual/OptionalTasks/rpm.html

However, this only runs with linux computers

Mario Ortegón
A: 

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.

questzen
It is possible to compile certain linux applications natively for windows. In fact I have this installed: http://unxutils.sourceforge.net/
Mario Ortegón
+2  A: 

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).

McDowell
I think I will try version number 1. I though about doing something similar, but I wanted to check if there was a better way
Mario Ortegón
I used the ant tasks scp and ssh to start the Build process in a separate computer. When the rpm -bb call finished, I used scp to copy the file back again.
Mario Ortegón
+1  A: 

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

Mario Ortegón
+1  A: 

Also consider the redline-rpm java library & ant task. http://code.google.com/p/redline-rpm/

sarabob