source: soft/build_system/build_system/upload/robot/trunk/diffsrcrpm @ 1

Last change on this file since 1 was 1, checked in by fasma, 13 years ago

Initial Import from Mandriva's soft revision 224062 and package revision 45733

File size: 1.6 KB
Line 
1#!/bin/sh
2#---------------------------------------------------------------
3# Project         : Mandrake Linux
4# Module          : bin
5# File            : diffsrcrpm
6# Version         : $Id: diffsrcrpm 869 2004-07-21 08:33:11Z mandrake $
7# Author          : Frederic Lepied
8# Created On      : Tue Apr  9 14:14:45 2002
9#---------------------------------------------------------------
10
11set -e
12
13if [ $# != 2 ]; then
14    echo "usage: `basename $0` <srpm> <old srpms dir>" 1>&2
15    exit 1
16fi
17
18TMPDIR=${TMPDIR=/tmp}
19
20base=`rpm -qp --qf '%{NAME}\n' $1`
21
22oldp=`ls $2/${base}-[0-9]*`
23old=`basename $oldp`
24new=`basename $1`
25
26tempdir=$TMPDIR/`basename $0`.$$
27mkdir -p $tempdir/{$old,$new}
28
29function clean() {
30    rm -rf $tempdir
31}
32
33trap clean 0
34
35rpm2cpio $oldp | (cd $tempdir/$old; cpio -id 2> /dev/null)
36rpm2cpio $1 | (cd $tempdir/$new; cpio -id 2> /dev/null)
37
38set +e
39
40cd $tempdir/$old; rm -f *.tar.*; bunzip2 *.bz2 2> /dev/null; gunzip *.gz 2> /dev/null; ls > ../lst
41cd $tempdir/$new; rm -f *.tar.*; bunzip2 *.bz2 2> /dev/null; gunzip *.gz 2> /dev/null; ls >> ../lst
42cd ..
43
44CHANGED=
45for f in `sort < lst | uniq`; do
46    if [ ! -f $old/$f ]; then
47        echo "$f added"
48    elif [ ! -f $new/$f ]; then
49        echo "$f removed"
50    else
51        cmp $old/$f $new/$f > /dev/null || echo "$f changed" && CHANGED="$CHANGED $f"
52    fi
53done
54
55for f in $CHANGED; do
56    case $f in
57        *.tar|*.jpg|*.xpm)
58            ;;
59        *.patch|*.diff)
60            interdiff $old/$f $new/$f
61            ;;
62        *)     
63            diff -u --minimal $old/$f $new/$f > $tempdir/dif
64            s=`ls -o $tempdir/dif | awk '{print $4;}'`
65            if [ "$s" -gt 20000 ] ;then
66                diffstat $tempdir/dif
67            else
68                cat $tempdir/dif
69            fi
70            ;;
71    esac
72done
73
74# diffsrcrpm ends here
Note: See TracBrowser for help on using the repository browser.