rpmrebuild 2.20: rpm2archive called with incorrect arguments
rpmrebuild build packages from modified installed packages
Brought to you by:
gerbier
According to rpm2archive manual page:
rpm2archive converts the .rpm files specified as arguments to tar
files. By default they are gzip compressed and saved with postfix
".tgz".
If '-' is given as argument, an rpm stream is read from standard in and
written to standard out.
I think the call to rpm2archive ${RPMREBUILD_PAQUET} needs to be changed from passing the file on the command line to using - and reading and writing from stdin and stdout.
Otherwise, using rpmrebuild -p PACKAGE fails for me.
See the attached patch.
Also, a minor nit, can BuildRequires: make be added to the rpmrebuild.spcto ensure that make is present during the build?
Anonymous
The man page of rpm2archive gives several examples of use :
rpm2archive glint-1.0-1.i386.rpm | tar -xvz
cat glint-1.0-1.i386.rpm | rpm2archive - | tar -tvz
the fist line is the way rpm2archive is used in rpmrebuild code, so the syntax should be ok
and my regression tests ( in t/rpmrebuild_basic.t file) do not fail.
could you send a full output of the failed command : rpmrebuild with args and output ?
So I can try to reproduce, fix and add more regression tests
I'm using RHEL9 and the manual page gives these examples:
EXAMPLES
rpm2archive glint-1.0-1.i386.rpm ; tar -xvz glint-1.0-1.i386.rpm.tgz
cat glint-1.0-1.i386.rpm | rpm2archive - | tar -tvz
Here's my reproduction recipe:
$ wget https://sourceforge.net/projects/rpmrebuild/files/rpmrebuild/2.20/rpmrebuild-2.20-1.noarch.rpm/download
$ mv download rpmrebuild-2.20-1.noarch.rpm
$ sudo dnf install rpmrebuild-2.20-1.noarch.rpm
$ wget https://download.rockylinux.org/pub/rocky/9/BaseOS/aarch64/os/Packages/b/bash-5.1.8-9.el9.aarch64.rpm
$ rpmrebuild -p bash-5.1.8-9.el9.aarch64.rpm
bash-5.1.8-9.el9.aarch64
(GenRpmQf) remove tag line ENHANCESFLAGS
(GenRpmQf) remove tag line ENHANCESNAME
(GenRpmQf) remove tag line ENHANCESVERSION
(GenRpmQf) remove tag line SUGGESTSFLAGS
(GenRpmQf) remove tag line SUGGESTSNAME
(GenRpmQf) remove tag line SUGGESTSVERSION
warning: bash-5.1.8-9.el9.aarch64.rpm: Header V4 RSA/SHA256 Signature, key ID 350d275d: NOKEY
warning: bash-5.1.8-9.el9.aarch64.rpm: Header V4 RSA/SHA256 Signature, key ID 350d275d: NOKEY
warning: bash-5.1.8-9.el9.aarch64.rpm: Header V4 RSA/SHA256 Signature, key ID 350d275d: NOKEY
warning: bash-5.1.8-9.el9.aarch64.rpm: Header V4 RSA/SHA256 Signature, key ID 350d275d: NOKEY
warning: bash-5.1.8-9.el9.aarch64.rpm: Header V4 RSA/SHA256 Signature, key ID 350d275d: NOKEY
warning: bash-5.1.8-9.el9.aarch64.rpm: Header V4 RSA/SHA256 Signature, key ID 350d275d: NOKEY
warning: bash-5.1.8-9.el9.aarch64.rpm: Header V4 RSA/SHA256 Signature, key ID 350d275d: NOKEY
warning: bash-5.1.8-9.el9.aarch64.rpm: Header V4 RSA/SHA256 Signature, key ID 350d275d: NOKEY
warning: bash-5.1.8-9.el9.aarch64.rpm: Header V4 RSA/SHA256 Signature, key ID 350d275d: NOKEY
warning: bash-5.1.8-9.el9.aarch64.rpm: Header V4 RSA/SHA256 Signature, key ID 350d275d: NOKEY
warning: bash-5.1.8-9.el9.aarch64.rpm: Header V4 RSA/SHA256 Signature, key ID 350d275d: NOKEY
warning: bash-5.1.8-9.el9.aarch64.rpm: Header V4 RSA/SHA256 Signature, key ID 350d275d: NOKEY
warning: bash-5.1.8-9.el9.aarch64.rpm: Header V4 RSA/SHA256 Signature, key ID 350d275d: NOKEY
warning: bash-5.1.8-9.el9.aarch64.rpm: Header V4 RSA/SHA256 Signature, key ID 350d275d: NOKEY
warning: bash-5.1.8-9.el9.aarch64.rpm: Header V4 RSA/SHA256 Signature, key ID 350d275d: NOKEY
warning: bash-5.1.8-9.el9.aarch64.rpm: Header V4 RSA/SHA256 Signature, key ID 350d275d: NOKEY
warning: bash-5.1.8-9.el9.aarch64.rpm: Header V4 RSA/SHA256 Signature, key ID 350d275d: NOKEY
warning: bash-5.1.8-9.el9.aarch64.rpm: Header V4 RSA/SHA256 Signature, key ID 350d275d: NOKEY
warning: bash-5.1.8-9.el9.aarch64.rpm: Header V4 RSA/SHA256 Signature, key ID 350d275d: NOKEY
warning: bash-5.1.8-9.el9.aarch64.rpm: Header V4 RSA/SHA256 Signature, key ID 350d275d: NOKEY
warning: bash-5.1.8-9.el9.aarch64.rpm: Header V4 RSA/SHA256 Signature, key ID 350d275d: NOKEY
warning: bash-5.1.8-9.el9.aarch64.rpm: Header V4 RSA/SHA256 Signature, key ID 350d275d: NOKEY
gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
/usr/lib/rpmrebuild/rpmrebuild.sh: ERROR: (RpmUnpack) rpm2archive
/usr/lib/rpmrebuild/rpmrebuild.sh: ERROR: (CreateBuildRoot) RpmUnpack
/usr/lib/rpmrebuild/rpmrebuild.sh: ERROR: CreateBuildRoot
Thanks
I am developping rpmrebuild on fedora (currently 41) and I was not able to reproduce the problem - my arch is x84_64, so I can't rebuild bash-5.1.8-9.el9.aarch64.rpm
- I have no problem with bash-5.1.8-9.el9.x86_64.rpm
but your change is valid and pass my regression test, so it will be included in 2.21 release
Do you have an ETA on 2.21? I just encountered this bug on AlmaLinux 9 trying the rebuild RPMs built on a CentOS 7 machine (it builds a CentOS 7 component, packages it, then wraps it in an RPM to install on the AlmaLinux 9 server it is downloaded from). The issue is CentOS 7 cannot create the RPM with the proper SHA256 Header and Payload digests, and as a result will not install in FIPS mode... This project solves that problem for me, I just need to be able to tell my build containers to pull release 2.21 from EPEL after it is released... :)
the code is already fixed in the devel branch. Il will release th 2.21 in june
Thanks for the quick fi! BTW, it appears that RHEL9 is based off of Fedora 34: https://docs.fedoraproject.org/en-US/quick-docs/fedora-and-red-hat-enterprise-linux/ which is quite a bit older than Fedora 41.
yes, it looks like older versions of rpm2archive does not support "rpm2archiv $Package | tar ..." and mention only cat $package |rpm2archive - | tar ...
I just rewrite the line in the RpmUnpack function
the problem is fixed in 2.21 release