Merge changes Ic2fd4056,I198fb9b7,I0d61ea11,I59d9b8f7

am: 1dc3d3be29

Change-Id: Ie2d88dcbdbfe46e8ce079eed01a39080bed8959b
This commit is contained in:
Jae Shin
2018-08-15 18:20:54 -07:00
committed by android-build-merger

View File

@@ -7,11 +7,11 @@ usage () {
echo
echo "Options -v, -m, -p must precede positional arguments."
echo
echo "vendor_version is the version of the vendor image when the mixed"
echo " build is inter branch. Optional."
echo "vendor_version is the version of the vendor image when Keymaster v3"
echo " related modifications to the system image is necessary. Optional."
echo " eg. 8.1.0 for a mixed build of GSI and O-MR1 vendor image."
echo "modify_system_image_path is the path to the script that modifies the"
echo " system image for an inter branch build target. Optional."
echo " system image, needed for Keymaster v3. Optional."
echo "override_vbmeta_image_path is the path to a vbmeta.img to use"
echo " to override the existing vbmeta.img of device. Optional."
echo "system_build_dir is the path to the system build"
@@ -67,14 +67,6 @@ fi
shift "$((OPTIND-1))"
if [[ ! -z "${MODIFY_SYSTEM_SCRIPT+x}" && ! -f "$MODIFY_SYSTEM_SCRIPT" ]]; then
exit_badparam "Script not found: "$MODIFY_SYSTEM_SCRIPT""
fi
if [[ ! -z "${OVERRIDE_VBMETA_IMAGE_PATH+x}" && ! -f "$OVERRIDE_VBMETA_IMAGE_PATH" ]]; then
exit_badparam "Specified vbmeta.img not found: "$OVERRIDE_VBMETA_IMAGE_PATH""
fi
if [[ $# -lt 3 ]]; then
exit_badparam "Unexpected number of arguments"
fi
@@ -85,21 +77,44 @@ readonly DIST_DIR="$3"
readonly CHECK_TOOL="$4"
readonly TEMP_DIR="$(mktemp -d /tmp/"$(basename $0)"_XXXXXXXX)"
readonly SYSTEM_TARGET_FILES_ARCHIVE="$(find "$SYSTEM_DIR" -name "*-target_files-*.zip" -print)"
# Retry command until a certain limit.
# Usage: retry "command"
retry () {
NEXT_WAIT_TIME=0
until ($1 && [[ -n "$($1)" ]]) || [[ $NEXT_WAIT_TIME -eq 4 ]]; do
sleep $(( ++NEXT_WAIT_TIME ))
done
}
command="find "$SYSTEM_DIR" -name "*-target_files-*.zip" -print"
retry "$command"
readonly SYSTEM_TARGET_FILES_ARCHIVE="$($command)"
if [[ ! -f "$SYSTEM_TARGET_FILES_ARCHIVE" ]]; then
exit_badparam "Could not find system target files archive in $SYSTEM_DIR."
fi
readonly DEVICE_ARCHIVE="$(find "$DEVICE_DIR" -name "*-img-*.zip" -print)"
command="find "$DEVICE_DIR" -name "*-img-*.zip" -print"
retry "$command"
readonly DEVICE_ARCHIVE="$($command)"
if [[ ! -f "$DEVICE_ARCHIVE" ]]; then
exit_badparam "Could not find device img archive in $DEVICE_DIR."
fi
readonly DEVICE_TARGET_FILES_ARCHIVE="$(find "$DEVICE_DIR" -name "*-target_files-*.zip" -print)"
if [[ ! -f "$DEVICE_ARCHIVE" ]]; then
command="find "$DEVICE_DIR" -name "*-target_files-*.zip" -print"
retry "$command"
readonly DEVICE_TARGET_FILES_ARCHIVE="$($command)"
if [[ ! -f "$DEVICE_TARGET_FILES_ARCHIVE" ]]; then
exit_badparam "Could not find device target_files archive in $DEVICE_DIR."
fi
if [[ ! -z "${MODIFY_SYSTEM_SCRIPT+x}" && ! -f "$MODIFY_SYSTEM_SCRIPT" ]]; then
exit_badparam "Script not found: "$MODIFY_SYSTEM_SCRIPT""
fi
if [[ ! -z "${OVERRIDE_VBMETA_IMAGE_PATH+x}" && ! -f "$OVERRIDE_VBMETA_IMAGE_PATH" ]]; then
exit_badparam "Specified vbmeta.img not found: "$OVERRIDE_VBMETA_IMAGE_PATH""
fi
readonly DEVICE_ARTIFACTS_DIR="$TEMP_DIR"/device_archive_artifacts
readonly DEVICE_IMAGES_DIR="$DEVICE_ARTIFACTS_DIR"/IMAGES
readonly SYSTEM_ARTIFACTS_DIR="$TEMP_DIR"/system_artifacts