summaryrefslogtreecommitdiffstats
path: root/makedist
blob: 0f10f423626020f77d683733d9a4041de725de00 (plain)
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
#!/bin/sh
arg=$1
target=~/public_html/source/mdadm
if [ " $arg" = " test" ]
then
  target=/tmp/mdadm-test
  rm -rf $target
  mkdir -p $target
fi
if [ -d $target ]
then :
else echo $target is not a directory
     exit 2
fi
set `grep '^char Version' ReadMe.c `
version=`echo $7 | sed 's/v//'`
grep "^.TH MDADM 8 .. v$version" mdadm.8.in > /dev/null 2>&1 ||
 {
   echo mdadm.8.in does not mention version $version.
   exit 1
 }
grep "^.TH MDMON 8 .. v$version" mdmon.8 > /dev/null 2>&1 ||
 {
   echo mdmon.8 does not mention version $version.
   exit 1
 }
rpmv=`echo $version | tr - _`
grep "^Version: *$rpmv$" mdadm.spec > /dev/null 2>&1 ||
 {
   echo mdadm.spec does not mention version $version.
   exit 1
 }
if [ -f ANNOUNCE-$version ]
then :
else
   echo ANNOUNCE-$version does not exist
   exit 1
fi
if grep "^ANNOUNCE-$version\$" inventory
then :
else { cat inventory ; echo ANNOUNCE-$version ; } | sort -o inventory
fi

echo version = $version
base=mdadm-$version.tgz
if [ " $arg" != " diff" ]
then
  if [ -f $target/$base ] 
  then 
    echo $target/$base exists.
    exit 1
  fi
  trap "rm $target/$base; exit" 1 2 3
  ( cd .. ; ln -s mdadm.v2 mdadm-$version ; tar chvf - --exclude=.git --exclude="TAGS" --exclude='*~' --exclude=.patches --exclude='*,v' --exclude='*.o' --exclude mdadm --exclude=mdadm'.[^ch0-9]' --exclude=RCS mdadm-$version ; rm mdadm-$version ) | gzip --best > $target/$base
  chmod a+r $target/$base
  ls -l $target/$base
  if tar tzf $target/$base | sed 's,[^/]*/,,' | sort | diff -u inventory -
  then : correct files found
  else echo "Extra files, or inventory is out-of-date"
       rm $target/$base
       exit 1
  fi
  rpmbuild -ta $target/$base || exit 1
  find /home/neilb/src/RPM -name "*mdadm-$version-*" \
     -exec cp {} $target/RPM \;
  cp ANNOUNCE-$version $target/ANNOUNCE
  cp ChangeLog $target/ChangeLog
  if [ " $arg" != " test" ]
  then
    scp $target/$base master.kernel.org:/pub/linux/utils/raid/mdadm/mdadm-$version.tar.gz
    scp $target/ANNOUNCE $target/ChangeLog master.kernel.org:/pub/linux/utils/raid/mdadm/
  fi
else
  if [ ! -f $target/$base ] 
  then 
    echo $target/$base does not exist.
    exit 1
  fi
  ( cd .. ; ln -s mdadm.v2 mdadm-$version ; tar chf - --exclude=.git --exclude="TAGS" --exclude='*,v' --exclude='*~' --exclude='*.o' --exclude mdadm --exclude=mdadm'.[^ch0-9]' --exclude=RCS mdadm-$version ; rm mdadm-$version ) | gzip --best > /var/tmp/mdadm-new.tgz
  mkdir /var/tmp/mdadm-old ; zcat $target/$base | ( cd /var/tmp/mdadm-old ; tar xf - )
  mkdir /var/tmp/mdadm-new ; zcat /var/tmp/mdadm-new.tgz | ( cd /var/tmp/mdadm-new ; tar xf - )
  diff -ru /var/tmp/mdadm-old /var/tmp/mdadm-new 
  rm -rf /var/tmp/mdadm-old /var/tmp/mdadm-new /var/tmp/mdadm-new.tgz
fi