uyuni-project / uyuni

Source code for Uyuni
https://www.uyuni-project.org/
GNU General Public License v2.0
434 stars 181 forks source link

spacewalk-repo-sync and "--latest" do not show latest packages.... #9212

Open marmau06 opened 2 months ago

marmau06 commented 2 months ago

Problem description

spacewalk-repo-sync and "--latest" do not show latest packages.... and seems to only show one version for each package..

Steps to reproduce

1.For example, for RHEL8 repository, use "spacewalk-repo-sync and "--latest" image Here we can see only kernel-4.18.0-553.el8_10.x86_64.

  1. looking for kernel packages files, we can found a lot of files, including "4.18.0-553.16.1.el8_10", image

3.Once spacewalk-repo-sync has been used without "--latest", Uyuni proposal is bigger (209 kernel packages instead of three), and include the latest version of kernel: image

...

Uyuni version

Information for package Uyuni-Server-release:
---------------------------------------------
Repository     : @System
Name           : Uyuni-Server-release
Version        : 2024.02-230900.213.1.uyuni3
Arch           : x86_64
Vendor         : obs://build.opensuse.org/systemsmanagement:Uyuni
Installed Size : 1.4 KiB
Installed      : Yes (automatically)
Status         : up-to-date
Source package : Uyuni-Server-release-2024.02-230900.213.1.uyuni3.src
Summary        : Uyuni Server
Description    : 
    Uyuni lets you efficiently manage physical, virtual,
    and cloud-based Linux systems. It provides automated and cost-effective
    configuration and software management, asset management, and system
    provisioning.

Uyuni proxy version (if used)

None

Useful logs

No log to provide...

Additional information

We tried to upgrade Uyuni to the latest version (2024-07) just to see if this behavior is still present... We got other big issues with spacewalk-repo-sync command, which do not work anyumore for other reason... So we have the workaround to remove the "--latest" switch to the command used, but it seems that "latest" package is not well managed by Uyuni.

mbussolotto commented 1 month ago

@meaksh FYI

agraul commented 20 hours ago

I think there is a little misunderstanding what --latest means. This options filters the list of packages to sync so that only the latest version of each package is synced. It's expected that there is only one package version for "kernel-4.18.0" when --latest is used.

Looking at the determination of "latest package version" here, I agree that this is a bug. We use Salt's LooseVersion() in our yum_src reposync plugin, but that gives us the wrong result in this case.

>>> a = "kernel-4.18.0-553.el8_10"
>>> b = "4.18.0-553.16.1.el8_10"
>>> LooseVersion(a) > LooseVersion(b)
True

vs

% rpmdev-vercmp kernel-4.18.0-553.el8_10 4.18.0-553.16.1.el8_10
rpmdev-vercmp kernel-4.18.0-553.el8_10 4.18.0-553.16.1.el8_10
WARNING: hyphen in release1: 4.18.0-553.el8_10

rpmdev-vercmp <epoch1> <ver1> <release1> <epoch2> <ver2> <release2>
rpmdev-vercmp <EVR1> <EVR2>
rpmdev-vercmp # with no arguments, prompt

Exit status is 0 if the EVR's are equal, 11 if EVR1 is newer, and 12 if EVR2
is newer.  Other exit statuses indicate problems.

kernel-4.18.0-553.el8_10 < 4.18.0-553.16.1.el8_10