Copied from https://build.opensuse.org/package/show/openSUSE:Factory/build-compare?rev=89
Change-Id: I28a9f779038f18906d1d1934f015d7d3ea861056
Signed-off-by: Stephane Desneux <stephane.desneux@open.eurogiciel.org>
+++ /dev/null
--------------------------------------------------------------------
-Thu Oct 28 09:49:14 UTC 2010 - aj@suse.de
-
-- If source file is different, do not compare binaries with check-all.
-
--------------------------------------------------------------------
-Wed Oct 27 11:59:15 UTC 2010 - aj@suse.de
-
-- Handle /usr/lib/texmf/doc/man as well
-
--------------------------------------------------------------------
-Tue Oct 26 19:43:39 UTC 2010 - aj@suse.de
-
-- Ignore metafont formats.
-
--------------------------------------------------------------------
-Tue Oct 26 08:37:35 UTC 2010 - aj@suse.de
-
-- Enable check-all to check for all differences in all packages.
-
--------------------------------------------------------------------
-Fri Oct 22 18:27:48 UTC 2010 - aj@suse.de
-
-- Handle new zip date.
-- Handle heartbeat man page.
-
--------------------------------------------------------------------
-Sun Sep 26 10:03:25 UTC 2010 - aj@suse.de
-
-- Fix man regex.
-
--------------------------------------------------------------------
-Wed Sep 22 13:24:19 UTC 2010 - coolo@novell.com
-
-- ignore texlive's fmt files as discussed with werner
-
--------------------------------------------------------------------
-Mon Sep 20 19:24:10 UTC 2010 - aj@suse.de
-
-- Handle man pages generated from docbook.
-- Handle rubygem documentation.
-
--------------------------------------------------------------------
-Mon Sep 20 18:45:01 UTC 2010 - aj@suse.de
-
-- Create common file functions.sh and cleanup code.
-
--------------------------------------------------------------------
-Mon Sep 20 15:21:55 UTC 2010 - lnussel@suse.de
-
-- exclude delta rpms
-
--------------------------------------------------------------------
-Mon Sep 20 07:58:59 UTC 2010 - aj@suse.de
-
-- Create script for just checking source rpms.
-
-
--------------------------------------------------------------------
-Thu Sep 9 20:02:33 UTC 2010 - aj@suse.de
-
-- Handle another date format for man pages found in coreutils.
-- Handle more html files, e.g. kdelibs4 and libvdpau.
-
--------------------------------------------------------------------
-Thu Sep 9 07:58:35 UTC 2010 - aj@suse.de
-
-- Handle weekday in man page.
-
--------------------------------------------------------------------
-Tue Aug 31 11:57:26 UTC 2010 - aj@suse.de
-
-- Refine texi2html rule (found in zsh)
-
--------------------------------------------------------------------
-Fri Aug 27 08:59:22 UTC 2010 - aj@suse.de
-
-- Handle png files with timestamp if convert is installed.
-
--------------------------------------------------------------------
-Fri Aug 27 06:50:13 UTC 2010 - aj@suse.de
-
-- Handle one more doxygen variation.
-
--------------------------------------------------------------------
-Sun May 23 12:19:56 UTC 2010 - aj@suse.de
-
-- Release is at end of line, avoid wrong matches.
-
--------------------------------------------------------------------
-Fri May 21 21:46:47 UTC 2010 - cmorve69@yahoo.es
-
-- Improved ELF executable detection (bnc#604049).
-
--------------------------------------------------------------------
-Thu May 20 08:23:52 UTC 2010 - aj@suse.de
-
-- Don't skip cross-x86_64-gcc-icecream-backend binary rpms: tighten
- the checks for -32bit packages.
-
--------------------------------------------------------------------
-Sun May 16 12:55:43 UTC 2010 - aj@suse.de
-
-- Further man pages tweek.
-
--------------------------------------------------------------------
-Sun May 16 11:28:14 UTC 2010 - aj@suse.de
-
-- further kde meinproc tuning.
-
--------------------------------------------------------------------
-Thu May 13 07:25:46 UTC 2010 - aj@suse.de
-
-- Further fixes for kde meinproc (bnc#604049).
-
--------------------------------------------------------------------
-Wed May 12 13:54:59 UTC 2010 - aj@suse.de
-
-- Fix doxygen docu handling.
-
--------------------------------------------------------------------
-Wed May 12 12:33:02 UTC 2010 - aj@suse.de
-
-- Handle one more GNU Classpath version.
-- Further improve man page regexp.
-
--------------------------------------------------------------------
-Tue May 11 20:12:59 UTC 2010 - aj@suse.de
-
-- Improve man page regexp.
-
--------------------------------------------------------------------
-Tue May 11 12:51:51 UTC 2010 - aj@suse.de
-
-- Improve kde index.cache handling as suggested by Cristian Morales
- Vega in bnc#604049.
-
--------------------------------------------------------------------
-Tue May 11 07:12:09 UTC 2010 - aj@suse.de
-
-- Handle deprecated-list.html generated by javadoc.
-- Handle doxygen docu.
-- Handle /etc/sendmail.cf as well.
-- Improve texi2html regexp to handle qemu.
-
--------------------------------------------------------------------
-Mon May 10 12:27:16 UTC 2010 - aj@suse.de
-
-- Handle kde index.cache files (bnc#604049).
-- Fix for handling of man pages and javadoc files.
-
--------------------------------------------------------------------
-Mon May 10 09:13:38 UTC 2010 - aj@suse.de
-
-- Handle kdelibs4
-
--------------------------------------------------------------------
-Sat May 8 19:41:30 UTC 2010 - aj@suse.de
-
-- Fix typo in last change - thanks Dirk Müller.
-
--------------------------------------------------------------------
-Fri May 7 13:05:57 UTC 2010 - aj@suse.de
-
-- Handle sendmail .cf files.
-
--------------------------------------------------------------------
-Tue Mar 23 13:37:47 UTC 2010 - aj@suse.de
-
-- Handle mono files.
-- Mount /proc if it's not mounted already to work around bug in
- build script.
-
--------------------------------------------------------------------
-Sun Mar 14 09:22:39 UTC 2010 - aj@suse.de
-
-- Improve last regexp to fix virt-utils.
-
--------------------------------------------------------------------
-Sat Mar 6 04:01:36 UTC 2010 - aj@suse.de
-
-- Improve regexp for last change.
-
--------------------------------------------------------------------
-Fri Mar 5 09:46:01 UTC 2010 - aj@suse.de
-
-- Handle more man files.
-
--------------------------------------------------------------------
-Sun Dec 13 12:59:16 UTC 2009 - aj@suse.de
-
-- Handle libtool writing the hostname
-
--------------------------------------------------------------------
-Wed Nov 18 06:48:27 UTC 2009 - aj@suse.de
-
-- Some more gjdoc dates (found in ant-antlr).
-
--------------------------------------------------------------------
-Thu Oct 22 09:03:46 UTC 2009 - coolo@novell.com
-
-- take out debugging code
-
--------------------------------------------------------------------
-Wed Oct 14 07:14:37 UTC 2009 - aj@suse.de
-
-- Replace external /usr/bin/unrpm by small function to get
- rid of dependency of build.rpm.
-
--------------------------------------------------------------------
-Thu Sep 24 06:47:22 UTC 2009 - aj@suse.de
-
-- Add comments.
-
--------------------------------------------------------------------
-Wed Sep 23 15:17:49 UTC 2009 - aj@suse.de
-
-- Handle noarch subpackage in sort correctly.
-
--------------------------------------------------------------------
-Tue Aug 25 10:28:17 CEST 2009 - mls@suse.de
-
-- the COPYRIGHT tag does not exist, map it back to LICENSE to
- be backward compatible
-
--------------------------------------------------------------------
-Mon Aug 17 22:24:50 CEST 2009 - aj@suse.de
-
-- Handle texi2html output.
-
--------------------------------------------------------------------
-Thu Aug 6 09:23:17 CEST 2009 - aj@suse.de
-
-- adjust gjdoc sed to match "August 1" and similar one-digit days.
-
--------------------------------------------------------------------
-Tue Aug 4 08:05:22 CEST 2009 - aj@suse.de
-
-- Compare mono files with cmp, just in case (handles rfc).
-
--------------------------------------------------------------------
-Sun Aug 2 07:15:45 CEST 2009 - aj@suse.de
-
-- Sort jar filelists before compare.
-
--------------------------------------------------------------------
-Mon Jul 27 10:36:49 CEST 2009 - aj@suse.de
-
-- Fail rpm-check if unrpm does not exist (noticed with package
- build).
-
--------------------------------------------------------------------
-Sun Jul 26 21:06:06 CEST 2009 - aj@suse.de
-
-- Fix problem found with building gettext-tools: tar packages
- directories.
-
--------------------------------------------------------------------
-Thu Jul 23 15:30:30 CEST 2009 - aj@suse.de
-
-- Update version number.
-
--------------------------------------------------------------------
-Tue Jul 21 16:41:39 CEST 2009 - aj@suse.de
-
-- Handle emacs bytecompiled files.
-- Handle /usr/share/man/man3/*3pm perl man pages.
-- Handle /var/adm/perl-modules/*.
-- Handle fonts.dir, fonts.scale and encoding.dir.
-
--------------------------------------------------------------------
-Tue Jul 21 13:02:36 CEST 2009 - aj@suse.de
-
-- Add return value for .a case so that it can succeed.
-
--------------------------------------------------------------------
-Mon Jul 20 15:50:46 CEST 2009 - aj@suse.de
-
-- Fix typo in same-build-results.sh
-- Ignore javadoc build stamp in javadoc html files.
-- Use jar,fastjar or unzip to extract jar files.
-
--------------------------------------------------------------------
-Wed Jul 15 13:31:30 CEST 2009 - coolo@novell.com
-
-- overwrite duplicated files in zip files
-
--------------------------------------------------------------------
-Tue Jul 14 11:46:04 CEST 2009 - coolo@novell.com
-
-- support .jar and .zip files
-- fix support of gzipped files
-
--------------------------------------------------------------------
-Mon May 4 15:19:04 CEST 2009 - coolo@suse.de
-
-- compare content of *.tar too
-
--------------------------------------------------------------------
-Mon May 4 14:17:07 CEST 2009 - coolo@suse.de
-
-- if objdump fails, fall back to hexdump (bnc#489965)
-
--------------------------------------------------------------------
-Mon May 4 14:10:24 CEST 2009 - coolo@suse.de
-
-- ignore dates in mo files (bnc#489198)
-
--------------------------------------------------------------------
-Tue Apr 28 13:47:36 CEST 2009 - mmarek@suse.cz
-
-- rpm-check.sh: add option --check-all to check all packaged files
- (useful for debugging)
-
--------------------------------------------------------------------
-Sun Feb 8 21:48:27 CET 2009 - coolo@suse.de
-
-- fix handling of hardlinks to compressed files
-
--------------------------------------------------------------------
-Sat Feb 7 21:05:30 CET 2009 - coolo@suse.de
-
-- fix handling of -32bit and -64bit
-
--------------------------------------------------------------------
-Sat Feb 7 14:58:48 CET 2009 - coolo@suse.de
-
-- fix command line order
-
--------------------------------------------------------------------
-Fri Feb 6 19:25:20 CET 2009 - coolo@suse.de
-
-- use --no-show-raw-insn for objdump -d
-
--------------------------------------------------------------------
-Fri Feb 6 18:18:15 CET 2009 - coolo@suse.de
-
-- hopefully fixed shell quoting for rpm command line
-
--------------------------------------------------------------------
-Thu Feb 5 17:34:29 CET 2009 - coolo@suse.de
-
-- fix 2 bugs
-- don't ignore source rpms - changed sources should output
- changed source rpms, no matter if they create the same binaries
- (think of changed copyright header in spec files)
-
--------------------------------------------------------------------
-Tue Jan 27 14:27:19 CET 2009 - adrian@suse.de
-
-- Create initial package based on the work of Matz and Coolo
- This package provides script for the main build script to be able
- to check if a new build has the same result than the former one.
- The Build Service is able to skip the new build than.
-- changes in source rpms are currently ignored, is that okay ?
-
-------------------------------------------------------------------
+Tue Apr 28 11:52:12 UTC 2015 - olaf@aepfle.de
+
+- 2015.04.28
+- Filter InitrdID in /linuxrc.config
+- Hexdump old and new file in parallel
+- Sort cpio file list with files to compare
+- Extract old and new files in parallel
+- Ignore block device nodes
+- Ignore character device nodes
+- Always clean tmpdir on exit in pkg-diff.sh
+- Handle squashfs files
+
+-------------------------------------------------------------------
+Mon Apr 13 08:55:39 UTC 2015 - olaf@aepfle.de
+
+- 2015.04.13
+- Show hint if pkg-diff.sh returns non-zero
+- Adjust intending in same-build-result.sh
+- Handle /usr/src/packages/OTHER
+- Handle "setuid directory"
+
+-------------------------------------------------------------------
+Fri Mar 20 18:58:22 UTC 2015 - olaf@aepfle.de
+
+- 2015.03.20
+- Convert correct png file before comparison
+- Avoid name clashes when comparing png files
+- Handle filename changes gracefully when comparing unknown filetypes
+- Use generic helper to compare png files
+
+-------------------------------------------------------------------
+Thu Feb 12 10:41:45 UTC 2015 - olaf@aepfle.de
+
+- Handle also .o files as ELF relocatable objects
+
+-------------------------------------------------------------------
+Thu Feb 12 08:22:09 UTC 2015 - randy.e.witt@linux.intel.com
+
+- Rename rpm-check.sh to pkg-diff.sh
+
+-------------------------------------------------------------------
+Tue Feb 10 15:35:25 UTC 2015 - olaf@aepfle.de
+
+- 2015.02.10
+- Trim objdump output properly
+- Trim .TH also in localized man pages (bnc#915941)
+- Remove also DVIPSSource from .ps files
+
+-------------------------------------------------------------------
+Tue Feb 10 15:33:32 UTC 2015 - randy.e.witt@linux.intel.com
+
+- Print section differences even if assembly has differences.
+- Add support for nested rpms.
+- Make rpm-check work for "packages" other than rpm.
+- Tell which section was different when doing ELF comparisons.
+- Error when one of the rpms is not found
+
+-------------------------------------------------------------------
+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
+
+- 2015.01.21
+- Remove leading spaces from file(1) output
+- Force removal of tmpdir to handle files marked as read-only
+
+-------------------------------------------------------------------
+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
+
+- 2014.11.25
+- correctly handle cmp_spec return code if file checksum differs
+- handle also bz2 and xz compressed files with odd name
+
+-------------------------------------------------------------------
+Tue Nov 18 11:58:51 UTC 2014 - ohering@suse.de
+
+- 2014.11.15
+- show sorted differences of rpmlint log (bnc#904092)
+- handle kernel and kmp packages, but support for kernel* is disabled
+- minor style fixes
+- handle cpio archives
+- handle absolute symlinks correctly
+- handle all ELF sections, not only the ones starting with dot
+
+-------------------------------------------------------------------
+Wed Nov 12 09:29:24 UTC 2014 - schwab@suse.de
+
+- Use $(...) instead of `...` to avoid losing backslash quoting
+
+-------------------------------------------------------------------
+Fri Nov 7 11:12:10 UTC 2014 - ohering@suse.de
+
+- Update check-all option to really keep going and check all files
+- Add check to recursively look into gzip files with odd suffix
+ to properly handle /usr/share/vlc/skins2/default.vlt
+
+-------------------------------------------------------------------
+Sat Aug 2 19:37:18 UTC 2014 - johannesobermayr@gmx.de
+
+- Fix quoting .
+
+-------------------------------------------------------------------
Tue Jul 29 15:07:04 UTC 2014 - johannesobermayr@gmx.de
- Remove numbered anchors from all Docbook / HTML files (bnc#889629).
-------------------------------------------------------------------
Sat May 8 19:41:30 UTC 2010 - aj@suse.de
-- Fix typo in last change - thanks Dirk MГјller.
+- Fix typo in last change - thanks Dirk Müller.
-------------------------------------------------------------------
Fri May 7 13:05:57 UTC 2010 - aj@suse.de
#
# spec file for package build-compare
#
-# Copyright (c) 2014 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
Summary: Build Result Compare Script
License: GPL-2.0+
Group: Development/Tools/Building
-Version: 2014.11.25
+Url: https://github.com/openSUSE/build-compare
+Version: 2015.04.28
Release: 0
Source1: COPYING
Source2: same-build-result.sh
-Source3: rpm-check.sh
+Source3: pkg-diff.sh
Source4: functions.sh
Source5: srpm-check.sh
Source1001: build-compare.manifest
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
+#!BuildIgnore: build-compare
%description
This package contains scripts to find out if the build result differs
$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
+# 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\|$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}
+ 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\|$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}
+ 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()
{
- 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()
check_header "$pkg"
}
-#usage unrpm <file> $dir
-# Unpack rpm files in directory $dir
-# like /usr/bin/unrpm - just for one file and with no options
-function unrpm()
+#usage unpackage <file> $dir
+# Unpack files in directory $dir
+# like /usr/bin/unpackage - just for one file and with no options
+function unpackage()
{
local file
local dir
file=$1
dir=$2
- CPIO_OPTS="--extract --unconditional --preserve-modification-time --make-directories --quiet"
mkdir -p $dir
pushd $dir 1>/dev/null
- rpm2cpio $file | cpio ${CPIO_OPTS}
+ case $file in
+ *.bz2)
+ bzip2 -d $file
+ ;;
+ *.gz)
+ gzip -d $file
+ ;;
+ *.xz)
+ xz -d $file
+ ;;
+ *.tar|*.tar.bz2|*.tar.gz|*.tgz|*.tbz2)
+ tar xf $file
+ ;;
+ *.rpm)
+ CPIO_OPTS="--extract --unconditional --preserve-modification-time --make-directories --quiet"
+ rpm2cpio $file | cpio ${CPIO_OPTS}
+ ;;
+ esac
popd 1>/dev/null
}
local file1 file2
local f
local sh=$1
+ local oldrpm=$2
+ local newrpm=$3
QF="%{NAME}"
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")
+ 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
- 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//./\\.}
+ 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 [ "${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
rm $file1 $file2
return $RES
}
+# vim: tw=666 ts=2 shiftwidth=2 et
exit 1
fi
+# Always clean up on exit
+local_tmpdir=`mktemp -d`
+if test -z "${local_tmpdir}"
+then
+ exit 1
+fi
+function _exit()
+{
+ chmod -R u+w "${local_tmpdir}"
+ rm -rf "${local_tmpdir}"
+}
+trap _exit EXIT
+# Let further mktemp refer to private tmpdir
+export TMPDIR=$local_tmpdir
+
+self_script=$(cd $(dirname $0); echo $(pwd)/$(basename $0))
+
source $FUNCTIONS
-oldrpm=`readlink -f $1`
-newrpm=`readlink -f $2`
+oldpkg=`readlink -f $1`
+newpkg=`readlink -f $2`
rename_script=`mktemp`
-if test ! -f $oldrpm; then
- echo "can't open $oldrpm"
+if test ! -f "$oldpkg"; then
+ echo "can't open $1"
exit 1
fi
-if test ! -f $newrpm; then
- echo "can't open $newrpm"
+if test ! -f "$newpkg"; then
+ echo "can't open $2"
exit 1
fi
sed -e 's/^ *[0-9a-f]\+://' -e 's/\$0x[0-9a-f]\+/$something/' -e 's/callq *[0-9a-f]\+/callq /' -e 's/# *[0-9a-f]\+/# /' -e 's/\(0x\)\?[0-9a-f]\+(/offset(/' -e 's/[0-9a-f]\+ </</' -e 's/^<\(.*\)>:/\1:/' -e 's/<\(.*\)+0x[0-9a-f]\+>/<\1 + ofs>/'
}
-cmp_spec $rename_script
-RES=$?
-case $RES in
- 0)
- echo "RPM meta information is identical"
- if test -z "$check_all"; then
- exit 0
- fi
- ;;
- 1)
- echo "RPM meta information is different"
- if test -z "$check_all"; then
- exit 1
- fi
- ;;
- 2)
- echo "RPM file checksum differs."
- RES=0
- ;;
- *)
- echo "Wrong exit code!"
- exit 1
+echo "Comparing `basename $oldpkg` to `basename $newpkg`"
+
+case $oldpkg in
+ *.rpm)
+ cmp_spec $rename_script $oldpkg $newpkg
+ RES=$?
+ case $RES in
+ 0)
+ echo "RPM meta information is identical"
+ if test -z "$check_all"; then
+ exit 0
+ fi
+ ;;
+ 1)
+ echo "RPM meta information is different"
+ if test -z "$check_all"; then
+ exit 1
+ fi
+ ;;
+ 2)
+ echo "RPM file checksum differs."
+ RES=0
+ ;;
+ *)
+ echo "Wrong exit code!"
+ exit 1
+ ;;
+ esac
;;
esac
dir=`mktemp -d`
echo "Extracting packages"
-unrpm $oldrpm $dir/old
-unrpm $newrpm $dir/new
+unpackage $oldpkg $dir/old
+unpackage $newpkg $dir/new
+
+# files is set in cmp_spec for rpms, so if RES is empty we should assume
+# it wasn't an rpm and pick all files for comparison.
+if [ -z $RES ]; then
+ oldfiles=`cd $dir/old; find . -type f`
+ newfiles=`cd $dir/new; find . -type f`
+
+ files=`echo -e "$oldfiles\n$newfiles" | sort -u`
+fi
+
cd $dir
bash $rename_script
diff_two_files()
{
- if ! cmp -s old/$file new/$file; then
- echo "$file differs ($ftype)"
- hexdump -C old/$file > $file1
- hexdump -C new/$file > $file2
- diff -u $file1 $file2 | head -n 200
- return 1
+ if test ! -e old/$file; then
+ echo "Missing in old package: $file"
+ return 1
fi
- return 0
+ if test ! -e new/$file; then
+ echo "Missing in new package: $file"
+ return 1
+ fi
+
+ if cmp -s old/$file new/$file; then
+ return 0
+ fi
+
+ echo "$file differs ($ftype)"
+ hexdump -C old/$file > $file1 &
+ hexdump -C new/$file > $file2 &
+ wait
+ diff -u $file1 $file2 | head -n 200
+ return 1
}
+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 "Tue Aug 31 2010" "Version 1.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 "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" "" ""
+ #.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()
{
bz2)
mv old/$file{,.bz2}
mv new/$file{,.bz2}
- bzip2 -d old/$file.bz2
- bzip2 -d new/$file.bz2
+ bzip2 -d old/$file.bz2 &
+ bzip2 -d new/$file.bz2 &
+ wait
;;
gzip)
mv old/$file{,.gz}
mv new/$file{,.gz}
- gzip -d old/$file.gz
- gzip -d new/$file.gz
+ gzip -d old/$file.gz &
+ gzip -d new/$file.gz &
+ wait
;;
xz)
mv old/$file{,.xz}
mv new/$file{,.xz}
- xz -d old/$file.xz
- xz -d new/$file.xz
+ xz -d old/$file.xz &
+ xz -d new/$file.xz &
+ wait
;;
esac
- ftype=`/usr/bin/file old/$file | cut -d: -f2-`
+ ftype=`/usr/bin/file old/$file | sed 's@^[^:]\+:[[:blank:]]*@@'`
case $ftype in
- *POSIX\ tar\ archive)
+ POSIX\ tar\ archive)
echo "$ext content is: $ftype"
mv old/$file{,.tar}
mv new/$file{,.tar}
ret=1
fi
;;
- *ASCII\ cpio\ archive\ *)
+ ASCII\ cpio\ archive\ *)
echo "$ext content is: $ftype"
mv old/$file{,.cpio}
mv new/$file{,.cpio}
return 0
;;
*.cpio)
- flist=`cpio --quiet --list --force-local < "new/$file"`
+ flist=`cpio --quiet --list --force-local < "new/$file" | sort`
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
fi
fi
done
+ rm -rf old/$fdir new/$fdir
+ return $ret
+ ;;
+ *.squashfs)
+ flist=`unsquashfs -no-progress -ls -dest '' "new/$file" | grep -Ev '^(Parallel unsquashfs:|[0-9]+ inodes )' | sort`
+ fdir=$file.extract.$PPID.$$
+ unsquashfs -no-progress -dest old/$fdir "old/$file"
+ unsquashfs -no-progress -dest new/$fdir "new/$file"
+ local ret=0
+ for f in $flist; do
+ if ! check_single_file $fdir/$f; then
+ ret=1
+ if test -z "$check_all"; then
+ break
+ fi
+ fi
+ done
+ rm -rf old/$fdir new/$fdir
return $ret
;;
*.tar|*.tar.bz2|*.tar.gz|*.tgz|*.tbz2)
done
return $ret
;;
- *.zip|*.jar)
+ *.zip|*.jar|*.war)
cd old
unjar_l ./$file |sort > flist
# 10-05-2010 14:39
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/}
check_single_file ${file/.gz/}
return $?
;;
+ *.rpm)
+ $self_script -a old/$file new/$file
+ return $?
+ ;;
*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
- convert old/$file +set date:create +set date:modify old/${file/.png/_n.png}
- convert old/$file +set date:create +set date:modify new/${file/.png/_n.png}
- if ! cmp -s old/${file/.png/_n.png} new/${file/.png/_n.png}; then
- echo "$file differs ($ftype)"
- hexdump -C old/${file/.png/_n.png} > $file1
- hexdump -C new/${file/.png/_n.png} > $file2
- diff -u $file1 $file2 | head -n 20
- return 1
- fi
- return 0
- fi
+ convert old/$file +set date:create +set date:modify old/${file}.$PPID.$$
+ convert new/$file +set date:create +set date:modify new/${file}.$PPID.$$
+ mv -f old/${file}.$PPID.$$ old/${file}
+ mv -f new/${file}.$PPID.$$ new/${file}
+ if ! diff_two_files; then
+ return 1
+ fi
+ return 0
+ fi
;;
/usr/share/locale/*/LC_MESSAGES/*.mo|/usr/share/locale-bundle/*/LC_MESSAGES/*.mo)
for f in old/$file new/$file; do
# 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
/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 "Tue Aug 31 2010" "Version 1.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"
+ /usr/share/man/*/man*|/usr/share/man/man*|/usr/lib/texmf/doc/man/*/*)
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
- # 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
;;
;;
*/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)
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
+ /^%DVIPSSource:[[:blank:]]/d
+ ' "$f"
+ done
+ ;;
*pdf)
# PDF files contain a unique ID, remove it
# Format of the ID is:
}' "$f"
done
;;
+ */linuxrc.config)
+ echo "${file}"
+ sed -i '/^InitrdID:/s@^.*@InitrdID: something@' "old/$file"
+ sed -i '/^InitrdID:/s@^.*@InitrdID: something@' "new/$file"
+ ;;
esac
- ftype=`/usr/bin/file old/$file | cut -d: -f2-`
+ ftype=`/usr/bin/file old/$file | sed 's@^[^:]\+:[[:blank:]]*@@'`
case $ftype in
- *PE32\ executable*Mono\/\.Net\ assembly*)
+ PE32\ executable*Mono\/\.Net\ assembly*)
echo "PE32 Mono/.Net assembly: $file"
if [ -x /usr/bin/monodis ] ; then
monodis old/$file 2>/dev/null|sed -e 's/GUID = {.*}/GUID = { 42 }/;'> ${file1}
return 1
fi
;;
- *ELF*executable*|*ELF*[LM]SB\ shared\ object*)
+ ELF*executable*|ELF*[LM]SB\ relocatable*|ELF*[LM]SB\ shared\ object*)
objdump -d --no-show-raw-insn old/$file | filter_disasm > $file1
if ! test -s $file1; then
# objdump has no idea how to handle it
break
fi
fi
+ elfdiff=
sed -i -e "s,old/,," $file1
objdump -d --no-show-raw-insn new/$file | filter_disasm > $file2
sed -i -e "s,new/,," $file2
if ! diff -u $file1 $file2 > $dfile; then
echo "$file differs in assembler output"
head -n 200 $dfile
- return 1
+ elfdiff="1"
fi
echo "" >$file1
echo "" >$file2
# Don't compare .build-id and .gnu_debuglink sections
sections="$(objdump -s new/$file | grep "Contents of section .*:" | sed -r "s,.* (.*):,\1,g" | grep -v -e "\.build-id" -e "\.gnu_debuglink" | tr "\n" " ")"
for section in $sections; do
- objdump -s -j $section old/$file | sed "s,old/,," >> $file1
- objdump -s -j $section new/$file | sed "s,new/,," >> $file2
+ objdump -s -j $section old/$file | sed "s,^old/,," > $file1
+ objdump -s -j $section new/$file | sed "s,^new/,," > $file2
+ if ! diff -u $file1 $file2 > $dfile; then
+ echo "$file differs in ELF section $section"
+ head -n 200 $dfile
+ elfdiff="1"
+ fi
done
- if ! diff -u $file1 $file2 > $dfile; then
- echo "$file differs in ELF sections"
- head -n 200 $dfile
- else
+ if test -z "$elfdiff"; then
echo "$file: only difference was in build-id or gnu_debuglink, GOOD."
return 0
fi
return 1
fi
;;
- *directory)
+ directory|setuid\ directory|setuid,\ directory|sticky,\ directory)
# tar might package directories - ignore them here
return 0
;;
- *bzip2\ compressed\ data*)
+ bzip2\ compressed\ data*)
if ! check_compressed_file "$file" "bz2"; then
return 1
fi
;;
- *gzip\ compressed\ data*)
+ gzip\ compressed\ data*)
if ! check_compressed_file "$file" "gzip"; then
return 1
fi
;;
- *XZ\ compressed\ data*)
+ XZ\ compressed\ data*)
if ! check_compressed_file "$file" "xz"; then
return 1
fi
;;
- *symbolic\ link\ to\ *)
+ 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}
+ if ! check_single_file ${file}.cpio; then
+ return 1
+ fi
+ ;;
+ Squashfs\ filesystem,*)
+ echo "$file ($ftype)"
+ mv old/$file{,.squashfs}
+ mv new/$file{,.squashfs}
+ if ! check_single_file ${file}.squashfs; then
+ return 1
+ fi
+ ;;
+ symbolic\ link\ to\ *)
readlink "old/$file" > $file1
readlink "new/$file" > $file2
if ! diff -u $file1 $file2; then
return 1
fi
;;
+ block\ special\ *)
+ ;;
+ character\ special\ *)
+ ;;
*)
if ! diff_two_files; then
return 1
fi
rm $file1 $file2 $dfile $rename_script
-rm -r $dir
+rm -rf $dir
if test "$ret" = 0; then
- echo "RPM content is identical"
+ echo "Package content is identical"
fi
exit $ret
+# vim: tw=666 ts=2 shiftwidth=2 et
# Enhanced by Andreas Jaeger <aj@suse.de>
#
# The script decides if the new build differes from the former one,
-# using rpm-check.sh.
+# using pkg-diff.sh.
# The script is called as part of the build process as:
# /usr/lib/build/same-build-result.sh /.build.oldpackages /usr/src/packages/RPMS /usr/src/packages/SRPMS
-CMPSCRIPT=${0%/*}/rpm-check.sh
+CMPSCRIPT=${0%/*}/pkg-diff.sh
SCMPSCRIPT=${0%/*}/srpm-check.sh
check_all=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 '
oname=`$rpmqp $opac`
nname=`$rpmqp $npac`
if test "$oname" != "$nname"; then
- echo "names differ: $oname $nname"
- exit 1
+ echo "names differ: $oname $nname"
+ exit 1
fi
case "$opac" in
*debuginfo*)
- echo "skipping -debuginfo package"
+ echo "skipping -debuginfo package"
;;
*)
- bash $CMPSCRIPT "$opac" "$npac" || SUCCESS=0
- if test $SUCCESS -eq 0 -a -z "$check_all"; then
+ bash $CMPSCRIPT "$opac" "$npac" || SUCCESS=0
+ if test $SUCCESS -eq 0 -a -z "$check_all"; then
+ echo "differences between $opac and $npac"
exit 1
- fi
+ fi
;;
esac
done
fi
# Compare rpmlint.log files
-OTHERDIR=/home/abuild/rpmbuild/OTHER
-
-if test -e $OLDDIR/rpmlint.log -a -e $OTHERDIR/rpmlint.log; then
- file1=`mktemp`
- file2=`mktemp`
- 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
- if ! cmp -s $file1 $file2; then
- echo "rpmlint.log files differ:"
- diff -u $file1 $file2 |head -n 20
- SUCCESS=0
- fi
- rm $file1 $file2
-elif test -e $OTHERDIR/rpmlint.log; then
- echo "rpmlint.log is new"
- SUCCESS=0
+if test -d /home/abuild/rpmbuild/OTHER; then
+ OTHERDIR=/home/abuild/rpmbuild/OTHER
+elif test -d /usr/src/packages/OTHER; then
+ OTHERDIR=/usr/src/packages/OTHER
+else
+ echo "no OTHERDIR"
+ OTHERDIR=
fi
-appdatas=`cd $OTHERDIR && find . -name *-appdata.xml`
-for xml in $appdatas; do
- # compare appstream data
- if test -e $OLDDIR/$xml -a -e $OTHERDIR/$xml; then
- file1=$OLDDIR/$xml
- file2=$OTHERDIR/$xml
+if test -n "$OTHERDIR"; then
+ if test -e $OLDDIR/rpmlint.log -a -e $OTHERDIR/rpmlint.log; then
+ file1=`mktemp`
+ file2=`mktemp`
+ 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,$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 "$xml files differ:"
- diff -u0 $file1 $file2 |head -n 20
+ echo "rpmlint.log files differ:"
+ diff -u $file1 $file2 |head -n 20
SUCCESS=0
fi
- elif test -e $OTHERDIR/$xml; then
- echo "$xml is new"
+ rm $file1 $file2
+ elif test -e $OTHERDIR/rpmlint.log; then
+ echo "rpmlint.log is new"
SUCCESS=0
fi
-done
+
+ appdatas=`cd $OTHERDIR && find . -name *-appdata.xml`
+ for xml in $appdatas; do
+ # compare appstream data
+ if test -e $OLDDIR/$xml -a -e $OTHERDIR/$xml; then
+ file1=$OLDDIR/$xml
+ file2=$OTHERDIR/$xml
+ if ! cmp -s $file1 $file2; then
+ echo "$xml files differ:"
+ diff -u0 $file1 $file2 |head -n 20
+ SUCCESS=0
+ fi
+ elif test -e $OTHERDIR/$xml; then
+ echo "$xml is new"
+ SUCCESS=0
+ fi
+ done
+fi
if test $SUCCESS -eq 0; then
exit 1
fi
echo 'compare validated built as identical !'
exit 0
+# vim: tw=666 ts=2 shiftwidth=2 et
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
RES=$?
case $RES in
0)
+ echo "RPM meta information is identical"
exit 0
;;
1)
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
fi
done
-rm -r $dir
+rm -rf $dir
exit $ret
+# vim: tw=666 ts=2 shiftwidth=2 et