forked from pool/build-compare
Accepting request 281275 from home:olh:branches:openSUSE:Tools
- 2015.01.14 - Trim VERSION-RELEASE instead of RELEASE because the release number will match other substrings. - Use regex instead in sed /regex/ to match dots properly - Handle plain cpio archives from gfxboot - Add patterns for .TH header in man pages to handle all cases OBS-URL: https://build.opensuse.org/request/show/281275 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/build-compare?expand=0&rev=157
This commit is contained in:
parent
7767ce80a4
commit
c8d0926edf
@ -1,3 +1,13 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Jan 9 09:37:34 UTC 2015 - olaf@aepfle.de
|
||||
|
||||
- 2015.01.14
|
||||
- Trim VERSION-RELEASE instead of RELEASE because the release number
|
||||
will match other substrings.
|
||||
- Use regex instead in sed /regex/ to match dots properly
|
||||
- Handle plain cpio archives from gfxboot
|
||||
- Add patterns for .TH header in man pages to handle all cases
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Nov 26 08:58:45 UTC 2014 - ohering@suse.de
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package build-compare
|
||||
#
|
||||
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2015 SUSE LINUX Products 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,7 @@ Name: build-compare
|
||||
Summary: Build Result Compare Script
|
||||
License: GPL-2.0+
|
||||
Group: Development/Tools/Building
|
||||
Version: 2014.11.25
|
||||
Version: 2015.01.14
|
||||
Release: 0
|
||||
Source1: COPYING
|
||||
Source2: same-build-result.sh
|
||||
|
28
functions.sh
28
functions.sh
@ -15,26 +15,26 @@ check_header()
|
||||
$RPM --qf "$QF" "$1"
|
||||
}
|
||||
|
||||
# Trim release string:
|
||||
# Trim version-release string:
|
||||
# - 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
|
||||
function trim_release_old()
|
||||
{
|
||||
sed -e "/\(\/boot\|\/lib\/modules\|\/lib\/firmware\|\/usr\/src\|$release_old\$\)/{s,-$release_old_regex_l,-@RELEASE_LONG@,g;s,-$release_old_regex_s,-@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}"
|
||||
}
|
||||
function trim_release_new()
|
||||
{
|
||||
sed -e "/\(\/boot\|\/lib\/modules\|\/lib\/firmware\|\/usr\/src\|$release_new\$\)/{s,-$release_new_regex_l,-@RELEASE_LONG@,g;s,-$release_new_regex_s,-@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}"
|
||||
}
|
||||
# Get single directory or filename with long or short release string
|
||||
function grep_release_old()
|
||||
{
|
||||
grep -E "(/boot|/lib/modules|/lib/firmware|/usr/src)/[^/]+(-${release_old_regex_l}(\$|[^/]+\$)|-${release_old_regex_s}(\$|[^/]+\$))"
|
||||
grep -E "(/boot|/lib/modules|/lib/firmware|/usr/src)/[^/]+(${version_release_old_regex_l}(\$|[^/]+\$)|${version_release_old_regex_s}(\$|[^/]+\$))"
|
||||
}
|
||||
function grep_release_new()
|
||||
{
|
||||
grep -E "(/boot|/lib/modules|/lib/firmware|/usr/src)/[^/]+(-${release_new_regex_l}(\$|[^/]+\$)|-${release_new_regex_s}(\$|[^/]+\$))"
|
||||
grep -E "(/boot|/lib/modules|/lib/firmware|/usr/src)/[^/]+(${version_release_new_regex_l}(\$|[^/]+\$)|${version_release_new_regex_s}(\$|[^/]+\$))"
|
||||
}
|
||||
|
||||
function check_provides()
|
||||
@ -117,19 +117,19 @@ function cmp_spec ()
|
||||
fi
|
||||
|
||||
# Remember to quote the . which is in release
|
||||
release_old=$($RPM --qf "%{RELEASE}" "$oldrpm")
|
||||
release_new=$($RPM --qf "%{RELEASE}" "$newrpm")
|
||||
version_release_old=$($RPM --qf "%{VERSION}-%{RELEASE}" "$oldrpm")
|
||||
version_release_new=$($RPM --qf "%{VERSION}-%{RELEASE}" "$newrpm")
|
||||
# Short version without B_CNT
|
||||
release_old_regex_s=${release_old%.*}
|
||||
release_old_regex_s=${release_old_regex_s//./\\.}
|
||||
release_new_regex_s=${release_new%.*}
|
||||
release_new_regex_s=${release_new_regex_s//./\\.}
|
||||
version_release_old_regex_s=${version_release_old%.*}
|
||||
version_release_old_regex_s=${version_release_old_regex_s//./\\.}
|
||||
version_release_new_regex_s=${version_release_new%.*}
|
||||
version_release_new_regex_s=${version_release_new_regex_s//./\\.}
|
||||
# Long version with B_CNT
|
||||
release_old_regex_l=${release_old//./\\.}
|
||||
release_new_regex_l=${release_new//./\\.}
|
||||
version_release_old_regex_l=${version_release_old//./\\.}
|
||||
version_release_new_regex_l=${version_release_new//./\\.}
|
||||
# This might happen when?!
|
||||
echo "comparing RELEASE"
|
||||
if [ "${release_old%.*}" != "${release_new%.*}" ] ; then
|
||||
if [ "${version_release_old%.*}" != "${version_release_new%.*}" ] ; then
|
||||
case $($RPM --qf '%{NAME}' "$newrpm") in
|
||||
kernel-*)
|
||||
# Make sure all kernel packages have the same %RELEASE
|
||||
|
38
rpm-check.sh
38
rpm-check.sh
@ -257,11 +257,12 @@ check_single_file()
|
||||
*.cpio)
|
||||
flist=`cpio --quiet --list --force-local < "new/$file"`
|
||||
pwd=$PWD
|
||||
fdir=`dirname $file`
|
||||
fdir=$file.extract.$PPID.$$
|
||||
mkdir old/$fdir new/$fdir
|
||||
cd old/$fdir
|
||||
cpio --quiet --extract --force-local < "${file##*/}"
|
||||
cpio --quiet --extract --force-local < "../${file##*/}"
|
||||
cd $pwd/new/$fdir
|
||||
cpio --quiet --extract --force-local < "${file##*/}"
|
||||
cpio --quiet --extract --force-local < "../${file##*/}"
|
||||
cd $pwd
|
||||
local ret=0
|
||||
for f in $flist; do
|
||||
@ -272,6 +273,7 @@ check_single_file()
|
||||
fi
|
||||
fi
|
||||
done
|
||||
rm -rf old/$fdir new/$fdir
|
||||
return $ret
|
||||
;;
|
||||
*.tar|*.tar.bz2|*.tar.gz|*.tgz|*.tbz2)
|
||||
@ -434,19 +436,20 @@ check_single_file()
|
||||
# .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 "Tue Aug 31 2010" "Version 1.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
|
||||
sed -i -e 's|.TH "\?\([^ "]*\)"\? "\?\([0-9][a-z]*\)"\? "\?\(20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]\|[0-9]* [A-Z][a-z]* 20[0-9][0-9]\)"\? |.TH \1 \2 "2000-01-01" |' $f
|
||||
sed -i -e 's|.TH "\?\([^ "]*\)"\? "\?\([0-9][a-z]*\)"\? "\?\([0-1][0-9]/[0-9][0-9]/201[0-9]\)"\? |.TH \1 \2 "2000-01-01" |' $f
|
||||
sed -i -e 's|.TH \(.*\) "\?\(20[0-1][0-9]-[0-9][0-9]-[0-9][0-9]\)"\? |.TH \1 "2000-01-01" |' $f
|
||||
# .TH ccmake 1 "February 05, 2012" "ccmake 2.8.7"
|
||||
sed -i -e 's|^.TH "\?\([^ "]*\)"\? "\?\([0-9][a-z]*\)"\? "\?\([A-Z][a-z]* [0-9][0-9], 20[0-9][0-9]\)"\? |.TH \1 \2 "2000-01-01" |' $f
|
||||
# .TH "appender.h" 3 "Tue Aug 31 2010" "Version 1.2.1" "log4c" \" -*- nroff -*-
|
||||
sed -i -e 's|.TH "\?\([^ "]*\)"\? "\?\([0-9][a-z]*\)"\? "\?[A-Z][a-z][a-z] [A-Z][a-z][a-z] [0-9]\+ 20[0-9][0-9]"\? |.TH \1 \2 "2000-01-01" |' $f
|
||||
# .TH ARCH "1" "September 2010" "GNU coreutils 8.5" "User Commands"
|
||||
sed -i -e 's|.TH "\?\([^ "]*\)"\? "\?\([0-9][a-z]*\)"\? "\?[A-Z][a-z]* 20[0-9][0-9]"\? |.TH \1 \2 "2000-01-01" |' $f
|
||||
# .TH "GCM-CALIBRATE" "1" "03 February 2012" "" ""
|
||||
sed -i -e 's|.TH "\?\([^ "]*\)"\? "\?\([0-9][a-z]*\)"\? "\?[0-9]* [A-Z][a-z]* 20[0-9][0-9]"\? |.TH \1 \2 "2000-01-01" |' $f
|
||||
# (.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
|
||||
sed -i -e 's|Date: [0-1][0-9]/[0-9][0-9]/201[0-9]|Date: 09/13/2010|' $f
|
||||
@ -624,6 +627,13 @@ check_single_file()
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
\ cpio\ archive)
|
||||
mv old/$file{,.cpio}
|
||||
mv new/$file{,.cpio}
|
||||
if ! check_single_file ${file}.cpio; then
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
*symbolic\ link\ to\ *)
|
||||
readlink "old/$file" > $file1
|
||||
readlink "new/$file" > $file2
|
||||
|
Loading…
Reference in New Issue
Block a user