extract_utils: Sort prefix_match() output
* When removing prefix, it might be possible that the resulting array isn't ordered anymore, thus breaking multilib detection with comm in write_product_packages()
* Sort the resulting files list to fix this
Change-Id: If3253c93881814d6c6ec42c9ef8d7b0258535455
diff --git a/extract_utils.sh b/extract_utils.sh
index f9e10c1..e19d588 100644
--- a/extract_utils.sh
+++ b/extract_utils.sh
@@ -217,17 +217,19 @@
#
function prefix_match() {
local PREFIX="$1"
+ local NEW_ARRAY=()
for LINE in "${PRODUCT_PACKAGES_LIST[@]}"; do
local FILE=$(target_file "$LINE")
if [[ "$FILE" =~ ^"$PREFIX" ]]; then
local ARGS=$(target_args "$LINE")
if [ -z "${ARGS}" ]; then
- echo "${FILE#$PREFIX}"
+ NEW_ARRAY+=("${FILE#$PREFIX}")
else
- echo "${FILE#$PREFIX};${ARGS}"
+ NEW_ARRAY+=("${FILE#$PREFIX};${ARGS}")
fi
fi
done
+ printf '%s\n' "${NEW_ARRAY[@]}" | LC_ALL=C sort
}
#