|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# Downloads and builds the Fuchsia operating system using a toolchain installed |
| 4 | +# in $RUST_INSTALL_DIR. |
| 5 | +# |
| 6 | +# You may run this script locally using Docker with the following command: |
| 7 | +# |
| 8 | +# $ src/ci/docker/run.sh x86_64-fuchsia |
| 9 | +# |
| 10 | +# Alternatively, from within the container with --dev, assuming you have made it |
| 11 | +# as far as building the toolchain with the above command: |
| 12 | +# |
| 13 | +# $ src/ci/docker/run.sh --dev x86_64-fuchsia |
| 14 | +# docker# git config --global --add safe.directory /checkout/obj/fuchsia |
| 15 | +# docker# ../src/ci/docker/host-x86_64/x86_64-fuchsia/checkout-fuchsia.sh |
| 16 | +# |
| 17 | +# Also see the docs in the rustc-dev-guide for more info: |
| 18 | +# https://github.com/rust-lang/rustc-dev-guide/pull/1989 |
| 19 | + |
| 20 | +set -euf -o pipefail |
| 21 | + |
| 22 | +# Set this variable to 1 to disable updating the Fuchsia checkout. This is |
| 23 | +# useful for making local changes. You can find the Fuchsia checkout in |
| 24 | +# `obj/x86_64-fuchsia/fuchsia` in your local checkout after running this |
| 25 | +# job for the first time. |
| 26 | +KEEP_CHECKOUT= |
| 27 | + |
| 28 | +# Any upstream refs that should be cherry-picked. This can be used to include |
| 29 | +# Gerrit changes from https://fxrev.dev during development (click the "Download" |
| 30 | +# button on a changelist to see the cherry pick ref). Example: |
| 31 | +# PICK_REFS=(refs/changes/71/1054071/2 refs/changes/74/1054574/2) |
| 32 | +PICK_REFS=() |
| 33 | + |
| 34 | +# The commit hash of Fuchsia's integration.git to check out. This controls the |
| 35 | +# commit hash of fuchsia.git and some other repos in the "monorepo" checkout, in |
| 36 | +# addition to versions of prebuilts. It should be bumped regularly by the |
| 37 | +# Fuchsia team – we aim for every 1-2 months. |
| 38 | +INTEGRATION_SHA=f6f83d3e3852209f7752be55694006afbe979e50 |
| 39 | + |
| 40 | +checkout=fuchsia |
| 41 | +jiri=.jiri_root/bin/jiri |
| 42 | + |
| 43 | +set -x |
| 44 | + |
| 45 | +if [ -z "$KEEP_CHECKOUT" ]; then |
| 46 | + # This script will: |
| 47 | + # - create a directory named "fuchsia" if it does not exist |
| 48 | + # - download "jiri" to "fuchsia/.jiri_root/bin" |
| 49 | + curl -s "https://fuchsia.googlesource.com/jiri/+/HEAD/scripts/bootstrap_jiri?format=TEXT" \ |
| 50 | + | base64 --decode \ |
| 51 | + | bash -s $checkout |
| 52 | + |
| 53 | + cd $checkout |
| 54 | + |
| 55 | + $jiri init \ |
| 56 | + -partial=true \ |
| 57 | + -analytics-opt=false \ |
| 58 | + . |
| 59 | + |
| 60 | + $jiri import \ |
| 61 | + -name=integration \ |
| 62 | + -revision=$INTEGRATION_SHA \ |
| 63 | + -overwrite=true \ |
| 64 | + flower \ |
| 65 | + "https://fuchsia.googlesource.com/integration" |
| 66 | + |
| 67 | + if [ -d ".git" ]; then |
| 68 | + # Wipe out any local changes if we're reusing a checkout. |
| 69 | + git checkout --force JIRI_HEAD |
| 70 | + fi |
| 71 | + |
| 72 | + $jiri update -autoupdate=false |
| 73 | + |
| 74 | + echo integration commit = $(git -C integration rev-parse HEAD) |
| 75 | + |
| 76 | + for git_ref in "${PICK_REFS[@]}"; do |
| 77 | + git fetch https://fuchsia.googlesource.com/fuchsia $git_ref |
| 78 | + git cherry-pick --no-commit FETCH_HEAD |
| 79 | + done |
| 80 | +else |
| 81 | + echo Reusing existing Fuchsia checkout |
| 82 | + cd $checkout |
| 83 | +fi |
0 commit comments