Skip to content

Commit

Permalink
Fix 'iocage fetch' sorting (iocage#716) (#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Schneider committed Dec 13, 2018
1 parent 8f7d0e1 commit 350d3e2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions iocage_lib/ioc_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ def sort_template(template):
return sort_name(_template) + get_name_sortkey(template[1])


def sort_release(releases, split=False):
def sort_release(releases, split=False, fetch_releases=False):
"""
Sort the list by RELEASE, if split is true it's expecting full
datasets.
Expand All @@ -373,7 +373,9 @@ def sort_release(releases, split=False):

length = len(releases)

if length == 9 or length == 10:
if fetch_releases:
pass
elif length == 9 or length == 10:
# Attempt to split off the -p* stuff.
try:
_release, _patch = releases[5].rsplit("-p", 1)
Expand Down
8 changes: 5 additions & 3 deletions iocage_lib/ioc_fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,8 @@ def fetch_http_release(self, eol, _list=False):
_callback=self.callback,
silent=self.silent)

releases = iocage_lib.ioc_common.sort_release(releases)
releases = iocage_lib.ioc_common.sort_release(
releases, fetch_releases=True)

for r in releases:
iocage_lib.ioc_common.logit(
Expand Down Expand Up @@ -461,11 +462,12 @@ def fetch_http_release(self, eol, _list=False):
_callback=self.callback,
silent=self.silent)

releases = iocage_lib.ioc_common.sort_release(
releases, fetch_releases=True)

if _list:
return releases

releases = iocage_lib.ioc_common.sort_release(releases)

for r in releases:
if r in eol:
iocage_lib.ioc_common.logit(
Expand Down

0 comments on commit 350d3e2

Please sign in to comment.