From c1156c0dab332b2e77b0f1b187734185079698c3a91537cc0436bddab84b048a Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Mon, 2 Feb 2015 11:33:28 +0000 Subject: [PATCH] Accepting request 283746 from home:olh:branches:openSUSE:Tools - 2015.02.02 - Trim VERSION-RELEASE also in rpmlint log - Adjust regex for spec comparing in src.rpm - handle also stick and setuid directory from file(1) output OBS-URL: https://build.opensuse.org/request/show/283746 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/build-compare?expand=0&rev=160 --- build-compare.changes | 8 ++++++++ build-compare.spec | 2 +- rpm-check.sh | 2 +- same-build-result.sh | 10 +++++----- srpm-check.sh | 9 +++++++-- 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/build-compare.changes b/build-compare.changes index 9bcc730..fc68f3c 100644 --- a/build-compare.changes +++ b/build-compare.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Mon Feb 2 10:05:40 UTC 2015 - olaf@aepfle.de + +- 2015.02.02 +- Trim VERSION-RELEASE also in rpmlint log +- Adjust regex for spec comparing in src.rpm +- handle also stick and setuid directory from file(1) output + ------------------------------------------------------------------- Wed Jan 21 08:34:32 UTC 2015 - olaf@aepfle.de diff --git a/build-compare.spec b/build-compare.spec index 08fb7c7..c1ddd38 100644 --- a/build-compare.spec +++ b/build-compare.spec @@ -1,7 +1,7 @@ # # spec file for package build-compare # -# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed diff --git a/rpm-check.sh b/rpm-check.sh index d6141e2..948e8af 100644 --- a/rpm-check.sh +++ b/rpm-check.sh @@ -608,7 +608,7 @@ check_single_file() return 1 fi ;; - directory) + directory|setuid, directory|sticky, directory) # tar might package directories - ignore them here return 0 ;; diff --git a/same-build-result.sh b/same-build-result.sh index 3f1269d..3f9a025 100644 --- a/same-build-result.sh +++ b/same-build-result.sh @@ -62,10 +62,10 @@ bash $SCMPSCRIPT "$osrpm" "$nsrpm" || exit 1 OLDRPMS=($(find "$OLDDIR" -type f -name \*rpm -a ! -name \*src.rpm -a ! -name \*.delta.rpm|sort|grep -v -- -32bit-|grep -v -- -64bit-|grep -v -- '-x86-.*\.ia64\.rpm')) NEWRPMS=($(find $NEWDIRS -type f -name \*rpm -a ! -name \*src.rpm -a ! -name \*.delta.rpm|sort --field-separator=/ --key=7|grep -v -- -32bit-|grep -v -- -64bit-|grep -v -- '-x86-.*\.ia64\.rpm')) -# Get 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 -release1=$(rpm -qp --nodigest --nosignature --qf "%{RELEASE}" "${OLDRPMS[0]}"|sed -e 's/\./\\./g') -release2=$(rpm -qp --nodigest --nosignature --qf "%{RELEASE}" "${NEWRPMS[0]}"|sed -e 's/\./\\./g') +ver_rel1=$(rpm -qp --nodigest --nosignature --qf "%{VERSION}-%{RELEASE}" "${OLDRPMS[0]}"|sed -e 's/\./\\./g') +ver_rel2=$(rpm -qp --nodigest --nosignature --qf "%{VERSION}-%{RELEASE}" "${NEWRPMS[0]}"|sed -e 's/\./\\./g') SUCCESS=1 rpmqp='rpm -qp --qf %{NAME} --nodigest --nosignature ' @@ -106,8 +106,8 @@ if test -e $OLDDIR/rpmlint.log -a -e $OTHERDIR/rpmlint.log; then echo "comparing $OLDDIR/rpmlint.log and $OTHERDIR/rpmlint.log" # Sort the files first since the order of messages is not deterministic # Remove release from files - sort -u $OLDDIR/rpmlint.log|sed -e "s,$release1,@RELEASE@,g" -e "s|/tmp/rpmlint\..*spec|.spec|g" > $file1 - sort -u $OTHERDIR/rpmlint.log|sed -e "s,$release2,@RELEASE@,g" -e "s|/tmp/rpmlint\..*spec|.spec|g" > $file2 + sort -u $OLDDIR/rpmlint.log|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 if ! cmp -s $file1 $file2; then echo "rpmlint.log files differ:" diff -u $file1 $file2 |head -n 20 diff --git a/srpm-check.sh b/srpm-check.sh index f2571a2..9cd2260 100644 --- a/srpm-check.sh +++ b/srpm-check.sh @@ -27,6 +27,10 @@ source $FUNCTIONS oldrpm=`readlink -f $1` newrpm=`readlink -f $2` +# 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 # if those are not the same, the source RPM has changed and therefore @@ -36,6 +40,7 @@ cmp_spec RES=$? case $RES in 0) + echo "RPM meta information is identical" exit 0 ;; 1) @@ -63,8 +68,8 @@ check_single_file() local file=$1 case $file in *.spec) - sed -i -e "s,Release:.*$release1,Release: @RELEASE@," old/$file - sed -i -e "s,Release:.*$release2,Release: @RELEASE@," new/$file + sed -i -e "s,Release:.*${ver_rel_old}$,Release: @RELEASE@," old/$file + sed -i -e "s,Release:.*${ver_rel_new}$,Release: @RELEASE@," new/$file if ! cmp -s old/$file new/$file; then echo "$file differs (spec file)" diff -u old/$file new/$file | head -n 20