More fixes for epel release symlink

Signed-off-by: Mohan Boddu <mboddu@bhujji.com>
This commit is contained in:
Mohan Boddu 2021-12-09 18:32:02 -05:00
parent 147785c399
commit f2d96224d9

View file

@ -444,6 +444,20 @@ def sync_single_release(release):
return needssync
def get_epel_release_rel_path(release, epel_next=False):
"""
Get the relative path of the epel-{next-}release build
"""
if epel_next:
for path in Path(RELEASES[release]['repos']['epel']['to'][0]['dest']).rglob('epel-next-release*noarch*'):
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*'):
if 'Packages' in str(path) and 'x86_64' in str(path):
pkg_relpath = os.path.relpath(path,EPELDEST)
return path, pkg_relpath
def update_epel_release_latest(releases):
"""
This function, creates or updates a symbolic links for epel-release, latest and next, packages.
@ -469,12 +483,10 @@ def update_epel_release_latest(releases):
# For next's epel release, use the subpackage rpm from epel repo instead of
# epel next repo
release = release[:-1]
path, pkg_relpath = get_epel_release_rel_path(release, True)
else:
dest = '/pub/epel/epel-release-latest-' + release[4] + '.noarch.rpm'
for path in 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)
path, pkg_relpath = get_epel_release_rel_path(release)
if os.path.lexists(dest) and os.path.islink(dest):
origin_dest = os.path.join(EPELDEST,os.readlink(dest))
@ -487,6 +499,7 @@ def update_epel_release_latest(releases):
else:
os.symlink(pkg_relpath, dest)
def main():
parser = argparse.ArgumentParser()
parser.add_argument("releases", nargs="*", default=RELEASES)