Decide if the source should be actually skipped

This commit is contained in:
Bo Maryniuk 2018-12-04 16:39:08 +01:00 committed by Daniel Wozniak
parent c6638f7229
commit 7c70497eeb

View file

@ -1645,6 +1645,27 @@ def list_repo_pkgs(*args, **kwargs): # pylint: disable=unused-import
return ret
def _skip_source(source):
'''
Decide to skip source or not.
:param source:
:return:
'''
if source.invalid:
if source.uri and source.type and source.type in ("deb", "deb-src", "rpm", "rpm-src"):
pieces = source.mysplit(source.line)
if pieces[1].strip()[0] == "[":
options = pieces.pop(1).strip("[]").split()
if len(options) > 0:
log.debug("Source %s will be included although is marked invalid", source.uri)
return False
return True
else:
return True
return False
def list_repos():
"""
Lists all repos in the sources.list (and sources.lists.d) files
@ -1660,7 +1681,7 @@ def list_repos():
repos = {}
sources = sourceslist.SourcesList()
for source in sources.list:
if source.invalid:
if _skip_source(source):
continue
repo = {}
repo["file"] = source.file