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 |
#
|
13135.1.1
by Steve Kowalik
Remove warnings from rf-get. |
3 |
# Copyright 2009-2011 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 |
#
|
6567.2.2
by Barry Warsaw
Respond to review comments. |
6 |
# Update your copy of trunk and the necessary source dependencies, and make
|
7 |
# sure all source dependencies are properly linked in to all the branches you
|
|
8 |
# are working on.
|
|
9 |
||
8698.7.1
by Gavin Panella
Lots of changes to rocketfuel-get so I feel more comfortable running it. |
10 |
# Stop if there's an error, and treat unset variables as errors.
|
11 |
set -eu
|
|
8486.13.1
by Curtis Hovey
Partial completion of a devpad-free rocketfuel get. |
12 |
|
13145.1.1
by Gavin Panella
Link sourcecode in parallel. On a 4-core machine this cuts the time taken by about 70%. |
13 |
# A rough measure of how much stuff we can do in parallel.
|
14 |
CPU_COUNT="$(egrep -c '^processor\b' /proc/cpuinfo)" |
|
15 |
||
8698.7.3
by Gavin Panella
Use a helper function, run-child, to indent stdout of some child processes. |
16 |
# Helper function to run a child process, indenting stdout to aid
|
17 |
# readability.
|
|
18 |
run-child() { |
|
19 |
"$@" | sed -e "s/^/ /" |
|
20 |
}
|
|
21 |
||
8698.7.1
by Gavin Panella
Lots of changes to rocketfuel-get so I feel more comfortable running it. |
22 |
# Load local settings.
|
23 |
if [ -e "$HOME/.rocketfuel-env.sh" ] |
|
24 |
then
|
|
25 |
source "$HOME/.rocketfuel-env.sh" |
|
26 |
else
|
|
27 |
echo "Please run rocketfuel-setup first." >&2 |
|
6673.1.5
by Barry Warsaw
Respond to Edwin's review. |
28 |
exit 1 |
29 |
fi
|
|
4317.1.1
by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP |
30 |
|
8698.7.1
by Gavin Panella
Lots of changes to rocketfuel-get so I feel more comfortable running it. |
31 |
LP_DOWNLOAD_CACHE_PATH="$LP_PROJECT_ROOT/$LP_SOURCEDEPS_DIR/download-cache" |
32 |
LP_EGGS_PATH="$LP_PROJECT_ROOT/$LP_SOURCEDEPS_DIR/eggs" |
|
33 |
LP_DOWNLOAD_CACHE_PATH="$(eval echo ${LP_DOWNLOAD_CACHE_PATH})" |
|
34 |
LP_EGGS_PATH="$(eval echo ${LP_EGGS_PATH})" |
|
35 |
||
36 |
# Pull launchpad devel from launchpad.
|
|
37 |
INITIAL_REV=$(bzr revno "$LP_TRUNK_PATH") |
|
38 |
bzr pull -d "$LP_TRUNK_PATH" |
|
39 |
FINAL_REV=$(bzr revno "$LP_TRUNK_PATH") |
|
40 |
||
8697.8.1
by Barry Warsaw
Fix bug 390702 by explicitly adding --standalone to bzr branch command. |
41 |
# Make sure our directories are around.
|
8698.7.1
by Gavin Panella
Lots of changes to rocketfuel-get so I feel more comfortable running it. |
42 |
mkdir -p "$LP_SOURCEDEPS_PATH" "$LP_EGGS_PATH" |
43 |
||
44 |
# Get/update the download cache.
|
|
45 |
if [ -d "$LP_DOWNLOAD_CACHE_PATH" ] |
|
46 |
then
|
|
47 |
bzr up "$LP_DOWNLOAD_CACHE_PATH" |
|
48 |
else
|
|
49 |
bzr co lp:lp-source-dependencies "$LP_DOWNLOAD_CACHE_PATH" |
|
8486.13.2
by Curtis Hovey
Merge from launchpad devel. Reconciled devpad removals. |
50 |
fi
|
8486.13.1
by Curtis Hovey
Partial completion of a devpad-free rocketfuel get. |
51 |
|
52 |
# Add or update sourcepackages.
|
|
8698.7.1
by Gavin Panella
Lots of changes to rocketfuel-get so I feel more comfortable running it. |
53 |
sourcedeps_conf="$(dirname "$0")/sourcedeps.conf" |
54 |
if [ ! -e "$sourcedeps_conf" ] |
|
8486.13.1
by Curtis Hovey
Partial completion of a devpad-free rocketfuel get. |
55 |
then
|
8698.7.1
by Gavin Panella
Lots of changes to rocketfuel-get so I feel more comfortable running it. |
56 |
# Use the global deps which are stable.
|
57 |
echo "Could not find $sourcedeps_conf" >&2 |
|
58 |
sourcedeps_conf="$LP_TRUNK_PATH/utilities/sourcedeps.conf" |
|
8486.13.1
by Curtis Hovey
Partial completion of a devpad-free rocketfuel get. |
59 |
fi
|
60 |
||
61 |
echo "Updating sourcecode dependencies in rocketfuel:" |
|
13145.1.1
by Gavin Panella
Link sourcecode in parallel. On a 4-core machine this cuts the time taken by about 70%. |
62 |
run-child \
|
63 |
"$LP_TRUNK_PATH/utilities/update-sourcecode" \ |
|
64 |
"$LP_SOURCEDEPS_PATH" "$sourcedeps_conf" |
|
8486.13.1
by Curtis Hovey
Partial completion of a devpad-free rocketfuel get. |
65 |
|
66 |
# Update the current trees in the repo.
|
|
67 |
echo "Updating sourcecode dependencies in current local branches:" |
|
13145.1.1
by Gavin Panella
Link sourcecode in parallel. On a 4-core machine this cuts the time taken by about 70%. |
68 |
find "$LP_PROJECT_PATH" -mindepth 2 -maxdepth 2 \ |
69 |
-type d -name sourcecode -printf '%h\0' | \ |
|
70 |
run-child xargs --no-run-if-empty \
|
|
71 |
--max-procs="${CPU_COUNT}" --max-args=1 --null \ |
|
72 |
"$LP_TRUNK_PATH/utilities/link-external-sourcecode" \ |
|
73 |
--parent "$LP_PROJECT_ROOT/$LP_SOURCEDEPS_DIR" --target |
|
4343.1.1
by Mark Shuttleworth
Link all current branches to current sourcecode deps |
74 |
|
8698.7.1
by Gavin Panella
Lots of changes to rocketfuel-get so I feel more comfortable running it. |
75 |
# Build launchpad if there were changes.
|
8486.13.2
by Curtis Hovey
Merge from launchpad devel. Reconciled devpad removals. |
76 |
if [ $FINAL_REV != $INITIAL_REV ]; |
8486.13.1
by Curtis Hovey
Partial completion of a devpad-free rocketfuel get. |
77 |
then
|
8734.1.1
by Gavin Panella
Use LP_TRUNK_PATH, not LP_TRUNK_NAME. |
78 |
make -C "$LP_TRUNK_PATH" |
8486.13.1
by Curtis Hovey
Partial completion of a devpad-free rocketfuel get. |
79 |
fi
|