blob: d858e0c51e602f01b48e7835f7dba3735392ae8a [file] [log] [blame]
#!/bin/bash
# Copyright 2017 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#### CATEGORY=Source tree
### configure jiri to manage a specific petal
## usage: fx set-petal none|fuchsia|topaz
##
## "none" configures jiri to fetch all repos at the global integration version,
## and is the recommended default.
##
## Other values configure jiri to fetch that specific petal's repo at
## top-of-tree (HEAD) instead of the globally integration version. This means a
## "jiri update" will pull down committed but not yet integrated changes, which
## will be faster but may be less stable.
set -e
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/../lib/vars.sh || exit $?
if [[ "$#" -ne 1 ]]; then
fx-command-help
exit 1
fi
petal="$1"
if [[ "${petal}" != "fuchsia" ]] &&
[[ "${petal}" != "topaz" ]] &&
[[ "${petal}" != "none" ]]; then
fx-command-help
exit 1
fi
cd "${FUCHSIA_DIR}"
rm -f -- "${FUCHSIA_DIR}/.jiri_manifest"
fx-command-run jiri import -name=integration flower https://fuchsia.googlesource.com/integration
if [[ "${petal}" != "none" ]]; then
fx-command-run jiri override "${petal}" "https://fuchsia.googlesource.com/${petal}"
echo "Configured jiri for ${petal}."
else
echo "Configured jiri for no petal/global integration."
fi
echo "Run these commands to update your tree:"
cat <<END
* jiri update -gc # Updates your source tree to contain ${petal} and
# removes unneeded repositories.
END