~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to utilities/rocketfuel-get

  • Committer: Gavin Panella
  • Date: 2011-06-01 09:02:19 UTC
  • mto: This revision was merged to the branch mainline in revision 13150.
  • Revision ID: gavin.panella@canonical.com-20110601090219-q30fhh4jdh72kmk9
Link sourcecode in parallel. On a 4-core machine this cuts the time taken by about 70%.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
# Stop if there's an error, and treat unset variables as errors.
11
11
set -eu
12
12
 
 
13
# A rough measure of how much stuff we can do in parallel.
 
14
CPU_COUNT="$(egrep -c '^processor\b' /proc/cpuinfo)"
 
15
 
13
16
# Helper function to run a child process, indenting stdout to aid
14
17
# readability.
15
18
run-child() {
56
59
fi
57
60
 
58
61
echo "Updating sourcecode dependencies in rocketfuel:"
59
 
echo ""
60
 
echo "    Sourcedeps: $LP_SOURCEDEPS_PATH"
61
 
 
62
 
run-child $LP_TRUNK_PATH/utilities/update-sourcecode $LP_SOURCEDEPS_PATH $sourcedeps_conf
63
 
 
 
62
run-child \
 
63
    "$LP_TRUNK_PATH/utilities/update-sourcecode" \
 
64
    "$LP_SOURCEDEPS_PATH" "$sourcedeps_conf"
64
65
 
65
66
# Update the current trees in the repo.
66
67
echo "Updating sourcecode dependencies in current local branches:"
67
 
for branch in "$LP_PROJECT_PATH"/*
68
 
do
69
 
    if [ -d "$branch/sourcecode" ]
70
 
    then
71
 
        echo "    ${branch}"
72
 
        run-child "$LP_TRUNK_PATH/utilities/link-external-sourcecode" \
73
 
            --parent="$LP_PROJECT_ROOT/$LP_SOURCEDEPS_DIR" --target="$branch"
74
 
    fi
75
 
done
 
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
76
74
 
77
75
# Build launchpad if there were changes.
78
76
if [ $FINAL_REV != $INITIAL_REV ];