From 074d0df916f864830f1885a8997ef7029079a364 Mon Sep 17 00:00:00 2001 From: oshima Date: Sat, 6 Sep 2014 13:03:51 -0700 Subject: Exit if pngcrush has a bug BUG=404893 Review URL: https://codereview.chromium.org/549553002 Cr-Commit-Position: refs/heads/master@{#293631} --- tools/resources/optimize-png-files.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tools/resources') diff --git a/tools/resources/optimize-png-files.sh b/tools/resources/optimize-png-files.sh index d9347ee..c7b37d7 100755 --- a/tools/resources/optimize-png-files.sh +++ b/tools/resources/optimize-png-files.sh @@ -381,6 +381,19 @@ function fail_if_not_installed { fi } +# Check pngcrush version and exit if the version is in bad range. +# See crbug.com/404893. +function exit_if_bad_pngcrush_version { + local version=$(pngcrush -v | awk "/pngcrush 1.7./ {print \$3}") + local version_num=$(echo $version | sed "s/\.//g") + if [[ (1748 -lt $version_num && $version_num -lt 1773) ]] ; then + echo "Your pngcrush ($version) has a bug that exists from " \ + "1.7.49 to 1.7.72 (see crbug.com/404893 for details)." + echo "Please upgrade pngcrush and try again" + exit 1; + fi +} + function show_help { local program=$(basename $0) echo \ @@ -461,6 +474,8 @@ shift $(($OPTIND -1)) # Make sure we have all necessary commands installed. install_if_not_installed pngcrush pngcrush +exit_if_bad_pngcrush_version + if [ $OPTIMIZE_LEVEL -ge 1 ]; then install_if_not_installed optipng optipng -- cgit v1.1