scanner: report all errors

This commit is contained in:
linsui 2025-07-26 18:33:57 +08:00
parent 19d709edcd
commit 120a1655b4
2 changed files with 20 additions and 8 deletions

View file

@ -2733,17 +2733,17 @@ def getpaths_map(build_dir, globpaths):
paths[p] = [r[len(str(build_dir)) + 1:] for r in glob.glob(full_path)]
if not paths[p]:
not_found_paths.append(p)
return paths, not_found_paths
def getpaths(build_dir, globpaths):
"""Extend via globbing the paths from a field and return them as a set."""
paths_map, not_found_paths = getpaths_map(build_dir, globpaths)
if not_found_paths:
raise FDroidException(
"Some glob paths did not match any files/dirs:\n"
+ "\n".join(not_found_paths)
)
return paths
def getpaths(build_dir, globpaths):
"""Extend via globbing the paths from a field and return them as a set."""
paths_map = getpaths_map(build_dir, globpaths)
paths = set()
for k, v in paths_map.items():
for p in v:

View file

@ -750,8 +750,12 @@ def scan_source(build_dir, build=metadata.Build(), json_per_build=None):
]
]
scanignore = common.getpaths_map(build_dir, build.scanignore)
scandelete = common.getpaths_map(build_dir, build.scandelete)
scanignore, scanignore_not_found_paths = common.getpaths_map(
build_dir, build.scanignore
)
scandelete, scandelete_not_found_paths = common.getpaths_map(
build_dir, build.scandelete
)
scanignore_worked = set()
scandelete_worked = set()
@ -1109,11 +1113,19 @@ def scan_source(build_dir, build=metadata.Build(), json_per_build=None):
json_per_build,
)
for p in scanignore_not_found_paths:
logging.error(_("Non-exist scanignore path: %s") % p)
count += 1
for p in scanignore:
if p not in scanignore_worked:
logging.error(_('Unused scanignore path: %s') % p)
count += 1
for p in scandelete_not_found_paths:
logging.error(_("Non-exist scandelete path: %s") % p)
count += 1
for p in scandelete:
if p not in scandelete_worked:
logging.error(_('Unused scandelete path: %s') % p)