~launchpad-pqm/launchpad/devel

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
80
81
82
83
84
85
86
87
88
89
90
91
#! /bin/bash
#
# Copyright 2009 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.

here=`pwd`

source "$HOME/.rocketfuel-env.sh"
if [ "$?" != 0 ]; then
    echo "Please run rocketfuel-setup first."
    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
cd $LP_TRUNK_PATH
INITIAL_REV=$(bzr revno)
bzr pull
FINAL_REV=$(bzr revno)

# Make sure our directories are around
if [ ! -d $LP_SOURCEDEPS_PATH ]; then mkdir -p $LP_SOURCEDEPS_PATH; fi
if [ ! -d $LP_EGGS_PATH ]; then mkdir -p $LP_EGGS_PATH; fi

# Get/update the download cache
if [ ! -d $LP_DOWNLOAD_CACHE_PATH ]
    then bzr co lp:lp-source-dependencies $LP_DOWNLOAD_CACHE_PATH
fi
bzr up $LP_DOWNLOAD_CACHE_PATH

# Create the source dependencies dir if this is the first time.
if [ ! -d $LP_SOURCEDEPS_PATH ]; then mkdir -p $LP_SOURCEDEPS_PATH; fi

# Add or update sourcepackages.
local_deps="$here/"`dirname $0`'/sourcedeps.conf'
if [ -e $local_deps ]
then
    # Load the local deps, which the developer may be developing.
    source $local_deps
else
    # Load the global deps which are stable.
    echo could not find $local_deps
    source $LP_TRUNK_PATH/utilities/sourcedeps.conf
fi

echo "Updating sourcecode dependencies in rocketfuel:"
echo "    Sourcedeps: $LP_SOURCEDEPS_PATH"
package_pattern="s,.*/\([^/]*\)/[^/]*/,\1,;"
for dep in $sourcedeps
do
    package=`echo $dep | cut -d= -f1`
    branch=`echo $dep | cut -d= -f2`
    package_path="$LP_SOURCEDEPS_PATH/$package"
    echo "    Checking $package_path"
    if [ -d $package_path ]
    then
        cd $package_path
        bzr pull --remember $branch | sed -e 's,.*,        \0,'
    else
        cd $LP_SOURCEDEPS_PATH
        bzr branch $branch $package | sed -e 's,.*,        \0,'
    fi
done

# Update the current trees in the repo.
echo "Updating sourcecode dependencies in current local branches:"
cd $LP_PROJECT_PATH
for branch in *; do
  if [ -d $branch/sourcecode ]
  then
    echo "    ${branch}"
    $LP_TRUNK_NAME/utilities/link-external-sourcecode \
        --target=$branch --parent=$LP_PROJECT_ROOT/$LP_SOURCEDEPS_DIR | \
        sed -e 's,.*,        \0,'
  fi
done

# Build launchpad if there were changes
if [ $FINAL_REV != $INITIAL_REV ];
then
    cd $LP_TRUNK_NAME
    make
fi