fuchsiaノート-コードダウンロード
6249 ワード
環境:Ubuntu 18.04
公式提供のcheckoutコマンド
実際にbootstrapスクリプトをダウンロードし、実行します.
別のbootstrapがダウンロードされましたjiriはいくつかの環境変数を宣言します
最初のダウンロードで発生したエラー:
ネットワークの問題かもしれませんが、もう一度実行すればいいです.
次のエラーも発生しました.
なぜか分かりませんが、ディレクトリの下のコードは同期済みです.一時的に無視
ダウンロード時間が長く、問題が発生する可能性があります.shellスクリプトでupdateを使用できます.
環境変数にjiriを宣言します.
export PATH=$PATH:$(pwd)/.jiri_root/bin
その後jiri updateを使用してコードを更新できます.
ダウンロードに失敗した場合は、国内のソースミラーを直接使用して、完全なコードパッケージをダウンロードすることができます.
https://mirrors.hexang.org/fuchsia/source-code/
https://fuchsia-china.com/fuchsia-source-code-china-mirror/
公式提供のcheckoutコマンド
curl -s "https://fuchsia.googlesource.com/fuchsia/+/master/scripts/bootstrap?format=TEXT" | base64 --decode | bash
実際にbootstrapスクリプトをダウンロードし、実行します.
#!/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.
set -e
function usage {
cat <
別のbootstrapがダウンロードされましたjiriはいくつかの環境変数を宣言します
#!/usr/bin/env bash
# Copyright 2015 The Vanadium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# bootstrap_jiri initializes a root directory for jiri. The following
# directories and files will be created:
# - root directory (picked by user)
# /.jiri_root - root metadata directory
# /.jiri_root/bin/jiri - jiri binary
#
# The jiri sources are downloaded and built into a temp directory, which is
# always deleted when this script finishes. The is deleted on any
# failure.
set -euf -o pipefail
# Jiri repo, from which we will download the jiri script wrapper.
readonly JIRI_REPO_URL="https://fuchsia.googlesource.com/jiri"
# Google Storage bucket that contains prebuilt versions of jiri.
readonly GS_BUCKET_URL="https://fuchsia-build.storage.googleapis.com/jiri"
# fatal prints an error message, followed by the usage string, and then exits.
fatal() {
usage='
Usage:
bootstrap_jiri
A typical bootstrap workflow looks like this:
$ curl -s https://fuchsia.googlesource.com/jiri/+/master/scripts/bootstrap_jiri?format=TEXT | base64 --decode | bash -s myroot
$ export PATH=myroot/.jiri_root/bin:$PATH
$ cd myroot
$ jiri import manifest https://example.com/manifest
$ jiri update'
echo "ERROR: $@${usage}" 1>&2
exit 1
}
readonly HOST_ARCH=$(uname -m)
if [ "$HOST_ARCH" == "aarch64" ]; then
readonly ARCH="arm64"
elif [ "$HOST_ARCH" == "x86_64" ]; then
readonly ARCH="amd64"
else
echo "Arch not supported: $HOST_ARCH"
exit 1
fi
# toabs converts the possibly relative argument into an absolute path. Run in a
# subshell to avoid changing the caller's working directory.
toabs() (
cd $(dirname $1)
echo ${PWD}/$(basename $1)
)
# Check the argument is supplied.
if [[ $# -ne 1 ]]; then
fatal "need argument"
fi
readonly ROOT_DIR="$(toabs $1)"
readonly BIN_DIR="${ROOT_DIR}/.jiri_root/bin"
# If ROOT_DIR doesn't already exist, we will destroy it during the exit trap,
# otherwise we will only destroy the BIN_DIR
if [[ -d "${ROOT_DIR}" ]]; then
CLEANUP_DIR="${BIN_DIR}"
else
CLEANUP_DIR="${ROOT_DIR}"
fi
mkdir -p "${BIN_DIR}"
# Remove the root_dir if this script fails so as to not leave the environment in a strange half-state.
trap "rm -rf -- \"${CLEANUP_DIR}\"" INT TERM EXIT
# Determine and validate the version of jiri.
readonly HOST_OS=$(uname | tr '[:upper:]' '[:lower:]')
readonly TARGET="${HOST_OS}-${ARCH}"
readonly COMMIT_URL="${JIRI_REPO_URL}/+refs/heads/master?format=JSON"
readonly LOG_URL="${JIRI_REPO_URL}/+log/refs/heads/master?format=JSON"
readonly VERSION=$(curl -sSf "${COMMIT_URL}" | sed -n 's/.*"value": "\([0-9a-f]\{40\}\)"/\1/p')
readonly VERSIONS=$(curl -sSf "${LOG_URL}" | sed -n 's/.*"commit": "\([0-9a-f]\{40\}\)".*/\1/p')
JIRI_URL=""
for version in ${VERSIONS}; do
url="${GS_BUCKET_URL}/${TARGET}/${version}"
if curl --output /dev/null --silent --head --fail "${url}"; then
JIRI_URL="${url}"
break
fi
done
if [[ -z "${JIRI_URL}" ]]; then
echo "Cannot find prebuilt Jiri binary." 1>&2
exit 1
fi
if ! curl -sf -o "${BIN_DIR}/jiri" "${JIRI_URL}"; then
echo "Failed downloading prebuilt Jiri binary." 1>&2
exit 1
fi
chmod 755 "${BIN_DIR}/jiri"
if [ "$ARCH" == "arm64" ]; then
echo "WARNING: Jiri doesn't support timely updates for arch '$HOST_ARCH'. This or future binaries of Jiri might be out of date."
fi
# Install cipd, which is frequently needed to use manifests.
pushd "${BIN_DIR}"
if ! "${BIN_DIR}/jiri" bootstrap cipd; then
echo "Running jiri bootstrap failed." 1>&2
popd
exit 1
fi
popd
echo "Please add ${BIN_DIR} to your PATH"
trap - EXIT
最初のダウンロードで発生したエラー:
Updating all projects
ERROR: Creating project "fuchsia": 'git fetch https://fuchsia.googlesource.com/fuchsia +refs/heads/*:refs/remotes/origin/*' failed:
stdout:
stderr:
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
command fail error: exit status 128
ネットワークの問題かもしれませんが、もう一度実行すればいいです.
次のエラーも発生しました.
Updating all projects
ERROR: context deadline exceeded
なぜか分かりませんが、ディレクトリの下のコードは同期済みです.一時的に無視
ダウンロード時間が長く、問題が発生する可能性があります.shellスクリプトでupdateを使用できます.
#! /bin/bash
# make_sure_update.sh
while true; do
jiri update -v && break
done
環境変数にjiriを宣言します.
export PATH=$PATH:$(pwd)/.jiri_root/bin
その後jiri updateを使用してコードを更新できます.
ダウンロードに失敗した場合は、国内のソースミラーを直接使用して、完全なコードパッケージをダウンロードすることができます.
https://mirrors.hexang.org/fuchsia/source-code/
https://fuchsia-china.com/fuchsia-source-code-china-mirror/