From 30706038f06a19fdec68bd4c120a7943482757004f6b19c778cb115e7cb73067 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Fri, 20 Mar 2015 19:33:05 +0000 Subject: [PATCH] - 2015.03.20 - Convert correct png file before comparison - Avoid name clashes when comparing png files - Handle filename changes gracefully when comparing unknown filetypes - Use generic helper to compare png files OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/build-compare?expand=0&rev=177 --- build-compare.changes | 9 ++++++++ build-compare.spec | 2 +- functions.sh | 2 +- pkg-diff.sh | 48 +++++++++++++++++++++++++------------------ same-build-result.sh | 2 +- srpm-check.sh | 2 +- 6 files changed, 41 insertions(+), 24 deletions(-) diff --git a/build-compare.changes b/build-compare.changes index 08e374e..1d96851 100644 --- a/build-compare.changes +++ b/build-compare.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Fri Mar 20 18:58:22 UTC 2015 - olaf@aepfle.de + +- 2015.03.20 +- Convert correct png file before comparison +- Avoid name clashes when comparing png files +- Handle filename changes gracefully when comparing unknown filetypes +- Use generic helper to compare png files + ------------------------------------------------------------------- Thu Feb 12 10:41:45 UTC 2015 - olaf@aepfle.de diff --git a/build-compare.spec b/build-compare.spec index 62cac35..a06babc 100644 --- a/build-compare.spec +++ b/build-compare.spec @@ -21,7 +21,7 @@ Summary: Build Result Compare Script License: GPL-2.0+ Group: Development/Tools/Building Url: https://github.com/openSUSE/build-compare -Version: 2015.02.10 +Version: 2015.03.20 Release: 0 Source1: COPYING Source2: same-build-result.sh diff --git a/functions.sh b/functions.sh index cb00279..aa01e28 100644 --- a/functions.sh +++ b/functions.sh @@ -255,4 +255,4 @@ function cmp_spec () rm $file1 $file2 return $RES } -# vim: tw=666 ts=2 et +# vim: tw=666 ts=2 shiftwidth=2 et diff --git a/pkg-diff.sh b/pkg-diff.sh index 6127afe..5848e0a 100644 --- a/pkg-diff.sh +++ b/pkg-diff.sh @@ -154,14 +154,24 @@ dfile=`mktemp` diff_two_files() { - if ! cmp -s old/$file new/$file; then - echo "$file differs ($ftype)" - hexdump -C old/$file > $file1 - hexdump -C new/$file > $file2 - diff -u $file1 $file2 | head -n 200 - return 1 + if test ! -e old/$file; then + echo "Missing in old package: $file" + return 1 fi - return 0 + if test ! -e new/$file; then + echo "Missing in new package: $file" + return 1 + fi + + if cmp -s old/$file new/$file; then + return 0 + fi + + echo "$file differs ($ftype)" + hexdump -C old/$file > $file1 + hexdump -C new/$file > $file2 + diff -u $file1 $file2 | head -n 200 + return 1 } trim_man_first_line() @@ -411,19 +421,17 @@ check_single_file() return $? ;; *png) - # Try to remove timestamps, only if convert from ImageMagick is installed + # Try to remove timestamps, only if convert from ImageMagick is installed if [[ $(type -p convert) ]]; then - convert old/$file +set date:create +set date:modify old/${file/.png/_n.png} - convert old/$file +set date:create +set date:modify new/${file/.png/_n.png} - if ! cmp -s old/${file/.png/_n.png} new/${file/.png/_n.png}; then - echo "$file differs ($ftype)" - hexdump -C old/${file/.png/_n.png} > $file1 - hexdump -C new/${file/.png/_n.png} > $file2 - diff -u $file1 $file2 | head -n 20 - return 1 - fi - return 0 - fi + convert old/$file +set date:create +set date:modify old/${file}.$PPID.$$ + convert new/$file +set date:create +set date:modify new/${file}.$PPID.$$ + mv -f old/${file}.$PPID.$$ old/${file} + mv -f new/${file}.$PPID.$$ new/${file} + if ! diff_two_files; then + return 1 + fi + return 0 + fi ;; /usr/share/locale/*/LC_MESSAGES/*.mo|/usr/share/locale-bundle/*/LC_MESSAGES/*.mo) for f in old/$file new/$file; do @@ -762,4 +770,4 @@ if test "$ret" = 0; then echo "Package content is identical" fi exit $ret -# vim: tw=666 ts=2 et +# vim: tw=666 ts=2 shiftwidth=2 et diff --git a/same-build-result.sh b/same-build-result.sh index 942e201..ae0c463 100644 --- a/same-build-result.sh +++ b/same-build-result.sh @@ -141,4 +141,4 @@ if test $SUCCESS -eq 0; then fi echo 'compare validated built as identical !' exit 0 -# vim: tw=666 ts=2 et +# vim: tw=666 ts=2 shiftwidth=2 et diff --git a/srpm-check.sh b/srpm-check.sh index 895cf6a..74a122a 100644 --- a/srpm-check.sh +++ b/srpm-check.sh @@ -97,4 +97,4 @@ done rm -rf $dir exit $ret -# vim: tw=666 ts=2 et +# vim: tw=666 ts=2 shiftwidth=2 et