1#!/usr/bin/env bash 2 3set -e 4 5. "${0%/*}/helpers" 6 7while getopts "n:o:" OPT; do 8 case "${OPT}" in 9 o) output="${OPTARG}";; 10 n) base_name="${OPTARG}";; 11 :) error "option '%s' expects a mandatory argument\n" "${OPTARG}";; 12 \?) error "unknown option '%s'\n" "${OPTARG}";; 13 esac 14done 15 16# Already vendored tarball, nothing to do 17if tar tf "${output}" | grep -q "^[^/]*/VENDOR" ; then 18 exit 0 19fi 20 21post_process_unpack "${base_name}" "${output}" 22 23# Do the Cargo vendoring 24pushd "${base_name}" > /dev/null 25 26# Create the local .cargo/config with vendor info 27mkdir -p .cargo/ 28mkdir -p "${CARGO_HOME}" 29flock "${CARGO_HOME}"/.br-lock \ 30cargo vendor \ 31 --manifest-path ${BR_CARGO_MANIFEST_PATH-Cargo.toml} \ 32 --locked VENDOR \ 33 > .cargo/config 34 35# "cargo vendor' outputs on stderr a message directing to add some data 36# to the project's .cargo/config.toml, data that it outputs on stdout. 37# Since we redirect stdout to .cargo/config.toml, the message on stderr 38# gets confusing, so instruct the user that it's been handled. 39printf '(note: .cargo/config.toml automatically updated by Buildroot)\n\n' 40 41popd > /dev/null 42 43post_process_repack "$(pwd)" "${base_name}" "${output}" 44