如何使用SHA-256校验和构建文件的rpm包? [英] How to build the rpm package with SHA-256 checksum for files?

查看:180
本文介绍了如何使用SHA-256校验和构建文件的rpm包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在标准的单独RHEL 6.4 rpm构建环境中,rpm软件包是使用SHA-256校验和生成的,该校验和是通过命令 rpm -qp --dump xxx.rpm

In standard alone RHEL 6.4 rpm build environment, the rpm packages is generated with SHA-256 check sum, which is gotten by command rpm -qp --dump xxx.rpm

[user@redhat64 abc]$ rpm -qp --dump package/rpm/abc-1.0.1-1.x86_64.rpm
..
/opt/company/abc/abc/1.0.1-1/bin/start.sh 507 1398338016 d8820685b6446ee36a85cc1f7387d14537d6f8bf5ce4c5a4ccd2f70e9066c859 0100750 user abcc 0
..

如果它是在 docker 环境(仍为RHEL6.4)中构建的,则校验和为md5

While if it is build in docker environment (still RHEL6.4) the checksum is md5

[user@c1cbdf51d189 abc]$ rpm -qp --dump package/rpm/abc-1.0.1-1.x86_64.rpm
..
/opt/company/abc/abc/1.0.1-1/bin/start.sh 507 1401952578 f229759944ba77c3c8ba2982c55bbe70 0100750 user abcc 0
..

如果我检查了真实文件,则文件是相同的

If I checked the real file, the file is the same

[user@c1cbdf51d189 1.0.1-1]$ sha256sum bin/start.sh
d8820685b6446ee36a85cc1f7387d14537d6f8bf5ce4c5a4ccd2f70e9066c859  bin/start.sh
[user@c1cbdf51d189 1.0.1-1]$ md5sum bin/start.sh
f229759944ba77c3c8ba2982c55bbe70  bin/start.sh

我如何配置 rpmbuild 以使生成的rpm文件基于SHA-256?

How I configure rpmbuild to let generated rpm file is SHA-256 based ?

推荐答案

它与docker不相关,可以通过以下配置启用它

It is not related with docker, it can be enabled by follow configuration

echo "%_binary_filedigest_algorithm  8" >> $HOME/.rpmmacros

仅在标准RHEL 6.4中就可以使用它的原因是因为它具有 redhat-rpm-config 软件包.

The reason for it is ok in standard alone RHEL 6.4 is because it has the redhat-rpm-config packages.

bash-4.1# yum install redhat-rpm-config

在软件包中,此配置存在于/usr/lib/rpm/redhat/macros

In the package, this configuration exists in /usr/lib/rpm/redhat/macros

bash-4.1# grep digest /usr/lib/rpm/redhat/macros
%_source_filedigest_algorithm 8
%_binary_filedigest_algorithm 8

您可以使用命令 rpmbuild --showrc 来检查所有配置.

You can use command rpmbuild --showrc to check all the configuration.

这篇关于如何使用SHA-256校验和构建文件的rpm包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆