From 2654eaa7efe90f8d98e5444f8665330e0ae77a8b Mon Sep 17 00:00:00 2001 From: Vladimir Oltean Date: Tue, 12 Jun 2018 01:17:35 +0300 Subject: [PATCH] extract_utils: prefix_match(): do not strip target_args from its output * The write_product_copy_files() and write_product_packages() functions rely on its undocumented behavior of keeping target_args in the returned list, because they are users of target_args (such as ";PRESIGNED" etc). * Make the behavior documented. Change-Id: If71595dca32abd40039706d4fed2d7f12e005365 Signed-off-by: Vladimir Oltean --- build/tools/extract_utils.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/build/tools/extract_utils.sh b/build/tools/extract_utils.sh index 69fabd3e..b0c712a0 100644 --- a/build/tools/extract_utils.sh +++ b/build/tools/extract_utils.sh @@ -147,17 +147,23 @@ function target_args() { # # prefix_match: # -# $1: the prefix to match on -# -# Internal function which loops thru the packages list and returns a new -# list containing the matched files with the prefix stripped away. +# input: +# - $1: prefix +# - (global variable) PRODUCT_PACKAGES_LIST: array of [src:]dst[;args] specs. +# output: +# - new array consisting of dst[;args] entries where $1 is a prefix of ${dst}. # function prefix_match() { local PREFIX="$1" for LINE in "${PRODUCT_PACKAGES_LIST[@]}"; do local FILE=$(target_file "$LINE") if [[ "$FILE" =~ ^"$PREFIX" ]]; then - printf '%s\n' "${FILE#$PREFIX}" + local ARGS=$(target_args "$LINE") + if [ -z "${ARGS}" ]; then + echo "${FILE#$PREFIX}" + else + echo "${FILE#$PREFIX};${ARGS}" + fi fi done }