updated update_epel_release_latest function to create or update symbolic links for epel-release, latest and next, packages
This commit is contained in:
parent
6231d8fd25
commit
2e7473fdbd
1 changed files with 34 additions and 9 deletions
|
@ -431,19 +431,44 @@ def sync_single_release(release):
|
||||||
return needssync
|
return needssync
|
||||||
|
|
||||||
def update_epel_release_latest(releases):
|
def update_epel_release_latest(releases):
|
||||||
|
"""
|
||||||
|
This function, creates or updates a symbolic links for epel-release, latest and next, packages.
|
||||||
|
|
||||||
|
Creates or updates a symbolic link pointing to the latest release of the epel-release package and
|
||||||
|
another pointing to the next release of the epel-release package.
|
||||||
|
|
||||||
|
The symbolic link will be created or updated if:
|
||||||
|
- There isn't a symbolic link for the latest package;
|
||||||
|
- Current symbolic link is pointing to an outdated package;
|
||||||
|
- Current symbolic link is broken;
|
||||||
|
- There is a file that isn't a link with the same name of the symbolic link.
|
||||||
|
|
||||||
|
If the symbolic link is pointing to the latest release already, this function will do nothing.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
releases (dict): contains similar information of global variable RELEASES
|
||||||
|
"""
|
||||||
for release in releases:
|
for release in releases:
|
||||||
if 'epel' in release:
|
if 'epel' in release:
|
||||||
for path in Path(RELEASES[release]['repos']['epel']['to'][0]['dest']).rglob('epel-release*noarch*'):
|
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):
|
if 'Packages' in str(path) and 'x86_64' in str(path):
|
||||||
dest = '/pub/epel/epel-release-latest-' + release[4]+ '.noarch.rpm'
|
if "next" in str(path):
|
||||||
if os.path.lexists(dest):
|
dest = 'pub/epel/epel-next-release-latest-' + release[4] + '.noarch.rpm'
|
||||||
if not os.path.islink(dest) or not os.path.exists(os.path.join(EPELDEST,os.readlink(dest))):
|
|
||||||
os.remove(dest)
|
|
||||||
os.symlink(os.path.relpath(path, os.path.dirname(dest)), dest)
|
|
||||||
break
|
|
||||||
else:
|
else:
|
||||||
os.symlink(os.path.relpath(path, os.path.dirname(dest)), dest)
|
dest = 'pub/epel/epel-release-latest-' + release[4] + '.noarch.rpm'
|
||||||
break
|
|
||||||
|
pkg_relpath = os.path.relpath(path,EPELDEST)
|
||||||
|
|
||||||
|
if os.path.lexists(dest) and os.path.islink(dest):
|
||||||
|
origin_dest = os.path.join(EPELDEST,os.readlink(dest))
|
||||||
|
if origin_dest != str(path):
|
||||||
|
os.remove(dest)
|
||||||
|
os.symlink(pkg_relpath, dest)
|
||||||
|
elif os.path.lexists(dest) and not os.path.islink(dest):
|
||||||
|
os.remove(dest)
|
||||||
|
os.symlink(pkg_relpath, dest)
|
||||||
|
else:
|
||||||
|
os.symlink(pkg_relpath, dest)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue