Accepting request 539772 from openSUSE:Tools
- srpm check requires cpio - Fix usage of cmp_spec and unrpm in srpm-check.sh - Catch empty rpm -qp --qf output for tags not understood by rpm OBS-URL: https://build.opensuse.org/request/show/539772 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/build-compare?expand=0&rev=106
This commit is contained in:
commit
b61ceaa86a
@ -1,3 +1,18 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Nov 8 06:04:42 UTC 2017 - olaf@aepfle.de
|
||||||
|
|
||||||
|
- srpm check requires cpio
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Nov 6 15:15:04 UTC 2017 - olaf@aepfle.de
|
||||||
|
|
||||||
|
- Fix usage of cmp_spec and unrpm in srpm-check.sh
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Nov 3 14:03:04 UTC 2017 - olaf@aepfle.de
|
||||||
|
|
||||||
|
- Catch empty rpm -qp --qf output for tags not understood by rpm
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Oct 20 06:53:18 UTC 2017 - olaf@aepfle.de
|
Fri Oct 20 06:53:18 UTC 2017 - olaf@aepfle.de
|
||||||
|
|
||||||
|
@ -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: 20171020T085619.7cef93b
|
Version: 20171108T070456.b855319
|
||||||
Release: 0
|
Release: 0
|
||||||
Source1: COPYING
|
Source1: COPYING
|
||||||
Source2: same-build-result.sh
|
Source2: same-build-result.sh
|
||||||
@ -31,6 +31,7 @@ Source5: srpm-check.sh
|
|||||||
%if 0%{?suse_version}
|
%if 0%{?suse_version}
|
||||||
Requires: bash
|
Requires: bash
|
||||||
Requires: coreutils
|
Requires: coreutils
|
||||||
|
Requires: cpio
|
||||||
Requires: diffutils
|
Requires: diffutils
|
||||||
Requires: file
|
Requires: file
|
||||||
Requires: gawk
|
Requires: gawk
|
||||||
|
67
functions.sh
67
functions.sh
@ -146,7 +146,7 @@ function unpackage()
|
|||||||
# $1: printed info
|
# $1: printed info
|
||||||
# $2: file1
|
# $2: file1
|
||||||
# $3: file2
|
# $3: file2
|
||||||
# $4, $5: spec_old and spec_new, for cleanup.
|
# $4, $5: rpm_meta_old and rpm_meta_new, for cleanup.
|
||||||
function comp_file()
|
function comp_file()
|
||||||
{
|
{
|
||||||
echo "comparing $1"
|
echo "comparing $1"
|
||||||
@ -208,7 +208,7 @@ function set_regex() {
|
|||||||
# 1 in case of errors or difference
|
# 1 in case of errors or difference
|
||||||
# 2 in case of differences that need further investigation
|
# 2 in case of differences that need further investigation
|
||||||
# Sets $files with list of files that need further investigation
|
# Sets $files with list of files that need further investigation
|
||||||
function cmp_spec ()
|
function cmp_rpm_meta ()
|
||||||
{
|
{
|
||||||
local RES
|
local RES
|
||||||
local file1 file2
|
local file1 file2
|
||||||
@ -219,36 +219,45 @@ function cmp_spec ()
|
|||||||
|
|
||||||
file1=`mktemp`
|
file1=`mktemp`
|
||||||
file2=`mktemp`
|
file2=`mktemp`
|
||||||
spec_old=`mktemp`
|
rpm_meta_old=`mktemp`
|
||||||
spec_new=`mktemp`
|
rpm_meta_new=`mktemp`
|
||||||
|
|
||||||
check_header "$QF_ALL" $oldrpm > $spec_old
|
check_header "$QF_ALL" $oldrpm > $rpm_meta_old
|
||||||
check_header "$QF_ALL" $newrpm > $spec_new
|
check_header "$QF_ALL" $newrpm > $rpm_meta_new
|
||||||
|
|
||||||
name_new="$(get_value QF_NAME $spec_new)"
|
# rpm returns 0 even in case of error
|
||||||
version_release_new="$(get_value QF_VER_REL $spec_new)"
|
if test -s $rpm_meta_old && test -s $rpm_meta_new ; then
|
||||||
name_ver_rel_new="$(get_value QF_NAME_VER_REL $spec_new)"
|
: some output provided, all query tags understood by rpm
|
||||||
|
else
|
||||||
|
ls -l $rpm_meta_old $rpm_meta_new
|
||||||
|
echo "empty 'rpm -qp' output..."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
version_release_old="$(get_value QF_VER_REL $spec_old)"
|
name_new="$(get_value QF_NAME $rpm_meta_new)"
|
||||||
name_ver_rel_old="$(get_value QF_NAME_VER_REL $spec_old)"
|
version_release_new="$(get_value QF_VER_REL $rpm_meta_new)"
|
||||||
|
name_ver_rel_new="$(get_value QF_NAME_VER_REL $rpm_meta_new)"
|
||||||
|
|
||||||
|
version_release_old="$(get_value QF_VER_REL $rpm_meta_old)"
|
||||||
|
name_ver_rel_old="$(get_value QF_NAME_VER_REL $rpm_meta_old)"
|
||||||
|
|
||||||
set_regex
|
set_regex
|
||||||
|
|
||||||
# Check the whole spec file at first, return 0 immediately if the
|
# Check the whole spec file at first, return 0 immediately if the
|
||||||
# are the same.
|
# are the same.
|
||||||
cat $spec_old | trim_release_old > $file1
|
cat $rpm_meta_old | trim_release_old > $file1
|
||||||
cat $spec_new | trim_release_new > $file2
|
cat $rpm_meta_new | trim_release_new > $file2
|
||||||
echo "comparing the rpm tags of $name_new"
|
echo "comparing the rpm tags of $name_new"
|
||||||
if diff -au $file1 $file2; then
|
if diff -au $file1 $file2; then
|
||||||
if test -z "$check_all"; then
|
if test -z "$check_all"; then
|
||||||
rm $file1 $file2 $spec_old $spec_new
|
rm $file1 $file2 $rpm_meta_old $rpm_meta_new
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
get_value QF_TAGS $spec_old > $file1
|
get_value QF_TAGS $rpm_meta_old > $file1
|
||||||
get_value QF_TAGS $spec_new > $file2
|
get_value QF_TAGS $rpm_meta_new > $file2
|
||||||
comp_file rpmtags $file1 $file2 $spec_old $spec_new || return 1
|
comp_file rpmtags $file1 $file2 $rpm_meta_old $rpm_meta_new || return 1
|
||||||
|
|
||||||
# This might happen when?!
|
# This might happen when?!
|
||||||
echo "comparing RELEASE"
|
echo "comparing RELEASE"
|
||||||
@ -266,24 +275,24 @@ function cmp_spec ()
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
get_value QF_PROVIDES $spec_old | trim_release_old | sort > $file1
|
get_value QF_PROVIDES $rpm_meta_old | trim_release_old | sort > $file1
|
||||||
get_value QF_PROVIDES $spec_new | trim_release_new | sort > $file2
|
get_value QF_PROVIDES $rpm_meta_new | trim_release_new | sort > $file2
|
||||||
comp_file PROVIDES $file1 $file2 $spec_old $spec_new || return 1
|
comp_file PROVIDES $file1 $file2 $rpm_meta_old $rpm_meta_new || return 1
|
||||||
|
|
||||||
get_value QF_SCRIPT $spec_old | trim_release_old > $file1
|
get_value QF_SCRIPT $rpm_meta_old | trim_release_old > $file1
|
||||||
get_value QF_SCRIPT $spec_new | trim_release_new > $file2
|
get_value QF_SCRIPT $rpm_meta_new | trim_release_new > $file2
|
||||||
comp_file scripts $file1 $file2 $spec_old $spec_new || return 1
|
comp_file scripts $file1 $file2 $rpm_meta_old $rpm_meta_new || return 1
|
||||||
|
|
||||||
# First check the file attributes and later the md5s
|
# First check the file attributes and later the md5s
|
||||||
get_value QF_FILELIST $spec_old | trim_release_old > $file1
|
get_value QF_FILELIST $rpm_meta_old | trim_release_old > $file1
|
||||||
get_value QF_FILELIST $spec_new | trim_release_new > $file2
|
get_value QF_FILELIST $rpm_meta_new | trim_release_new > $file2
|
||||||
comp_file filelist $file1 $file2 $spec_old $spec_new || return 1
|
comp_file filelist $file1 $file2 $rpm_meta_old $rpm_meta_new || return 1
|
||||||
|
|
||||||
# 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
|
||||||
# file flag 64 means "ghost", filter those out.
|
# file flag 64 means "ghost", filter those out.
|
||||||
get_value QF_CHECKSUM $spec_old | grep -v " 64$" | trim_release_old > $file1
|
get_value QF_CHECKSUM $rpm_meta_old | grep -v " 64$" | trim_release_old > $file1
|
||||||
get_value QF_CHECKSUM $spec_new | grep -v " 64$" | trim_release_new > $file2
|
get_value QF_CHECKSUM $rpm_meta_new | grep -v " 64$" | trim_release_new > $file2
|
||||||
RES=2
|
RES=2
|
||||||
# done if the same
|
# done if the same
|
||||||
echo "comparing file checksum"
|
echo "comparing file checksum"
|
||||||
@ -294,7 +303,7 @@ function cmp_spec ()
|
|||||||
# Get only files with different MD5sums
|
# Get only files with different MD5sums
|
||||||
files=`diff -U0 $file1 $file2 | fgrep -v +++ | grep ^+ | cut -b2- | awk '{print $1}'`
|
files=`diff -U0 $file1 $file2 | fgrep -v +++ | grep ^+ | cut -b2- | awk '{print $1}'`
|
||||||
|
|
||||||
if test -f "$sh"; then
|
if test -n "$sh"; then
|
||||||
echo "creating rename script"
|
echo "creating rename script"
|
||||||
# Create a temporary helper script to rename files/dirs with release in it
|
# Create a temporary helper script to rename files/dirs with release in it
|
||||||
for f in `$RPM --qf '[%{FILENAMES} %{FILEFLAGS}\n]\n' "$oldrpm" | grep_release_old | grep -vw 64$ | awk '{ print $1}'`
|
for f in `$RPM --qf '[%{FILENAMES} %{FILEFLAGS}\n]\n' "$oldrpm" | grep_release_old | grep -vw 64$ | awk '{ print $1}'`
|
||||||
|
@ -223,7 +223,7 @@ echo "Comparing `basename $oldpkg` to `basename $newpkg`"
|
|||||||
|
|
||||||
case $oldpkg in
|
case $oldpkg in
|
||||||
*.rpm)
|
*.rpm)
|
||||||
cmp_spec $rename_script $oldpkg $newpkg
|
cmp_rpm_meta "$rename_script" "$oldpkg" "$newpkg"
|
||||||
RES=$?
|
RES=$?
|
||||||
case $RES in
|
case $RES in
|
||||||
0)
|
0)
|
||||||
@ -264,7 +264,7 @@ case $oldpkg in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# files is set in cmp_spec for rpms, so if RES is empty we should assume
|
# files is set in cmp_rpm_meta for rpms, so if RES is empty we should assume
|
||||||
# it wasn't an rpm and pick all files for comparison.
|
# it wasn't an rpm and pick all files for comparison.
|
||||||
if [ -z $RES ]; then
|
if [ -z $RES ]; then
|
||||||
oldfiles=`cd $dir/old; find . -type f`
|
oldfiles=`cd $dir/old; find . -type f`
|
||||||
@ -926,7 +926,7 @@ if [ ! -d /proc/self/ ]; then
|
|||||||
PROC_MOUNTED=1
|
PROC_MOUNTED=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# preserve cmp_spec result for check_all runs
|
# preserve cmp_rpm_meta result for check_all runs
|
||||||
ret=$RES
|
ret=$RES
|
||||||
for file in $files; do
|
for file in $files; do
|
||||||
if ! check_single_file $file; then
|
if ! check_single_file $file; then
|
||||||
|
@ -26,6 +26,7 @@ source $FUNCTIONS
|
|||||||
|
|
||||||
oldrpm=`readlink -f $1`
|
oldrpm=`readlink -f $1`
|
||||||
newrpm=`readlink -f $2`
|
newrpm=`readlink -f $2`
|
||||||
|
rename_script=
|
||||||
|
|
||||||
# Get version-release from first RPM and keep for rpmlint check
|
# Get version-release from first RPM and keep for rpmlint check
|
||||||
# Remember to quote the "." for future regexes
|
# Remember to quote the "." for future regexes
|
||||||
@ -36,7 +37,7 @@ ver_rel_new=$(rpm -qp --nodigest --nosignature --qf "%{RELEASE}" "${newrpm}"|sed
|
|||||||
# 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.
|
||||||
|
|
||||||
cmp_spec
|
cmp_rpm_meta "$rename_script" "$oldrpm" "$newrpm"
|
||||||
RES=$?
|
RES=$?
|
||||||
case $RES in
|
case $RES in
|
||||||
0)
|
0)
|
||||||
@ -59,8 +60,8 @@ esac
|
|||||||
# nothing else
|
# nothing else
|
||||||
|
|
||||||
dir=`mktemp -d`
|
dir=`mktemp -d`
|
||||||
unrpm $oldrpm $dir/old
|
unpackage $oldrpm $dir/old
|
||||||
unrpm $newrpm $dir/new
|
unpackage $newrpm $dir/new
|
||||||
cd $dir
|
cd $dir
|
||||||
|
|
||||||
check_single_file()
|
check_single_file()
|
||||||
|
Loading…
Reference in New Issue
Block a user