From 31153d04edcbc4b10387b207619a42e28640532512bd8c747c3d5d82f9206a83 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Tue, 28 Apr 2015 12:48:08 +0000 Subject: [PATCH] - 2015.04.28 - Filter InitrdID in /linuxrc.config - Hexdump old and new file in parallel - Sort cpio file list with files to compare - Extract old and new files in parallel - Ignore block device nodes - Ignore character device nodes - Always clean tmpdir on exit in pkg-diff.sh - Handle squashfs files OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/build-compare?expand=0&rev=183 --- build-compare.changes | 13 ++++++++ build-compare.spec | 2 +- pkg-diff.sh | 71 +++++++++++++++++++++++++++++++++++++------ 3 files changed, 76 insertions(+), 10 deletions(-) diff --git a/build-compare.changes b/build-compare.changes index bb045c6..a23e076 100644 --- a/build-compare.changes +++ b/build-compare.changes @@ -1,3 +1,16 @@ +------------------------------------------------------------------- +Tue Apr 28 11:52:12 UTC 2015 - olaf@aepfle.de + +- 2015.04.28 +- Filter InitrdID in /linuxrc.config +- Hexdump old and new file in parallel +- Sort cpio file list with files to compare +- Extract old and new files in parallel +- Ignore block device nodes +- Ignore character device nodes +- Always clean tmpdir on exit in pkg-diff.sh +- Handle squashfs files + ------------------------------------------------------------------- Mon Apr 13 08:55:39 UTC 2015 - olaf@aepfle.de diff --git a/build-compare.spec b/build-compare.spec index af423c2..edb8c15 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.04.13 +Version: 2015.04.28 Release: 0 Source1: COPYING Source2: same-build-result.sh diff --git a/pkg-diff.sh b/pkg-diff.sh index 65157b7..261f0c8 100644 --- a/pkg-diff.sh +++ b/pkg-diff.sh @@ -20,6 +20,21 @@ if test "$#" != 2; then exit 1 fi +# Always clean up on exit +local_tmpdir=`mktemp -d` +if test -z "${local_tmpdir}" +then + exit 1 +fi +function _exit() +{ + chmod -R u+w "${local_tmpdir}" + rm -rf "${local_tmpdir}" +} +trap _exit EXIT +# Let further mktemp refer to private tmpdir +export TMPDIR=$local_tmpdir + self_script=$(cd $(dirname $0); echo $(pwd)/$(basename $0)) source $FUNCTIONS @@ -168,8 +183,9 @@ diff_two_files() fi echo "$file differs ($ftype)" - hexdump -C old/$file > $file1 - hexdump -C new/$file > $file2 + hexdump -C old/$file > $file1 & + hexdump -C new/$file > $file2 & + wait diff -u $file1 $file2 | head -n 200 return 1 } @@ -246,20 +262,23 @@ check_compressed_file() bz2) mv old/$file{,.bz2} mv new/$file{,.bz2} - bzip2 -d old/$file.bz2 - bzip2 -d new/$file.bz2 + bzip2 -d old/$file.bz2 & + bzip2 -d new/$file.bz2 & + wait ;; gzip) mv old/$file{,.gz} mv new/$file{,.gz} - gzip -d old/$file.gz - gzip -d new/$file.gz + gzip -d old/$file.gz & + gzip -d new/$file.gz & + wait ;; xz) mv old/$file{,.xz} mv new/$file{,.xz} - xz -d old/$file.xz - xz -d new/$file.xz + xz -d old/$file.xz & + xz -d new/$file.xz & + wait ;; esac ftype=`/usr/bin/file old/$file | sed 's@^[^:]\+:[[:blank:]]*@@'` @@ -324,7 +343,7 @@ check_single_file() return 0 ;; *.cpio) - flist=`cpio --quiet --list --force-local < "new/$file"` + flist=`cpio --quiet --list --force-local < "new/$file" | sort` pwd=$PWD fdir=$file.extract.$PPID.$$ mkdir old/$fdir new/$fdir @@ -345,6 +364,23 @@ check_single_file() rm -rf old/$fdir new/$fdir return $ret ;; + *.squashfs) + flist=`unsquashfs -no-progress -ls -dest '' "new/$file" | grep -Ev '^(Parallel unsquashfs:|[0-9]+ inodes )' | sort` + fdir=$file.extract.$PPID.$$ + unsquashfs -no-progress -dest old/$fdir "old/$file" + unsquashfs -no-progress -dest new/$fdir "new/$file" + local ret=0 + for f in $flist; do + if ! check_single_file $fdir/$f; then + ret=1 + if test -z "$check_all"; then + break + fi + fi + done + rm -rf old/$fdir new/$fdir + return $ret + ;; *.tar|*.tar.bz2|*.tar.gz|*.tgz|*.tbz2) flist=`tar tf new/$file` pwd=$PWD @@ -626,6 +662,11 @@ check_single_file() }' "$f" done ;; + */linuxrc.config) + echo "${file}" + sed -i '/^InitrdID:/s@^.*@InitrdID: something@' "old/$file" + sed -i '/^InitrdID:/s@^.*@InitrdID: something@' "new/$file" + ;; esac ftype=`/usr/bin/file old/$file | sed 's@^[^:]\+:[[:blank:]]*@@'` @@ -722,6 +763,14 @@ check_single_file() return 1 fi ;; + Squashfs\ filesystem,*) + echo "$file ($ftype)" + mv old/$file{,.squashfs} + mv new/$file{,.squashfs} + if ! check_single_file ${file}.squashfs; then + return 1 + fi + ;; symbolic\ link\ to\ *) readlink "old/$file" > $file1 readlink "new/$file" > $file2 @@ -730,6 +779,10 @@ check_single_file() return 1 fi ;; + block\ special\ *) + ;; + character\ special\ *) + ;; *) if ! diff_two_files; then return 1