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 <olteanv@gmail.com>
gugelfrei
Vladimir Oltean 6 years ago committed by Michael Bestas
parent 6a7946baeb
commit 2654eaa7ef

@ -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
}

Loading…
Cancel
Save