forked from pool/build-compare
Accepting request 263099 from home:olh:branches:openSUSE:Tools
- 2014.11.25 - correctly handle cmp_spec return code if file checksum differs - handle also bz2 and xz compressed files with odd name check ret instead of RES OBS-URL: https://build.opensuse.org/request/show/263099 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/build-compare?expand=0&rev=155
This commit is contained in:
parent
dd47afde1c
commit
7767ce80a4
@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Nov 26 08:58:45 UTC 2014 - ohering@suse.de
|
||||||
|
|
||||||
|
- 2014.11.25
|
||||||
|
- correctly handle cmp_spec return code if file checksum differs
|
||||||
|
- handle also bz2 and xz compressed files with odd name
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Nov 18 11:58:51 UTC 2014 - ohering@suse.de
|
Tue Nov 18 11:58:51 UTC 2014 - ohering@suse.de
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ Name: build-compare
|
|||||||
Summary: Build Result Compare Script
|
Summary: Build Result Compare Script
|
||||||
License: GPL-2.0+
|
License: GPL-2.0+
|
||||||
Group: Development/Tools/Building
|
Group: Development/Tools/Building
|
||||||
Version: 2014.11.15
|
Version: 2014.11.25
|
||||||
Release: 0
|
Release: 0
|
||||||
Source1: COPYING
|
Source1: COPYING
|
||||||
Source2: same-build-result.sh
|
Source2: same-build-result.sh
|
||||||
|
53
rpm-check.sh
53
rpm-check.sh
@ -101,6 +101,7 @@ cmp_spec $rename_script
|
|||||||
RES=$?
|
RES=$?
|
||||||
case $RES in
|
case $RES in
|
||||||
0)
|
0)
|
||||||
|
echo "RPM meta information is identical"
|
||||||
if test -z "$check_all"; then
|
if test -z "$check_all"; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
@ -112,6 +113,8 @@ case $RES in
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
|
echo "RPM file checksum differs."
|
||||||
|
RES=0
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Wrong exit code!"
|
echo "Wrong exit code!"
|
||||||
@ -157,25 +160,43 @@ strip_numbered_anchors()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
check_gzip_file()
|
check_compressed_file()
|
||||||
{
|
{
|
||||||
local file=$1
|
local file=$1
|
||||||
|
local ext=$2
|
||||||
local tmpdir=`mktemp -d`
|
local tmpdir=`mktemp -d`
|
||||||
local ftype
|
local ftype
|
||||||
local ret=0
|
local ret=0
|
||||||
|
echo "$ext file with odd filename: $file"
|
||||||
if test -n "$tmpdir"; then
|
if test -n "$tmpdir"; then
|
||||||
mkdir $tmpdir/{old,new}
|
mkdir $tmpdir/{old,new}
|
||||||
cp --parents --dereference old/$file $tmpdir/
|
cp --parents --dereference old/$file $tmpdir/
|
||||||
cp --parents --dereference new/$file $tmpdir/
|
cp --parents --dereference new/$file $tmpdir/
|
||||||
if pushd $tmpdir > /dev/null ; then
|
if pushd $tmpdir > /dev/null ; then
|
||||||
mv old/$file{,.gz}
|
case "$ext" in
|
||||||
mv new/$file{,.gz}
|
bz2)
|
||||||
gunzip old/$file.gz
|
mv old/$file{,.bz2}
|
||||||
gunzip new/$file.gz
|
mv new/$file{,.bz2}
|
||||||
|
bzip2 -d old/$file.bz2
|
||||||
|
bzip2 -d new/$file.bz2
|
||||||
|
;;
|
||||||
|
gzip)
|
||||||
|
mv old/$file{,.gz}
|
||||||
|
mv new/$file{,.gz}
|
||||||
|
gzip -d old/$file.gz
|
||||||
|
gzip -d new/$file.gz
|
||||||
|
;;
|
||||||
|
xz)
|
||||||
|
mv old/$file{,.xz}
|
||||||
|
mv new/$file{,.xz}
|
||||||
|
xz -d old/$file.xz
|
||||||
|
xz -d new/$file.xz
|
||||||
|
;;
|
||||||
|
esac
|
||||||
ftype=`/usr/bin/file old/$file | cut -d: -f2-`
|
ftype=`/usr/bin/file old/$file | cut -d: -f2-`
|
||||||
case $ftype in
|
case $ftype in
|
||||||
*POSIX\ tar\ archive)
|
*POSIX\ tar\ archive)
|
||||||
echo "gzip content is: $ftype"
|
echo "$ext content is: $ftype"
|
||||||
mv old/$file{,.tar}
|
mv old/$file{,.tar}
|
||||||
mv new/$file{,.tar}
|
mv new/$file{,.tar}
|
||||||
if ! check_single_file ${file}.tar; then
|
if ! check_single_file ${file}.tar; then
|
||||||
@ -183,7 +204,7 @@ check_gzip_file()
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*ASCII\ cpio\ archive\ *)
|
*ASCII\ cpio\ archive\ *)
|
||||||
echo "gzip content is: $ftype"
|
echo "$ext content is: $ftype"
|
||||||
mv old/$file{,.cpio}
|
mv old/$file{,.cpio}
|
||||||
mv new/$file{,.cpio}
|
mv new/$file{,.cpio}
|
||||||
if ! check_single_file ${file}.cpio; then
|
if ! check_single_file ${file}.cpio; then
|
||||||
@ -191,7 +212,7 @@ check_gzip_file()
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "unhandled gzip content: $ftype"
|
echo "unhandled $ext content: $ftype"
|
||||||
if ! diff_two_files; then
|
if ! diff_two_files; then
|
||||||
ret=1
|
ret=1
|
||||||
fi
|
fi
|
||||||
@ -588,9 +609,18 @@ check_single_file()
|
|||||||
# tar might package directories - ignore them here
|
# tar might package directories - ignore them here
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
|
*bzip2\ compressed\ data*)
|
||||||
|
if ! check_compressed_file "$file" "bz2"; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
*gzip\ compressed\ data*)
|
*gzip\ compressed\ data*)
|
||||||
echo "gzipped file with odd filename: $file"
|
if ! check_compressed_file "$file" "gzip"; then
|
||||||
if ! check_gzip_file "$file"; then
|
return 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*XZ\ compressed\ data*)
|
||||||
|
if ! check_compressed_file "$file" "xz"; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
@ -638,4 +668,7 @@ fi
|
|||||||
|
|
||||||
rm $file1 $file2 $dfile $rename_script
|
rm $file1 $file2 $dfile $rename_script
|
||||||
rm -r $dir
|
rm -r $dir
|
||||||
|
if test "$ret" = 0; then
|
||||||
|
echo "RPM content is identical"
|
||||||
|
fi
|
||||||
exit $ret
|
exit $ret
|
||||||
|
Loading…
x
Reference in New Issue
Block a user