-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmakedist
executable file
·88 lines (81 loc) · 1.77 KB
/
makedist
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
#!/bin/sh
# Generates a .tar.gz file containing all of the files to distribute.
# It gathers all of the files in the cyclone source tree, minus those
# appearing the file .excludelist. This file should contain a bunch
# of regular expressions of filenames to exclude.
#
# TODO:
# 1) tar the files into the directory $PWD-$version
#
# usage: makedist
TMP=/tmp/makedist$$
if [ $# != 0 ]; then
echo "usage: $0"
exit 1
else
version=`make version`
echo "Making distribution for version $version; OK? (y/n)"
read resp
if [ "$resp" != "y" ]; then
echo "aborting---please specify a version #"
exit 1
fi
fi
# grepexpr
# given the file .excludelist which has elements x y z ..., it echos
# a string of the form x|y|z to be used as the expression to egrep.
#
grepexpr () {
first=0
if [ -f ".excludelist" ]; then
for file in `cat .excludelist`; do
if [ $first != 0 ]; then
echo -n "|"
else
first=1
fi
echo -n $file
done
else
echo
fi
}
# figure out files to exclude
#
grepstr=`grepexpr`
DIR=`basename $PWD`
OLDDIR="$DIR"
cd ..
mv $DIR $DIR-$version
DIR="$DIR-$version"
find $DIR -print | egrep -e $grepstr > $TMP
# tar 'em up
#
filename=$DIR
tar -cvf ${filename}.tar -X $TMP $DIR
if [ $? != 0 ]; then
echo Failed to tar the files into ${filename}.tar
exit 1
fi
gzip ${filename}.tar
if [ $? != 0 ]; then
echo Failed to gzip ${filename}.tar
\rm -f ${filename}.tar
exit 1
fi
mv $filename.tar.gz $DIR
if [ -f "$TMP" ]; then
\rm -f $TMP
fi
# restore the directory name
#
mv $DIR $OLDDIR
cd $OLDDIR
# tag CVS, if desired
#
echo "Tag the current CVS as version $version? (y/n)"
echo " (only currently committed files will be tagged)"
read resp
if [ "$resp" = "y" ]; then
cvs tag `echo v${version} | sed -e 's/\./-/g'`
fi