~launchpad-pqm/launchpad/devel

4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
1
#! /bin/bash
8452.3.3 by Karl Fogel
* utilities/: Add copyright header block to source files that were
2
#
8687.15.2 by Karl Fogel
In files modified by r8688, change "<YEARS>" to "2009", as per
3
# Copyright 2009 Canonical Ltd.  This software is licensed under the
8687.15.3 by Karl Fogel
Shorten the copyright header block to two lines.
4
# GNU Affero General Public License version 3 (see the file LICENSE).
8452.3.3 by Karl Fogel
* utilities/: Add copyright header block to source files that were
5
#
8931.1.4 by Karl Fogel
* utilities/rocketfuel-setup: Tell the user to hit Return after
6
# This script will set up a brand new Ubuntu machine as a LP developer
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
7
# workstation, from scratch. The script lives in the LP codebase itself,
8
# as utilities/rocketfuel-setup
9
9948.1.1 by Maris Fogels
Make the apache process restart after installing the new configuration and modules, to prevent the new modules from segfaulting because of bugs.
10
# We require Bazaar 1.16.1 or higher.
8687.14.2 by Karl Fogel
In rocketfuel-setup, bail early if not running with Bazaar 1.16.1 or higher.
11
# So first, grab the output of 'bzr --version' and transform the
12
# version line, like "Bazaar (bzr) 1.16.1", into "1 16 1":
9102.1.1 by Karl Fogel
* utilities/rocketfuel-setup: Fix the Bazaar version check to allow
13
VER_RAW=`bzr --version | head -1 | sed -e 's/Bazaar (bzr) //g'`
14
VER_NUMS=`echo -n ${VER_RAW} | sed -e 's/[^.0-9]//g' | sed -e 's/[.]/ /g'`
8687.14.2 by Karl Fogel
In rocketfuel-setup, bail early if not running with Bazaar 1.16.1 or higher.
15
# Now stuff each component into its own variable, so we can check sanely.
16
MAJOR=0
17
MINOR=0
18
MICRO=0
19
ITER=0
20
for VER_COMPONENT in ${VER_NUMS}; do
21
  if [ ${ITER} -eq 0 ]; then
22
    MAJOR=${VER_COMPONENT}
23
  elif [ ${ITER} -eq 1 ]; then
24
    MINOR=${VER_COMPONENT}
25
  elif [ ${ITER} -eq 2 ]; then
26
    MICRO=${VER_COMPONENT}
27
  # Ignore anything beyond micro -- nanoversions are irrelevant here.
28
  fi
29
  ITER=`expr ${ITER} + 1`
30
done
31
# Check that the version is high enough.
32
BAZAAR_BAIL=0
9102.1.1 by Karl Fogel
* utilities/rocketfuel-setup: Fix the Bazaar version check to allow
33
if [ ${MAJOR} -lt 2 ]; then
34
  if [ ${MAJOR} -lt 1 ]; then
35
    BAZAAR_BAIL=1
36
  elif [ ${MINOR} -lt 16 ]; then
37
    BAZAAR_BAIL=1
38
  elif [ ${MINOR} -eq 16 -a ${MICRO} -lt 1 ]; then
39
    BAZAAR_BAIL=1
40
  fi
8687.14.2 by Karl Fogel
In rocketfuel-setup, bail early if not running with Bazaar 1.16.1 or higher.
41
fi
42
if [ ${BAZAAR_BAIL} -ne 0 ]; then
43
  echo "ERROR: You don't have a high enough version of Bazaar:"
9102.1.1 by Karl Fogel
* utilities/rocketfuel-setup: Fix the Bazaar version check to allow
44
  echo "  rocketfuel-setup requires bzr 1.16.1 or higher, but you have bzr ${VER_RAW}."
8687.14.2 by Karl Fogel
In rocketfuel-setup, bail early if not running with Bazaar 1.16.1 or higher.
45
  echo "  Please see http://bazaar-vcs.org/Download to get a newer version."
46
  exit 1
47
fi
48
6673.1.3 by Barry Warsaw
Use $HOME instead of ~
49
if [ ! -e "$HOME/.rocketfuel-env.sh" ]; then
6673.1.1 by Barry Warsaw
Write rocketfuel-env.sh if it doesn't exist. Allows RocketFuelSetup
50
  echo "# Common environment variables for the rocketfuel-* scripts.
51
#
52
# The ones you can set are:
53
#
8931.1.1 by Karl Fogel
Use more appropriate defaults for LP_PROJECT_ROOT and LP_TRUNK_NAME.
54
# LP_PROJECT_ROOT - The root directory of all your Launchpad stuff.  Your
6673.1.1 by Barry Warsaw
Write rocketfuel-env.sh if it doesn't exist. Allows RocketFuelSetup
55
#                   Launchpad shared repository will live in a child directory
56
#                   of this directory.
57
# LP_SHARED_REPO  - Your Launchpad shared repository directory.  All of your
58
#                   Launchpad development branches will live under here.
59
# LP_TRUNK_NAME   - The directory name (not path!) to your rocketfuel trunk
60
#                   mirror directory.  This is relative to your shared repo.
61
# LP_SOURCEDEPS_DIR - The name of the directory (not path!) where your
62
#                   trunk sourcecode will be placed.  This is relative to your
63
#                   LP_PROJECT_ROOT and should /not/ have the 'sourcecode'
64
#                   path appended to it, since this is automatically added by
65
#                   the scripts.
66
8931.1.1 by Karl Fogel
Use more appropriate defaults for LP_PROJECT_ROOT and LP_TRUNK_NAME.
67
LP_PROJECT_ROOT=\${LP_PROJECT_ROOT:=~/launchpad}
6673.1.1 by Barry Warsaw
Write rocketfuel-env.sh if it doesn't exist. Allows RocketFuelSetup
68
LP_SHARED_REPO=\${LP_SHARED_REPO:=lp-branches}
69
LP_PROJECT_PATH=\$LP_PROJECT_ROOT/\$LP_SHARED_REPO
8931.1.1 by Karl Fogel
Use more appropriate defaults for LP_PROJECT_ROOT and LP_TRUNK_NAME.
70
LP_TRUNK_NAME=\${LP_TRUNK_NAME:=devel}
6673.1.1 by Barry Warsaw
Write rocketfuel-env.sh if it doesn't exist. Allows RocketFuelSetup
71
LP_TRUNK_PATH=\$LP_PROJECT_PATH/\$LP_TRUNK_NAME
72
73
LP_SOURCEDEPS_DIR=\${LP_SOURCEDEPS_DIR:=lp-sourcedeps}
74
LP_SOURCEDEPS_PATH=\$LP_PROJECT_ROOT/\$LP_SOURCEDEPS_DIR/sourcecode
75
76
# Force tilde expansion
77
LP_SOURCEDEPS_PATH=\$(eval echo \${LP_SOURCEDEPS_PATH})
6673.1.3 by Barry Warsaw
Use $HOME instead of ~
78
" > "$HOME/.rocketfuel-env.sh"
6673.1.1 by Barry Warsaw
Write rocketfuel-env.sh if it doesn't exist. Allows RocketFuelSetup
79
fi
80
6673.1.3 by Barry Warsaw
Use $HOME instead of ~
81
source "$HOME/.rocketfuel-env.sh"
6673.1.5 by Barry Warsaw
Respond to Edwin's review.
82
if [ "$?" != 0 ]; then
83
    echo "Something went wrong with rocketfuel-setup!"
84
    exit 1
85
fi
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
86
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
87
# load up Ubuntu release details so we know which repos to enable
88
source /etc/lsb-release
89
8486.13.2 by Curtis Hovey
Merge from launchpad devel. Reconciled devpad removals.
90
# Establish LP username
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
91
whoami=`whoami`
7426.1.1 by Julian Edwards
Tweak rocketfuel-setup so that:
92
printf "What is your Launchpad username? [$whoami] "
93
read lpusername
94
if [ -z ${lpusername} ]; then
95
  lpusername=${whoami}
96
fi
97
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
98
# Make sure you have all the needed virtual hosts
99
100
dev_host() {
6979.1.5 by Curtis Hovey
Added id.launchpad.net to /etc/hosts. Updated the matching rules to check for the
101
  grep -q "^127.0.0.88.* ${hostname}" /etc/hosts
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
102
  if [ $? -ne 0 ]; then
103
    sudo sed -i "s/^127.0.0.88.*$/&\ ${hostname}/" /etc/hosts
104
    echo "${hostname} added to /etc/hosts"
105
  fi
106
  }
107
108
grep -q "^127.0.0.88" /etc/hosts
109
if [ $? -ne 0 ]; then
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
110
  echo "Adding development hosts on local machine"
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
111
  echo "
112
# Launchpad virtual domains. This should be on one line.
113
127.0.0.88      launchpad.dev
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
114
" | sudo tee -a /etc/hosts > /dev/null
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
115
  echo "launchpad.dev added to /etc/hosts"
116
fi
117
6673.1.5 by Barry Warsaw
Respond to Edwin's review.
118
declare -a hostnames
119
hostnames=$(cat <<EOF
120
    answers.launchpad.dev
10053.1.1 by William Grant
Create archive.launchpad.dev, to which the local primary/partner archives are published.
121
    archive.launchpad.dev
6673.1.5 by Barry Warsaw
Respond to Edwin's review.
122
    api.launchpad.dev
7459.5.21 by Michael Hudson
make security considerations much more obvious
123
    bazaar-internal.launchpad.dev
6673.1.5 by Barry Warsaw
Respond to Edwin's review.
124
    beta.launchpad.dev
125
    blueprints.launchpad.dev
126
    bugs.launchpad.dev
127
    code.launchpad.dev
128
    feeds.launchpad.dev
6979.1.5 by Curtis Hovey
Added id.launchpad.net to /etc/hosts. Updated the matching rules to check for the
129
    id.launchpad.dev
8971.11.1 by William Grant
Add PPA and keyserver hostnames to /etc/hosts.
130
    keyserver.launchpad.dev
8687.11.1 by Karl Fogel
* utilities/rocketfuel-setup
131
    lists.launchpad.dev
6673.1.5 by Barry Warsaw
Respond to Edwin's review.
132
    openid.launchpad.dev
7675.346.1 by James Henstridge
Add central config changes to support second OpenID provider vhost.
133
    ubuntu-openid.launchpad.dev
8971.11.1 by William Grant
Add PPA and keyserver hostnames to /etc/hosts.
134
    ppa.launchpad.dev
135
    private-ppa.launchpad.dev
6673.1.5 by Barry Warsaw
Respond to Edwin's review.
136
    shipit.edubuntu.dev
137
    shipit.kubuntu.dev
138
    shipit.ubuntu.dev
10212.5.9 by Guilherme Salgado
Rename the vhost used for the test OpenID provider to testopenid.dev
139
    testopenid.dev
6673.1.5 by Barry Warsaw
Respond to Edwin's review.
140
    translations.launchpad.dev
141
    xmlrpc-private.launchpad.dev
142
    xmlrpc.launchpad.dev
143
EOF
144
    )
145
146
for hostname in $hostnames; do
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
147
  dev_host;
148
done
149
7551.3.11 by Michael Hudson
reasonably foul (but working!) apache config
150
grep -q "^127.0.0.99" /etc/hosts
151
if [ $? -ne 0 ]; then
152
  echo "
153
127.0.0.99      bazaar.launchpad.dev
154
" | sudo tee -a /etc/hosts > /dev/null
155
  echo "bazaar.launchpad.dev added to /etc/hosts"
156
fi
157
11128.10.2 by Michael Hudson
merge more separate apache config from later pipe
158
grep -q "^127.0.0.77" /etc/hosts
159
if [ $? -ne 0 ]; then
160
  echo "
161
127.0.0.77      vostok.dev archive.vostok.dev
162
" | sudo tee -a /etc/hosts > /dev/null
163
  echo "vostok.dev added to /etc/hosts"
164
fi
165
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
166
# Enable relevant Ubuntu package repositories
167
grep -q "^deb http:.* ${DISTRIB_CODENAME} .*universe" /etc/apt/sources.list
168
if [ $? -ne 0 ]; then
169
    echo "Please enable the 'universe' component in /etc/apt/source.list'"
170
    exit 1
171
fi
172
grep -q "^deb http:.* ${DISTRIB_CODENAME} .*multiverse" /etc/apt/sources.list
173
if [ $? -ne 0 ]; then
174
    echo "Please enable the 'multiverse' component in /etc/apt/source.list'"
175
    exit 1
176
fi
177
7426.1.1 by Julian Edwards
Tweak rocketfuel-setup so that:
178
LPDEV_SOURCES="/etc/apt/sources.list.d/launchpad-dev.list"
179
if [ ! -e $LPDEV_SOURCES ]; then
180
  sudo touch $LPDEV_SOURCES
181
fi
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
182
7693.1.5 by Brad Crittenden
Merge from trunk. Fix RFS
183
LP_PPA="deb http://ppa.launchpad.net/launchpad/ppa/ubuntu ${DISTRIB_CODENAME} main"
184
grep -q "^${LP_PPA}" $LPDEV_SOURCES
7693.1.1 by Brad Crittenden
Corrected GPG key for bzr, add apache2 to installed packages, add lp:~launchpad ppa key.
185
if [ $? -ne 0 ]; then
7693.1.3 by Brad Crittenden
Changes due to review
186
  echo "Adding ~launchpad PPA repository to package source list."
7693.1.5 by Brad Crittenden
Merge from trunk. Fix RFS
187
  echo "$LP_PPA"  | sudo tee -a $LPDEV_SOURCES
7693.1.1 by Brad Crittenden
Corrected GPG key for bzr, add apache2 to installed packages, add lp:~launchpad ppa key.
188
fi
189
7693.1.5 by Brad Crittenden
Merge from trunk. Fix RFS
190
BZR_PPA="deb http://ppa.launchpad.net/bzr/ppa/ubuntu ${DISTRIB_CODENAME} main"
191
grep -q "^${BZR_PPA}" $LPDEV_SOURCES
7426.1.1 by Julian Edwards
Tweak rocketfuel-setup so that:
192
if [ $? -ne 0 ]; then
7693.1.3 by Brad Crittenden
Changes due to review
193
  echo "Adding ~bzr PPA repository to package source list."
7693.1.5 by Brad Crittenden
Merge from trunk. Fix RFS
194
  echo "$BZR_PPA" | sudo tee -a $LPDEV_SOURCES
7426.1.1 by Julian Edwards
Tweak rocketfuel-setup so that:
195
fi
196
7598.6.2 by Brad Crittenden
Added LP signing key, moved some items to the default section of bazaar.conf
197
# Get the key used to sign the launchpad-developer-dependencies in the PPA.
7693.1.1 by Brad Crittenden
Corrected GPG key for bzr, add apache2 to installed packages, add lp:~launchpad ppa key.
198
REQUIRED_PPA_KEYS="0A5174AF 8C6C1EFD"
7598.6.4 by Brad Crittenden
Added bzr PPA key and brought up-to-date with new apache local-launchpad settings.
199
for key in $REQUIRED_PPA_KEYS; do
200
   sudo apt-key list | grep -q $key
201
   if [ $? -ne 0 ]; then
202
     echo "Retrieving key $key."
203
     gpg --keyserver keyserver.ubuntu.com --recv-keys $key
204
     if [ $? -ne 0 ]; then
205
       echo "Could not retrieve key $key."
206
       exit 1
207
     fi
208
     gpg --export -a $key | sudo apt-key add -
209
     if [ $? -ne 0 ]; then
210
       echo "Could not install key $key."
211
       exit 1
212
     fi
213
   fi
214
done
7598.6.2 by Brad Crittenden
Added LP signing key, moved some items to the default section of bazaar.conf
215
7693.1.1 by Brad Crittenden
Corrected GPG key for bzr, add apache2 to installed packages, add lp:~launchpad ppa key.
216
do_install() {
7693.1.3 by Brad Crittenden
Changes due to review
217
  dpkg -s $pkg | grep -q "^Status: install ok installed"
7693.1.1 by Brad Crittenden
Corrected GPG key for bzr, add apache2 to installed packages, add lp:~launchpad ppa key.
218
  if [ $? -ne 0 ]; then
219
    echo "Installing $pkg package..."
220
    sudo aptitude install $pkg
221
    if [ $? -ne 0 ]; then
222
      echo "Unable to install $pkg."
223
      exit 1
224
    fi
225
  fi
226
  }
227
7426.1.1 by Julian Edwards
Tweak rocketfuel-setup so that:
228
sudo aptitude update
7693.1.5 by Brad Crittenden
Merge from trunk. Fix RFS
229
REQUIRED_PACKAGES="launchpad-developer-dependencies apache2 apache2-mpm-worker"
7693.1.1 by Brad Crittenden
Corrected GPG key for bzr, add apache2 to installed packages, add lp:~launchpad ppa key.
230
for pkg in $REQUIRED_PACKAGES; do
231
  do_install;
232
done
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
233
7693.1.1 by Brad Crittenden
Corrected GPG key for bzr, add apache2 to installed packages, add lp:~launchpad ppa key.
234
# Create the document root(s) to avoid Apache warnings
7598.6.4 by Brad Crittenden
Added bzr PPA key and brought up-to-date with new apache local-launchpad settings.
235
mkdir -p /var/tmp/bazaar.launchpad.dev/static
7693.1.1 by Brad Crittenden
Corrected GPG key for bzr, add apache2 to installed packages, add lp:~launchpad ppa key.
236
mkdir -p /var/tmp/bazaar.launchpad.dev/mirrors
4706.2.19 by Jonathan Lange
Make the mirrors directory in rocketfuel-setup.
237
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
238
sudo a2enmod proxy > /dev/null
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
239
if [ $? -ne 0 ]; then
240
  echo "ERROR: Unable to enable proxy module in Apache2"
241
  exit 1
242
fi
243
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
244
sudo a2enmod proxy_http > /dev/null
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
245
if [ $? -ne 0 ]; then
246
  echo "ERROR: Unable to enable proxy_http module in Apache2"
247
  exit 1
248
fi
249
4706.2.9 by Jonathan Lange
Update the documentation and add bazaar.launchpad.dev setup to rocketfuel-setup.
250
sudo a2enmod rewrite > /dev/null
251
if [ $? -ne 0 ]; then
252
  echo "ERROR: Unable to enable rewrite module in Apache2"
253
  exit 1
254
fi
255
6991.1.1 by Guilherme Salgado
Serve *.launchpad.dev through https
256
sudo a2enmod ssl > /dev/null
257
if [ $? -ne 0 ]; then
258
  echo "ERROR: Unable to enable ssl module in Apache2"
259
  exit 1
260
fi
261
7140.7.2 by Celso Providelo
Adjust rocketfuel-setup and development apache configuration to use mod_deflate.
262
sudo a2enmod deflate > /dev/null
263
if [ $? -ne 0 ]; then
264
  echo "ERROR: Unable to enable deflate module in Apache2"
265
  exit 1
266
fi
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
267
7598.6.4 by Brad Crittenden
Added bzr PPA key and brought up-to-date with new apache local-launchpad settings.
268
sudo a2enmod headers > /dev/null
269
if [ $? -ne 0 ]; then
270
  echo "ERROR: Unable to enable headers module in Apache2"
271
  exit 1
272
fi
273
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
274
# Create the local branch structure we will use for managing Launchpad code
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
275
mkdir -p $LP_PROJECT_ROOT
276
cd $LP_PROJECT_ROOT
6567.2.2 by Barry Warsaw
Respond to review comments.
277
if [ ! -d $LP_SHARED_REPO ]; then
8687.14.1 by Karl Fogel
In rocketfuel-setup, pass '--2a' instead of '--1.6' to 'bzr init-repo'.
278
  # 2a format (a.k.a. "brisbane-core") needed for stacking on Launchpad.
279
  bzr init-repo --2a $LP_SHARED_REPO
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
280
  if [ $? -ne 0 ]; then
8931.1.4 by Karl Fogel
* utilities/rocketfuel-setup: Tell the user to hit Return after
281
    echo "ERROR: Unable to set up local LP repository"
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
282
    exit 1
283
  fi
284
fi
6567.2.2 by Barry Warsaw
Respond to review comments.
285
if [ ! -d $LP_SHARED_REPO/.bzr -a -d $LP_SHARED_REPO/.bzr/repository ]; then
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
286
  echo "ERROR: LP repository not found in $LP_PROJECT_PATH"
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
287
  exit 1
288
fi
289
8931.1.5 by Karl Fogel
* utilities/rocketfuel-setup: Tell the user that a certain bzr warning
290
echo "Logging bzr into Launchpad (it's okay if this errors)..."
7426.1.1 by Julian Edwards
Tweak rocketfuel-setup so that:
291
bzr launchpad-login $lpusername
8931.1.5 by Karl Fogel
* utilities/rocketfuel-setup: Tell the user that a certain bzr warning
292
if [ $? -ne 0 ]; then
293
  echo ""
294
  echo "You can ignore any error above about not registering an SSH key"
295
  echo "with Launchpad.  Registering an SSH key is only important if you"
296
  echo "are writing data to Launchpad, or trying to access private data."
297
  echo ""
298
fi
7426.1.1 by Julian Edwards
Tweak rocketfuel-setup so that:
299
6567.2.2 by Barry Warsaw
Respond to review comments.
300
cd $LP_SHARED_REPO
6567.1.4 by Barry Warsaw
Last minute patch and whitespace normalization.
301
if [ ! -d $LP_TRUNK_NAME ]; then
302
  echo "Making local branch of Launchpad trunk, this may take a while..."
9647.2.1 by Michael Hudson
use bzr+ssh rather than http in rocketfuel-setup
303
  bzr branch lp:~launchpad-pqm/launchpad/devel $LP_TRUNK_NAME
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
304
  if [ $? -ne 0 ]; then
305
    echo "ERROR: Unable to create local copy of Rocketfuel trunk"
306
    exit 1
307
  fi
308
fi
309
6567.1.4 by Barry Warsaw
Last minute patch and whitespace normalization.
310
cd $LP_TRUNK_NAME
9322.4.1 by Simon Olofsson
Fixes: bug 402187: rocketfuel-setup can't resume if fails to complete
311
bzr st -q
312
if [ $? -ne 0 ]; then
313
  echo "ERROR: Your trunk branch in $LP_TRUNK_PATH is corrupted.
314
       Please delete $LP_TRUNK_PATH and run rocketfuel-setup again."
315
       exit 1
316
fi
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
317
if [ ! `bzr info | grep -i "parent branch" | cut -d: -f3` = \
8931.1.4 by Karl Fogel
* utilities/rocketfuel-setup: Tell the user to hit Return after
318
  "//bazaar.launchpad.net/~launchpad-pqm/launchpad/devel/" ]; then
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
319
  echo "ERROR: Your trunk branch in $LP_TRUNK_PATH has an
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
320
       incorrect pull location, correcting now..."
7426.1.1 by Julian Edwards
Tweak rocketfuel-setup so that:
321
  bzr pull --remember bzr+ssh://bazaar.launchpad.net/~launchpad-pqm/launchpad/devel/
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
322
  if [ $? -ne 0 ]; then
7426.1.1 by Julian Edwards
Tweak rocketfuel-setup so that:
323
    echo "ERROR: Unable to set trunk pull location to lp:~launchpad-pqm/launchpad/devel/"
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
324
    exit 1
325
  fi
326
fi
327
9948.1.1 by Maris Fogels
Make the apache process restart after installing the new configuration and modules, to prevent the new modules from segfaulting because of bugs.
328
# Call the newly minted Launchpad branch's 'make install' target to do some
329
# more apache setup.
5543.3.2 by Tim Penhey
Alterations to the way codebrowse is started, and updating rocketfuel-setup
330
sudo make install > /dev/null
331
if [ $? -ne 0 ]; then
332
  echo "ERROR: Unable to install apache config appropriately"
333
  exit 1
334
fi
335
336
8931.1.4 by Karl Fogel
* utilities/rocketfuel-setup: Tell the user to hit Return after
337
# Set up Bazaar locations configuration
4958.2.3 by Mark Shuttleworth
Make rf-setup create ~/.bazaar if needed
338
if [ ! -d ~/.bazaar ]; then
339
  mkdir ~/.bazaar
340
  if [ $? -ne 0 ]; then
341
    echo "Unable to create ~/.bazaar/ directory"
342
    exit 1
343
  fi
344
fi
7598.6.2 by Brad Crittenden
Added LP signing key, moved some items to the default section of bazaar.conf
345
4317.1.3 by Mark Shuttleworth
Also fixup ~/.bazaar/locations.conf
346
if [ ! -e ~/.bazaar/locations.conf ]; then
347
  touch ~/.bazaar/locations.conf
348
fi
7598.6.2 by Brad Crittenden
Added LP signing key, moved some items to the default section of bazaar.conf
349
6666.1.2 by Brad Crittenden
Simplified the setting for locations.conf
350
grep -q "\[${LP_PROJECT_PATH}\]" ~/.bazaar/locations.conf
4317.1.3 by Mark Shuttleworth
Also fixup ~/.bazaar/locations.conf
351
if [ $? -ne 0 ]; then
7426.1.1 by Julian Edwards
Tweak rocketfuel-setup so that:
352
  cat >> ~/.bazaar/locations.conf << EOF
6666.1.2 by Brad Crittenden
Simplified the setting for locations.conf
353
[$LP_PROJECT_PATH]
6666.1.1 by Brad Crittenden
Changes to locations.conf to match RocketFuelSetupDetails
354
submit_branch = ${LP_TRUNK_PATH}
7426.1.1 by Julian Edwards
Tweak rocketfuel-setup so that:
355
public_branch = bzr+ssh://bazaar.launchpad.net/~${lpusername}/launchpad
4317.1.3 by Mark Shuttleworth
Also fixup ~/.bazaar/locations.conf
356
public_branch:policy = appendpath
7426.1.1 by Julian Edwards
Tweak rocketfuel-setup so that:
357
push_location = lp:~${lpusername}/launchpad
4317.1.6 by Mark Shuttleworth
Make sure new stanza in ~/.bazaar/locations.conf starts on its own line
358
push_location:policy = appendpath
7426.1.1 by Julian Edwards
Tweak rocketfuel-setup so that:
359
merge_target = ${LP_TRUNK_PATH}
7598.6.2 by Brad Crittenden
Added LP signing key, moved some items to the default section of bazaar.conf
360
submit_to = merge@code.launchpad.net
7426.1.1 by Julian Edwards
Tweak rocketfuel-setup so that:
361
EOF
4317.1.3 by Mark Shuttleworth
Also fixup ~/.bazaar/locations.conf
362
6666.1.1 by Brad Crittenden
Changes to locations.conf to match RocketFuelSetupDetails
363
grep -q "\[$LP_TRUNK_PATH\]" ~/.bazaar/locations.conf
364
if [ $? -ne 0 ]; then
365
  echo "
366
[$LP_TRUNK_PATH]
7598.6.6 by Brad Crittenden
Fixed location of public_branch
367
public_branch = bzr+ssh://bazaar.launchpad.net/~launchpad-pqm/launchpad/devel\
6666.1.1 by Brad Crittenden
Changes to locations.conf to match RocketFuelSetupDetails
368
" | tee -a ~/.bazaar/locations.conf > /dev/null
369
fi
370
8931.1.1 by Karl Fogel
Use more appropriate defaults for LP_PROJECT_ROOT and LP_TRUNK_NAME.
371
echo "Bazaar branch configuration updated."
7598.6.2 by Brad Crittenden
Added LP signing key, moved some items to the default section of bazaar.conf
372
373
fi
374
8931.1.4 by Karl Fogel
* utilities/rocketfuel-setup: Tell the user to hit Return after
375
# Set up scripts in /usr/local/bin
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
376
cd /usr/local/bin
377
if [ ! -e rocketfuel-get ]; then
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
378
  sudo ln -s $LP_TRUNK_PATH/utilities/rocketfuel-get
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
379
fi
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
380
ls -l rocketfuel-get | cut -d">" -f2 | grep -q "$LP_TRUNK_NAME\/utilities\/rocketfuel"
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
381
if [ $? -ne 0 ]; then
382
  echo "WARNING: /usr/local/bin/rocketfuel-get should be deleted so I can
383
         recreate it."
384
fi
5323.2.1 by Mark Shuttleworth
Manage featured projects in the db
385
if [ ! -e rocketfuel-flakes ]; then
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
386
  sudo ln -s $LP_TRUNK_PATH/utilities/rocketfuel-flakes
5323.2.1 by Mark Shuttleworth
Manage featured projects in the db
387
fi
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
388
ls -l rocketfuel-flakes | cut -d">" -f2 | grep -q "$LP_TRUNK_NAME\/utilities\/rocketfuel"
5323.2.1 by Mark Shuttleworth
Manage featured projects in the db
389
if [ $? -ne 0 ]; then
390
  echo "WARNING: /usr/local/bin/rocketfuel-flakes should be deleted so I can
391
         recreate it."
392
fi
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
393
if [ ! -e rocketfuel-branch ]; then
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
394
  sudo ln -s $LP_TRUNK_PATH/utilities/rocketfuel-branch
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
395
fi
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
396
ls -l rocketfuel-branch | cut -d">" -f2 | grep -q "$LP_TRUNK_NAME\/utilities\/rocketfuel"
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
397
if [ $? -ne 0 ]; then
398
  echo "WARNING: /usr/local/bin/rocketfuel-branch should be deleted so I can
399
         recreate it."
400
fi
401
if [ ! -e rocketfuel-setup ]; then
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
402
  sudo ln -s $LP_TRUNK_PATH/utilities/rocketfuel-setup
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
403
fi
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
404
ls -l rocketfuel-setup | cut -d">" -f2 | grep -q "$LP_TRUNK_NAME\/utilities\/rocketfuel"
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
405
if [ $? -ne 0 ]; then
406
  echo "WARNING: /usr/local/bin/rocketfuel-setup should be deleted so I can
407
         recreate it."
408
fi
4343.1.3 by Mark Shuttleworth
Add symlink for rocketfuel-status
409
if [ ! -e rocketfuel-status ]; then
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
410
  sudo ln -s $LP_TRUNK_PATH/utilities/rocketfuel-status
4343.1.3 by Mark Shuttleworth
Add symlink for rocketfuel-status
411
fi
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
412
ls -l rocketfuel-status | cut -d">" -f2 | grep -q "$LP_TRUNK_NAME\/utilities\/rocketfuel"
4343.1.3 by Mark Shuttleworth
Add symlink for rocketfuel-status
413
if [ $? -ne 0 ]; then
414
  echo "WARNING: /usr/local/bin/rocketfuel-status should be deleted so I can
415
         recreate it."
416
fi
4920.2.13 by Mark Shuttleworth
Add rocketfuel-push script and make rocketfuel-setup aware of it
417
if [ ! -e rocketfuel-push ]; then
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
418
  sudo ln -s $LP_TRUNK_PATH/utilities/rocketfuel-push
4920.2.13 by Mark Shuttleworth
Add rocketfuel-push script and make rocketfuel-setup aware of it
419
fi
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
420
ls -l rocketfuel-push | cut -d">" -f2 | grep -q "$LP_TRUNK_NAME\/utilities\/rocketfuel"
4920.2.13 by Mark Shuttleworth
Add rocketfuel-push script and make rocketfuel-setup aware of it
421
if [ $? -ne 0 ]; then
422
  echo "WARNING: /usr/local/bin/rocketfuel-push should be deleted so I can
423
         recreate it."
424
fi
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
425
426
427
# Make sure we have all the right code in place for source dependencies
428
/usr/local/bin/rocketfuel-get
429
4317.1.5 by Mark Shuttleworth
Also setup ssh access to bazaar.launchpad.dev
430
echo "
8931.1.1 by Karl Fogel
Use more appropriate defaults for LP_PROJECT_ROOT and LP_TRUNK_NAME.
431
Thank you for using this script.  You can improve it for everyone by
8931.1.4 by Karl Fogel
* utilities/rocketfuel-setup: Tell the user to hit Return after
432
committing changes to Launchpad in utilities/rocketfuel-setup.
4317.1.5 by Mark Shuttleworth
Also setup ssh access to bazaar.launchpad.dev
433
8931.1.1 by Karl Fogel
Use more appropriate defaults for LP_PROJECT_ROOT and LP_TRUNK_NAME.
434
Please see http://dev.launchpad.net/ for more information on
435
developing and testing Launchpad, and on submitting changes.
7426.1.2 by Julian Edwards
remove the canonical smtp server pssword and direct the user to where to find it.
436
8931.1.1 by Karl Fogel
Use more appropriate defaults for LP_PROJECT_ROOT and LP_TRUNK_NAME.
437
You can use the following commands to manage your Launchpad
438
development environment:
4920.2.13 by Mark Shuttleworth
Add rocketfuel-push script and make rocketfuel-setup aware of it
439
440
 rocketfuel-get
8931.1.1 by Karl Fogel
Use more appropriate defaults for LP_PROJECT_ROOT and LP_TRUNK_NAME.
441
    Update your copy of $LP_TRUNK_NAME and the necessary source
442
    dependencies, and make sure all source dependencies are properly
443
    linked in to all the branches you are working on.
6567.1.3 by Barry Warsaw
parameterize all paths so that launchpad code can live anywhere.
444
445
 rocketfuel-branch foo
8234.1.7 by Gary Poster
rocketfuel scripts and download cache are in place now.
446
    Create a new branch of LP called \"foo\" in
447
    $LP_PROJECT_PATH/foo,
6567.1.3 by Barry Warsaw
parameterize all paths so that launchpad code can live anywhere.
448
    with all the source dependencies properly linked in.
4920.2.13 by Mark Shuttleworth
Add rocketfuel-push script and make rocketfuel-setup aware of it
449
450
 rocketfuel-status
8234.1.7 by Gary Poster
rocketfuel scripts and download cache are in place now.
451
    Check each of the branches in $LP_PROJECT_PATH
8931.1.4 by Karl Fogel
* utilities/rocketfuel-setup: Tell the user to hit Return after
452
    and show which of them have uncommitted changes; also check which ones
8234.1.7 by Gary Poster
rocketfuel scripts and download cache are in place now.
453
    have revisions that have not yet landed on trunk.
4920.2.13 by Mark Shuttleworth
Add rocketfuel-push script and make rocketfuel-setup aware of it
454
455
 rocketfuel-push
7693.1.1 by Brad Crittenden
Corrected GPG key for bzr, add apache2 to installed packages, add lp:~launchpad ppa key.
456
    Push all of your branches to Launchpad, so that you have a server-side
4920.2.13 by Mark Shuttleworth
Add rocketfuel-push script and make rocketfuel-setup aware of it
457
    backup of everything.
4317.1.5 by Mark Shuttleworth
Also setup ssh access to bazaar.launchpad.dev
458
459
Happy hacking!
460
"