summaryrefslogtreecommitdiffstats
path: root/release.sh
blob: cbd6e1a894cd51c841af9a44e698b639f2d1860d (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
85
86
87
88
89
90
91
92
#!/bin/bash

set -e

vers=`grep AM_INIT_AUTOMAKE configure.ac | head -1 | cut '-d '  -f 2 | sed 's/)//'`
echo vers $vers

repo=$1
force=$2

[ -z "$repo" ] && echo stable or testing or unstable && exit 1

if git diff --quiet ; then
    echo repository is clean
else
    echo
    echo "**** REPOSITORY IS DIRTY ****"
    echo
    if [ "$force" != "force" ]; then
	echo "add 'force' argument if you really want to continue."
	exit 1
    fi
    echo "forcing."
fi

gitver=`git rev-parse HEAD 2>/dev/null | cut -c 1-8`
echo gitver $gitver

if [ "$repo" = "testing" ]; then
    versuffix=`date "+%Y%m%d%H%M"`
    finalvers="${vers}-testing${versuffix}-$gitver"
else
    if [ "$repo" = "unstable" ]; then
	versuffix=`date "+%Y%m%d%H%M"`
	finalvers="${vers}-unstable${versuffix}-$gitver"
    else
	finalvers="$vers"
    fi
fi

echo final vers $finalvers

echo making sure .git_version is up to date
cd src
./check_version .git_version
cd ..

echo building tarball
make dist

echo extracting
mkdir -p release/$finalvers
cd release/$finalvers

tar zxf ../../ceph-$vers.tar.gz 
[ "$vers" != "$finalvers" ] && mv ceph-$vers ceph-$finalvers
tar zcf ceph_$finalvers.orig.tar.gz ceph-$finalvers

# add debian dir
cp -a ../../debian ceph-$finalvers

for dist in sid squeeze lenny
do
    echo building $dist dsc
#    mkdir $dist
#    cd $dist

    dvers="$finalvers-1"
    [ "$dist" = "squeeze" ] && dvers="$dvers~bpo60+1"
    [ "$dist" = "lenny" ] && dvers="$dvers~bpo50+1"

    comment=""
    [ -n "$versuffix" ] && comment="git snapshot "
    [ "$dist" != "sid" ] && comment="${comment}$dist backport"

    if [ -n "$comment" ]; then
	cd ceph-$finalvers
	DEBEMAIL="sage@newdream.net" dch -D $dist --force-distribution -b -v "$dvers" "$comment"
	cd ..
    fi

    dpkg-source -b ceph-$finalvers

#    cd ..
done

rm -r ceph-$finalvers
cp -a ceph_$finalvers.orig.tar.gz ceph-$finalvers.tar.gz
echo finished release $finalvers

cd ../..
echo $finalvers > .last_release