Windows下通过ANT脚本创建RPM包
我需要从 Windows 计算机上运行的 ANT 脚本创建 RPM 包。 该包必须包含构建的结果类以及一些其他附加资源。
我想应该有一些程序可以从命令行调用来创建这个包。
我想在 Windows 下执行此操作的原因是,我们有一个为多个不同平台构建安装程序的脚本,并且所有内容都已针对 Windows 配置,因此我想避免将所有内容迁移到 Linux 的痛苦。
你知道如何实现这一目标吗?
编辑: 我使用了一台单独的 Linux 机器来执行此操作。 我使用 scp 任务复制所有文件,然后使用 ssh 任务远程执行 rpm 命令。 如果此任务返回成功代码,我将使用 scp 将生成的 rpm 复制回来。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
还要考虑 redline-rpm java 库 & 蚂蚁任务。 https://github.com/craigwblake/redline
Also consider the redline-rpm java library & ant task. https://github.com/craigwblake/redline
一种可能的解决方案是使用纯 java RPM 操作工具,例如:
http: //jrpm.sourceforge.net/rpmspec/index.html
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
我不知道有任何软件包可以做到这一点,但这可能只是我的无知。
两个建议:
设置一台 Linux 机器(单独的 PC 或虚拟机)并通过脚本远程安装 rpm(请参阅 ssh/scp/samba)。 我认为这是一种安全的方法,可以避免完全构建环境迁移。
更冒险的方法是使用 Java 编写您自己的 RPM 文件。 RPM 文件格式 似乎是一个标头,后面跟着许多标准存档格式之一。 需要对存档内容进行一些分析,因此这种方法在短期内可能会非常耗时(尽管它可能会导致更快的构建)。
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).
检查 Ant 手册,我发现以下可选任务:
http://ant.apache。 org/manual/Tasks/rpm.html
但是,这只能在 Linux 计算机上运行
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
该死的包管理可以做到这一点。 您应该能够使用 JRuby 和 MRI Ruby 运行它。
fpm -s dir -t rpm mydir
——或者您提供 rpm 关键字的另一个咒语。 请参阅fpm --help
。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. Seefpm --help
.我认为这是不可能的,为 linux 构建的运行时包无法在 windows 上运行(我们不希望在 linux 上使用 dll 和 exe,不是吗!)。 Cygwin 面临着类似的挑战,他们明确表示他们是通过编译 Windows 源文件来做到这一点的。
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.