diff options
author | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-14 14:41:02 +0000 |
---|---|---|
committer | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-14 14:41:02 +0000 |
commit | dbfc0f25aa7e2a066685c8671f1544afe191b07a (patch) | |
tree | 5140aa619b7cf1b609390ba75f62d219e50dfc94 | |
parent | b0069e7e0f87c230694f8281c04df43b3a3124dc (diff) | |
download | chromium_src-dbfc0f25aa7e2a066685c8671f1544afe191b07a.zip chromium_src-dbfc0f25aa7e2a066685c8671f1544afe191b07a.tar.gz chromium_src-dbfc0f25aa7e2a066685c8671f1544afe191b07a.tar.bz2 |
Small cleanups in dmgdiffer, dirdiffer, and dirpatcher.
Use += to append to arrays.
Declare err before it's used.
Use -L to test for symbolic links.
BUG=45017
TEST=none
Review URL: http://codereview.chromium.org/2799003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49686 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-x | chrome/installer/mac/dirdiffer.sh | 26 | ||||
-rwxr-xr-x | chrome/installer/mac/dirpatcher.sh | 21 | ||||
-rwxr-xr-x | chrome/installer/mac/dmgdiffer.sh | 21 |
3 files changed, 32 insertions, 36 deletions
diff --git a/chrome/installer/mac/dirdiffer.sh b/chrome/installer/mac/dirdiffer.sh index f746d72..81e401c 100755 --- a/chrome/installer/mac/dirdiffer.sh +++ b/chrome/installer/mac/dirdiffer.sh @@ -154,8 +154,13 @@ readonly PLAIN_SUFFIX='$raw' declare DIRDIFFER_EXCLUDE declare DIRDIFFER_NO_DIFF -declare -a g_cleanup g_verify_exclude +err() { + local error="${1}" + echo "${ME}: ${error}" >& 2 +} + +declare -a g_cleanup g_verify_exclude cleanup() { local status=${?} @@ -173,12 +178,6 @@ cleanup() { exit ${status} } -err() { - local error="${1}" - - echo "${ME}: ${error}" >& 2 -} - copy_mode_and_time() { local new_file="${1}" local patch_file="${2}" @@ -189,7 +188,7 @@ copy_mode_and_time() { exit 16 fi - if ! [[ -h "${patch_file}" ]]; then + if ! [[ -L "${patch_file}" ]]; then # Symbolic link modification times can't be copied because there's no # shell tool that provides direct access to lutimes. Instead, the symbolic # link was created with rsync, which already copied the timestamp with @@ -261,7 +260,7 @@ make_patch_file() { keep_size="${gz_size}" fi - if [[ -f "${old_file}" ]] && ! [[ -h "${old_file}" ]] && + if [[ -f "${old_file}" ]] && ! [[ -L "${old_file}" ]] && ! [[ "${new_file}" =~ ${DIRDIFFER_NO_DIFF} ]]; then local gbs_file="${patch_file}${GBS_SUFFIX}" if [[ -e "${gbs_file}" ]]; then @@ -320,7 +319,7 @@ make_patch_dir() { local patch_file="${patch_dir}/${file}" if [[ "${new_file}" =~ ${DIRDIFFER_EXCLUDE} ]]; then - g_verify_exclude[${#g_verify_exclude[@]}]="${new_file}" + g_verify_exclude+=("${new_file}") continue fi @@ -329,7 +328,7 @@ make_patch_dir() { exit 8 fi - if [[ -h "${new_file}" ]]; then + if [[ -L "${new_file}" ]]; then make_patch_symlink "${new_file}" "${patch_file}" elif [[ -d "${new_file}" ]]; then make_patch_dir "${old_file}" "${new_file}" "${patch_file}" @@ -351,7 +350,7 @@ verify_patch_dir() { local verify_temp_dir verify_dir verify_temp_dir="$(mktemp -d -t "${ME}")" - g_cleanup[${#g_cleanup[@]}]="${verify_temp_dir}" + g_cleanup+=("${verify_temp_dir}") verify_dir="${verify_temp_dir}/patched" if ! "${DIRPATCHER}" "${old_dir}" "${patch_dir}" "${verify_dir}"; then @@ -370,8 +369,7 @@ verify_patch_dir() { # ${g_verify_exclude[@]} contains paths in ${new_dir}. Strip off # ${new_dir} from the beginning of each, but leave a leading "/" so that # rsync treats them as being at the root of the "transfer." - rsync_command[${#rsync_command[@]}]="--exclude" - rsync_command[${#rsync_command[@]}]="${exclude:${#new_dir}}" + rsync_command+=("--exclude" "${exclude:${#new_dir}}") done fi diff --git a/chrome/installer/mac/dirpatcher.sh b/chrome/installer/mac/dirpatcher.sh index 2cff191..c2e019d 100755 --- a/chrome/installer/mac/dirpatcher.sh +++ b/chrome/installer/mac/dirpatcher.sh @@ -96,8 +96,13 @@ readonly BZ2_SUFFIX='$bz2' readonly GZ_SUFFIX='$gz' readonly PLAIN_SUFFIX='$raw' -declare -a g_cleanup +err() { + local error="${1}" + echo "${ME}: ${error}" >& 2 +} + +declare -a g_cleanup cleanup() { local status=${?} @@ -115,12 +120,6 @@ cleanup() { exit ${status} } -err() { - local error="${1}" - - echo "${ME}: ${error}" >& 2 -} - copy_mode_and_time() { local patch_file="${1}" local new_file="${2}" @@ -131,7 +130,7 @@ copy_mode_and_time() { exit 16 fi - if ! [[ -h "${new_file}" ]]; then + if ! [[ -L "${new_file}" ]]; then # Symbolic link modification times can't be copied because there's no # shell tool that provides direct access to lutimes. Instead, the symbolic # link was created with rsync, which already copied the timestamp with @@ -148,7 +147,7 @@ apply_patch() { local new_file="${3}" local patcher="${4}" - if [[ -h "${old_file}" ]] || ! [[ -f "${old_file}" ]]; then + if [[ -L "${old_file}" ]] || ! [[ -f "${old_file}" ]]; then err "can't patch nonexistent or irregular file ${old_file}" exit 12 fi @@ -260,7 +259,7 @@ patch_dir() { exit 8 fi - if [[ -h "${patch_file}" ]]; then + if [[ -L "${patch_file}" ]]; then patch_symlink "${patch_file}" "${new_file}" elif [[ -d "${patch_file}" ]]; then patch_dir "${old_file}" "${patch_file}" "${new_file}" @@ -345,7 +344,7 @@ main() { exit 6 fi - g_cleanup[${#g_cleanup[@]}]="${new_dir}" + g_cleanup+=("${new_dir}") patch_dir "${old_dir}" "${patch_dir}" "${new_dir}" diff --git a/chrome/installer/mac/dmgdiffer.sh b/chrome/installer/mac/dmgdiffer.sh index 37b839b..9a6b6a2 100755 --- a/chrome/installer/mac/dmgdiffer.sh +++ b/chrome/installer/mac/dmgdiffer.sh @@ -77,8 +77,13 @@ readonly SCRIPT_DIR readonly DIRDIFFER="${SCRIPT_DIR}/dirdiffer.sh" readonly PKG_DMG="${SCRIPT_DIR}/pkg-dmg" -declare -a g_cleanup g_cleanup_mount_points +err() { + local error="${1}" + echo "${ME}: ${error}" >& 2 +} + +declare -a g_cleanup g_cleanup_mount_points cleanup() { local status=${?} @@ -103,12 +108,6 @@ cleanup() { exit ${status} } -err() { - local error="${1}" - - echo "${ME}: ${error}" >& 2 -} - mount_dmg() { local dmg="${1}" local mount_point="${2}" @@ -147,7 +146,7 @@ make_patch_fs() { readonly VERSIONS_DIR="Contents/Versions" readonly PRODUCT_URL="http://www.google.com/chrome/" readonly BUILD_RE="^[0-9]+\\.[0-9]+\\.([0-9]+)\\.[0-9]+\$" - readonly MIN_BUILD=434 + readonly MIN_BUILD=375 local old_app_path="${old_fs}/${APP_NAME}" local old_app_info_plist="${old_app_path}/${APP_INFO_PLIST}" @@ -322,17 +321,17 @@ make_patch_dmg() { local temp_dir temp_dir="$(mktemp -d -t "${ME}")" - g_cleanup[${#g_cleanup[@]}]="${temp_dir}" + g_cleanup+=("${temp_dir}") local old_mount_point="${temp_dir}/old" - g_cleanup_mount_points[${#g_cleanup_mount_points[@]}]="${old_mount_point}" + g_cleanup_mount_points+=("${old_mount_point}") if ! mount_dmg "${old_dmg}" "${old_mount_point}"; then err "could not mount old_dmg ${old_dmg}" exit 6 fi local new_mount_point="${temp_dir}/new" - g_cleanup_mount_points[${#g_cleanup_mount_points[@]}]="${new_mount_point}" + g_cleanup_mount_points+=("${new_mount_point}") if ! mount_dmg "${new_dmg}" "${new_mount_point}"; then err "could not mount new_dmg ${new_dmg}" exit 7 |