packages: make _mode in PKGBUILD optional for building (but not for cmd_check), warn if missing

This commit is contained in:
InsanePrawn 2022-11-03 15:21:44 +01:00
parent 46f1e91f88
commit ec323ce8d7
2 changed files with 7 additions and 1 deletions

View file

@ -484,6 +484,8 @@ def build_package(
extra_packages=['base-devel'] + CROSSDIRECT_PKGS,
clean_chroot=clean_chroot,
)
if not package.mode:
logging.warning('Package {package.path} has no _mode set, assuming "host"')
cross = foreign_arch and package.mode == 'cross' and enable_crosscompile
if cross:

View file

@ -294,7 +294,11 @@ def parse_pkgbuild(
if mode not in ['host', 'cross']:
err = 'an invalid' if mode is not None else 'no'
err_end = f": {repr(mode)}" if mode is not None else "."
raise Exception(f'{relative_pkg_dir}/PKGBUILD has {err} mode configured{err_end}')
msg = f'{relative_pkg_dir}/PKGBUILD has {err} mode configured{err_end}'
if mode is None:
logging.warning(msg)
else:
raise Exception(msg)
base_package = Pkgbase(relative_pkg_dir, sources_refreshed=sources_refreshed, srcinfo_cache=srcinfo_cache)
base_package.mode = mode