Message when building non-existing package

When user try to build a package that doesn't
exist, build-pkgs will now display a message
saying which package it didn't find.

Test Plan:
PASS: build-pkgs -c -p thereisnopackagewiththisname
PASS: build-pkgs -c -p thereisnopackagewiththisname,logmgmt
PASS: build-pkgs -c -p logmgmt
PASS: build-pkgs

Story: 2008846
Task: 47668

Signed-off-by: Dostoievski Batista <dostoievski.albinobatista@windriver.com>
Change-Id: I703a9c0146c5b8b49c53ae8abdc290e32befd93e
This commit is contained in:
Dostoievski Batista 2023-03-23 16:46:13 -03:00
parent 566ef1a56d
commit 2cc754c462

View File

@ -648,6 +648,8 @@ class BuildController():
caches_dir = os.path.join(BUILD_ROOT, 'caches')
os.makedirs(caches_dir, exist_ok=True)
self.lists['pkgs_not_found'] = []
for build_type in build_types_to_init:
self.lists['success_' + build_type] = []
self.lists['fail_' + build_type] = []
@ -1536,6 +1538,10 @@ class BuildController():
else:
layers = ALL_LAYERS
if packages:
# We save all pkgs specified by the user and remove it as we find it.
self.lists['pkgs_not_found'] = packages
if build_types:
for build_type in build_types:
if build_type not in ALL_BUILD_TYPES:
@ -1584,6 +1590,9 @@ class BuildController():
pkg_dirs, pkgs_exist = discovery.filter_package_dirs_by_package_names(pkg_dirs, packages, distro=self.attrs['distro'])
self.save_failed_pkgs(pkgs_exist, packages, build_type)
layer_pkg_dirs = pkg_dirs
for pkg in self.lists['pkgs_not_found'].copy():
if pkg in pkgs_exist.values():
self.lists['pkgs_not_found'].remove(pkg)
if not pkg_dirs:
logger.debug(' '.join(['Found no buildable packages matching selection criteria in build_type',
@ -1931,6 +1940,15 @@ class BuildController():
logger.info("For the failure reason, you can check with:")
logger.info("\'cat /localdisk/builder.log | grep ERROR\' or")
logger.info("\'cat ${MY_WORKSPACE}/<std or rt>/<Failed package>/*.build\'")
if len(self.lists['pkgs_not_found']) > 0:
# self.lists['pkgs_not_found'] is set of packages specified by the user that has not been found
ret_val = 1
logger.info("-------------------------------------------")
logger.error('The following packages were not found in the building process:')
for pkg in self.lists['pkgs_not_found']:
logger.error(pkg)
return ret_val