3
0
forked from pool/build-compare

baserev update by copy to link target

OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/build-compare?expand=0&rev=288
This commit is contained in:
Olaf Hering 2022-03-04 23:16:27 +00:00 committed by Git OBS Bridge
parent 1bc9801b2d
commit 714195e1eb
6 changed files with 319 additions and 268 deletions

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Fri Mar 4 12:34:56 UTC 2022 - olaf@aepfle.de
- remove Check time report from rpmlint.log
- ELF diffing performance improvements
- unpack packages in parallel
- Add zstd handling
-------------------------------------------------------------------
Wed Feb 23 08:13:27 UTC 2022 - Stefan Seyfried <seife+obs@b1-systems.com>
- Add extra handling for KMP versions
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Sep 21 19:19:19 UTC 2021 - Stephan Kulow <coolo@suse.de> Tue Sep 21 19:19:19 UTC 2021 - Stephan Kulow <coolo@suse.de>

View File

@ -21,7 +21,7 @@ Summary: Build Result Compare Script
License: GPL-2.0+ License: GPL-2.0+
Group: Development/Tools/Building Group: Development/Tools/Building
Url: https://github.com/openSUSE/build-compare Url: https://github.com/openSUSE/build-compare
Version: 20210921T214418.86d06d9 Version: 20220305T001156.c33e802
Release: 0 Release: 0
Source1: COPYING Source1: COPYING
Source2: same-build-result.sh Source2: same-build-result.sh

View File

@ -141,23 +141,38 @@ check_header()
# - it is used as direntry below certain paths # - it is used as direntry below certain paths
# - it is assigned to some variable in scripts, at the end of a line # - 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 # - it is used in PROVIDES, at the end of a line
# - special-case KMP package:
# PROVIDES version_k.*-release at end of line, trim release
# [ 23s] -acpi_call-kmp-default 8 1.2.2_k5.17.0_rc5_1.ga9b2c1d-6.110
# [ 23s] +acpi_call-kmp-default 8 1.2.2_k5.17.0_rc5_1.ga9b2c1d-6.111
# Trim name-version-release string: # Trim name-version-release string:
# - it is used in update-scripts which are called by libzypp # - it is used in update-scripts which are called by libzypp
# - special-case KMP package:
# [ 64s] PREIN
# [ 64s] /bin/sh (none) /usr/lib/module-init-tools/kernel-scriptlets/kmp-pre --name "acpi_call-kmp-default" \
# [ 64s] - --version "1.2.2_k5.17.0_rc5_1.ga9b2c1d" --release "6.112" --kernelrelease "5.17.0-rc5-1.ga9b2c1d" \
# [ 64s] + --version "1.2.2_k5.17.0_rc5_1.ga9b2c1d" --release "6.113" --kernelrelease "5.17.0-rc5-1.ga9b2c1d" \
function trim_release_old() function trim_release_old()
{ {
local rel_regex_l=${version_release_old_regex_l##*-}
sed -e " sed -e "
/\(\/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} /\(\/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-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 s/\(\/var\/adm\/update-messages\/\)${name_ver_rel_old_regex_l}\([^[:blank:]]\+\)/\1@NAME_VER_REL@\2/g
s/\(^[^[:blank:]].*-kmp-.*[[:blank:]].*_k.*-\)${rel_regex_l}$/\1@RELEASE_LONG@/g
s/--release \"${rel_regex_l}\" --kernel/--release \"@RELEASE_LONG@\" --kernel/g
/\/usr\/lib\/\.build-id/d /\/usr\/lib\/\.build-id/d
" "
} }
function trim_release_new() function trim_release_new()
{ {
local rel_regex_l=${version_release_new_regex_l##*-}
sed -e " sed -e "
/\(\/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} /\(\/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-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 s/\(\/var\/adm\/update-messages\/\)${name_ver_rel_new_regex_l}\([^[:blank:]]\+\)/\1@NAME_VER_REL@\2/g
s/\(^[^[:blank:]].*-kmp-.*[[:blank:]].*_k.*-\)${rel_regex_l}$/\1@RELEASE_LONG@/g
s/--release \"${rel_regex_l}\" --kernel/--release \"@RELEASE_LONG@\" --kernel/g
/\/usr\/lib\/\.build-id/d /\/usr\/lib\/\.build-id/d
" "
} }
@ -280,16 +295,15 @@ function set_regex() {
function cmp_rpm_meta () function cmp_rpm_meta ()
{ {
local RES local RES
local file1 file2
local f local f
local sh=$1 local sh=$1
local oldrpm=$2 local oldrpm=$2
local newrpm=$3 local newrpm=$3
local tmpdir="$(mktemp -d)"
file1=`mktemp` local file1="$tmpdir/file1"
file2=`mktemp` local file2="$tmpdir/file2"
rpm_meta_old=`mktemp` local rpm_meta_old="$tmpdir/rpm-meta-old"
rpm_meta_new=`mktemp` local rpm_meta_new="$tmpdir/rpm-meta-new"
collect_rpm_querytags collect_rpm_querytags
set_rpm_meta_global_variables $oldrpm set_rpm_meta_global_variables $oldrpm
@ -303,6 +317,7 @@ function cmp_rpm_meta ()
else else
ls -l $rpm_meta_old $rpm_meta_new ls -l $rpm_meta_old $rpm_meta_new
echo "empty 'rpm -qp' output..." echo "empty 'rpm -qp' output..."
rm -rf "$tmpdir"
return 1 return 1
fi fi
@ -317,17 +332,20 @@ function cmp_rpm_meta ()
# Check the whole spec file at first, return 0 immediately if they # Check the whole spec file at first, return 0 immediately if they
# are the same. # are the same.
cat $rpm_meta_old | trim_release_old > $file1 trim_release_old < $rpm_meta_old > $file1
cat $rpm_meta_new | trim_release_new > $file2 trim_release_new < $rpm_meta_new > $file2
echo "comparing the rpm tags of $name_new" echo "comparing the rpm tags of $name_new"
if diff --label old-rpm-tags --label new-rpm-tags -au $file1 $file2; then if diff --speed-large-files --label old-rpm-tags --label new-rpm-tags -au0 $file1 $file2; then
rm $file1 $file2 $rpm_meta_old $rpm_meta_new rm -rf "$tmpdir"
return 0 return 0
fi fi
get_value QF_TAGS $rpm_meta_old > $file1 get_value QF_TAGS $rpm_meta_old > $file1
get_value QF_TAGS $rpm_meta_new > $file2 get_value QF_TAGS $rpm_meta_new > $file2
comp_file rpmtags $file1 $file2 $rpm_meta_old $rpm_meta_new || return 1 if ! comp_file rpmtags $file1 $file2 $rpm_meta_old $rpm_meta_new; then
rm -rf "$tmpdir"
return 1
fi
# This might happen when?! # This might happen when?!
echo "comparing RELEASE" echo "comparing RELEASE"
@ -337,6 +355,7 @@ function cmp_rpm_meta ()
# Make sure all kernel packages have the same %RELEASE # Make sure all kernel packages have the same %RELEASE
echo "release prefix mismatch" echo "release prefix mismatch"
if test -z "$check_all"; then if test -z "$check_all"; then
rm -rf "$tmpdir"
return 1 return 1
fi fi
difffound=1 difffound=1
@ -348,16 +367,25 @@ function cmp_rpm_meta ()
get_value QF_PROVIDES $rpm_meta_old | trim_release_old | sort > $file1 get_value QF_PROVIDES $rpm_meta_old | trim_release_old | sort > $file1
get_value QF_PROVIDES $rpm_meta_new | trim_release_new | sort > $file2 get_value QF_PROVIDES $rpm_meta_new | trim_release_new | sort > $file2
comp_file PROVIDES $file1 $file2 $rpm_meta_old $rpm_meta_new || return 1 if ! comp_file PROVIDES $file1 $file2 $rpm_meta_old $rpm_meta_new; then
rm -rf "$tmpdir"
return 1
fi
get_value QF_SCRIPT $rpm_meta_old | trim_release_old > $file1 get_value QF_SCRIPT $rpm_meta_old | trim_release_old > $file1
get_value QF_SCRIPT $rpm_meta_new | trim_release_new > $file2 get_value QF_SCRIPT $rpm_meta_new | trim_release_new > $file2
comp_file scripts $file1 $file2 $rpm_meta_old $rpm_meta_new || return 1 if ! comp_file scripts $file1 $file2 $rpm_meta_old $rpm_meta_new; then
rm -rf "$tmpdir"
return 1
fi
# First check the file attributes and later the md5s # First check the file attributes and later the md5s
get_value QF_FILELIST $rpm_meta_old | trim_release_old > $file1 get_value QF_FILELIST $rpm_meta_old | trim_release_old > $file1
get_value QF_FILELIST $rpm_meta_new | trim_release_new > $file2 get_value QF_FILELIST $rpm_meta_new | trim_release_new > $file2
comp_file filelist $file1 $file2 $rpm_meta_old $rpm_meta_new || return 1 if ! comp_file filelist $file1 $file2 $rpm_meta_old $rpm_meta_new; then
rm -rf "$tmpdir"
return 1
fi
# now the md5sums. if they are different, we check more detailed # now the md5sums. if they are different, we check more detailed
# if there are different filenames, we will already have aborted before # if there are different filenames, we will already have aborted before
@ -392,8 +420,8 @@ function cmp_rpm_meta ()
echo mv -v \"new/${f}\" \"new/`echo ${f} | trim_release_new`\" echo mv -v \"new/${f}\" \"new/`echo ${f} | trim_release_new`\"
done >> "${sh}" done >> "${sh}"
fi fi
#
rm $file1 $file2 rm -rf "$tmpdir"
[ "$difffound" = 1 ] && RES=1 [ "$difffound" = 1 ] && RES=1
return $RES return $RES
} }
@ -404,9 +432,9 @@ function adjust_controlfile() {
version_release_new="`sed -ne 's/^Version: \(.*\)/\1/p' $2/control`" version_release_new="`sed -ne 's/^Version: \(.*\)/\1/p' $2/control`"
name_ver_rel_new="`sed -n -e 's/^Package: \(.*\)/\1/p' $2/control`-`sed -n -e 's/^Version: \(.*\)/\1/p' $2/control`" name_ver_rel_new="`sed -n -e 's/^Package: \(.*\)/\1/p' $2/control`-`sed -n -e 's/^Version: \(.*\)/\1/p' $2/control`"
set_regex set_regex
cat $1/control | trim_release_old > $1/control.fixed trim_release_old < $1/control > $1/control.fixed
mv $1/control.fixed $1/control mv $1/control.fixed $1/control
cat $2/control | trim_release_new > $2/control.fixed trim_release_new < $2/control > $2/control.fixed
mv $2/control.fixed $2/control mv $2/control.fixed $2/control
} }

View File

@ -318,6 +318,13 @@ check_compressed_file()
xz -d new/$file.xz & xz -d new/$file.xz &
wait wait
;; ;;
zst)
mv old/$file{,.zst}
mv new/$file{,.zst}
zstd -d old/$file.zst &
zstd -d new/$file.zst &
wait
;;
esac esac
ftype=`/usr/bin/file old/$file | sed 's@^[^:]\+:[[:blank:]]*@@'` ftype=`/usr/bin/file old/$file | sed 's@^[^:]\+:[[:blank:]]*@@'`
case $ftype in case $ftype in
@ -414,7 +421,7 @@ normalize_file()
*.dvi) *.dvi)
filter_generic dvi filter_generic dvi
;; ;;
*png) *.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 if [[ $(type -p convert) ]]; then
filter_generic png filter_generic png
@ -599,7 +606,7 @@ normalize_file()
*.ps) *.ps)
filter_generic ps filter_generic ps
;; ;;
*pdf) *.pdf)
filter_generic pdf filter_generic pdf
;; ;;
*/linuxrc.config) */linuxrc.config)
@ -858,7 +865,7 @@ check_single_file()
compare_archive "${file}" 'archive_squashfs' compare_archive "${file}" 'archive_squashfs'
return $? return $?
;; ;;
*.tar|*.tar.bz2|*.tar.gz|*.tgz|*.tbz2) *.tar|*.tar.bz2|*.tar.gz|*.tgz|*.tbz2|*.tar.zst)
compare_archive "${file}" 'archive_tar' compare_archive "${file}" 'archive_tar'
return $? return $?
;; ;;
@ -878,6 +885,12 @@ check_single_file()
check_single_file ${file/.gz/} check_single_file ${file/.gz/}
return $? return $?
;; ;;
*.zst)
zstd -dc old/$file > old/${file/.zst/}
zstd -dc new/$file > new/${file/.zst/}
check_single_file ${file/.zst/}
return $?
;;
*.rpm) *.rpm)
$self_script -a old/$file new/$file $self_script -a old/$file new/$file
return $? return $?
@ -909,136 +922,106 @@ check_single_file()
set?id\ ELF*[LM]SB\ shared\ object*|\ set?id\ ELF*[LM]SB\ shared\ object*|\
ELF*[LM]SB\ pie\ executable*|\ ELF*[LM]SB\ pie\ executable*|\
set?id\ ELF*[LM]SB\ pie\ executable*) set?id\ ELF*[LM]SB\ pie\ executable*)
diff --speed-large-files --unified \ local sections=($(
--label "old $file (disasm)" \
--label "new $file (disasm)" \
<( $OBJDUMP -d --no-show-raw-insn old/$file |
filter_disasm |
sed -e "s,old/,," ;
echo "${PIPESTATUS[@]}" > $file1
) \
<( $OBJDUMP -d --no-show-raw-insn new/$file |
filter_disasm |
sed -e "s,new/,," ;
echo "${PIPESTATUS[@]}" > $file2
) > $dfile
ret=$?
failed=
read i < ${file1}
pipestatus=( $i )
objdump_failed="${pipestatus[0]}"
i=0
while test $i -lt ${#pipestatus[@]}
do
if test "${pipestatus[$i]}" != "0"
then
wprint "ELF: pipe command #$i failed with ${pipestatus[$i]} for old/$file"
failed='failed'
fi
: $(( i++ ))
done
read i < ${file2}
pipestatus=( $i )
objdump_failed="${objdump_failed}${pipestatus[0]}"
i=0
while test $i -lt ${#pipestatus[@]}
do
if test "${pipestatus[$i]}" != "0"
then
wprint "ELF: pipe command #$i failed with ${pipestatus[$i]} for new/$file"
failed='failed'
fi
: $(( i++ ))
done
if test "${objdump_failed}" != "00" || test -n "${failed}"
then
# objdump had no idea how to handle it
if diff_two_files; then
return 0
fi
return 1
fi
elfdiff=
if test "$ret" != "0"
then
wprint "$file differs in assembler output"
$buildcompare_head $dfile
elfdiff='elfdiff'
fi
sections="$(
$OBJDUMP -s new/$file | $OBJDUMP -s new/$file |
sed -n --regexp-extended -e ' sed -n --regexp-extended -e '
/Contents of section .*:/ { /Contents of section .*:/ {
s,.* (.*):,\1,g s,.* (.*):,-j \1,g
/\.build-id/d /\.build-id/d
/\.gnu_debuglink/d /\.gnu_debuglink/d
/\.gnu_debugdata/d /\.gnu_debugdata/d
p p
} }
' '))
)" ($OBJDUMP -s ${sections[@]} old/$file |
for section in $sections sed -e "s,old/,," ; echo "${PIPESTATUS[@]}" > $file1 ) > old/$file.objdump &
do ($OBJDUMP -s ${sections[@]} new/$file |
diff --unified \ sed -e "s,new/,," ; echo "${PIPESTATUS[@]}" > $file2 ) > new/$file.objdump &
--label "old $file (objdump)" \ wait
--label "new $file (objdump)" \
<( $OBJDUMP -s -j $section old/$file |
sed -e "s,^old/,," ;
echo "${PIPESTATUS[@]}" > $file1) \
<( $OBJDUMP -s -j $section new/$file |
sed -e "s,^new/,," ;
echo "${PIPESTATUS[@]}" > $file2
) > $dfile
ret=$?
failed=
read i < ${file1} read i < ${file1}
pipestatus=( $i ) pipestatus=( $i )
objdump_failed="${pipestatus[0]}" objdump_failed="${pipestatus[0]}"
i=0 if [[ ${pipestatus[*]} =~ [1-9] ]]
while test $i -lt ${#pipestatus[@]}
do
if test "${pipestatus[$i]}" != "0"
then then
wprint "ELF section: pipe command #$i failed with ${pipestatus[$i]} for old/$file" wprint "ELF section: pipe command failed for old/$file"
failed='failed' elfdiff='failed'
fi fi
: $(( i++ ))
done
read i < ${file2} read i < ${file2}
pipestatus=( $i ) pipestatus=( $i )
objdump_failed="${objdump_failed}${pipestatus[0]}" objdump_failed="${objdump_failed}${pipestatus[0]}"
i=0 if [[ ${pipestatus[*]} =~ [1-9] ]]
while test $i -lt ${#pipestatus[@]}
do
if test "${pipestatus[$i]}" != "0"
then then
wprint "ELF section: pipe command #$i failed with ${pipestatus[$i]} for new/$file" wprint "ELF section: pipe command failed for new/$file"
failed='failed' elfdiff='failed'
fi fi
: $(( i++ )) if test -z "${elfdiff}"
done
if test -n "${failed}"
then then
elfdiff='elfdiff' diff --speed-large-files --unified \
break --label "old $file (objdump)" \
fi --label "new $file (objdump)" \
old/$file.objdump new/$file.objdump > $dfile
ret=$?
if test "$ret" != "0" if test "$ret" != "0"
then then
wprint "$file differs in ELF section $section" wprint "$file differs in ELF sections"
$buildcompare_head $dfile
elfdiff='elfdiff'
fi
fi
if test -n "$elfdiff"
then
rm old/$file.objdump new/$file.objdump &
return 1
fi
watchdog_touch
($OBJDUMP -d --no-show-raw-insn old/$file | filter_disasm |
sed -e "s,old/,," ; echo "${PIPESTATUS[@]}" > $file1 ) > old/$file.objdump &
($OBJDUMP -d --no-show-raw-insn new/$file | filter_disasm |
sed -e "s,new/,," ; echo "${PIPESTATUS[@]}" > $file2 ) > new/$file.objdump &
wait
read i < ${file1}
pipestatus=( $i )
objdump_failed="${objdump_failed}${pipestatus[0]}"
if [[ ${pipestatus[*]} =~ [1-9] ]]
then
wprint "ELF disassembly: pipe command failed for old/$file"
elfdiff='failed'
fi
read i < ${file2}
pipestatus=( $i )
objdump_failed="${objdump_failed}${pipestatus[0]}"
if [[ ${pipestatus[*]} =~ [1-9] ]]
then
wprint "ELF disassembly: pipe command failed for new/$file"
elfdiff='failed'
fi
if test ${objdump_failed} -gt 0 || test -n "${elfdiff}"
then
# objdump had no idea how to handle it
rm old/$file.objdump new/$file.objdump &
if diff_two_files; then
return 0
fi
return 1
fi
diff --speed-large-files --unified \
--label "old $file (disasm)" \
--label "new $file (disasm)" \
old/$file.objdump new/$file.objdump > $dfile
ret=$?
rm old/$file.objdump new/$file.objdump &
if test "$ret" != "0"
then
wprint "$file differs in assembler output"
$buildcompare_head $dfile $buildcompare_head $dfile
elfdiff='elfdiff' elfdiff='elfdiff'
else else
watchdog_touch watchdog_touch
fi fi
done if test -n "$elfdiff"
if test -n "$elfdiff"; then then
return 1 return 1
fi fi
return 0
;; ;;
*ASCII*|*text*) *ASCII*|*text*)
if ! cmp -s "old/$file" "new/$file" ; then if ! cmp -s "old/$file" "new/$file" ; then
@ -1066,6 +1049,11 @@ check_single_file()
return 1 return 1
fi fi
;; ;;
Zstandard\ compressed\ data*)
if ! check_compressed_file "$file" "zst" ; then
return 1
fi
;;
Zip\ archive\ data,*) Zip\ archive\ data,*)
if ! compare_archive "${file}" 'archive_zip' ; then if ! compare_archive "${file}" 'archive_zip' ; then
return 1 return 1
@ -1211,8 +1199,9 @@ case $oldpkg in
esac esac
wprint "Extracting packages" wprint "Extracting packages"
unpackage $oldpkg $dir/old unpackage $oldpkg $dir/old &
unpackage $newpkg $dir/new unpackage $newpkg $dir/new &
wait
case $oldpkg in case $oldpkg in
*.deb|*.ipk) *.deb|*.ipk)

View File

@ -21,6 +21,31 @@ _x() {
} }
trap _x EXIT trap _x EXIT
# #
remove_check_time_report() {
local f=$1
awk '
BEGIN {
ctr_seen=0;
}
/Check time report .*:$/ {
ctr_seen=1;
next;
}
/TOTAL[[:blank:]]+[0-9]/ {
if (ctr_seen == 1) {
ctr_seen=0;
next;
}
}
{
if (ctr_seen == 1) {
next;
}
print $0;
}
' < "${f}"
}
#
check_all= check_all=
if test "$1" = "-a" if test "$1" = "-a"
then then
@ -134,12 +159,15 @@ else
fi fi
if test -n "$OTHERDIR"; then if test -n "$OTHERDIR"; then
if test -e $OLDDIR/rpmlint.log -a -e $OTHERDIR/rpmlint.log; then old_log=$OLDDIR/rpmlint.log
echo "comparing $OLDDIR/rpmlint.log and $OTHERDIR/rpmlint.log" new_log=$OTHERDIR/rpmlint.log
if test -e ${old_log} && test -e ${new_log} ; then
echo "comparing ${old_log} and ${new_log}"
# Remove --time-report from rpmlint
# Sort the files first since the order of messages is not deterministic # Sort the files first since the order of messages is not deterministic
# Remove release from files # Remove release from files
sort -u $OLDDIR/rpmlint.log|sed -e "s,$ver_rel1,@VERSION@-@RELEASE@,g" -e "s|/tmp/rpmlint\..*spec|.spec|g" > $file1 remove_check_time_report ${old_log}|sort -u|sed -e "s,$ver_rel1,@VERSION@-@RELEASE@,g" -e "s|/tmp/rpmlint\..*spec|.spec|g" > $file1
sort -u $OTHERDIR/rpmlint.log|sed -e "s,$ver_rel2,@VERSION@-@RELEASE@,g" -e "s|/tmp/rpmlint\..*spec|.spec|g" > $file2 remove_check_time_report ${new_log}|sort -u|sed -e "s,$ver_rel2,@VERSION@-@RELEASE@,g" -e "s|/tmp/rpmlint\..*spec|.spec|g" > $file2
# Remove odd warning about not-hardlinked files # Remove odd warning about not-hardlinked files
# Remove odd warning about data and time, it comes and goes # Remove odd warning about data and time, it comes and goes
# Remove warning about python mtime mismatch, a republish will not help # Remove warning about python mtime mismatch, a republish will not help
@ -159,7 +187,7 @@ if test -n "$OTHERDIR"; then
SUCCESS=0 SUCCESS=0
fi fi
rm $file1 $file2 rm $file1 $file2
elif test -e $OTHERDIR/rpmlint.log; then elif test -e ${new_log} ; then
echo "rpmlint.log is new" echo "rpmlint.log is new"
SUCCESS=0 SUCCESS=0
fi fi

View File

@ -1,10 +1,11 @@
#!/bin/bash #!/bin/bash
# #
# Copyright (c) 2009, 2010 SUSE Linux Product GmbH, Germany. # Copyright (c) 2009, 2010 SUSE Linux Product GmbH, Germany.
# Copyright (c) 2022 SUSE LLC
# Licensed under GPL v2, see COPYING file for details. # Licensed under GPL v2, see COPYING file for details.
# #
# Written by Michael Matz and Stephan Coolo # Written by Michael Matz and Stephan Kulow
# Enhanced by Andreas Jaeger # Enhanced by Andreas Jaeger and Dirk Müller
# Compare two source RPMs # Compare two source RPMs
@ -24,15 +25,10 @@ fi
source $FUNCTIONS source $FUNCTIONS
oldrpm=`readlink -f $1` oldrpm=$(readlink -f $1)
newrpm=`readlink -f $2` newrpm=$(readlink -f $2)
rename_script= rename_script=
# Get version-release from first RPM and keep for rpmlint check
# Remember to quote the "." for future regexes
ver_rel_old=$(rpm -qp --nodigest --nosignature --qf "%{RELEASE}" "${oldrpm}"|sed -e 's/\./\\./g')
ver_rel_new=$(rpm -qp --nodigest --nosignature --qf "%{RELEASE}" "${newrpm}"|sed -e 's/\./\\./g')
# For source RPMs, we can just check the metadata in the spec file # For source RPMs, we can just check the metadata in the spec file
# if those are not the same, the source RPM has changed and therefore # if those are not the same, the source RPM has changed and therefore
# the resulting files are needed. # the resulting files are needed.
@ -59,10 +55,11 @@ esac
# Now check that only the spec file has a changed release number and # Now check that only the spec file has a changed release number and
# nothing else # nothing else
dir=`mktemp -d` dir=$(mktemp -d)
unpackage $oldrpm $dir/old unpackage $oldrpm $dir/old &
unpackage $newrpm $dir/new unpackage $newrpm $dir/new &
cd $dir cd $dir
wait
check_single_file() check_single_file()
{ {
@ -71,12 +68,8 @@ check_single_file()
*.spec) *.spec)
sed -i -e 's,^Release:.*$,Release: @RELEASE@,' old/$file sed -i -e 's,^Release:.*$,Release: @RELEASE@,' old/$file
sed -i -e 's,^Release:.*$,Release: @RELEASE@,' new/$file sed -i -e 's,^Release:.*$,Release: @RELEASE@,' new/$file
if ! cmp -s old/$file new/$file; then diff --speed-large-files -su0 old/$file new/$file | head -n 20
echo "$file differs (spec file)" return "${PIPESTATUS[0]}"
diff -u old/$file new/$file | head -n 20
return 1
fi
return 0
;; ;;
*) *)
echo "$file differs" echo "$file differs"