From a61301b4a9203582c214e9de586e999d1c6829d4 Mon Sep 17 00:00:00 2001 From: Yue Tao Date: Sat, 27 Aug 2022 18:54:48 +0800 Subject: [PATCH] Debian: build-image support debian_iso_image.inc We plan to break down the huge file "stx-std.lst" to debian_iso_image.inc in each respository. This is the first step that build-image add the packages in debian_iso_image.inc to yaml_doc['packages'] after adding the packages in "stx-std.lst". Test Plan: Pass: build-image, all packages in existing debian_iso_image.inc files are already in "stx-std.lst", so no change to ISO image. Story: 2008846 Task: 46141 Signed-off-by: Yue Tao Change-Id: I6c3fea78a1c22592f608551fee0a332809352423 --- build-tools/stx/build-image | 6 ++++++ build-tools/stx/discovery.py | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/build-tools/stx/build-image b/build-tools/stx/build-image index 0f91afc8..29623197 100755 --- a/build-tools/stx/build-image +++ b/build-tools/stx/build-image @@ -31,6 +31,7 @@ import yaml STX_DEFAULT_DISTRO = discovery.STX_DEFAULT_DISTRO ALL_LAYERS = discovery.get_all_layers(distro=STX_DEFAULT_DISTRO) +ALL_BUILD_TYPES = discovery.get_all_build_types(distro=STX_DEFAULT_DISTRO) LAT_ROOT = '/localdisk' REPO_ALL = 'deb-merge-all' @@ -289,6 +290,11 @@ def add_lat_packages(img_yaml, packages): with open(img_yaml) as f: yaml_doc = yaml.safe_load(f) yaml_doc['packages'].extend(packages) + + for build_type in ALL_BUILD_TYPES: + pkgs = discovery.package_iso_list(distro=STX_DEFAULT_DISTRO, layer="all", build_type=build_type) + yaml_doc['packages'].extend(pkgs) + yaml_doc['packages'] = list(set(yaml_doc['packages'])) yaml_doc['packages'].sort() diff --git a/build-tools/stx/discovery.py b/build-tools/stx/discovery.py index 3e35dfa7..3de7d489 100644 --- a/build-tools/stx/discovery.py +++ b/build-tools/stx/discovery.py @@ -185,6 +185,23 @@ def package_dir_list_handler(entry, proj_dir): return [] return [ path ] + +def package_iso_list (distro="debian", layer="all", build_type="std", skip_non_buildable=True): + pkg_iso_list = [] + if layer is None: + layer = "all" + for proj_dir in project_dir_list(distro=distro, layer=layer, skip_non_buildable=skip_non_buildable): + iso_file = os.path.join(proj_dir, "%s%s%s%s" % (distro, "_iso_image_", build_type, ".inc")) + if not os.path.isfile(iso_file): + if build_type == "std": + # It's permitted to omit the "_std" suffix from the file name + iso_file = os.path.join(proj_dir, "%s%s" % (distro, "_iso_image.inc")) + if not os.path.isfile(iso_file): + continue + pkg_iso_list.extend(bc_safe_fetch(iso_file)) + return pkg_iso_list + + def package_dir_list (distro="debian", layer="all", build_type="std", skip_non_buildable=True): pkg_dir_list = [] if layer is None: