mirror of
https://gitlab.com/kupfer/kupferbootstrap.git
synced 2025-06-27 02:35:37 -04:00
packages.py: cmd_{build,check}: fail if no packages match specified path. also enforce_wrap() in check
This commit is contained in:
parent
dfce1cf4e0
commit
6d05f2b9e5
1 changed files with 7 additions and 3 deletions
10
packages.py
10
packages.py
|
@ -191,13 +191,16 @@ def discover_packages() -> dict[str, Package]:
|
||||||
return packages
|
return packages
|
||||||
|
|
||||||
|
|
||||||
def filter_packages_by_paths(repo: dict[str, Package], paths: list[str]) -> list[Package]:
|
def filter_packages_by_paths(repo: dict[str, Package], paths: list[str], allow_empty_results=True) -> list[Package]:
|
||||||
if 'all' in paths:
|
if 'all' in paths:
|
||||||
return repo.values()
|
return repo.values()
|
||||||
result = []
|
result = []
|
||||||
for pkg in repo.values():
|
for pkg in repo.values():
|
||||||
if pkg.path in paths:
|
if pkg.path in paths:
|
||||||
result += [pkg]
|
result += [pkg]
|
||||||
|
|
||||||
|
if not allow_empty_results and not result:
|
||||||
|
raise Exception('No packages matched by paths: ' + ', '.join([f'"{p}"' for p in paths]))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
@ -567,7 +570,7 @@ def build_packages_by_paths(
|
||||||
|
|
||||||
for _arch in set([arch, config.runtime['arch']]):
|
for _arch in set([arch, config.runtime['arch']]):
|
||||||
init_prebuilts(_arch)
|
init_prebuilts(_arch)
|
||||||
packages = filter_packages_by_paths(repo, paths)
|
packages = filter_packages_by_paths(repo, paths, allow_empty_results=False)
|
||||||
return build_packages(
|
return build_packages(
|
||||||
repo,
|
repo,
|
||||||
packages,
|
packages,
|
||||||
|
@ -682,8 +685,9 @@ def cmd_clean():
|
||||||
@cmd_packages.command(name='check')
|
@cmd_packages.command(name='check')
|
||||||
@click.argument('paths', nargs=-1)
|
@click.argument('paths', nargs=-1)
|
||||||
def cmd_check(paths):
|
def cmd_check(paths):
|
||||||
|
enforce_wrap()
|
||||||
paths = list(paths)
|
paths = list(paths)
|
||||||
packages = filter_packages_by_paths(discover_packages(), paths)
|
packages = filter_packages_by_paths(discover_packages(), paths, allow_empty_results=False)
|
||||||
|
|
||||||
for package in packages:
|
for package in packages:
|
||||||
name = package.name
|
name = package.name
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue