Accepting request 284445 from openSUSE:Tools

- 2015.02.06
- Remove more javadoc references (bnc#916161)
- Handle *.war files like *.jar files
- Trim name-version-release string in update-scripts

- 2015.02.04
- Handle ruby gem files, they are tar archives (bnc#916047)
- Remove Creator: and CreationDate: tags from .ps files (bnc#915952)
- Correct regex for hostname in libtool (bnc#916268)

- 2015.02.03
- Trim .TH also in perl man pages (bnc#915941)
- Trim first line of man page to catch overly verbose tools
- Use correct offset for patching mtime out of .pyc files
- Add BuildIgnore to allow bootstrap in sle11

- 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/284445
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/build-compare?expand=0&rev=85
This commit is contained in:
Dominique Leuenberger 2015-02-08 10:42:11 +00:00 committed by Git OBS Bridge
commit 8de12bc047
6 changed files with 155 additions and 45 deletions

View File

@ -1,3 +1,36 @@
-------------------------------------------------------------------
Fri Feb 6 10:35:56 UTC 2015 - olaf@aepfle.de
- 2015.02.06
- Remove more javadoc references (bnc#916161)
- Handle *.war files like *.jar files
- Trim name-version-release string in update-scripts
-------------------------------------------------------------------
Wed Feb 4 15:53:05 UTC 2015 - olaf@aepfle.de
- 2015.02.04
- Handle ruby gem files, they are tar archives (bnc#916047)
- Remove Creator: and CreationDate: tags from .ps files (bnc#915952)
- Correct regex for hostname in libtool (bnc#916268)
-------------------------------------------------------------------
Tue Feb 3 11:34:39 UTC 2015 - olaf@aepfle.de
- 2015.02.03
- Trim .TH also in perl man pages (bnc#915941)
- Trim first line of man page to catch overly verbose tools
- Use correct offset for patching mtime out of .pyc files
- Add BuildIgnore to allow bootstrap in sle11
-------------------------------------------------------------------
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

View File

@ -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
@ -20,7 +20,8 @@ Name: build-compare
Summary: Build Result Compare Script
License: GPL-2.0+
Group: Development/Tools/Building
Version: 2015.01.21
Url: https://github.com/openSUSE/build-compare
Version: 2015.02.06
Release: 0
Source1: COPYING
Source2: same-build-result.sh
@ -29,6 +30,7 @@ Source4: functions.sh
Source5: srpm-check.sh
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
#!BuildIgnore: build-compare
%description
This package contains scripts to find out if the build result differs

View File

@ -19,13 +19,21 @@ check_header()
# - 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
# Trim name-version-release string:
# - it is used in update-scripts which are called by libzypp
function trim_release_old()
{
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}"
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}
s/\(\/var\/adm\/update-scripts\/\)${name_ver_rel_old_regex_l}\([^[:blank:]]\+\)/\1@NAME_VER_REL@\2/g
"
}
function trim_release_new()
{
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}"
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}
s/\(\/var\/adm\/update-scripts\/\)${name_ver_rel_new_regex_l}\([^[:blank:]]\+\)/\1@NAME_VER_REL@\2/g
"
}
# Get single directory or filename with long or short release string
function grep_release_old()
@ -119,6 +127,8 @@ function cmp_spec ()
# Remember to quote the . which is in release
version_release_old=$($RPM --qf "%{VERSION}-%{RELEASE}" "$oldrpm")
version_release_new=$($RPM --qf "%{VERSION}-%{RELEASE}" "$newrpm")
name_ver_rel_old=$($RPM --qf "%{NAME}-%{VERSION}-%{RELEASE}" "$oldrpm")
name_ver_rel_new=$($RPM --qf "%{NAME}-%{VERSION}-%{RELEASE}" "$newrpm")
# Short version without B_CNT
version_release_old_regex_s=${version_release_old%.*}
version_release_old_regex_s=${version_release_old_regex_s//./\\.}
@ -127,6 +137,8 @@ function cmp_spec ()
# Long version with B_CNT
version_release_old_regex_l=${version_release_old//./\\.}
version_release_new_regex_l=${version_release_new//./\\.}
name_ver_rel_old_regex_l=${name_ver_rel_old//./\\.}
name_ver_rel_new_regex_l=${name_ver_rel_new//./\\.}
# This might happen when?!
echo "comparing RELEASE"
if [ "${version_release_old%.*}" != "${version_release_new%.*}" ] ; then
@ -225,3 +237,4 @@ function cmp_spec ()
rm $file1 $file2
return $RES
}
# vim: tw=666 ts=2 et

View File

@ -146,6 +146,47 @@ diff_two_files()
return 0
}
trim_man_first_line()
{
# Handles the first line if it is like:
#.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
#.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.43.3.
local f=$1
sed -i -e '1{
s|^\.\\"[[:blank:]]\+Automatically[[:blank:]]generated[[:blank:]]by[[:blank:]]Pod::Man[[:blank:]].*|.\\" Overly verbose Pod::Man|
s|^\.\\"[[:blank:]]\+DO[[:blank:]]NOT[[:blank:]]MODIFY[[:blank:]]THIS[[:blank:]]FILE![[:blank:]]\+It[[:blank:]]was[[:blank:]]generated[[:blank:]]by[[:blank:]]help2man[[:blank:]].*|.\\" Overly verbose help2man|
}' $f
}
trim_man_TH()
{
# Handles lines like:
# .TH debhelper 7 "2010-02-27" "7.4.15" "Debhelper"
# .TH DIRMNGR-CLIENT 1 2010-02-27 "Dirmngr 1.0.3" "GNU Privacy Guard"
# .TH ccmake 1 "March 06, 2010" "ccmake 2.8.1-rc3"
# .TH QEMU-IMG 1 "2010-03-14" " " " "
# .TH kdecmake 1 "May 07, 2010" "cmake 2.8.1"
# .TH "appender.h" 3 "12 May 2010" "Version 1.2.1" "log4c" \" -*- nroff -*-
# .TH"appender.h"3"TueAug312010""Version1.2.1""log4c"\"-*-nroff-*-
# .TH "OFFLINEIMAP" "1" "11 May 2010" "John Goerzen" "OfflineIMAP Manual"
# .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"TueAug312010""Version1.2.1""log4c"\"-*-nroff-*-
# .TH ARCH "1" "September 2010" "GNU coreutils 8.5" "User Commands"
# .TH "GCM-CALIBRATE" "1" "03 February 2012" "" ""
#.TH Locale::Po4a::Xml.pm 3pm "2015-01-30" "Po4a Tools" "Po4a Tools"
local f=$1
# (.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
}
strip_numbered_anchors()
{
@ -296,7 +337,7 @@ check_single_file()
done
return $ret
;;
*.zip|*.jar)
*.zip|*.jar|*.war)
cd old
unjar_l ./$file |sort > flist
# 10-05-2010 14:39
@ -332,8 +373,8 @@ check_single_file()
done
return $ret;;
*.pyc|*.pyo)
perl -e "open fh, '+<', 'old/$file'; seek fh, 3, SEEK_SET; print fh '0000';"
perl -e "open fh, '+<', 'new/$file'; seek fh, 3, SEEK_SET; print fh '0000';"
perl -e "open fh, '+<', 'old/$file'; seek fh, 4, SEEK_SET; print fh '0000';"
perl -e "open fh, '+<', 'new/$file'; seek fh, 4, SEEK_SET; print fh '0000';"
;;
*.bz2)
bunzip2 -c old/$file > old/${file/.bz2/}
@ -386,9 +427,27 @@ check_single_file()
# There are more timestamps in html, so far we handle only some primitive versions.
for f in old/$file new/$file; do
# Javadoc:
sed -i -e "s,^<!-- Generated by javadoc (build [0-9._]*) on ... ... .. ..:..:.. UTC .... -->,^<!-- Generated by javadoc (build 1.6.0_0) on Sun Jul 01 00:00:00 UTC 2000 -->," $f
sed -i -e 's|^<!-- Generated by javadoc on ... ... .. ..:..:.. UTC ....-->$|<!-- Generated by javadoc on Sun Jul 01 00:00:00 UTC 2000-->|' $f
sed -i -e 's|<META NAME="date" CONTENT="20..-..-..">|<META NAME="date" CONTENT="1970-01-01">|' $f
# <head>
# <!-- 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 -->
# <meta name="date" content="2015-02-03">
# </head>
sed -i -e '
/^<head>/{
: next
n
/^<\/head>/{
b end_head
}
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\) \(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">/
b next
}
: end_head
' $f
# Gjdoc HtmlDoclet:
sed -i -e 's%Generated by Gjdoc HtmlDoclet [0-9,.]*, part of <a href="http://www.gnu.org/software/classpath/cp-tools/" title="" target="_top">GNU Classpath Tools</a>, on .*, 20.. [0-9]*:..:.. \(a\|p\)\.m\. GMT.%Generated by Gjdoc.%' $f
sed -i -e 's%<!DOCTYPE html PUBLIC "-//gnu.org///DTD XHTML 1.1 plus Target 1.0//EN"\(.*\)GNU Classpath Tools</a>, on [A-Z][a-z]* [0-9]*, 20?? [0-9]*:??:?? \(a|p\)\.m\. GMT.</p>%<!DOCTYPE html PUBLIC "-//gnu.org///DTD XHTML 1.1 plus Target 1.0//EN"\1GNU Classpath Tools</a>, on January 1, 2009 0:00:00 a.m. GMT.</p>%' $f
@ -421,37 +480,17 @@ check_single_file()
/usr/share/man/man3/*3pm)
for f in old/$file new/$file; do
sed -i -e 's| 3 "20..-..-.." "perl v5....." "User Contributed Perl Documentation"$| 3 "2009-01-01" "perl v5.10.0" "User Contributed Perl Documentation"|' $f
trim_man_TH $f
trim_man_first_line $f
done
;;
/usr/share/man/man*/*|/usr/lib/texmf/doc/man/*/*)
# Handles lines like:
# .TH debhelper 7 "2010-02-27" "7.4.15" "Debhelper"
# .TH DIRMNGR-CLIENT 1 2010-02-27 "Dirmngr 1.0.3" "GNU Privacy Guard"
# .TH ccmake 1 "March 06, 2010" "ccmake 2.8.1-rc3"
# .TH QEMU-IMG 1 "2010-03-14" " " " "
# .TH kdecmake 1 "May 07, 2010" "cmake 2.8.1"
# .TH "appender.h" 3 "12 May 2010" "Version 1.2.1" "log4c" \" -*- nroff -*-
# .TH"appender.h"3"TueAug312010""Version1.2.1""log4c"\"-*-nroff-*-
# .TH "OFFLINEIMAP" "1" "11 May 2010" "John Goerzen" "OfflineIMAP Manual"
# .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"TueAug312010""Version1.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
# (.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
trim_man_TH $f
trim_man_first_line $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
done
;;
@ -470,7 +509,7 @@ check_single_file()
;;
*/libtool)
for f in old/$file new/$file; do
sed -i -e 's|^# Libtool was configured on host [a-z0-9]*:$|Libtool was configured on host x42:|' $f
sed -i -e 's|^# Libtool was configured on host [A-Za-z0-9]*:$|# Libtool was configured on host x42:|' $f
done
;;
/etc/mail/*cf|/etc/sendmail.cf)
@ -526,6 +565,14 @@ check_single_file()
echo "$file and $oldfn are same"
return 0
;;
*.ps)
for f in "old/$file" "new/$file"; do
sed -i -e '
/^%%CreationDate:[[:blank:]]/d
/^%%Creator:[[:blank:]]groff[[:blank:]]version[[:blank:]]/d
' "$f"
done
;;
*pdf)
# PDF files contain a unique ID, remove it
# Format of the ID is:
@ -608,7 +655,7 @@ check_single_file()
return 1
fi
;;
directory)
directory|setuid,\ directory|sticky,\ directory)
# tar might package directories - ignore them here
return 0
;;
@ -627,6 +674,13 @@ check_single_file()
return 1
fi
;;
POSIX\ tar\ archive)
mv old/$file{,.tar}
mv new/$file{,.tar}
if ! check_single_file ${file}.tar; then
return 1
fi
;;
cpio\ archive)
mv old/$file{,.cpio}
mv new/$file{,.cpio}
@ -682,3 +736,4 @@ if test "$ret" = 0; then
echo "RPM content is identical"
fi
exit $ret
# vim: tw=666 ts=2 et

View File

@ -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
@ -141,3 +141,4 @@ if test $SUCCESS -eq 0; then
fi
echo 'compare validated built as identical !'
exit 0
# vim: tw=666 ts=2 et

View File

@ -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
@ -92,3 +97,4 @@ done
rm -rf $dir
exit $ret
# vim: tw=666 ts=2 et