~launchpad-pqm/launchpad/devel

4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
1
#! /bin/bash
2
6567.2.2 by Barry Warsaw
Respond to review comments.
3
# Update your copy of trunk and the necessary source dependencies, and make
4
# sure all source dependencies are properly linked in to all the branches you
5
# are working on.
6
8698.7.1 by Gavin Panella
Lots of changes to rocketfuel-get so I feel more comfortable running it.
7
# Stop if there's an error, and treat unset variables as errors.
8
set -eu
8486.13.1 by Curtis Hovey
Partial completion of a devpad-free rocketfuel get.
9
8698.7.3 by Gavin Panella
Use a helper function, run-child, to indent stdout of some child processes.
10
# Helper function to run a child process, indenting stdout to aid
11
# readability.
12
run-child() {
13
    "$@" | sed -e "s/^/        /"
14
}
15
8698.7.1 by Gavin Panella
Lots of changes to rocketfuel-get so I feel more comfortable running it.
16
# Load local settings.
17
if [ -e "$HOME/.rocketfuel-env.sh" ]
18
then
19
    source "$HOME/.rocketfuel-env.sh"
20
else
21
    echo "Please run rocketfuel-setup first." >&2
6673.1.5 by Barry Warsaw
Respond to Edwin's review.
22
    exit 1
23
fi
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
24
8698.7.1 by Gavin Panella
Lots of changes to rocketfuel-get so I feel more comfortable running it.
25
LP_DOWNLOAD_CACHE_PATH="$LP_PROJECT_ROOT/$LP_SOURCEDEPS_DIR/download-cache"
26
LP_EGGS_PATH="$LP_PROJECT_ROOT/$LP_SOURCEDEPS_DIR/eggs"
27
LP_DOWNLOAD_CACHE_PATH="$(eval echo ${LP_DOWNLOAD_CACHE_PATH})"
28
LP_EGGS_PATH="$(eval echo ${LP_EGGS_PATH})"
29
30
# Pull launchpad devel from launchpad.
31
INITIAL_REV=$(bzr revno "$LP_TRUNK_PATH")
32
bzr pull -d "$LP_TRUNK_PATH"
33
FINAL_REV=$(bzr revno "$LP_TRUNK_PATH")
34
8697.8.1 by Barry Warsaw
Fix bug 390702 by explicitly adding --standalone to bzr branch command.
35
# 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.
36
mkdir -p "$LP_SOURCEDEPS_PATH" "$LP_EGGS_PATH"
37
38
# Get/update the download cache.
39
if [ -d "$LP_DOWNLOAD_CACHE_PATH" ]
40
then
41
    bzr up "$LP_DOWNLOAD_CACHE_PATH"
42
else
43
    bzr co lp:lp-source-dependencies "$LP_DOWNLOAD_CACHE_PATH"
8486.13.2 by Curtis Hovey
Merge from launchpad devel. Reconciled devpad removals.
44
fi
8486.13.1 by Curtis Hovey
Partial completion of a devpad-free rocketfuel get.
45
46
# Add or update sourcepackages.
8698.7.1 by Gavin Panella
Lots of changes to rocketfuel-get so I feel more comfortable running it.
47
sourcedeps_conf="$(dirname "$0")/sourcedeps.conf"
48
if [ ! -e "$sourcedeps_conf" ]
8486.13.1 by Curtis Hovey
Partial completion of a devpad-free rocketfuel get.
49
then
8698.7.1 by Gavin Panella
Lots of changes to rocketfuel-get so I feel more comfortable running it.
50
    # Use the global deps which are stable.
51
    echo "Could not find $sourcedeps_conf" >&2
52
    sourcedeps_conf="$LP_TRUNK_PATH/utilities/sourcedeps.conf"
8486.13.1 by Curtis Hovey
Partial completion of a devpad-free rocketfuel get.
53
fi
54
55
echo "Updating sourcecode dependencies in rocketfuel:"
56
echo "    Sourcedeps: $LP_SOURCEDEPS_PATH"
8698.7.1 by Gavin Panella
Lots of changes to rocketfuel-get so I feel more comfortable running it.
57
while IFS="=" read package branch
8486.13.1 by Curtis Hovey
Partial completion of a devpad-free rocketfuel get.
58
do
59
    package_path="$LP_SOURCEDEPS_PATH/$package"
60
    echo "    Checking $package_path"
8698.7.1 by Gavin Panella
Lots of changes to rocketfuel-get so I feel more comfortable running it.
61
    if [ -d "$package_path" ]
8486.13.1 by Curtis Hovey
Partial completion of a devpad-free rocketfuel get.
62
    then
8698.7.3 by Gavin Panella
Use a helper function, run-child, to indent stdout of some child processes.
63
        run-child bzr pull --remember "$branch" --directory "$package_path"
8486.13.1 by Curtis Hovey
Partial completion of a devpad-free rocketfuel get.
64
    else
8698.7.3 by Gavin Panella
Use a helper function, run-child, to indent stdout of some child processes.
65
        run-child bzr branch --standalone "$branch" "$package_path"
8486.13.1 by Curtis Hovey
Partial completion of a devpad-free rocketfuel get.
66
    fi
8698.7.1 by Gavin Panella
Lots of changes to rocketfuel-get so I feel more comfortable running it.
67
done < "$sourcedeps_conf"
8486.13.1 by Curtis Hovey
Partial completion of a devpad-free rocketfuel get.
68
69
# Update the current trees in the repo.
70
echo "Updating sourcecode dependencies in current local branches:"
8698.7.1 by Gavin Panella
Lots of changes to rocketfuel-get so I feel more comfortable running it.
71
for branch in "$LP_PROJECT_PATH"/*
72
do
73
    if [ -d "$branch/sourcecode" ]
74
    then
75
        echo "    ${branch}"
8698.7.3 by Gavin Panella
Use a helper function, run-child, to indent stdout of some child processes.
76
        run-child "$LP_TRUNK_PATH/utilities/link-external-sourcecode" \
77
            --parent="$LP_PROJECT_ROOT/$LP_SOURCEDEPS_DIR" --target="$branch"
8698.7.1 by Gavin Panella
Lots of changes to rocketfuel-get so I feel more comfortable running it.
78
    fi
4343.1.1 by Mark Shuttleworth
Link all current branches to current sourcecode deps
79
done
80
8698.7.1 by Gavin Panella
Lots of changes to rocketfuel-get so I feel more comfortable running it.
81
# Build launchpad if there were changes.
8486.13.2 by Curtis Hovey
Merge from launchpad devel. Reconciled devpad removals.
82
if [ $FINAL_REV != $INITIAL_REV ];
8486.13.1 by Curtis Hovey
Partial completion of a devpad-free rocketfuel get.
83
then
8734.1.1 by Gavin Panella
Use LP_TRUNK_PATH, not LP_TRUNK_NAME.
84
    make -C "$LP_TRUNK_PATH"
8486.13.1 by Curtis Hovey
Partial completion of a devpad-free rocketfuel get.
85
fi