projects.py: Add argument --ignore to pkg_relations()

Packages that should be ignored altogether with their dependencies can now be
specified with --ignore to various commands using pkg_relations().

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2019-06-21 12:52:53 +00:00
commit 6eee41ac08

View file

@ -332,6 +332,8 @@ class Projects(object):
default=False, help='Find dependencies recursively')
parser.add_argument('--dont-expand-version-macros', action='store_true',
default=False, help='Don\'t expand VERSION and REVISION macros')
parser.add_argument('--ignore', nargs='?', default='', help='Packages that '
'should be ignored together with their dependencies')
args = parser.parse_args(args_)
version_pattern=re.compile("[0-9-.]*")
if args.subsections is None:
@ -340,6 +342,8 @@ class Projects(object):
else:
subsecs = args.subsections.split(',')
self.debug('flavour = ', args.flavour, ', subsecs = ', ' '.join(subsecs))
ignore = args.ignore.split(',')
self.debug("ignore = ", ignore)
r = []
flavours = args.flavour.split(',')
@ -350,7 +354,7 @@ class Projects(object):
modules = args.module.copy()
while len(modules):
m = modules.pop(0)
if m in visited:
if m in visited or m in ignore:
continue
visited.add(m)
value = self.get_value(m, section, flavour)
@ -363,6 +367,8 @@ class Projects(object):
dep = dep[:1]
dep = list(map(str.strip, dep))
dep_name = re.sub('-dev$|-devel$|-run$', '', dep[0])
if dep_name in ignore or dep[0] in ignore:
continue
if args.no_subpackages:
dep[0] = dep_name
for i, item in enumerate(dep):
@ -389,6 +395,7 @@ class Projects(object):
raise Exception("Unknown version specifier in " + spec)
cleaned_dep = ' '.join(dep)
if not cleaned_dep in r:
self.debug("appending", cleaned_dep)
r.append(cleaned_dep)
return args.delimiter.join(r)