mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 12:03:31 +01:00
projects.py / pkg-relations(): Add option --recursive
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
7abbf1d044
commit
a85640e58c
1 changed files with 36 additions and 21 deletions
|
|
@ -497,6 +497,8 @@ def pkg_relations(rel_type, args_):
|
|||
default=False, help='Don\'t report version information')
|
||||
parser.add_argument('--dont-strip-revision', action='store_true',
|
||||
default=False, help='Always treat VERSION macro as VERSION-REVISION')
|
||||
parser.add_argument('--recursive', action='store_true',
|
||||
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')
|
||||
args = parser.parse_args(args_)
|
||||
|
|
@ -507,12 +509,20 @@ def pkg_relations(rel_type, args_):
|
|||
else:
|
||||
subsecs = args.subsections.split(',')
|
||||
debug('flavour = ', args.flavour, ', subsecs = ', ' '.join(subsecs))
|
||||
|
||||
r = []
|
||||
flavours = args.flavour.split(',')
|
||||
for flavour in flavours:
|
||||
for s in subsecs:
|
||||
for m in args.module:
|
||||
value = get_value(m, 'pkg.' + rel_type + '.' + s, flavour)
|
||||
section = 'pkg.' + rel_type + '.' + s
|
||||
visited = set()
|
||||
modules = args.module.copy()
|
||||
while len(modules):
|
||||
m = modules.pop(0)
|
||||
if m in visited:
|
||||
continue
|
||||
visited.add(m)
|
||||
value = get_value(m, section, flavour)
|
||||
if not value:
|
||||
continue
|
||||
deps = value.split(',')
|
||||
|
|
@ -521,29 +531,34 @@ def pkg_relations(rel_type, args_):
|
|||
if args.no_version:
|
||||
dep = dep[:1]
|
||||
dep = list(map(str.strip, dep))
|
||||
dep_name = re.sub('-dev$|-devel$|-run$', '', dep[0])
|
||||
if args.no_subpackages:
|
||||
dep[0] = re.sub('-dev$|-devel$|-run$', '', dep[0])
|
||||
dep[0] = dep_name
|
||||
for i, item in enumerate(dep):
|
||||
dep[i] = item.strip()
|
||||
if s == 'jw' and len(dep) == 3:
|
||||
dep_project = re.sub(r'-devel$|-dev$|-run$', '', dep[0])
|
||||
if args.dont_expand_version_macros and dep_project in args.module:
|
||||
version = dep[2]
|
||||
else:
|
||||
version = get_value(dep_project, 'version', '')
|
||||
if dep[2] == 'VERSION':
|
||||
if args.dont_strip_revision:
|
||||
dep[2] = version
|
||||
if s == 'jw':
|
||||
if args.recursive and not dep_name in visited and not dep_name in modules:
|
||||
modules.append(dep_name)
|
||||
if len(dep) == 3:
|
||||
if args.dont_expand_version_macros and dep_name in args.module:
|
||||
version = dep[2]
|
||||
else:
|
||||
dep[2] = version.split('-')[0]
|
||||
elif dep[2] == 'VERSION-REVISION':
|
||||
dep[2] = version
|
||||
elif version_pattern.match(dep[2]):
|
||||
# dep[2] = dep[2]
|
||||
pass
|
||||
else:
|
||||
raise Exception("Unknown version specifier in " + spec)
|
||||
r.append(' '.join(dep))
|
||||
version = get_value(dep_name, 'version', '')
|
||||
if dep[2] == 'VERSION':
|
||||
if args.dont_strip_revision:
|
||||
dep[2] = version
|
||||
else:
|
||||
dep[2] = version.split('-')[0]
|
||||
elif dep[2] == 'VERSION-REVISION':
|
||||
dep[2] = version
|
||||
elif version_pattern.match(dep[2]):
|
||||
# dep[2] = dep[2]
|
||||
pass
|
||||
else:
|
||||
raise Exception("Unknown version specifier in " + spec)
|
||||
cleaned_dep = ' '.join(dep)
|
||||
if not cleaned_dep in r:
|
||||
r.append(cleaned_dep)
|
||||
print(args.delimiter.join(r))
|
||||
|
||||
def get_libname(names):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue