Bug#944678: rinse downloads not reproduceable

2019-11-26 Thread Stefan Möding

I’ve created the attached patch for the ’rinse’ script. The updated code
uses a sorted array of the candidate RPM files matching the requested
package name. Sorting uses a subroutine that determines which package
version has the highest version (according to the rules I found).

This patch seems to work for my environment and allows me to use ’rinse’
for the OracleLinux-7 repository.

Regards,
Stefan



rinse.patch.gz
Description: rinse.patch.gz


Bug#944678: rinse downloads not reproduceable

2019-11-13 Thread Stefan Möding
Package: rinse
Version: 3.3
Severity: important

I’m using rinse as part of the FAI toolchain to install OracleLinux-7
machines. Building the RPM basefile fails about half of the time (e.g.
with message "Failed to initialize NSS library"). Sometimes the error
message suggests that a shared library could not be found.

I believe the root cause is that rinse downloads different packages
every time if the RPM repository contains multiple packages of the same
name (obviously with different version numbers).

I could reproduce this using the following setup:

1) Add the OracleLinux-7 repository to /etc/rinse/rinse.conf

[ol7]
mirror.amd64 = http://public-yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64

2) Create a stripped-down /etc/rinse/ol7.packages

nss
nss-softokn
nss-softokn-freebl
nss-sysinit
nss-tools
nss-util

3) Show what rinse would download

# rinse --directory /tmp --distribution ol7 --arch amd64 --cache 0 --print-uris
http://public-yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/nss-3.34.0-4.el7.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/nss-softokn-3.44.0-5.0.1.el7.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/nss-softokn-freebl-3.34.0-2.0.1.el7.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/nss-sysinit-3.36.0-5.el7_5.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/nss-tools-3.36.0-5.el7_5.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/nss-util-3.34.0-2.el7.x86_64.rpm

# rinse --directory /tmp --distribution ol7 --arch amd64 --cache 0 --print-uris
http://public-yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/nss-3.44.0-4.el7.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/nss-softokn-3.36.0-5.0.1.el7_5.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/nss-softokn-freebl-3.34.0-2.0.1.el7.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/nss-sysinit-3.36.0-7.1.el7_6.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/nss-tools-3.36.0-7.1.el7_6.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/nss-util-3.34.0-2.el7.x86_64.rpm

# rinse --directory /tmp --distribution ol7 --arch amd64 --cache 0 --print-uris
http://public-yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/nss-3.44.0-4.el7.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/nss-softokn-3.36.0-5.0.1.el7_5.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/nss-softokn-freebl-3.36.0-5.0.1.el7_5.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/nss-sysinit-3.36.0-7.el7_5.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/nss-tools-3.44.0-4.el7.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/nss-util-3.36.0-1.1.el7_6.x86_64.rpm


As you can see I get each time a different mixture of 3.34, 3.36 and
3.44 package versions if I run the same command multiple times in a row.

NSS is used by the ’rpm’ package to unpack the packages in the chroot
which sometimes fails caused by mismatching shared libraries. Therefore
I don’t get a working base in the chroot where I could use ’yum’ to
update all the packages to the latest version.

I believe that ’rinse’ should only download the latest version of every
package found in the package repository. Currently it looks like it is
downloading a random package that matches the name.

I’m not sure if this also happenw with other distributions. But it looks
like Oracle keeps old packages in the repository causing it to fail.

Regards,
Stefan