root/build-tools/image-utils.sh
Scott Little fa455c0b94 Tool changes to allow image.inc to be split across git repos.
Currently compiling a new package and adding it
to the iso still requires a multi-git update because
image.inc is a single centralized file in the root git.

It would be better to allow a single git update to add
a package. Too allow this, image.inc must be split across
the git repos and the build tools must be changed to
read/merge those files to arrive at the final package list.

Current scheme is to name the image.inc files using this
schema.

${distro}_${build_target}_image_${build_type}.inc

distro = centos, ...
build_target = iso, guest ...
build_type = std, rt ...

Traditionally build_type=std is omitted from config files,
so we instread use ${distro}_${build_target}_image.inc.

Story: 2003447
Task: 24650
Change-Id: Ib39b8063e7759842ba15330c68503bfe2dea6e20
Signed-off-by: Scott Little <scott.little@windriver.com>
2018-08-17 15:00:42 +00:00

55 lines
1.4 KiB
Bash
Executable File

#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
#
# A place for any functions related to image.inc files
#
IMAGE_UTILS_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}" )" )"
source "${IMAGE_UTILS_DIR}/git-utils.sh"
#
# image_inc_list <build_target> <build_type> <distro>
#
# Parameters:
# build_target: One of 'iso', 'guest' ...
# build_type: One of 'std', 'rt', 'dev' ...
# distro: One of 'centos', ...
#
# Returns: A list of unique package that must be included for
# the desired distro's build target and build type.
# This is the union of the global and per git
# image.inc files.
image_inc_list () {
local build_target=$1
local build_type=$2
local distro=$3
local root_file=""
local build_type_extension=""
local search_target=""
if [ "${build_type}" != "std" ]; then
build_type_extension="_${build_type}"
build_type_extension_bt="-${build_type}"
fi
root_dir="${MY_REPO}/build-tools/build_${build_target}"
root_file="${root_dir}/image${build_type_extension_bt}.inc"
search_target=${distro}_${build_target}_image${build_type_extension}.inc
(
if [ -f ${root_file} ]; then
grep '^[^#]' ${root_file}
fi
for d in $GIT_LIST; do
find $d -maxdepth 1 -name "${search_target}" -exec grep '^[^#]' {} +
done
) | sort --unique
}