forked from pool/build-compare
Accepting request 282298 from openSUSE:Tools
- 2015.01.21 - Remove leading spaces from file(1) output - Force removal of tmpdir to handle files marked as read-only - 2015.01.14 - Trim VERSION-RELEASE instead of RELEASE because the release number will match other substrings. - Use regex instead in sed /regex/ to match dots properly - Handle plain cpio archives from gfxboot - Add patterns for .TH header in man pages to handle all cases OBS-URL: https://build.opensuse.org/request/show/282298 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/build-compare?expand=0&rev=84
This commit is contained in:
commit
905f0d1500
@ -1,3 +1,20 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Jan 21 08:34:32 UTC 2015 - olaf@aepfle.de
|
||||
|
||||
- 2015.01.21
|
||||
- Remove leading spaces from file(1) output
|
||||
- Force removal of tmpdir to handle files marked as read-only
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jan 9 09:37:34 UTC 2015 - olaf@aepfle.de
|
||||
|
||||
- 2015.01.14
|
||||
- Trim VERSION-RELEASE instead of RELEASE because the release number
|
||||
will match other substrings.
|
||||
- Use regex instead in sed /regex/ to match dots properly
|
||||
- Handle plain cpio archives from gfxboot
|
||||
- Add patterns for .TH header in man pages to handle all cases
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Nov 26 08:58:45 UTC 2014 - ohering@suse.de
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package build-compare
|
||||
#
|
||||
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -20,7 +20,7 @@ Name: build-compare
|
||||
Summary: Build Result Compare Script
|
||||
License: GPL-2.0+
|
||||
Group: Development/Tools/Building
|
||||
Version: 2014.11.25
|
||||
Version: 2015.01.21
|
||||
Release: 0
|
||||
Source1: COPYING
|
||||
Source2: same-build-result.sh
|
||||
|
28
functions.sh
28
functions.sh
@ -15,26 +15,26 @@ check_header()
|
||||
$RPM --qf "$QF" "$1"
|
||||
}
|
||||
|
||||
# Trim release string:
|
||||
# Trim version-release string:
|
||||
# - it is used as direntry below certain paths
|
||||
# - it is assigned to some variable in scripts, at the end of a line
|
||||
# - it is used in PROVIDES, at the end of a line
|
||||
function trim_release_old()
|
||||
{
|
||||
sed -e "/\(\/boot\|\/lib\/modules\|\/lib\/firmware\|\/usr\/src\|$release_old\$\)/{s,-$release_old_regex_l,-@RELEASE_LONG@,g;s,-$release_old_regex_s,-@RELEASE_SHORT@,g}"
|
||||
sed -e "/\(\/boot\|\/lib\/modules\|\/lib\/firmware\|\/usr\/src\|$version_release_old_regex_l\$\)/{s,$version_release_old_regex_l,@VERSION@-@RELEASE_LONG@,g;s,$version_release_old_regex_s,@VERSION@-@RELEASE_SHORT@,g}"
|
||||
}
|
||||
function trim_release_new()
|
||||
{
|
||||
sed -e "/\(\/boot\|\/lib\/modules\|\/lib\/firmware\|\/usr\/src\|$release_new\$\)/{s,-$release_new_regex_l,-@RELEASE_LONG@,g;s,-$release_new_regex_s,-@RELEASE_SHORT@,g}"
|
||||
sed -e "/\(\/boot\|\/lib\/modules\|\/lib\/firmware\|\/usr\/src\|$version_release_new_regex_l\$\)/{s,$version_release_new_regex_l,@VERSION@-@RELEASE_LONG@,g;s,$version_release_new_regex_s,@VERSION@-@RELEASE_SHORT@,g}"
|
||||
}
|
||||
# Get single directory or filename with long or short release string
|
||||
function grep_release_old()
|
||||
{
|
||||
grep -E "(/boot|/lib/modules|/lib/firmware|/usr/src)/[^/]+(-${release_old_regex_l}(\$|[^/]+\$)|-${release_old_regex_s}(\$|[^/]+\$))"
|
||||
grep -E "(/boot|/lib/modules|/lib/firmware|/usr/src)/[^/]+(${version_release_old_regex_l}(\$|[^/]+\$)|${version_release_old_regex_s}(\$|[^/]+\$))"
|
||||
}
|
||||
function grep_release_new()
|
||||
{
|
||||
grep -E "(/boot|/lib/modules|/lib/firmware|/usr/src)/[^/]+(-${release_new_regex_l}(\$|[^/]+\$)|-${release_new_regex_s}(\$|[^/]+\$))"
|
||||
grep -E "(/boot|/lib/modules|/lib/firmware|/usr/src)/[^/]+(${version_release_new_regex_l}(\$|[^/]+\$)|${version_release_new_regex_s}(\$|[^/]+\$))"
|
||||
}
|
||||
|
||||
function check_provides()
|
||||
@ -117,19 +117,19 @@ function cmp_spec ()
|
||||
fi
|
||||
|
||||
# Remember to quote the . which is in release
|
||||
release_old=$($RPM --qf "%{RELEASE}" "$oldrpm")
|
||||
release_new=$($RPM --qf "%{RELEASE}" "$newrpm")
|
||||
version_release_old=$($RPM --qf "%{VERSION}-%{RELEASE}" "$oldrpm")
|
||||
version_release_new=$($RPM --qf "%{VERSION}-%{RELEASE}" "$newrpm")
|
||||
# Short version without B_CNT
|
||||
release_old_regex_s=${release_old%.*}
|
||||
release_old_regex_s=${release_old_regex_s//./\\.}
|
||||
release_new_regex_s=${release_new%.*}
|
||||
release_new_regex_s=${release_new_regex_s//./\\.}
|
||||
version_release_old_regex_s=${version_release_old%.*}
|
||||
version_release_old_regex_s=${version_release_old_regex_s//./\\.}
|
||||
version_release_new_regex_s=${version_release_new%.*}
|
||||
version_release_new_regex_s=${version_release_new_regex_s//./\\.}
|
||||
# Long version with B_CNT
|
||||
release_old_regex_l=${release_old//./\\.}
|
||||
release_new_regex_l=${release_new//./\\.}
|
||||
version_release_old_regex_l=${version_release_old//./\\.}
|
||||
version_release_new_regex_l=${version_release_new//./\\.}
|
||||
# This might happen when?!
|
||||
echo "comparing RELEASE"
|
||||
if [ "${release_old%.*}" != "${release_new%.*}" ] ; then
|
||||
if [ "${version_release_old%.*}" != "${version_release_new%.*}" ] ; then
|
||||
case $($RPM --qf '%{NAME}' "$newrpm") in
|
||||
kernel-*)
|
||||
# Make sure all kernel packages have the same %RELEASE
|
||||
|
62
rpm-check.sh
62
rpm-check.sh
@ -193,9 +193,9 @@ check_compressed_file()
|
||||
xz -d new/$file.xz
|
||||
;;
|
||||
esac
|
||||
ftype=`/usr/bin/file old/$file | cut -d: -f2-`
|
||||
ftype=`/usr/bin/file old/$file | sed 's@^[^:]\+:[[:blank:]]*@@'`
|
||||
case $ftype in
|
||||
*POSIX\ tar\ archive)
|
||||
POSIX\ tar\ archive)
|
||||
echo "$ext content is: $ftype"
|
||||
mv old/$file{,.tar}
|
||||
mv new/$file{,.tar}
|
||||
@ -203,7 +203,7 @@ check_compressed_file()
|
||||
ret=1
|
||||
fi
|
||||
;;
|
||||
*ASCII\ cpio\ archive\ *)
|
||||
ASCII\ cpio\ archive\ *)
|
||||
echo "$ext content is: $ftype"
|
||||
mv old/$file{,.cpio}
|
||||
mv new/$file{,.cpio}
|
||||
@ -257,11 +257,12 @@ check_single_file()
|
||||
*.cpio)
|
||||
flist=`cpio --quiet --list --force-local < "new/$file"`
|
||||
pwd=$PWD
|
||||
fdir=`dirname $file`
|
||||
fdir=$file.extract.$PPID.$$
|
||||
mkdir old/$fdir new/$fdir
|
||||
cd old/$fdir
|
||||
cpio --quiet --extract --force-local < "${file##*/}"
|
||||
cpio --quiet --extract --force-local < "../${file##*/}"
|
||||
cd $pwd/new/$fdir
|
||||
cpio --quiet --extract --force-local < "${file##*/}"
|
||||
cpio --quiet --extract --force-local < "../${file##*/}"
|
||||
cd $pwd
|
||||
local ret=0
|
||||
for f in $flist; do
|
||||
@ -272,6 +273,7 @@ check_single_file()
|
||||
fi
|
||||
fi
|
||||
done
|
||||
rm -rf old/$fdir new/$fdir
|
||||
return $ret
|
||||
;;
|
||||
*.tar|*.tar.bz2|*.tar.gz|*.tgz|*.tbz2)
|
||||
@ -434,19 +436,20 @@ check_single_file()
|
||||
# .TH gv 3guile "13 May 2010"
|
||||
#.TH "GIT\-ARCHIMPORT" "1" "09/13/2010" "Git 1\&.7\&.1" "Git Manual"
|
||||
# .TH LDIRECTORD 8 "2010-10-20" "perl v5.12.2" "User Contributed Perl Documentation"
|
||||
# .TH ccmake 1 "February 05, 2012" "ccmake 2.8.7"
|
||||
# .TH "appender.h" 3 "Tue Aug 31 2010" "Version 1.2.1" "log4c" \" -*- nroff -*-
|
||||
# .TH ARCH "1" "September 2010" "GNU coreutils 8.5" "User Commands"
|
||||
# .TH "GCM-CALIBRATE" "1" "03 February 2012" "" ""
|
||||
|
||||
for f in old/$file new/$file; do
|
||||
sed -i -e 's|.TH "\?\([^ "]*\)"\? "\?\([0-9][a-z]*\)"\? "\?\(20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]\|[0-9]* [A-Z][a-z]* 20[0-9][0-9]\)"\? |.TH \1 \2 "2000-01-01" |' $f
|
||||
sed -i -e 's|.TH "\?\([^ "]*\)"\? "\?\([0-9][a-z]*\)"\? "\?\([0-1][0-9]/[0-9][0-9]/201[0-9]\)"\? |.TH \1 \2 "2000-01-01" |' $f
|
||||
sed -i -e 's|.TH \(.*\) "\?\(20[0-1][0-9]-[0-9][0-9]-[0-9][0-9]\)"\? |.TH \1 "2000-01-01" |' $f
|
||||
# .TH ccmake 1 "February 05, 2012" "ccmake 2.8.7"
|
||||
sed -i -e 's|^.TH "\?\([^ "]*\)"\? "\?\([0-9][a-z]*\)"\? "\?\([A-Z][a-z]* [0-9][0-9], 20[0-9][0-9]\)"\? |.TH \1 \2 "2000-01-01" |' $f
|
||||
# .TH "appender.h" 3 "Tue Aug 31 2010" "Version 1.2.1" "log4c" \" -*- nroff -*-
|
||||
sed -i -e 's|.TH "\?\([^ "]*\)"\? "\?\([0-9][a-z]*\)"\? "\?[A-Z][a-z][a-z] [A-Z][a-z][a-z] [0-9]\+ 20[0-9][0-9]"\? |.TH \1 \2 "2000-01-01" |' $f
|
||||
# .TH ARCH "1" "September 2010" "GNU coreutils 8.5" "User Commands"
|
||||
sed -i -e 's|.TH "\?\([^ "]*\)"\? "\?\([0-9][a-z]*\)"\? "\?[A-Z][a-z]* 20[0-9][0-9]"\? |.TH \1 \2 "2000-01-01" |' $f
|
||||
# .TH "GCM-CALIBRATE" "1" "03 February 2012" "" ""
|
||||
sed -i -e 's|.TH "\?\([^ "]*\)"\? "\?\([0-9][a-z]*\)"\? "\?[0-9]* [A-Z][a-z]* 20[0-9][0-9]"\? |.TH \1 \2 "2000-01-01" |' $f
|
||||
# (.TH quoted section) (quoted_date)(*)
|
||||
sed -i -e 's|^\([[:blank:]]*\.TH[[:blank:]]\+"[^"]\+"[[:blank:]]\+[^[:blank:]]\+\)[[:blank:]]\+\("[^"]\+"\)\([[:blank:]]\+.*\)\?|\1 "qq2000-01-01"\3|' $f
|
||||
# (.TH unquoted section) (quoted_date)(*)
|
||||
sed -i -e 's|^\([[:blank:]]*\.TH[[:blank:]]\+[^"][^[:blank:]]\+[[:blank:]]\+[^[:blank:]]\+\)[[:blank:]]\+\("[^"]\+"\)\([[:blank:]]\+.*\)\?|\1 "uq2000-02-02"\3|' $f
|
||||
# (.TH quoted section) (unquoted_date)(*)
|
||||
sed -i -e 's|^\([[:blank:]]*\.TH[[:blank:]]\+"[^"]\+"[[:blank:]]\+[^[:blank:]]\+\)[[:blank:]]\+\([^"][^[:blank:]]\+\)\([[:blank:]]\+.*\)\?|\1 qu2000-03-03\3|' $f
|
||||
# (.TH unquoted section) (unquoted_date)(*)
|
||||
sed -i -e 's|^\([[:blank:]]*\.TH[[:blank:]]\+[^"][^[:blank:]]\+[[:blank:]]\+[^[:blank:]]\+\)[[:blank:]]\+\([^"][^[:blank:]]\+\)\([[:blank:]]\+.*\)\?|\1 uu2000-04-04\3|' $f
|
||||
# generated by docbook xml:
|
||||
#.\" Date: 09/13/2010
|
||||
sed -i -e 's|Date: [0-1][0-9]/[0-9][0-9]/201[0-9]|Date: 09/13/2010|' $f
|
||||
@ -547,9 +550,9 @@ check_single_file()
|
||||
;;
|
||||
esac
|
||||
|
||||
ftype=`/usr/bin/file old/$file | cut -d: -f2-`
|
||||
ftype=`/usr/bin/file old/$file | sed 's@^[^:]\+:[[:blank:]]*@@'`
|
||||
case $ftype in
|
||||
*PE32\ executable*Mono\/\.Net\ assembly*)
|
||||
PE32\ executable*Mono\/\.Net\ assembly*)
|
||||
echo "PE32 Mono/.Net assembly: $file"
|
||||
if [ -x /usr/bin/monodis ] ; then
|
||||
monodis old/$file 2>/dev/null|sed -e 's/GUID = {.*}/GUID = { 42 }/;'> ${file1}
|
||||
@ -564,7 +567,7 @@ check_single_file()
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
*ELF*executable*|*ELF*[LM]SB\ shared\ object*)
|
||||
ELF*executable*|ELF*[LM]SB\ shared\ object*)
|
||||
objdump -d --no-show-raw-insn old/$file | filter_disasm > $file1
|
||||
if ! test -s $file1; then
|
||||
# objdump has no idea how to handle it
|
||||
@ -605,26 +608,33 @@ check_single_file()
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
*directory)
|
||||
directory)
|
||||
# tar might package directories - ignore them here
|
||||
return 0
|
||||
;;
|
||||
*bzip2\ compressed\ data*)
|
||||
bzip2\ compressed\ data*)
|
||||
if ! check_compressed_file "$file" "bz2"; then
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
*gzip\ compressed\ data*)
|
||||
gzip\ compressed\ data*)
|
||||
if ! check_compressed_file "$file" "gzip"; then
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
*XZ\ compressed\ data*)
|
||||
XZ\ compressed\ data*)
|
||||
if ! check_compressed_file "$file" "xz"; then
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
*symbolic\ link\ to\ *)
|
||||
cpio\ archive)
|
||||
mv old/$file{,.cpio}
|
||||
mv new/$file{,.cpio}
|
||||
if ! check_single_file ${file}.cpio; then
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
symbolic\ link\ to\ *)
|
||||
readlink "old/$file" > $file1
|
||||
readlink "new/$file" > $file2
|
||||
if ! diff -u $file1 $file2; then
|
||||
@ -667,7 +677,7 @@ if [ "$PROC_MOUNTED" -eq "1" ]; then
|
||||
fi
|
||||
|
||||
rm $file1 $file2 $dfile $rename_script
|
||||
rm -r $dir
|
||||
rm -rf $dir
|
||||
if test "$ret" = 0; then
|
||||
echo "RPM content is identical"
|
||||
fi
|
||||
|
@ -90,5 +90,5 @@ for file in $files; do
|
||||
fi
|
||||
done
|
||||
|
||||
rm -r $dir
|
||||
rm -rf $dir
|
||||
exit $ret
|
||||
|
Loading…
Reference in New Issue
Block a user