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')
|
default=False, help='Don\'t report version information')
|
||||||
parser.add_argument('--dont-strip-revision', action='store_true',
|
parser.add_argument('--dont-strip-revision', action='store_true',
|
||||||
default=False, help='Always treat VERSION macro as VERSION-REVISION')
|
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',
|
parser.add_argument('--dont-expand-version-macros', action='store_true',
|
||||||
default=False, help='Don\'t expand VERSION and REVISION macros')
|
default=False, help='Don\'t expand VERSION and REVISION macros')
|
||||||
args = parser.parse_args(args_)
|
args = parser.parse_args(args_)
|
||||||
|
|
@ -507,12 +509,20 @@ def pkg_relations(rel_type, args_):
|
||||||
else:
|
else:
|
||||||
subsecs = args.subsections.split(',')
|
subsecs = args.subsections.split(',')
|
||||||
debug('flavour = ', args.flavour, ', subsecs = ', ' '.join(subsecs))
|
debug('flavour = ', args.flavour, ', subsecs = ', ' '.join(subsecs))
|
||||||
|
|
||||||
r = []
|
r = []
|
||||||
flavours = args.flavour.split(',')
|
flavours = args.flavour.split(',')
|
||||||
for flavour in flavours:
|
for flavour in flavours:
|
||||||
for s in subsecs:
|
for s in subsecs:
|
||||||
for m in args.module:
|
section = 'pkg.' + rel_type + '.' + s
|
||||||
value = get_value(m, 'pkg.' + rel_type + '.' + s, flavour)
|
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:
|
if not value:
|
||||||
continue
|
continue
|
||||||
deps = value.split(',')
|
deps = value.split(',')
|
||||||
|
|
@ -521,29 +531,34 @@ def pkg_relations(rel_type, args_):
|
||||||
if args.no_version:
|
if args.no_version:
|
||||||
dep = dep[:1]
|
dep = dep[:1]
|
||||||
dep = list(map(str.strip, dep))
|
dep = list(map(str.strip, dep))
|
||||||
|
dep_name = re.sub('-dev$|-devel$|-run$', '', dep[0])
|
||||||
if args.no_subpackages:
|
if args.no_subpackages:
|
||||||
dep[0] = re.sub('-dev$|-devel$|-run$', '', dep[0])
|
dep[0] = dep_name
|
||||||
for i, item in enumerate(dep):
|
for i, item in enumerate(dep):
|
||||||
dep[i] = item.strip()
|
dep[i] = item.strip()
|
||||||
if s == 'jw' and len(dep) == 3:
|
if s == 'jw':
|
||||||
dep_project = re.sub(r'-devel$|-dev$|-run$', '', dep[0])
|
if args.recursive and not dep_name in visited and not dep_name in modules:
|
||||||
if args.dont_expand_version_macros and dep_project in args.module:
|
modules.append(dep_name)
|
||||||
version = dep[2]
|
if len(dep) == 3:
|
||||||
else:
|
if args.dont_expand_version_macros and dep_name in args.module:
|
||||||
version = get_value(dep_project, 'version', '')
|
version = dep[2]
|
||||||
if dep[2] == 'VERSION':
|
|
||||||
if args.dont_strip_revision:
|
|
||||||
dep[2] = version
|
|
||||||
else:
|
else:
|
||||||
dep[2] = version.split('-')[0]
|
version = get_value(dep_name, 'version', '')
|
||||||
elif dep[2] == 'VERSION-REVISION':
|
if dep[2] == 'VERSION':
|
||||||
dep[2] = version
|
if args.dont_strip_revision:
|
||||||
elif version_pattern.match(dep[2]):
|
dep[2] = version
|
||||||
# dep[2] = dep[2]
|
else:
|
||||||
pass
|
dep[2] = version.split('-')[0]
|
||||||
else:
|
elif dep[2] == 'VERSION-REVISION':
|
||||||
raise Exception("Unknown version specifier in " + spec)
|
dep[2] = version
|
||||||
r.append(' '.join(dep))
|
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))
|
print(args.delimiter.join(r))
|
||||||
|
|
||||||
def get_libname(names):
|
def get_libname(names):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue