使用rpm -maven-plugin构建的RPM上的rpmlib(FileDigests)依赖性错误

Ste*_*hen 2 dependencies rpm rpm-maven-plugin

就像这个问题一样,我尝试安装RPM并得到以下错误:

# rpm -iv myapp-0.0.14-SNAPSHOT.rpm 
error: Failed dependencies:
        rpmlib(FileDigests) <= 4.6.0-1 is needed by myapp-0.0.14-SNAPSHOT20151117233758.noarch
        rpmlib(PayloadIsXz) <= 5.2-1 is needed by myapp-0.0.14-SNAPSHOT20151117233758.noarch
Run Code Online (Sandbox Code Playgroud)

但我的应用程序是使用rpm-maven-plugin构建的.

构建机器和我想要安装的服务器之间的redhat版本有所不同.

$ uname -a
Linux buildmach 2.6.32-573.el6.x86_64 #1 SMP Wed Jul 1 18:23:37 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux

# uname -a
Linux myserver 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:39 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
Run Code Online (Sandbox Code Playgroud)

如何解决这个问题,如果我使用这个插件来构建rpm?

Ste*_*hen 5

实际上,它并不难,至少不是我的用例,我基本上只是使用rpm来部署war文件.

您只需要定义一些宏,而不是redhat安装程序为您提供的那些宏:

%_binary_payload    w9.gzdio
%_binary_filedigest_algorithm   1
Run Code Online (Sandbox Code Playgroud)

有趣的是,redhat的rhel6宏文件表明这些是默认值,但事实上它们不是默认值:

#   Compression type and level for source/binary package payloads.
#       "w9.gzdio"  gzip level 9 (default).
#       "w9.bzdio"  bzip2 level 9.
#       "w7.xzdio"  xz level 7, xz's default.
#       "w7.lzdio"  lzma-alone level 7, lzma's default
#
#%_source_payload   w9.gzdio
#%_binary_payload   w9.gzdio

#   Algorithm to use for generating file checksum digests on build.
#   If not specified or 0, MD5 is used.
#   WARNING: non-MD5 is backwards incompatible, don't enable lightly!
#   The supported algorithms may depend on NSS version, as of NSS
#   3.11.99.5 the following are supported:
#   1   MD5 (default)
#   2   SHA1
#   8   SHA256
#   9   SHA384
#   10  SHA512
#
#%_source_filedigest_algorithm  1
#%_binary_filedigest_algorithm  1
Run Code Online (Sandbox Code Playgroud)

如果默认值是redhat宏文件中的注释所指示的,则不必取消注释这些行.

无论如何,由于我使用的是rpm-maven-plugin,我可以使用pom.xml中的插件参数来配置它,而无需更改宏文件.

<defineStatements>
    <defineStatement>_binary_payload w9.gzdio</defineStatement>
    <defineStatement>_binary_filedigest_algorithm 1</defineStatement>
</defineStatements>
Run Code Online (Sandbox Code Playgroud)