~ahasenack/landscape-client/landscape-client-11.02-0ubuntu0.8.04.1

« back to all changes in this revision

Viewing changes to dev/upload-to-ppa

  • Committer: Andreas Hasenack
  • Date: 2011-05-05 14:12:15 UTC
  • Revision ID: andreas@canonical.com-20110505141215-5ymuyyh5es9pwa6p
Added hardy files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh -e
 
2
 
 
3
help () {
 
4
    cat <<EOF
 
5
Invoke this script from a $package bzr branch to build source packages for
 
6
all target distributions and upload them to a PPA.
 
7
 
 
8
Options:
 
9
 
 
10
  -p=<PPA>|--ppa=<PPA>  The PPA to upload to. This gets passed to dput, please
 
11
                        make sure you have a matching stanza in your ~/.dput.cf
 
12
 
 
13
  -k=<KEY>|--key=<KEY>  The GPG key used to sign the packages
 
14
 
 
15
  -s|--snapshot         Tweak the Debian revision by including the current bzr
 
16
                        revision number in it (e.g. 1.4.0~bzr178-0ubuntu0.8.04)
 
17
 
 
18
  -h|--help             Print this help and exit
 
19
 
 
20
EOF
 
21
    exit
 
22
}
 
23
 
 
24
#
 
25
# Check if we are in a bzr branch
 
26
#
 
27
if ! [ -d .bzr ] || ! [ -f debian/changelog ]; then
 
28
    echo "Error: not in a package bzr branch"
 
29
    echo
 
30
    help
 
31
fi
 
32
 
 
33
#
 
34
# Set defaults and parse command line arguments
 
35
#
 
36
ppa=landscape
 
37
key=free.ekanayaka@canonical.com
 
38
snapshot=no
 
39
package=$(dpkg-parsechangelog |grep ^Source|cut -f 2 -d " ")
 
40
version=$(dpkg-parsechangelog |grep ^Version|cut -f 2 -d " ")
 
41
upstream=$(echo $version | cut -f 1 -d "-")
 
42
 
 
43
for i in $*; do
 
44
    case $i in
 
45
        -p=*|--ppa=*)
 
46
                ppa=`echo $i | sed 's/[-a-zA-Z0-9]*=//'`
 
47
                ;;
 
48
        -k=*|--key=*)
 
49
                key=`echo $i | sed 's/[-a-zA-Z0-9]*=//'`
 
50
                ;;
 
51
        -s|--snapshot)
 
52
                snapshot=yes
 
53
                ;;
 
54
        -h|--help)
 
55
                help
 
56
                ;;
 
57
        *)
 
58
                echo "Error: unknown option $i"
 
59
                echo
 
60
                help
 
61
                ;;
 
62
    esac
 
63
done
 
64
 
 
65
if [ "$snapshot" = "yes" ]; then
 
66
    bzr_rev=$(bzr log -l 1|grep ^revno|cut -f 2 -d " ")
 
67
    upstream="$upstream~bzr$bzr_rev"
 
68
fi
 
69
 
 
70
#
 
71
# Clean up from possible previous runs
 
72
#
 
73
rm -fR ../${package}-*
 
74
rm -f ../${package}_*
 
75
 
 
76
#
 
77
# Export the sources
 
78
#
 
79
bzr export ../${package}-${upstream}
 
80
cd ..
 
81
cp -a ${package}-${upstream} ${package}-${upstream}.orig
 
82
rm -R ${package}-${upstream}.orig/debian
 
83
cd ${package}-${upstream}
 
84
 
 
85
#
 
86
# Build source packages and upload them
 
87
#
 
88
releases="dapper_6.06 hardy_8.04 intrepid_8.10 jaunty_9.04 karmic_9.10"
 
89
 
 
90
if [ "$snapshot" = "yes" ]; then
 
91
    # Snapshot, we'll add a dummy changelog entry like for all releases
 
92
    source_opt="-sa"
 
93
    releases="$releases lucid_10.04"
 
94
else
 
95
    # Actual release, use the latest changelog entry and upload now
 
96
    dpkg-buildpackage -S -sa -k$key
 
97
    dput $ppa ../${package}_${version}_source.changes
 
98
    source_opt="-sd"
 
99
fi    
 
100
 
 
101
for release in $releases; do
 
102
 
 
103
   codename=$(echo $release|cut -f 1 -d _)
 
104
   revision=0ubuntu0.$(echo $release|cut -f 2 -d _)
 
105
   if ! [ "$snapshot" = "yes" ]; then
 
106
       revision=${revision}.0~landscape1
 
107
   fi
 
108
   version=$upstream-$revision
 
109
 
 
110
   if [ "$snapshot" = "yes" ]; then
 
111
       message="Snapshot build for $codename"
 
112
   else
 
113
       message="Built for $codename, no source changes"
 
114
   fi
 
115
   cp debian/changelog ../   
 
116
   dch --force-distribution -b -v $version -D $codename -m $message
 
117
   dpkg-buildpackage -S $source_opt -k$key
 
118
   dput $ppa ../${package}_${version}_source.changes
 
119
   mv ../changelog debian
 
120
 
 
121
   source_opt="-sd"
 
122
 
 
123
done