File: distcomp.bash

package info (click to toggle)
dvdisaster 0.79.10-3.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 25,200 kB
  • sloc: ansic: 33,607; sh: 4,914; makefile: 136
file content (92 lines) | stat: -rwxr-xr-x 1,703 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env bash

if test $# != 1 || ! test -d $1; then
  echo "Usage: distcomp <path to alternate distribution>"
  echo 
  echo "- call within source directory, e.g. dvdisaster-0.72"
  echo "- make sure both are in distclean state"
  exit 1
fi

HEAD_LINES=10

ref=$1
new=$(pwd)

# Make sure we're talking about same stuff

echo "Old distribution: $ref"
echo "New distribution: $new"
echo 

# Looks for added files

ADDED=0
echo "Files and dirs ADDED in this distribution:"
for i in $(find .); do
  if test "${i:0:9}" == "./PRIVATE";
    then continue;
  fi
  if test -d $i && ! test -e $ref/$i; then
    ADDED=$((ADDED+1))
    echo "  Dir : $i"
  fi
  if test -f $i && ! test -e $ref/$i; then
    ADDED=$((ADDED+1))
    echo "  File: $i"
  fi
done

if test $ADDED == 0; then
  echo "  None"
fi

# Looks for removed files

cd $ref
REMOVED=0
echo
echo "Files and dirs REMOVED in this distribution:"
for i in $(find .); do
  if test "${i:0:5}" == "./.hg";
    then continue;
  fi
  if test -d $i && ! test -e $new/$i; then
    REMOVED=$((REMOVED+1))
    echo "  Dir : $i"
  fi
  if test -f $i && ! test -e $new/$i; then
    REMOVED=$((REMOVED+1))
    echo "  File: $i"
  fi
done

if test $REMOVED == 0; then
  echo "  None"
fi

cd $new
CHANGED=0
echo 
echo "Files CHANGED in this distribution:"
for i in $(find .); do
  if test -f $i && test -f $ref/$i; then
    if ! cmp -s $i $ref/$i; then
       echo $i
       diff $ref/$i $i | head -n $HEAD_LINES
       echo
       CHANGED=$((CHANGED+1))
    fi
  fi
done

if test $CHANGED == 0; then
  echo "  None"
fi

echo
if test $((CHANGED+ADDED+REMOVED)) == 0; then
  echo "No changes."
else
  echo "$CHANGED changed, $ADDED added and $REMOVED removed."
fi