forked from pool/build-compare
Accepting request 621344 from openSUSE:Tools
- pkg-diff: fix diff returning 0 - Match also ELF pie executable (bsc#1097339) - Remove trailing space from two match patterns - Recognize "setuid ELF nn-bit xSB shared object" ELF binaries - Avoid large temporary files from hexdump output and avoid diff(1) runing OOM by using a fifo (issue#24) - check rpm capabilities for recommends/suggests - Ignore /usr/lib/.build-id differences in package filelist OBS-URL: https://build.opensuse.org/request/show/621344 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/build-compare?expand=0&rev=108
This commit is contained in:
commit
436e7886b3
@ -1,3 +1,39 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Jul 6 14:01:17 UTC 2018 - olaf@aepfle.de
|
||||
|
||||
- pkg-diff: fix diff returning 0
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jul 4 05:58:13 UTC 2018 - olaf@aepfle.de
|
||||
|
||||
- Match also ELF pie executable (bsc#1097339)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jul 4 05:42:05 UTC 2018 - olaf@aepfle.de
|
||||
|
||||
- Remove trailing space from two match patterns
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jun 26 06:45:38 UTC 2018 - olaf@aepfle.de
|
||||
|
||||
- Recognize "setuid ELF nn-bit xSB shared object" ELF binaries
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon May 28 13:26:44 UTC 2018 - olaf@aepfle.de
|
||||
|
||||
- Avoid large temporary files from hexdump output and avoid
|
||||
diff(1) runing OOM by using a fifo (issue#24)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Apr 13 07:10:30 UTC 2018 - olaf@aepfle.de
|
||||
|
||||
- check rpm capabilities for recommends/suggests
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Dec 8 16:57:00 UTC 2017 - ol@infoserver.lv
|
||||
|
||||
- Ignore /usr/lib/.build-id differences in package filelist
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Dec 4 10:21:44 UTC 2017 - olaf@aepfle.de
|
||||
|
||||
|
@ -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: 20171204T112209.f06fbac
|
||||
Version: 20180706T160151.66224a8
|
||||
Release: 0
|
||||
Source1: COPYING
|
||||
Source2: same-build-result.sh
|
||||
@ -30,8 +30,8 @@ Source4: functions.sh
|
||||
Source5: srpm-check.sh
|
||||
%if 0%{?suse_version}
|
||||
Requires: bash
|
||||
Requires: coreutils
|
||||
Requires: cpio
|
||||
Requires: coreutils
|
||||
Requires: diffutils
|
||||
Requires: file
|
||||
Requires: gawk
|
||||
|
26
functions.sh
26
functions.sh
@ -10,6 +10,12 @@
|
||||
|
||||
RPM="rpm -qp --nodigest --nosignature"
|
||||
|
||||
set_rpm_meta_global_variables() {
|
||||
|
||||
local pkg=$1
|
||||
local rpm_tags=
|
||||
local out=`mktemp`
|
||||
|
||||
# Name, Version, Release
|
||||
QF_NAME="%{NAME}"
|
||||
QF_VER_REL="%{VERSION}-%{RELEASE}"
|
||||
@ -21,8 +27,19 @@ QF_PROVIDES="[%{PROVIDENAME} %{PROVIDEFLAGS} %{PROVIDEVERSION}\\n]\\n"
|
||||
QF_PROVIDES="${QF_PROVIDES}[%{REQUIRENAME} %{REQUIREFLAGS} %{REQUIREVERSION}\\n]\\n"
|
||||
QF_PROVIDES="${QF_PROVIDES}[%{CONFLICTNAME} %{CONFLICTFLAGS} %{CONFLICTVERSION}\\n]\\n"
|
||||
QF_PROVIDES="${QF_PROVIDES}[%{OBSOLETENAME} %{OBSOLETEFLAGS} %{OBSOLETEVERSION}\\n]\\n"
|
||||
QF_PROVIDES="${QF_PROVIDES}[%{RECOMMENDNAME} %{RECOMMENDFLAGS} %{RECOMMENDVERSION}\\n]\\n"
|
||||
QF_PROVIDES="${QF_PROVIDES}[%{SUPPLEMENTNAME} %{SUPPLEMENTFLAGS} %{SUPPLEMENTVERSION}\\n]\\n"
|
||||
|
||||
rpm_tags="%{RECOMMENDNAME} %{RECOMMENDFLAGS} %{RECOMMENDVERSION}"
|
||||
check_header "%{NAME} ${rpm_tags}" > "${out}"
|
||||
if test -s "${out}"
|
||||
then
|
||||
QF_PROVIDES="${QF_PROVIDES}[${rpm_tags}\\n]\\n"
|
||||
fi
|
||||
rpm_tags="%{SUPPLEMENTNAME} %{SUPPLEMENTFLAGS} %{SUPPLEMENTVERSION}"
|
||||
check_header "%{NAME} ${rpm_tags}" > "${out}"
|
||||
if test -s "${out}"
|
||||
then
|
||||
QF_PROVIDES="${QF_PROVIDES}[${rpm_tags}\\n]\\n"
|
||||
fi
|
||||
|
||||
# don't look at RELEASE, it contains our build number
|
||||
QF_TAGS="%{NAME} %{VERSION} %{EPOCH}\\n"
|
||||
@ -65,6 +82,7 @@ QF_ALL="$QF_ALL\n___QF_PROVIDES___\n${QF_PROVIDES}\n___QF_PROVIDES___\n"
|
||||
QF_ALL="$QF_ALL\n___QF_SCRIPT___\n${QF_SCRIPT}\n___QF_SCRIPT___\n"
|
||||
QF_ALL="$QF_ALL\n___QF_FILELIST___\n${QF_FILELIST}\n___QF_FILELIST___\n"
|
||||
QF_ALL="$QF_ALL\n___QF_CHECKSUM___\n${QF_CHECKSUM}\n___QF_CHECKSUM___\n"
|
||||
}
|
||||
|
||||
check_header()
|
||||
{
|
||||
@ -83,6 +101,7 @@ function trim_release_old()
|
||||
/\(\/boot\|\/lib\/modules\|\/lib\/firmware\|\/usr\/src\|$version_release_old_regex_l\$\|$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}
|
||||
s/\(\/var\/adm\/update-scripts\/\)${name_ver_rel_old_regex_l}\([^[:blank:]]\+\)/\1@NAME_VER_REL@\2/g
|
||||
s/\(\/var\/adm\/update-messages\/\)${name_ver_rel_old_regex_l}\([^[:blank:]]\+\)/\1@NAME_VER_REL@\2/g
|
||||
/\/usr\/lib\/\.build-id/d
|
||||
"
|
||||
}
|
||||
function trim_release_new()
|
||||
@ -91,6 +110,7 @@ function trim_release_new()
|
||||
/\(\/boot\|\/lib\/modules\|\/lib\/firmware\|\/usr\/src\|$version_release_new_regex_l\$\|$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}
|
||||
s/\(\/var\/adm\/update-scripts\/\)${name_ver_rel_new_regex_l}\([^[:blank:]]\+\)/\1@NAME_VER_REL@\2/g
|
||||
s/\(\/var\/adm\/update-messages\/\)${name_ver_rel_new_regex_l}\([^[:blank:]]\+\)/\1@NAME_VER_REL@\2/g
|
||||
/\/usr\/lib\/\.build-id/d
|
||||
"
|
||||
}
|
||||
# Get single directory or filename with long or short release string
|
||||
@ -222,6 +242,8 @@ function cmp_rpm_meta ()
|
||||
rpm_meta_old=`mktemp`
|
||||
rpm_meta_new=`mktemp`
|
||||
|
||||
set_rpm_meta_global_variables $oldrpm
|
||||
|
||||
check_header "$QF_ALL" $oldrpm > $rpm_meta_old
|
||||
check_header "$QF_ALL" $newrpm > $rpm_meta_new
|
||||
|
||||
|
40
pkg-diff.sh
40
pkg-diff.sh
@ -280,6 +280,9 @@ dfile=`mktemp`
|
||||
|
||||
diff_two_files()
|
||||
{
|
||||
local offset length
|
||||
local po pn
|
||||
|
||||
if test ! -e old/$file; then
|
||||
echo "Missing in old package: $file"
|
||||
return 1
|
||||
@ -289,15 +292,25 @@ diff_two_files()
|
||||
return 1
|
||||
fi
|
||||
|
||||
if cmp -s old/$file new/$file; then
|
||||
if cmp -b old/$file new/$file > $dfile ; then
|
||||
return 0
|
||||
fi
|
||||
if ! test -s $dfile ; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "$file differs ($ftype)"
|
||||
hexdump -C old/$file > $file1 &
|
||||
hexdump -C new/$file > $file2 &
|
||||
wait
|
||||
diff -u $file1 $file2 | $buildcompare_head
|
||||
offset=`sed 's@^.*differ: byte @@;s@,.*@@' < $dfile`
|
||||
echo "$file differs at offset '$offset' ($ftype)"
|
||||
po=`mktemp --dry-run $TMPDIR/old.XXX`
|
||||
pn=`mktemp --dry-run $TMPDIR/new.XXX`
|
||||
mkfifo -m 0600 $po
|
||||
mkfifo -m 0600 $pn
|
||||
offset=$(( ($offset >> 6) << 6 ))
|
||||
length=512
|
||||
hexdump -C -s $offset -n $length old/$file > $po &
|
||||
hexdump -C -s $offset -n $length new/$file > $pn &
|
||||
diff -u $po $pn | $buildcompare_head
|
||||
rm -f $po $pn
|
||||
return 1
|
||||
}
|
||||
|
||||
@ -456,6 +469,7 @@ check_compressed_file()
|
||||
check_single_file()
|
||||
{
|
||||
local file="$1"
|
||||
local ret=0
|
||||
|
||||
# If the two files are the same, return at once.
|
||||
if [ -f old/$file -a -f new/$file ]; then
|
||||
@ -499,7 +513,6 @@ check_single_file()
|
||||
cd $pwd/new/$fdir
|
||||
cpio --quiet --extract --force-local < "../${file##*/}"
|
||||
cd $pwd
|
||||
local ret=0
|
||||
for f in $flist; do
|
||||
if ! check_single_file $fdir/$f; then
|
||||
ret=1
|
||||
@ -516,7 +529,6 @@ check_single_file()
|
||||
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
|
||||
@ -537,7 +549,6 @@ check_single_file()
|
||||
cd $pwd/new/$fdir
|
||||
tar xf `basename $file`
|
||||
cd $pwd
|
||||
local ret=0
|
||||
for f in $flist; do
|
||||
if ! check_single_file $fdir/$f; then
|
||||
ret=1
|
||||
@ -569,7 +580,6 @@ check_single_file()
|
||||
cd $pwd/new/$fdir
|
||||
unjar `basename $file`
|
||||
cd $pwd
|
||||
local ret=0
|
||||
for f in $flist; do
|
||||
if test -f new/$fdir/$f && ! check_single_file $fdir/$f; then
|
||||
ret=1
|
||||
@ -659,6 +669,7 @@ check_single_file()
|
||||
# <!-- Generated by javadoc (version 1.7.0_75) on Tue Feb 03 02:20:12 GMT 2015 -->
|
||||
# <!-- Generated by javadoc on Tue Feb 03 00:02:48 GMT 2015 -->
|
||||
# <!-- Generated by javadoc (1.8.0_72) on Thu Mar 03 12:50:28 GMT 2016 -->
|
||||
# <!-- Generated by javadoc (10-internal) on Wed Feb 07 06:33:41 GMT 2018 -->
|
||||
# <meta name="date" content="2015-02-03">
|
||||
# </head>
|
||||
sed -i -e '
|
||||
@ -672,6 +683,8 @@ check_single_file()
|
||||
t next
|
||||
s/^\(<!-- Generated by javadoc\) \((\(build\|version\) [0-9._]\+) on ... ... .. ..:..:.. \(GMT\|UTC\) ....\) \(-->\)/\1 some-date-removed-by-build-compare \5/
|
||||
t next
|
||||
s/^\(<!-- Generated by javadoc\) ([0-9._]\+-internal) on ... ... .. ..:..:.. \(GMT\|UTC\) .... \(-->\)/\1 some-date-removed-by-build-compare \3/
|
||||
t next
|
||||
s/^\(<!-- Generated by javadoc\) \(on ... ... .. ..:..:.. \(GMT\|UTC\) ....\) \(-->\)/\1 some-date-removed-by-build-compare \3/
|
||||
t next
|
||||
s/^<meta name="date" content="[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}">/<meta name="date" content="some-date-removed-by-build-compare">/
|
||||
@ -808,7 +821,12 @@ check_single_file()
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
ELF*executable*|ELF*[LM]SB\ relocatable*|ELF*[LM]SB\ shared\ object*)
|
||||
ELF*executable*|\
|
||||
ELF*[LM]SB\ relocatable*|\
|
||||
ELF*[LM]SB\ shared\ object*|\
|
||||
setuid\ ELF*[LM]SB\ shared\ object*|\
|
||||
ELF*[LM]SB\ pie\ executable*|\
|
||||
setuid\ ELF*[LM]SB\ pie\ executable*)
|
||||
$OBJDUMP -d --no-show-raw-insn old/$file > $file1
|
||||
ret=$?
|
||||
$OBJDUMP -d --no-show-raw-insn new/$file > $file2
|
||||
|
Loading…
Reference in New Issue
Block a user