Initialize Tizen 2.3 tizen_2.3 2.3a_release submit/tizen_2.3/20140531.061702 submit/tizen_2.3/20150202.102221 tizen_2.3_release
authorSehong Na <sehong.na@samsung.com>
Sat, 31 May 2014 03:32:26 +0000 (12:32 +0900)
committerSehong Na <sehong.na@samsung.com>
Sat, 31 May 2014 03:32:26 +0000 (12:32 +0900)
packaging/COPYING [new file with mode: 0644]
packaging/Changes [new file with mode: 0644]
packaging/build-compare.changes [new file with mode: 0644]
packaging/build-compare.spec [new file with mode: 0644]
packaging/functions.sh [new file with mode: 0644]
packaging/rpm-check.sh [new file with mode: 0644]
packaging/same-build-result.sh [new file with mode: 0644]
packaging/srpm-check.sh [new file with mode: 0644]

diff --git a/packaging/COPYING b/packaging/COPYING
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/packaging/Changes b/packaging/Changes
new file mode 100644 (file)
index 0000000..d82f100
--- /dev/null
@@ -0,0 +1,356 @@
+-------------------------------------------------------------------
+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 ?
+
diff --git a/packaging/build-compare.changes b/packaging/build-compare.changes
new file mode 100644 (file)
index 0000000..bcfd7fa
--- /dev/null
@@ -0,0 +1,57 @@
+* Mon Jan 10 2011 Anas Nashif <anas.nashif@intel.com> - 2009.10.14
+- Update script from upstream with more checks
+
+* Thu Mar 25 2010 Anas Nashif <anas.nashif@intel.com> - 2009.10.14
+- Update script from upstream with more checks
+
+* Mon Jan 11 2010 nashif <anas.nashif@intel.com> - 2009.10.14
+- Dont diff against disturl
+
+* Wed Nov 18 2009 Anas Nashif <anas.nashif@intel.com> - 2009.10.14
+- Update to 2009.10.14
+
+* Thu Sep 24 2009 Anas Nashif <anas.nashif@intel.com> - 2009.08.20
+- Update to 2009.08.20
+
+* Mon Aug 10 2009 Anas Nashif <anas.nashif@intel.com> - 2009.08.06
+- Update to 2009.08.06 snapshot
+
+* Sun Jul 26 2009 Anas Nashif <anas.nashif@intel.com> - 2009.07.23
+- Sync with upstream which has lots of enhancements
+
+* Thu Jul 09 2009 Anas Nashif <anas.nashif@intel.com> - 2009.01.27
+- More files to exclude
+
+* Wed Jul 08 2009 Anas Nashif <anas.nashif@intel.com> - 2009.01.27
+- Ignore comments when comparing files
+
+* Tue Jul 07 2009 Anas Nashif <anas.nashif@intel.com> - 2009.01.27
+- Also ignore date changes in info files
+
+* Tue Jul 07 2009 Anas Nashif <anas.nashif@intel.com> - 2009.01.27
+- Ignore changes in docs and manpages only
+
+* Fri Feb 27 2009 Anas Nashif <anas.nashif@intel.com> 2009.01.27
+- Initial import into Moblin
+
+* Sun Feb  8 2009 coolo@suse.de
+- fix handling of hardlinks to compressed files
+* Sat Feb  7 2009 coolo@suse.de
+- fix handling of -32bit and -64bit
+* Sat Feb  7 2009 coolo@suse.de
+- fix command line order
+* Fri Feb  6 2009 coolo@suse.de
+- use --no-show-raw-insn for objdump -d
+* Fri Feb  6 2009 coolo@suse.de
+- hopefully fixed shell quoting for rpm command line
+* Thu Feb  5 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 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 ?
diff --git a/packaging/build-compare.spec b/packaging/build-compare.spec
new file mode 100644 (file)
index 0000000..3205072
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# spec file for package build-compare (Version 2009.10.14)
+#
+# Copyright (c) 2010 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
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via http://bugs.opensuse.org/
+#
+
+# norootforbuild
+
+
+Name:           build-compare
+License:        GPLv2+
+Group:          Development/Tools/Building
+AutoReqProv:    on
+Summary:        Build Result Compare Script
+Version:        2009.10.14
+Release:        26
+Source1:        COPYING
+Source2:        same-build-result.sh
+Source3:        rpm-check.sh
+Source4:        functions.sh
+Source5:        srpm-check.sh
+BuildRoot:      %{_tmppath}/%{name}-%{version}-build
+BuildArch:      noarch
+
+%description
+This package contains scripts to find out if the build result differs
+to a former build.
+
+
+
+%prep
+mkdir $RPM_BUILD_DIR/%name-%version
+%setup -T 0 -D
+
+%build
+
+%install
+mkdir -p $RPM_BUILD_ROOT/usr/lib/build/ $RPM_BUILD_ROOT/%_defaultdocdir/%name
+install -m 0755 %SOURCE2 %SOURCE3 %SOURCE4 %SOURCE5 $RPM_BUILD_ROOT/usr/lib/build/
+install -m 0644 %SOURCE1 $RPM_BUILD_ROOT/%_defaultdocdir/%name/
+
+%files
+%defattr(-,root,root)
+%doc %_defaultdocdir/%name
+/usr/lib/build
+
diff --git a/packaging/functions.sh b/packaging/functions.sh
new file mode 100644 (file)
index 0000000..8137400
--- /dev/null
@@ -0,0 +1,138 @@
+#! /bin/bash
+#
+# Copyright (c) 2009, 2010 SUSE Linux Product GmbH, Germany.
+# Licensed under GPL v2, see COPYING file for details.
+#
+# Written by Michael Matz and Stephan Coolo
+# Enhanced by Andreas Jaeger
+
+# library of functions used by scripts
+
+RPM="rpm -qp --nodigest --nosignature"
+
+check_header() 
+{
+   $RPM --qf "$QF" "$1"
+}
+
+function check_provides()
+{
+
+  # provides destroy this because at least the self-provide includes the
+  # -buildnumber :-(
+  QF="[%{PROVIDENAME} %{PROVIDEFLAGS} %{PROVIDEVERSION}\\n]\\n"
+  QF="$QF [%{REQUIRENAME} %{REQUIREFLAGS} %{REQUIREVERSION}\\n]\\n"
+  QF="$QF [%{CONFLICTNAME} %{CONFLICTFLAGS} %{CONFLICTVERSION}\\n]\\n"
+  QF="$QF [%{OBSOLETENAME} %{OBSOLETEFLAGS} %{OBSOLETEVERSION}\\n]\\n"
+  check_header "$1" | sed -e "s,-$2$,-@RELEASE@,"
+}
+
+#usage unrpm <file> $dir
+# Unpack rpm files in directory $dir
+# like /usr/bin/unrpm - just for one file and with no options
+function unrpm()
+{
+    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}
+    popd 1>/dev/null
+}
+
+# Compare just the rpm meta data of two rpms
+# Returns:
+# 0 in case of same content
+# 1 in case of errors or difference
+# 2 in case of differences that need further investigation
+# Sets $files with list of files that need further investigation
+function cmp_spec ()
+{
+    QF="%{NAME}"
+    
+    # don't look at RELEASE, it contains our build number
+    QF="$QF %{VERSION} %{EPOCH}\\n"
+    QF="$QF %{SUMMARY}\\n%{DESCRIPTION}\\n"
+    QF="$QF %{VENDOR} %{DISTRIBUTION} %{DISTURL}"
+    QF="$QF %{LICENSE} %{LICENSE}\\n"
+    QF="$QF %{GROUP} %{URL} %{EXCLUDEARCH} %{EXCLUDEOS} %{EXCLUSIVEARCH}\\n"
+    QF="$QF %{EXCLUSIVEOS} %{RPMVERSION} %{PLATFORM}\\n"
+    QF="$QF %{PAYLOADFORMAT} %{PAYLOADCOMPRESSOR} %{PAYLOADFLAGS}\\n"
+    
+    QF="$QF [%{PREINPROG} %{PREIN}\\n]\\n[%{POSTINPROG} %{POSTIN}\\n]\\n[%{PREUNPROG} %{PREUN}\\n]\\n[%{POSTUNPROG} %{POSTUN}\\n]\\n"
+    
+    # XXX We also need to check the existence (but not the content (!))
+    # of SIGGPG (and perhaps the other SIG*)
+    
+    # XXX We don't look at triggers
+    
+    QF="$QF [%{VERIFYSCRIPTPROG} %{VERIFYSCRIPT}]\\n"
+    
+    # Only the first ChangeLog entry; should be enough
+    QF="$QF %{CHANGELOGTIME} %{CHANGELOGNAME} %{CHANGELOGTEXT}\\n"
+    
+    file1=`mktemp`
+    file2=`mktemp`
+    
+    check_header $oldrpm > $file1
+    check_header $newrpm > $file2
+    
+    # the DISTURL tag can be used as checkin ID
+    #echo "$QF"
+    if ! diff -au $file1 $file2; then
+      rm $file1 $file2
+      return 1
+    fi
+    
+    release1=`$RPM --qf "%{RELEASE}" "$oldrpm"`
+    release2=`$RPM --qf "%{RELEASE}" "$newrpm"`
+    
+    check_provides $oldrpm $release1 > $file1
+    check_provides $newrpm $release2 > $file2
+    
+    if ! diff -au $file1 $file2; then
+      rm $file1 $file2
+      return 1
+    fi
+    
+    # First check the file attributes and later the md5s
+    
+    # Now the files.  We leave out mtime and size.  For normal files
+    # the size will influence the MD5 anyway.  For directories the sizes can
+    # differ, depending on which file system the package was built.  To not
+    # have to filter out directories we simply ignore all sizes.
+    # Also leave out FILEDEVICES, FILEINODES (depends on the build host),
+    # FILECOLORS, FILECLASS (???), FILEDEPENDSX and FILEDEPENDSN.
+    # Also FILELANGS (or?)
+    QF="[%{FILENAMES} %{FILEFLAGS} %{FILESTATES} %{FILEMODES:octal} %{FILEUSERNAME} %{FILEGROUPNAME} %{FILERDEVS} %{FILEVERIFYFLAGS} %{FILELINKTOS}\n]\\n"
+    # ??? what to do with FILEPROVIDE and FILEREQUIRE?
+    
+    check_header $oldrpm > $file1
+    check_header $newrpm > $file2
+    
+    if ! diff -au $file1 $file2; then
+      rm $file1 $file2
+      return 1
+    fi
+    
+    # now the md5sums. if they are different, we check more detailed
+    # if there are different filenames, we will already have aborted before
+    QF="[%{FILENAMES} %{FILEMD5S}\n]\\n"
+    check_header $oldrpm > $file1
+    check_header $newrpm > $file2
+    
+    RES=2
+    # done if the same
+    if cmp -s $file1 $file2; then
+      RES=0
+    fi
+    
+    # Get only files with different MD5sums
+    files=`diff -U0 $file1 $file2 | fgrep -v +++ | grep ^+ | cut -b2- | awk '{print $1}'`
+
+    rm $file1 $file2
+    return $RES
+}
diff --git a/packaging/rpm-check.sh b/packaging/rpm-check.sh
new file mode 100644 (file)
index 0000000..f571994
--- /dev/null
@@ -0,0 +1,476 @@
+#! /bin/bash
+#
+# Copyright (c) 2009, 2010 SUSE Linux Product GmbH, Germany.
+# Licensed under GPL v2, see COPYING file for details.
+#
+# Written by Michael Matz and Stephan Coolo
+# Enhanced by Andreas Jaeger
+
+FUNCTIONS=${0%/*}/functions.sh
+
+check_all=
+case $1 in
+  -a | --check-all)
+    check_all=1
+    shift
+esac
+
+if test "$#" != 2; then
+   echo "usage: $0 [-a|--check-all] old.rpm new.rpm"
+   exit 1
+fi
+
+source $FUNCTIONS
+
+oldrpm=`readlink -f $1`
+newrpm=`readlink -f $2`
+
+if test ! -f $oldrpm; then
+    echo "can't open $oldrpm"
+    exit 1
+fi
+
+if test ! -f $newrpm; then
+    echo "can't open $newrpm"
+    exit 1
+fi
+
+#usage unjar <file>
+function unjar()
+{
+    local file
+    file=$1
+
+    if [[ $(type -p fastjar) ]]; then
+        UNJAR=fastjar
+    elif [[ $(type -p jar) ]]; then
+        UNJAR=jar
+    elif [[ $(type -p unzip) ]]; then
+        UNJAR=unzip
+    else
+        echo "ERROR: jar, fastjar, or unzip is not installed (trying file $file)"
+        exit 1
+    fi
+
+    case $UNJAR in
+        jar|fastjar)
+        # echo jar -xf $file
+        ${UNJAR} -xf $file
+        ;;
+        unzip)
+        unzip -oqq $file
+        ;;
+    esac
+}
+
+# list files in directory
+#usage unjar_l <file>
+function unjar_l()
+{
+    local file
+    file=$1
+
+    if [[ $(type -p fastjar) ]]; then
+        UNJAR=fastjar
+    elif [[ $(type -p jar) ]]; then
+        UNJAR=jar
+    elif [[ $(type -p unzip) ]]; then
+        UNJAR=unzip
+    else
+        echo "ERROR: jar, fastjar, or unzip is not installed (trying file $file)"
+        exit 1
+    fi
+
+    case $UNJAR in
+        jar|fastjar)
+        ${UNJAR} -tf $file
+        ;;
+        unzip)
+        unzip -l $file
+        ;;
+    esac
+}
+
+filter_disasm()
+{
+   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 $1 $2
+RES=$?
+case $RES in
+  0)
+     exit 0
+     ;;
+  1)
+     echo "RPM meta information is different"
+     exit 1
+     ;;
+  2)
+     ;;
+  *)
+     echo "Wrong exit code!"
+     exit 1
+     ;;
+esac
+
+file1=`mktemp`
+file2=`mktemp`
+
+dir=`mktemp -d`
+unrpm $oldrpm $dir/old
+unrpm $newrpm $dir/new
+cd $dir
+
+dfile=`mktemp`
+
+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
+  fi
+  return 0
+}
+
+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
+       ;;
+    *.exe.mdb|*.dll.mdb)
+       # Just debug information, we can skip them
+       echo "$file skipped as debug file."
+       return 0
+       ;;
+    *.a)
+       echo "$file is .a"
+       flist=`ar t new/$file`
+       pwd=$PWD
+       fdir=`dirname $file`
+       cd old/$fdir
+       ar x `basename $file`
+       cd $pwd/new/$fdir
+       ar x `basename $file`
+       cd $pwd
+       for f in $flist; do
+          if ! check_single_file $fdir/$f; then
+             return 1
+          fi
+       done
+       return 0
+       ;;
+    *.tar|*.tar.bz2|*.tar.gz|*.tgz|*.tbz2)
+       flist=`tar tf new/$file`
+       pwd=$PWD
+       fdir=`dirname $file`
+       cd old/$fdir
+       tar xf `basename $file`
+       cd $pwd/new/$fdir
+       tar xf `basename $file`
+       cd $pwd
+       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
+       return $ret
+       ;;
+    *.zip|*.jar)
+       cd old
+       unjar_l ./$file |sort > flist
+       #  10-05-2010 14:39
+       sed -i -e "s, [0-9][0-9]-[0-9][0-9]-[0-9]\+ [0-9][0-9]:[0-9][0-9] , date ," flist
+       cd ../new
+       unjar_l ./$file |sort> flist
+       sed -i -e "s, [0-9][0-9]-[0-9][0-9]-[0-9]\+ [0-9][0-9]:[0-9][0-9] , date ,; " flist
+       cd ..
+       if ! cmp -s old/flist new/flist; then
+          echo "$file has different file list"
+          diff -u old/flist new/flist
+          return 1
+       fi
+       flist=`grep date new/flist | sed -e 's,.* date ,,'`
+       pwd=$PWD
+       fdir=`dirname $file`
+       cd old/$fdir
+       unjar `basename $file`
+       cd $pwd/new/$fdir
+       unjar `basename $file`
+       cd $pwd
+       local ret=0
+       for f in $flist; do
+         if test -f new/$fdir/$f && ! check_single_file $fdir/$f; then
+           ret=1
+           if test -z "$check_all"; then
+             break
+           fi
+         fi
+       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';"
+        ;;
+     *.bz2)
+        bunzip2 -c old/$file > old/${file/.bz2/}
+        bunzip2 -c new/$file > new/${file/.bz2/}
+        check_single_file ${file/.bz2/}
+        return $?
+        ;;
+     *.gz)
+        gunzip -c old/$file > old/${file/.gz/}
+        gunzip -c new/$file > new/${file/.gz/}
+        check_single_file ${file/.gz/}
+        return $?
+        ;;
+     *png)
+       # 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
+        ;;
+     /usr/share/locale/*/LC_MESSAGES/*.mo|/usr/share/locale-bundle/*/LC_MESSAGES/*.mo)
+       for f in old/$file new/$file; do
+         sed -i -e "s,POT-Creation-Date: ....-..-.. ..:..+....,POT-Creation-Date: 1970-01-01 00:00+0000," $f
+       done
+       ;;
+     /usr/share/doc/packages/*/*.html|\
+     /usr/share/doc/kde/HTML/*/*/*.html|/usr/share/doc/*/html/*.html)
+       for f in old/$file new/$file; do
+         # texi2html output, e.g. in kvm, indent, qemu
+        sed -i -e "s|^<!-- Created on .*, 20.. by texi2html .\...|<!-- Created on August 7, 2009 by texi2html 1.82|" $f
+        sed -i -e 's|^ *This document was generated by <em>Autobuild</em> on <em>.*, 20..</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html .\...</em></a>.$|  This document was generated by <em>Autobuild</em> on <em>August 7, 2009</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.82</em></a>.|' $f
+        # doxygen docu, e.g. in libssh and log4c
+        sed -i -e 's|Generated on ... ... [0-9]* [0-9]*:[0-9][0-9]:[0-9][0-9] 20[0-9][0-9] for |Generated on Mon May 10 20:45:00 2010 for |' $f
+        # Generated on Sat Aug 14 2010 16:49:48 for libssh
+        sed -i -e 's|Generated on ... ... [0-9]* 20[0-9][0-9] [0-9]*:[0-9][0-9]:[0-9][0-9] for |Generated on Mon May 10 20:45:00 2010 for |' $f
+       done
+       ;;
+     /usr/share/javadoc/*.html |\
+     /usr/share/javadoc/*/*.html|/usr/share/javadoc/*/*/*.html)
+       # 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
+         # 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
+        sed -i -e 's%<!DOCTYPE html PUBLIC "-//gnu.org///DTD\(.*GNU Classpath Tools</a>\), on [a-zA-Z]* [0-9][0-9], 20.. [0-9]*:..:.. \(a\|p\)\.m\. GMT.</p>%<!DOCTYPE html PUBLIC "-//gnu.org///DTD\1,on May 1, 2010 1:11:42 p.m. GMT.</p>%' $f
+        # deprecated-list is randomly ordered, sort it for comparison
+        case $f in
+          */deprecated-list.html)
+            sort -o $f $f 
+            ;;
+        esac
+       done
+       ;;
+     /usr/share/javadoc/gjdoc.properties |\
+     /usr/share/javadoc/*/gjdoc.properties)
+       for f in old/$file new/$file; do
+        sed -i -e 's|^#[A-Z][a-z]\{2\} [A-Z][a-z]\{2\} [0-9]\{2\} ..:..:.. GMT 20..$|#Fri Jan 01 11:27:36 GMT 2009|' $f
+       done
+       ;;
+     */fonts.scale|*/fonts.dir|*/encodings.dir)
+       for f in old/$file new/$file; do
+         # sort files before comparing
+         sort -o $f $f
+       done
+       ;;
+     /var/adm/perl-modules/*)
+       for f in old/$file new/$file; do
+         sed -i -e 's|^=head2 ... ... .. ..:..:.. ....: C<Module>|=head2 Wed Jul  1 00:00:00 2009: C<Module>|' $f
+       done
+       ;;
+     /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
+       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 ARCH "1" "September 2010" "GNU coreutils 8.5" "User Commands"
+        #.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"
+
+       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]\|[A-Z][a-z]* [0-9][0-9], 20[0-9][0-9]\|[0-9]* [A-Z][a-z]* 20[0-9][0-9]\|[A-Z][a-z][a-z] [A-Z][a-z][a-z] [0-9]\+ 20[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
+        # 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
+       ;;
+     *.elc)
+       # emacs lisp files
+       for f in old/$file new/$file; do
+         sed -i -e 's|Compiled by abuild@.* on ... ... .. ..:..:.. 20..$|compiled by abuild@buildhost on Wed Jul 01 00:00:00 2009|' $f
+       done
+       ;;
+     /var/lib/texmf/web2c/*/*fmt |\
+     /var/lib/texmf/web2c/metafont/*.base|\
+     /var/lib/texmf/web2c/metapost/*.mem)
+       # binary dump of TeX and Metafont formats, we can ignore them for good
+       echo "difference in $file ignored."
+       return 0
+       ;;
+     */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
+       done
+       ;;
+     /etc/mail/*cf|/etc/sendmail.cf)
+       # from sendmail package
+       for f in old/$file new/$file; do
+         # - ##### built by abuild@build33 on Thu May 6 11:21:17 UTC 2010
+         sed -i -e 's|built by abuild@[a-z0-9]* on ... ... [0-9]* [0-9]*:[0-9][0-9]:[0-9][0-9] .* 20[0-9][0-9]|built by abuild@build42 on Thu May 6 11:21:17 UTC 2010|' $f
+       done
+       ;;
+     /usr/share/doc/kde/HTML/*/*/index.cache|/usr/share/doc/kde/HTML/*/*/*/index.cache)
+       # various kde packages
+       for f in old/$file new/$file; do
+         sed -i -e 's%name="id[0-9]*"\([> ]\)%name="id424242"\1%g' $f
+         sed -i -e 's%name="[a-z]*\.id[0-9]*"%name="ftn.id111111"%g' $f
+         sed -i -e 's%\.html#id[0-9]*">%.html#id424242">%g' $f
+         sed -i -e 's%href="#\([a-z]*\.\)\?id[0-9]*">%href="#\1id0000000">%g' $f
+       done
+       ;;
+    */created.rid)
+       # ruby documentation
+       # file just contains a timestamp and nothing else, so ignore it
+       echo "Ignore $file"
+       return 0
+       ;;
+    */rdoc/files/*.html)
+       # ruby documentation
+       # <td>Mon Sep 20 19:02:43 +0000 2010</td>
+       for f in old/$file new/$file; do
+          sed -i -e 's%<td>[A-Z][a-z][a-z] [A-Z][a-z][a-z] [0-9]\+ [0-9]\+:[0-9]\+:[0-9]\+ +0000 201[0-9]</td>%<td>Mon Sep 20 19:02:43 +0000 2010</td>%g' $f
+       done
+       ;;
+  esac
+
+  ftype=`/usr/bin/file old/$file | cut -d: -f2-`
+  case $ftype in
+     *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}
+         monodis new/$file 2>/dev/null|sed -e 's/GUID = {.*}/GUID = { 42 }/;'> ${file2}
+         if ! cmp -s ${file1} ${file2}; then
+           echo "$file differs ($ftype)"
+           diff -u ${file1} ${file2}
+           return 1
+         fi
+       else
+         echo "Cannot compare, no monodis installed"
+         return 1
+       fi
+       ;;
+    *ELF*executable*|*ELF*LSB\ 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
+         if ! diff_two_files; then
+           ret=1
+           break
+         fi
+       fi       
+       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
+       fi
+       objdump -s old/$file > $file1
+       sed -i -e "s,old/,," $file1
+       objdump -s new/$file > $file2
+       sed -i -e "s,new/,," $file2
+       if ! diff -u $file1 $file2 > $dfile; then
+          echo "$file differs in ELF sections"
+          head -n 200 $dfile
+       else
+          echo "WARNING: no idea about $file"
+       fi
+       return 1
+       ;;
+     *ASCII*|*text*)
+       if ! cmp -s old/$file new/$file; then
+         echo "$file differs ($ftype)"
+         diff -u old/$file new/$file | head -n 200
+         return 1
+       fi
+       ;;
+     *directory)
+       # tar might package directories - ignore them here
+       return 0
+       ;;
+     *)
+       if ! diff_two_files; then
+           return 1
+       fi
+       ;;
+  esac
+  return 0
+}
+
+# We need /proc mounted for some tests, so check that it's mounted and
+# complain if not.
+PROC_MOUNTED=0
+if [ ! -d /proc/self/ ]; then
+  echo "/proc is not mounted"
+  mount -orw -n -tproc none /proc
+  PROC_MOUNTED=1
+fi
+
+ret=0
+for file in $files; do
+   if ! check_single_file $file; then
+       ret=1
+       if test -z "$check_all"; then
+           break
+       fi
+   fi
+done
+
+if [ "$PROC_MOUNTED" -eq "1" ]; then
+  echo "Unmounting proc"
+  umount /proc
+fi
+
+rm $file1 $file2 $dfile
+rm -r $dir
+exit $ret
diff --git a/packaging/same-build-result.sh b/packaging/same-build-result.sh
new file mode 100644 (file)
index 0000000..152b76f
--- /dev/null
@@ -0,0 +1,92 @@
+#!/bin/bash
+#
+# Copyright (c) 2009, 2010 SUSE Linux Product GmbH, Germany.
+# Licensed under GPL v2, see COPYING file for details.
+#
+# Written by Adrian Schroeter <adrian@suse.de>
+# Enhanced by Andreas Jaeger <aj@suse.de>
+#
+# The script decides if the new build differes from the former one,
+# using rpm-check.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
+SCMPSCRIPT=${0%/*}/srpm-check.sh
+
+check_all=1
+OLDDIR="$1"
+shift
+NEWDIRS="$*"
+
+echo "$CMPSCRIPT"
+
+if [ ! -d "$OLDDIR" ]; then
+  echo "No valid directory with old build result given !"
+  exit 1
+fi
+if [ -z "$NEWDIRS" ]; then
+  echo "No valid directory with new build result given !"
+  exit 1
+fi
+
+if test `find $NEWDIRS -name '*.rpm' -and ! -name '*.delta.rpm' | wc -l` != `find $OLDDIR -name '*.rpm' -and ! -name '*.delta.rpm' | wc -l`; then
+   echo "different number of subpackages"
+   find $OLDDIR $NEWDIRS -name '*.rpm' -and ! -name '*.delta.rpm'
+   exit 1
+fi
+
+osrpm=$(find "$OLDDIR" -name \*src.rpm)
+nsrpm=$(find $NEWDIRS -name \*src.rpm)
+
+if test ! -f "$osrpm"; then
+  echo no old source rpm in $OLDDIR
+  exit 1
+fi
+
+if test ! -f "$nsrpm"; then
+  echo no new source rpm in $NEWDIRS
+  exit 1
+fi
+
+echo "compare $osrpm $nsrpm"
+bash $SCMPSCRIPT "$osrpm" "$nsrpm" || exit 1
+
+# technically we should not all exclude all -32bit but filter for different archs,
+# like done with -x86
+# but it would be better if this script ran earlier in the build
+# sort the rpms so that both lists have the same order
+# problem: a package can contain both noarch and arch subpackages, so we have to 
+# take care of proper sorting of NEWRPMS, e.g. noarch/x.rpm and x86_64/w.rpm since OLDRPMS 
+# has all the packages in a single directory and would sort this as w.rpm, x.rpm.
+OLDRPMS=($(find "$OLDDIR" -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 -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'))
+
+SUCCESS=1
+rpmqp='rpm -qp --qf %{NAME} --nodigest --nosignature '
+for opac in ${OLDRPMS[*]}; do
+  npac=${NEWRPMS[0]}
+  NEWRPMS=(${NEWRPMS[@]:1}) # shift
+  echo compare "$opac" "$npac"
+  oname=`$rpmqp $opac`
+  nname=`$rpmqp $npac`
+  if test "$oname" != "$nname"; then
+     echo "names differ: $oname $nname"
+     exit 1
+  fi
+  bash $CMPSCRIPT "$opac" "$npac" || SUCCESS=0
+  if test $SUCCESS -eq 0 -a -z "$check_all"; then
+     exit 1
+  fi
+done
+
+if [ -n "${NEWRPMS[0]}" ]; then
+  echo additional new package
+  exit 1
+fi
+
+if test $SUCCESS -eq 0; then
+  exit 1
+fi
+echo 'compare validated built as identical !'
+exit 0
diff --git a/packaging/srpm-check.sh b/packaging/srpm-check.sh
new file mode 100644 (file)
index 0000000..67f1b3c
--- /dev/null
@@ -0,0 +1,93 @@
+#!/bin/bash
+#
+# Copyright (c) 2009, 2010 SUSE Linux Product GmbH, Germany.
+# Licensed under GPL v2, see COPYING file for details.
+#
+# Written by Michael Matz and Stephan Coolo
+# Enhanced by Andreas Jaeger
+
+# Compare two source RPMs
+
+FUNCTIONS=${0%/*}/functions.sh
+
+check_all=
+case $1 in
+  -a | --check-all)
+    check_all=1
+    shift
+esac
+
+if test "$#" != 2; then
+   echo "usage: $0 [-a|--check-all] old.rpm new.rpm"
+   exit 1
+fi
+
+source $FUNCTIONS
+
+oldrpm=`readlink -f $1`
+newrpm=`readlink -f $2`
+
+
+# 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 
+# the resulting files are needed.
+
+cmp_spec $1 $2
+RES=$?
+case $RES in
+  0)
+     exit 0
+     ;;
+  1)
+     exit 1
+     ;;
+  2)
+     ;;
+  *)
+     echo "Wrong exit code!"
+     exit 1
+     ;;
+esac
+
+# Now check that only the spec file has a changed release number and
+# nothing else
+
+dir=`mktemp -d`
+unrpm $oldrpm $dir/old
+unrpm $newrpm $dir/new
+cd $dir
+
+check_single_file()
+{ 
+  local file=$1
+  case $file in
+    *.spec)
+       sed -i -e "s,^Release:.*,Release: @RELEASE@," old/$file
+       sed -i -e "s,^Release:.*,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
+         return 1
+       fi
+       return 0
+       ;;
+    *)
+       echo "$file differs"
+       # Nothing else should be changed
+       ;;
+   esac
+   return 1
+}
+
+ret=0
+for file in $files; do
+   if ! check_single_file $file; then
+       ret=1
+       if test -z "$check_all"; then
+           break
+       fi
+   fi
+done
+
+rm -r $dir
+exit $ret