~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
#
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
8698.7.3 by Gavin Panella
Use a helper function, run-child, to indent stdout of some child processes.
13
# Helper function to run a child process, indenting stdout to aid
14
# readability.
15
run-child() {
16
    "$@" | sed -e "s/^/        /"
17
}
18
8698.7.1 by Gavin Panella
Lots of changes to rocketfuel-get so I feel more comfortable running it.
19
# Load local settings.
20
if [ -e "$HOME/.rocketfuel-env.sh" ]
21
then
22
    source "$HOME/.rocketfuel-env.sh"
23
else
24
    echo "Please run rocketfuel-setup first." >&2
6673.1.5 by Barry Warsaw
Respond to Edwin's review.
25
    exit 1
26
fi
4317.1.1 by Mark Shuttleworth
Initial batch of setup and maintenance scripts for LP
27
8698.7.1 by Gavin Panella
Lots of changes to rocketfuel-get so I feel more comfortable running it.
28
LP_DOWNLOAD_CACHE_PATH="$LP_PROJECT_ROOT/$LP_SOURCEDEPS_DIR/download-cache"
29
LP_EGGS_PATH="$LP_PROJECT_ROOT/$LP_SOURCEDEPS_DIR/eggs"
30
LP_DOWNLOAD_CACHE_PATH="$(eval echo ${LP_DOWNLOAD_CACHE_PATH})"
31
LP_EGGS_PATH="$(eval echo ${LP_EGGS_PATH})"
32
33
# Pull launchpad devel from launchpad.
34
INITIAL_REV=$(bzr revno "$LP_TRUNK_PATH")
35
bzr pull -d "$LP_TRUNK_PATH"
36
FINAL_REV=$(bzr revno "$LP_TRUNK_PATH")
37
8697.8.1 by Barry Warsaw
Fix bug 390702 by explicitly adding --standalone to bzr branch command.
38
# 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.
39
mkdir -p "$LP_SOURCEDEPS_PATH" "$LP_EGGS_PATH"
40
41
# Get/update the download cache.
42
if [ -d "$LP_DOWNLOAD_CACHE_PATH" ]
43
then
44
    bzr up "$LP_DOWNLOAD_CACHE_PATH"
45
else
46
    bzr co lp:lp-source-dependencies "$LP_DOWNLOAD_CACHE_PATH"
8486.13.2 by Curtis Hovey
Merge from launchpad devel. Reconciled devpad removals.
47
fi
8486.13.1 by Curtis Hovey
Partial completion of a devpad-free rocketfuel get.
48
49
# Add or update sourcepackages.
8698.7.1 by Gavin Panella
Lots of changes to rocketfuel-get so I feel more comfortable running it.
50
sourcedeps_conf="$(dirname "$0")/sourcedeps.conf"
51
if [ ! -e "$sourcedeps_conf" ]
8486.13.1 by Curtis Hovey
Partial completion of a devpad-free rocketfuel get.
52
then
8698.7.1 by Gavin Panella
Lots of changes to rocketfuel-get so I feel more comfortable running it.
53
    # Use the global deps which are stable.
54
    echo "Could not find $sourcedeps_conf" >&2
55
    sourcedeps_conf="$LP_TRUNK_PATH/utilities/sourcedeps.conf"
8486.13.1 by Curtis Hovey
Partial completion of a devpad-free rocketfuel get.
56
fi
57
58
echo "Updating sourcecode dependencies in rocketfuel:"
8931.1.4 by Karl Fogel
* utilities/rocketfuel-setup: Tell the user to hit Return after
59
echo ""
60
echo "  NOTE: Each sourcedep may take a while; please be patient."
8931.1.5 by Karl Fogel
* utilities/rocketfuel-setup: Tell the user that a certain bzr warning
61
echo ""
62
echo "  ALSO NOTE: You can ignore any warnings you see below about how"
63
echo "  'You have not informed bzr of your Launchpad ID ...' etc."
11677.3.3 by Robert Collins
More edge removal.
64
echo "  See https://bugs.launchpad.net/bzr/+bug/401617 for why."
8931.1.4 by Karl Fogel
* utilities/rocketfuel-setup: Tell the user to hit Return after
65
echo ""
8486.13.1 by Curtis Hovey
Partial completion of a devpad-free rocketfuel get.
66
echo "    Sourcedeps: $LP_SOURCEDEPS_PATH"
9370.1.19 by Jonathan Lange
Remove a bunch of shell script.
67
68
run-child $LP_TRUNK_PATH/utilities/update-sourcecode $LP_SOURCEDEPS_PATH $sourcedeps_conf
69
8486.13.1 by Curtis Hovey
Partial completion of a devpad-free rocketfuel get.
70
71
# Update the current trees in the repo.
72
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.
73
for branch in "$LP_PROJECT_PATH"/*
74
do
75
    if [ -d "$branch/sourcecode" ]
76
    then
77
        echo "    ${branch}"
8698.7.3 by Gavin Panella
Use a helper function, run-child, to indent stdout of some child processes.
78
        run-child "$LP_TRUNK_PATH/utilities/link-external-sourcecode" \
79
            --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.
80
    fi
4343.1.1 by Mark Shuttleworth
Link all current branches to current sourcecode deps
81
done
82
8698.7.1 by Gavin Panella
Lots of changes to rocketfuel-get so I feel more comfortable running it.
83
# Build launchpad if there were changes.
8486.13.2 by Curtis Hovey
Merge from launchpad devel. Reconciled devpad removals.
84
if [ $FINAL_REV != $INITIAL_REV ];
8486.13.1 by Curtis Hovey
Partial completion of a devpad-free rocketfuel get.
85
then
8734.1.1 by Gavin Panella
Use LP_TRUNK_PATH, not LP_TRUNK_NAME.
86
    make -C "$LP_TRUNK_PATH"
8486.13.1 by Curtis Hovey
Partial completion of a devpad-free rocketfuel get.
87
fi