~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
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
158
# Enable relevant Ubuntu package repositories
159
grep -q "^deb http:.* ${DISTRIB_CODENAME} .*universe" /etc/apt/sources.list
160
if [ $? -ne 0 ]; then
161
    echo "Please enable the 'universe' component in /etc/apt/source.list'"
162
    exit 1
163
fi
164
grep -q "^deb http:.* ${DISTRIB_CODENAME} .*multiverse" /etc/apt/sources.list
165
if [ $? -ne 0 ]; then
166
    echo "Please enable the 'multiverse' component in /etc/apt/source.list'"
167
    exit 1
168
fi
169
7426.1.1 by Julian Edwards
Tweak rocketfuel-setup so that:
170
LPDEV_SOURCES="/etc/apt/sources.list.d/launchpad-dev.list"
171
if [ ! -e $LPDEV_SOURCES ]; then
172
  sudo touch $LPDEV_SOURCES
173
fi
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
174
7693.1.5 by Brad Crittenden
Merge from trunk. Fix RFS
175
LP_PPA="deb http://ppa.launchpad.net/launchpad/ppa/ubuntu ${DISTRIB_CODENAME} main"
176
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.
177
if [ $? -ne 0 ]; then
7693.1.3 by Brad Crittenden
Changes due to review
178
  echo "Adding ~launchpad PPA repository to package source list."
7693.1.5 by Brad Crittenden
Merge from trunk. Fix RFS
179
  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.
180
fi
181
7693.1.5 by Brad Crittenden
Merge from trunk. Fix RFS
182
BZR_PPA="deb http://ppa.launchpad.net/bzr/ppa/ubuntu ${DISTRIB_CODENAME} main"
183
grep -q "^${BZR_PPA}" $LPDEV_SOURCES
7426.1.1 by Julian Edwards
Tweak rocketfuel-setup so that:
184
if [ $? -ne 0 ]; then
7693.1.3 by Brad Crittenden
Changes due to review
185
  echo "Adding ~bzr PPA repository to package source list."
7693.1.5 by Brad Crittenden
Merge from trunk. Fix RFS
186
  echo "$BZR_PPA" | sudo tee -a $LPDEV_SOURCES
7426.1.1 by Julian Edwards
Tweak rocketfuel-setup so that:
187
fi
188
7598.6.2 by Brad Crittenden
Added LP signing key, moved some items to the default section of bazaar.conf
189
# 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.
190
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.
191
for key in $REQUIRED_PPA_KEYS; do
192
   sudo apt-key list | grep -q $key
193
   if [ $? -ne 0 ]; then
194
     echo "Retrieving key $key."
195
     gpg --keyserver keyserver.ubuntu.com --recv-keys $key
196
     if [ $? -ne 0 ]; then
197
       echo "Could not retrieve key $key."
198
       exit 1
199
     fi
200
     gpg --export -a $key | sudo apt-key add -
201
     if [ $? -ne 0 ]; then
202
       echo "Could not install key $key."
203
       exit 1
204
     fi
205
   fi
206
done
7598.6.2 by Brad Crittenden
Added LP signing key, moved some items to the default section of bazaar.conf
207
7693.1.1 by Brad Crittenden
Corrected GPG key for bzr, add apache2 to installed packages, add lp:~launchpad ppa key.
208
do_install() {
7693.1.3 by Brad Crittenden
Changes due to review
209
  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.
210
  if [ $? -ne 0 ]; then
211
    echo "Installing $pkg package..."
212
    sudo aptitude install $pkg
213
    if [ $? -ne 0 ]; then
214
      echo "Unable to install $pkg."
215
      exit 1
216
    fi
217
  fi
218
  }
219
7426.1.1 by Julian Edwards
Tweak rocketfuel-setup so that:
220
sudo aptitude update
7693.1.5 by Brad Crittenden
Merge from trunk. Fix RFS
221
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.
222
for pkg in $REQUIRED_PACKAGES; do
223
  do_install;
224
done
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
225
7693.1.1 by Brad Crittenden
Corrected GPG key for bzr, add apache2 to installed packages, add lp:~launchpad ppa key.
226
# 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.
227
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.
228
mkdir -p /var/tmp/bazaar.launchpad.dev/mirrors
4706.2.19 by Jonathan Lange
Make the mirrors directory in rocketfuel-setup.
229
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
230
sudo a2enmod proxy > /dev/null
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
231
if [ $? -ne 0 ]; then
232
  echo "ERROR: Unable to enable proxy module in Apache2"
233
  exit 1
234
fi
235
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
236
sudo a2enmod proxy_http > /dev/null
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
237
if [ $? -ne 0 ]; then
238
  echo "ERROR: Unable to enable proxy_http module in Apache2"
239
  exit 1
240
fi
241
4706.2.9 by Jonathan Lange
Update the documentation and add bazaar.launchpad.dev setup to rocketfuel-setup.
242
sudo a2enmod rewrite > /dev/null
243
if [ $? -ne 0 ]; then
244
  echo "ERROR: Unable to enable rewrite module in Apache2"
245
  exit 1
246
fi
247
6991.1.1 by Guilherme Salgado
Serve *.launchpad.dev through https
248
sudo a2enmod ssl > /dev/null
249
if [ $? -ne 0 ]; then
250
  echo "ERROR: Unable to enable ssl module in Apache2"
251
  exit 1
252
fi
253
7140.7.2 by Celso Providelo
Adjust rocketfuel-setup and development apache configuration to use mod_deflate.
254
sudo a2enmod deflate > /dev/null
255
if [ $? -ne 0 ]; then
256
  echo "ERROR: Unable to enable deflate module in Apache2"
257
  exit 1
258
fi
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
259
7598.6.4 by Brad Crittenden
Added bzr PPA key and brought up-to-date with new apache local-launchpad settings.
260
sudo a2enmod headers > /dev/null
261
if [ $? -ne 0 ]; then
262
  echo "ERROR: Unable to enable headers module in Apache2"
263
  exit 1
264
fi
265
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
266
# 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.
267
mkdir -p $LP_PROJECT_ROOT
268
cd $LP_PROJECT_ROOT
6567.2.2 by Barry Warsaw
Respond to review comments.
269
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'.
270
  # 2a format (a.k.a. "brisbane-core") needed for stacking on Launchpad.
271
  bzr init-repo --2a $LP_SHARED_REPO
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
272
  if [ $? -ne 0 ]; then
8931.1.4 by Karl Fogel
* utilities/rocketfuel-setup: Tell the user to hit Return after
273
    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
274
    exit 1
275
  fi
276
fi
6567.2.2 by Barry Warsaw
Respond to review comments.
277
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.
278
  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
279
  exit 1
280
fi
281
8931.1.5 by Karl Fogel
* utilities/rocketfuel-setup: Tell the user that a certain bzr warning
282
echo "Logging bzr into Launchpad (it's okay if this errors)..."
7426.1.1 by Julian Edwards
Tweak rocketfuel-setup so that:
283
bzr launchpad-login $lpusername
8931.1.5 by Karl Fogel
* utilities/rocketfuel-setup: Tell the user that a certain bzr warning
284
if [ $? -ne 0 ]; then
285
  echo ""
286
  echo "You can ignore any error above about not registering an SSH key"
287
  echo "with Launchpad.  Registering an SSH key is only important if you"
288
  echo "are writing data to Launchpad, or trying to access private data."
289
  echo ""
290
fi
7426.1.1 by Julian Edwards
Tweak rocketfuel-setup so that:
291
6567.2.2 by Barry Warsaw
Respond to review comments.
292
cd $LP_SHARED_REPO
6567.1.4 by Barry Warsaw
Last minute patch and whitespace normalization.
293
if [ ! -d $LP_TRUNK_NAME ]; then
294
  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
295
  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
296
  if [ $? -ne 0 ]; then
297
    echo "ERROR: Unable to create local copy of Rocketfuel trunk"
298
    exit 1
299
  fi
300
fi
301
6567.1.4 by Barry Warsaw
Last minute patch and whitespace normalization.
302
cd $LP_TRUNK_NAME
9322.4.1 by Simon Olofsson
Fixes: bug 402187: rocketfuel-setup can't resume if fails to complete
303
bzr st -q
304
if [ $? -ne 0 ]; then
305
  echo "ERROR: Your trunk branch in $LP_TRUNK_PATH is corrupted.
306
       Please delete $LP_TRUNK_PATH and run rocketfuel-setup again."
307
       exit 1
308
fi
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
309
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
310
  "//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.
311
  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
312
       incorrect pull location, correcting now..."
7426.1.1 by Julian Edwards
Tweak rocketfuel-setup so that:
313
  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
314
  if [ $? -ne 0 ]; then
7426.1.1 by Julian Edwards
Tweak rocketfuel-setup so that:
315
    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
316
    exit 1
317
  fi
318
fi
319
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.
320
# Call the newly minted Launchpad branch's 'make install' target to do some
321
# more apache setup.
5543.3.2 by Tim Penhey
Alterations to the way codebrowse is started, and updating rocketfuel-setup
322
sudo make install > /dev/null
323
if [ $? -ne 0 ]; then
324
  echo "ERROR: Unable to install apache config appropriately"
325
  exit 1
326
fi
327
328
8931.1.4 by Karl Fogel
* utilities/rocketfuel-setup: Tell the user to hit Return after
329
# Set up Bazaar locations configuration
4958.2.3 by Mark Shuttleworth
Make rf-setup create ~/.bazaar if needed
330
if [ ! -d ~/.bazaar ]; then
331
  mkdir ~/.bazaar
332
  if [ $? -ne 0 ]; then
333
    echo "Unable to create ~/.bazaar/ directory"
334
    exit 1
335
  fi
336
fi
7598.6.2 by Brad Crittenden
Added LP signing key, moved some items to the default section of bazaar.conf
337
4317.1.3 by Mark Shuttleworth
Also fixup ~/.bazaar/locations.conf
338
if [ ! -e ~/.bazaar/locations.conf ]; then
339
  touch ~/.bazaar/locations.conf
340
fi
7598.6.2 by Brad Crittenden
Added LP signing key, moved some items to the default section of bazaar.conf
341
6666.1.2 by Brad Crittenden
Simplified the setting for locations.conf
342
grep -q "\[${LP_PROJECT_PATH}\]" ~/.bazaar/locations.conf
4317.1.3 by Mark Shuttleworth
Also fixup ~/.bazaar/locations.conf
343
if [ $? -ne 0 ]; then
7426.1.1 by Julian Edwards
Tweak rocketfuel-setup so that:
344
  cat >> ~/.bazaar/locations.conf << EOF
6666.1.2 by Brad Crittenden
Simplified the setting for locations.conf
345
[$LP_PROJECT_PATH]
6666.1.1 by Brad Crittenden
Changes to locations.conf to match RocketFuelSetupDetails
346
submit_branch = ${LP_TRUNK_PATH}
7426.1.1 by Julian Edwards
Tweak rocketfuel-setup so that:
347
public_branch = bzr+ssh://bazaar.launchpad.net/~${lpusername}/launchpad
4317.1.3 by Mark Shuttleworth
Also fixup ~/.bazaar/locations.conf
348
public_branch:policy = appendpath
7426.1.1 by Julian Edwards
Tweak rocketfuel-setup so that:
349
push_location = lp:~${lpusername}/launchpad
4317.1.6 by Mark Shuttleworth
Make sure new stanza in ~/.bazaar/locations.conf starts on its own line
350
push_location:policy = appendpath
7426.1.1 by Julian Edwards
Tweak rocketfuel-setup so that:
351
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
352
submit_to = merge@code.launchpad.net
7426.1.1 by Julian Edwards
Tweak rocketfuel-setup so that:
353
EOF
4317.1.3 by Mark Shuttleworth
Also fixup ~/.bazaar/locations.conf
354
6666.1.1 by Brad Crittenden
Changes to locations.conf to match RocketFuelSetupDetails
355
grep -q "\[$LP_TRUNK_PATH\]" ~/.bazaar/locations.conf
356
if [ $? -ne 0 ]; then
357
  echo "
358
[$LP_TRUNK_PATH]
7598.6.6 by Brad Crittenden
Fixed location of public_branch
359
public_branch = bzr+ssh://bazaar.launchpad.net/~launchpad-pqm/launchpad/devel\
6666.1.1 by Brad Crittenden
Changes to locations.conf to match RocketFuelSetupDetails
360
" | tee -a ~/.bazaar/locations.conf > /dev/null
361
fi
362
8931.1.1 by Karl Fogel
Use more appropriate defaults for LP_PROJECT_ROOT and LP_TRUNK_NAME.
363
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
364
365
fi
366
8931.1.4 by Karl Fogel
* utilities/rocketfuel-setup: Tell the user to hit Return after
367
# Set up scripts in /usr/local/bin
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
368
cd /usr/local/bin
369
if [ ! -e rocketfuel-get ]; then
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
370
  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
371
fi
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
372
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
373
if [ $? -ne 0 ]; then
374
  echo "WARNING: /usr/local/bin/rocketfuel-get should be deleted so I can
375
         recreate it."
376
fi
5323.2.1 by Mark Shuttleworth
Manage featured projects in the db
377
if [ ! -e rocketfuel-flakes ]; 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-flakes
5323.2.1 by Mark Shuttleworth
Manage featured projects in the db
379
fi
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
380
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
381
if [ $? -ne 0 ]; then
382
  echo "WARNING: /usr/local/bin/rocketfuel-flakes should be deleted so I can
383
         recreate it."
384
fi
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
385
if [ ! -e rocketfuel-branch ]; 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-branch
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
387
fi
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
388
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
389
if [ $? -ne 0 ]; then
390
  echo "WARNING: /usr/local/bin/rocketfuel-branch should be deleted so I can
391
         recreate it."
392
fi
393
if [ ! -e rocketfuel-setup ]; 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-setup
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-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
397
if [ $? -ne 0 ]; then
398
  echo "WARNING: /usr/local/bin/rocketfuel-setup should be deleted so I can
399
         recreate it."
400
fi
4343.1.3 by Mark Shuttleworth
Add symlink for rocketfuel-status
401
if [ ! -e rocketfuel-status ]; 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-status
4343.1.3 by Mark Shuttleworth
Add symlink for rocketfuel-status
403
fi
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
404
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
405
if [ $? -ne 0 ]; then
406
  echo "WARNING: /usr/local/bin/rocketfuel-status should be deleted so I can
407
         recreate it."
408
fi
4920.2.13 by Mark Shuttleworth
Add rocketfuel-push script and make rocketfuel-setup aware of it
409
if [ ! -e rocketfuel-push ]; 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-push
4920.2.13 by Mark Shuttleworth
Add rocketfuel-push script and make rocketfuel-setup aware of it
411
fi
6567.1.2 by Barry Warsaw
Parameterized most paths so this script is more useful to everyone.
412
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
413
if [ $? -ne 0 ]; then
414
  echo "WARNING: /usr/local/bin/rocketfuel-push should be deleted so I can
415
         recreate it."
416
fi
4317.1.2 by Mark Shuttleworth
Extend utility scripts to handle local branch structure creation too
417
418
419
# Make sure we have all the right code in place for source dependencies
420
/usr/local/bin/rocketfuel-get
421
4317.1.5 by Mark Shuttleworth
Also setup ssh access to bazaar.launchpad.dev
422
echo "
8931.1.1 by Karl Fogel
Use more appropriate defaults for LP_PROJECT_ROOT and LP_TRUNK_NAME.
423
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
424
committing changes to Launchpad in utilities/rocketfuel-setup.
4317.1.5 by Mark Shuttleworth
Also setup ssh access to bazaar.launchpad.dev
425
8931.1.1 by Karl Fogel
Use more appropriate defaults for LP_PROJECT_ROOT and LP_TRUNK_NAME.
426
Please see http://dev.launchpad.net/ for more information on
427
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.
428
8931.1.1 by Karl Fogel
Use more appropriate defaults for LP_PROJECT_ROOT and LP_TRUNK_NAME.
429
You can use the following commands to manage your Launchpad
430
development environment:
4920.2.13 by Mark Shuttleworth
Add rocketfuel-push script and make rocketfuel-setup aware of it
431
432
 rocketfuel-get
8931.1.1 by Karl Fogel
Use more appropriate defaults for LP_PROJECT_ROOT and LP_TRUNK_NAME.
433
    Update your copy of $LP_TRUNK_NAME and the necessary source
434
    dependencies, and make sure all source dependencies are properly
435
    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.
436
437
 rocketfuel-branch foo
8234.1.7 by Gary Poster
rocketfuel scripts and download cache are in place now.
438
    Create a new branch of LP called \"foo\" in
439
    $LP_PROJECT_PATH/foo,
6567.1.3 by Barry Warsaw
parameterize all paths so that launchpad code can live anywhere.
440
    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
441
442
 rocketfuel-status
8234.1.7 by Gary Poster
rocketfuel scripts and download cache are in place now.
443
    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
444
    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.
445
    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
446
447
 rocketfuel-push
7693.1.1 by Brad Crittenden
Corrected GPG key for bzr, add apache2 to installed packages, add lp:~launchpad ppa key.
448
    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
449
    backup of everything.
4317.1.5 by Mark Shuttleworth
Also setup ssh access to bazaar.launchpad.dev
450
451
Happy hacking!
452
"