From 2cc754c462f4a628257f53d14d4e957d736155b4 Mon Sep 17 00:00:00 2001 From: Dostoievski Batista Date: Thu, 23 Mar 2023 16:46:13 -0300 Subject: [PATCH] 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 Change-Id: I703a9c0146c5b8b49c53ae8abdc290e32befd93e --- build-tools/stx/build-pkgs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/build-tools/stx/build-pkgs b/build-tools/stx/build-pkgs index 0197240a..92ac8cbd 100755 --- a/build-tools/stx/build-pkgs +++ b/build-tools/stx/build-pkgs @@ -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}///*.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