Reduce variable expansions in libretro-fetch.sh

This commit is contained in:
T. Joseph Carter 2015-02-06 05:30:53 -08:00
parent ec5ebfbf20
commit 4b0923c0e7

View File

@ -44,16 +44,17 @@ log_verbose() {
# fetch_git <repository> <local directory> # fetch_git <repository> <local directory>
# Clones or pulls updates from a git repository into a local directory # Clones or pulls updates from a git repository into a local directory
fetch_git() { fetch_git() {
fetch_dir="${WORKDIR}/${2}"
if [ -n "${3}" ]; then if [ -n "${3}" ]; then
echo "=== Fetching ${3} ===" echo "=== Fetching ${3} ==="
fi fi
if [ -d "${WORKDIR}/${2}/.git" ]; then if [ -d "${fetch_dir}/.git" ]; then
log_verbose "${WORKDIR}/${2}:git pull" log_verbose "${fetch_dir}:git pull"
cd "${WORKDIR}/${2}" cd "${fetch_dir}"
git pull git pull
else else
log_verbose "git clone \"${1}\" \"${WORKDIR}/${2}\"" log_verbose "git clone \"${1}\" \"${fetch_dir}\""
git clone "${1}" "${WORKDIR}/${2}" git clone "${1}" "${fetch_dir}"
fi fi
if [ -n "${3}" ]; then if [ -n "${3}" ]; then
echo "=== Fetched ===" echo "=== Fetched ==="
@ -64,20 +65,21 @@ fetch_git() {
# Clones or pulls updates from a git repository (and its submodules, if any) # Clones or pulls updates from a git repository (and its submodules, if any)
# into a local directory # into a local directory
fetch_git_submodules() { fetch_git_submodules() {
fetch_dir="${WORKDIR}/${2}"
if [ -n "${3}" ]; then if [ -n "${3}" ]; then
echo "=== Fetching ${3} ===" echo "=== Fetching ${3} ==="
fi fi
if [ -d "${WORKDIR}/${2}/.git" ]; then if [ -d "${fetch_dir}/.git" ]; then
cd "${WORKDIR}/${2}" cd "${fetch_dir}"
log_verbose "${WORKDIR}/${2}:git pull" log_verbose "${fetch_dir}:git pull"
git pull git pull
log_verbose "${WORKDIR}/${2}:git submodule foreach git pull origin master" log_verbose "${fetch_dir}:git submodule foreach git pull origin master"
git submodule foreach git pull origin master git submodule foreach git pull origin master
else else
log_verbose "git clone \"${1}\" \"${WORKDIR}/${2}\"" log_verbose "git clone \"${1}\" \"${fetch_dir}\""
git clone "${1}" "${WORKDIR}/${2}" git clone "${1}" "${fetch_dir}"
cd "${WORKDIR}/${2}" cd "${fetch_dir}"
log_verbose "${WORKDIR}/${2}:git submodule update --init" log_verbose "${fetch_dir}:git submodule update --init"
git submodule update --init git submodule update --init
fi fi
if [ -n "${3}" ]; then if [ -n "${3}" ]; then
@ -92,18 +94,19 @@ fetch_git_submodules() {
# Basically if the core has a ton of external dependencies, you may not want # Basically if the core has a ton of external dependencies, you may not want
# them updated automatically # them updated automatically
fetch_git_submodules_no_update() { fetch_git_submodules_no_update() {
fetch_dir="${WORKDIR}/${2}"
if [ -n "${3}" ]; then if [ -n "${3}" ]; then
echo "=== Fetching ${3} ===" echo "=== Fetching ${3} ==="
fi fi
if [ -d "${WORKDIR}/${2}/.git" ]; then if [ -d "${fetch_dir}/.git" ]; then
cd "${WORKDIR}/${2}" cd "${fetch_dir}"
log_verbose "${WORKDIR}/${2}:git pull" log_verbose "${fetch_dir}:git pull"
git pull git pull
else else
log_verbose "git clone \"${1}\" \"${WORKDIR}/${2}\"" log_verbose "git clone \"${1}\" \"${fetch_dir}\""
git clone "${1}" "${WORKDIR}/${2}" git clone "${1}" "${fetch_dir}"
cd "${WORKDIR}/${2}" cd "${fetch_dir}"
log_verbose "${WORKDIR}/${2}:git submodule update --init" log_verbose "${fetch_dir}:git submodule update --init"
git submodule update --init git submodule update --init
fi fi
if [ -n "${3}" ]; then if [ -n "${3}" ]; then