Create RPM package from ANT script under Windows

若如初见. 提交于 2019-12-18 12:27:07

问题


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.


回答1:


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




回答2:


Also consider the redline-rpm java library & ant task. https://github.com/craigwblake/redline




回答3:


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




回答4:


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




回答5:


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.




回答6:


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.



来源:https://stackoverflow.com/questions/449983/create-rpm-package-from-ant-script-under-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!