bodhi / new-updates-sync / epel7: fix epel7 latest release sync

Recently (possibly with the new python in fedora 38), the updates-sync
logic that updates the 'latest' link for epel-release rpms has started
replacing it everytime it runs. Since this is every minute, it sometimes
results in people getting odd perm denied errors when they try and fetch
it as it's being removed or updated.

The problem seems to be that the script looks for all
epel-release*noarch* packages under a release tree and then links to the
x86_64 one. With all the other epel branches, x86_64 was the last one it
saw with the file glob, so everything was fine.

For some reason on epel7 now, it's seeing them in the following order:
/pub/epel/7/ppc64/Packages/e/epel-release-7-11.noarch.rpm
/pub/epel/7/x86_64/Packages/e/epel-release-7-14.noarch.rpm
/pub/epel/7/ppc64le/Packages/e/epel-release-7-14.noarch.rpm
/pub/epel/7/aarch64/Packages/e/epel-release-7-12.noarch.rpm

This means it sees the 'aarch64' one last and since it's not = to the
x86_64 one, it replaces it. Luckily it's hard coded to use the x86_64
one so the link is always the same, it's just never equal to the one
it's checking against.

I am not sure why this is happening only on epel7, but this PR just
sorts all the path's so that x86_64 is always 'last' and should match
up.

Signed-off-by: Kevin Fenzi <kevin@scrye.com>
This commit is contained in:
Kevin Fenzi 2023-10-09 10:39:18 -07:00 committed by kevin
parent 29001c9704
commit afe74d88a4

View file

@ -493,7 +493,7 @@ def get_epel_release_rel_path(release, epel_next=False):
if 'Packages' in str(path) and 'x86_64' in str(path):
pkg_relpath = os.path.relpath(path,EPELDEST)
else:
for path in Path(RELEASES[release]['repos']['epel']['to'][0]['dest']).rglob('epel-release*noarch*'):
for path in sorted(Path(RELEASES[release]['repos']['epel']['to'][0]['dest']).rglob('epel-release*noarch*')):
if 'Packages' in str(path) and 'x86_64' in str(path):
pkg_relpath = os.path.relpath(path,EPELDEST)
return path, pkg_relpath