diff options
author | benwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-30 03:56:54 +0000 |
---|---|---|
committer | benwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-30 03:56:54 +0000 |
commit | e989af81feb1c6917e5ddd21abe224b6f25a8ac5 (patch) | |
tree | f9af24ddad98f5bd3b186cb76f622fec6cc1b227 /build/sanitize-png-files.sh | |
parent | 88a91ee3d5549c0a9fff29afa389eb2608f1e78f (diff) | |
download | chromium_src-e989af81feb1c6917e5ddd21abe224b6f25a8ac5.zip chromium_src-e989af81feb1c6917e5ddd21abe224b6f25a8ac5.tar.gz chromium_src-e989af81feb1c6917e5ddd21abe224b6f25a8ac5.tar.bz2 |
Fix a couple of minor bugs with build/sanitize-png-files.sh
The bugs fixed are:
- programs required for -o2 weren't checked for when using -o2
but were checked for lower -o levels.
- if no savings could be found the results printed at the end
were confusing and the script had a divide by zero error.
BUG=None
Review URL: https://chromiumcodereview.appspot.com/15970004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203051 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/sanitize-png-files.sh')
-rwxr-xr-x | build/sanitize-png-files.sh | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/build/sanitize-png-files.sh b/build/sanitize-png-files.sh index 2270e72..ddcfe55 100755 --- a/build/sanitize-png-files.sh +++ b/build/sanitize-png-files.sh @@ -374,7 +374,7 @@ done # Make sure we have all necessary commands installed. install_if_not_installed pngcrush -if [ $OPTIMIZE_LEVEL != 2 ]; then +if [ $OPTIMIZE_LEVEL == 2 ]; then install_if_not_installed optipng install_if_not_installed advancecomp @@ -401,10 +401,15 @@ for d in $DIRS; do done # Print the results. -let diff=$TOTAL_OLD_BYTES-$TOTAL_NEW_BYTES -let percent=$diff*100/$TOTAL_OLD_BYTES -echo "Processed $PROCESSED_FILE files (out of $TOTAL_FILE files)" \ - "in $(date -u -d @$SECONDS +%T)s" -echo "Result : $TOTAL_OLD_BYTES => $TOTAL_NEW_BYTES bytes" \ - "($diff bytes : $percent %)" - +if [ $PROCESSED_FILE == 0 ]; then + echo "Did not find any files (out of $TOTAL_FILE files)" \ + "that could be optimized" \ + "in $(date -u -d @$SECONDS +%T)s" +else + let diff=$TOTAL_OLD_BYTES-$TOTAL_NEW_BYTES + let percent=$diff*100/$TOTAL_OLD_BYTES + echo "Processed $PROCESSED_FILE files (out of $TOTAL_FILE files)" \ + "in $(date -u -d @$SECONDS +%T)s" + echo "Result : $TOTAL_OLD_BYTES => $TOTAL_NEW_BYTES bytes" \ + "($diff bytes : $percent %)" +fi |