From b05f8e93f6030556e660784f7a049cce1c54e9cd Mon Sep 17 00:00:00 2001 From: Mohan Boddu Date: Jan 06 2021 17:50:29 +0000 Subject: Attempt 2: Update epel-release-latest-.noarch.rpm on /pub/epel Use the relative path to symlink and only use x86_64/ dir for symlinking This reverts commit 297a736e801f448cc9f5ea0e5c67b3a4e2a61389. --- diff --git a/roles/bodhi2/backend/files/new-updates-sync b/roles/bodhi2/backend/files/new-updates-sync index 8bf0deb..ec39904 100755 --- a/roles/bodhi2/backend/files/new-updates-sync +++ b/roles/bodhi2/backend/files/new-updates-sync @@ -13,6 +13,7 @@ import fedora_messaging.api import fedora_messaging.config import fedora_messaging.exceptions +from pathlib import Path logging.basicConfig(level=logging.ERROR) logger = logging.getLogger('updates-sync') @@ -393,6 +394,20 @@ def sync_single_release(release): return needssync +def update_epel_release_latest(releases): + for release in releases: + if 'epel' in release: + 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): + dest = '/pub/epel/epel-release-latest-' + release[4]+ '.noarch.rpm' + if os.path.exists(dest): + if not os.path.exists(os.readlink(dest)): + os.remove(dest) + os.symlink(os.path.relpath(path, os.path.dirname(dest)), dest) + break + else: + os.symlink(os.path.relpath(path, os.path.dirname(dest)), dest) + break def main(): parser = argparse.ArgumentParser() @@ -418,7 +433,7 @@ def main(): to_update = list(set(to_update)) logger.info('Filelists to update: %s', to_update) update_fullfilelist(to_update) - + update_epel_release_latest(args.releases) if __name__ == '__main__': main()