Attempt 2: Update epel-release-latest-<rel>.noarch.rpm on /pub/epel

Use the relative path to symlink and only use x86_64/ dir for symlinking

This reverts commit 297a736e80.
This commit is contained in:
Mohan Boddu 2020-12-02 17:16:45 -05:00 committed by mohanboddu
parent bd0219f65f
commit b05f8e93f6

View file

@ -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()