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
|
#! /bin/bash
#
# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
#
# Update your copy of trunk and the necessary source dependencies, and make
# sure all source dependencies are properly linked in to all the branches you
# are working on.
# Stop if there's an error, and treat unset variables as errors.
set -eu
# A rough measure of how much stuff we can do in parallel.
CPU_COUNT="$(egrep -c '^processor\b' /proc/cpuinfo)"
# Helper function to run a child process, indenting stdout to aid
# readability.
run-child() {
"$@" | sed -e "s/^/ /"
}
# Load local settings.
if [ -e "$HOME/.rocketfuel-env.sh" ]
then
source "$HOME/.rocketfuel-env.sh"
else
echo "Please run rocketfuel-setup first." >&2
exit 1
fi
LP_DOWNLOAD_CACHE_PATH="$LP_PROJECT_ROOT/$LP_SOURCEDEPS_DIR/download-cache"
LP_EGGS_PATH="$LP_PROJECT_ROOT/$LP_SOURCEDEPS_DIR/eggs"
LP_DOWNLOAD_CACHE_PATH="$(eval echo ${LP_DOWNLOAD_CACHE_PATH})"
LP_EGGS_PATH="$(eval echo ${LP_EGGS_PATH})"
# Pull launchpad devel from launchpad.
INITIAL_REV=$(bzr revno "$LP_TRUNK_PATH")
bzr pull -d "$LP_TRUNK_PATH"
FINAL_REV=$(bzr revno "$LP_TRUNK_PATH")
# Make sure our directories are around.
mkdir -p "$LP_SOURCEDEPS_PATH" "$LP_EGGS_PATH"
# Get/update the download cache.
if [ -d "$LP_DOWNLOAD_CACHE_PATH" ]
then
bzr up "$LP_DOWNLOAD_CACHE_PATH"
else
bzr co lp:lp-source-dependencies "$LP_DOWNLOAD_CACHE_PATH"
fi
# Add or update sourcepackages.
sourcedeps_conf="$(dirname "$0")/sourcedeps.conf"
if [ ! -e "$sourcedeps_conf" ]
then
# Use the global deps which are stable.
echo "Could not find $sourcedeps_conf" >&2
sourcedeps_conf="$LP_TRUNK_PATH/utilities/sourcedeps.conf"
fi
echo "Updating sourcecode dependencies in rocketfuel:"
run-child \
"$LP_TRUNK_PATH/utilities/update-sourcecode" \
"$LP_SOURCEDEPS_PATH" "$sourcedeps_conf"
# Update the current trees in the repo.
echo "Updating sourcecode dependencies in current local branches:"
find "$LP_PROJECT_PATH" -mindepth 2 -maxdepth 2 \
-type d -name sourcecode -printf '%h\0' | \
run-child xargs --no-run-if-empty \
--max-procs="${CPU_COUNT}" --max-args=1 --null \
"$LP_TRUNK_PATH/utilities/link-external-sourcecode" \
--parent "$LP_PROJECT_ROOT/$LP_SOURCEDEPS_DIR" --target
# Build launchpad if there were changes.
if [ $FINAL_REV != $INITIAL_REV ];
then
make -C "$LP_TRUNK_PATH"
fi
|