extract_utils: sort the package list before writing blueprints
"comm" requires both input to be sorted. The T_X_LIB32 and T_X_LIB64
arrays from prefix_match-ing PRODUCT_PACKAGES_LIST may not always
be sorted, which causes certain multilib to be mis-categorized as
32-bit and 64-bit separately. The final blueprint would then have
duplicated targets.
Therefore, sort the package list first so that arrays generated
from the package list are also sorted. Set LC_ALL=C to avoid "sort"
using system locale.
Change-Id: Ia2bc9733d89de66eda52059237a54d624ba4b0ad
Signed-off-by: Chenyang Zhong <zhongcy95@gmail.com>
diff --git a/extract_utils.sh b/extract_utils.sh
index 1b6bda7..9e04377 100644
--- a/extract_utils.sh
+++ b/extract_utils.sh
@@ -550,6 +550,9 @@
function write_product_packages() {
PACKAGE_LIST=()
+ # Sort the package list for comm
+ PRODUCT_PACKAGES_LIST=($( printf '%s\n' "${PRODUCT_PACKAGES_LIST[@]}" | LC_ALL=C sort))
+
local COUNT=${#PRODUCT_PACKAGES_LIST[@]}
if [ "$COUNT" = "0" ]; then