Some cleanups of the fetch rules a bit, move echo_cmd to script-modules

This commit is contained in:
T. Joseph Carter 2015-02-26 00:14:05 -08:00
parent 22d5895162
commit 82a87696d4
4 changed files with 39 additions and 40 deletions

View File

@ -1,20 +1,14 @@
# vim: set ts=3 sw=3 noet ft=sh : bash
. "${BASE_DIR}/script-modules/fetch-rules.sh"
. "${BASE_DIR}/script-modules/cpu.sh"
. "$BASE_DIR/script-modules/util.sh"
. "$BASE_DIR/script-modules/fetch-rules.sh"
. "$BASE_DIR/script-modules/cpu.sh"
die() {
echo $1
#exit 1
}
echo_cmd() {
eval 'echo "$@"'
eval "$@"
return $?
}
#
# Regarding COMPILER... It didn't used to be safe. Now it is, provided that
# you are using it in a command line passed to echo_cmd without additional

View File

@ -15,6 +15,7 @@ else
fi
. "$BASE_DIR/libretro-config.sh"
. "$BASE_DIR/script-modules/util.sh"
. "$BASE_DIR/script-modules/fetch-rules.sh"
# Rules for fetching cores are in this file:
@ -45,8 +46,9 @@ libretro_fetch_core() {
eval "core_git_submodules=\$libretro_${1}_git_submodules"
eval "core_git_submodules_update=\$libretro_${1}_git_submodules_update"
# TODO: Don't depend on fetch_rule being git
echo "Fetching ${1}..."
$core_fetch_rule "$core_fetch_url" "$core_dir" "" $core_git_submodules $core_git_submodules_update
$core_fetch_rule "$core_fetch_url" "$core_dir" $core_git_submodules $core_git_submodules_update
;;
*)
echo "libretro_fetch_core:Unknown fetch rule for $1: \"$core_fetch_rule\"."
@ -56,26 +58,30 @@ libretro_fetch_core() {
}
fetch_retroarch() {
echo "=== Fetching RetroArch ==="
fetch_git "https://github.com/libretro/RetroArch.git" "retroarch" ""
fetch_git "https://github.com/libretro/common-shaders.git" "retroarch/media/shaders_cg" ""
fetch_git "https://github.com/libretro/common-overlays.git" "retroarch/media/overlays" ""
fetch_git "https://github.com/libretro/retroarch-assets.git" "retroarch/media/assets" ""
fetch_git "https://github.com/libretro/retroarch-joypad-autoconfig.git" "retroarch/media/autoconfig" ""
fetch_git "https://github.com/libretro/libretro-database.git" "retroarch/media/libretrodb" ""
echo "=== RetroArch"
echo "Fetching retroarch..."
fetch_git "https://github.com/libretro/RetroArch.git" "retroarch"
echo_cmd "cd \"$WORKDIR/retroarch\""
echo_cmd "./fetch-submodules.sh"
}
fetch_devkit() {
fetch_git "https://github.com/libretro/libretro-manifest.git" "libretro-manifest" "libretro/libretro-manifest"
fetch_git "https://github.com/libretro/libretrodb.git" "libretrodb" "libretro/libretrodb"
fetch_git "https://github.com/libretro/libretro-dat-pull.git" "libretro-dat-pull" "libretro/libretro-dat-pull"
fetch_git "https://github.com/libretro/libretro-common.git" "libretro-common" "libretro/common"
echo "=== libretro Developer's Kit"
echo "Fetching the libretro devkit..."
fetch_git "https://github.com/libretro/libretro-manifest.git" "libretro-manifest"
fetch_git "https://github.com/libretro/libretrodb.git" "libretrodb"
fetch_git "https://github.com/libretro/libretro-dat-pull.git" "libretro-dat-pull"
fetch_git "https://github.com/libretro/libretro-common.git" "libretro-common"
}
if [ -n "$1" ]; then
while [ -n "$1" ]; do
case "$1" in
fetch_retroarch|fetch_devkit)
# These don't have rule-based fetch yet.
$1
;;
fetch_libretro_*)
# "Old"-style
$1

View File

@ -4,35 +4,27 @@
#
# $1 The URI to fetch
# $2 The local directory to fetch to (relative)
# $3 The pretty name for the === Fetching line ("" to print nothing)
# $4 Set to clone --recursive
# $5 Set to pull --recursive
# $3 Set to clone --recursive
# $4 Set to pull --recursive
#
# NOTE: git _now_ has a -C argument that would replace the cd commands in
# this rule, but this is a fairly recent addition to git, so we can't
# use it here. --iKarith
fetch_git() {
fetch_dir="$WORKDIR/$2"
[ -n "$3" ] && echo "=== Fetching $3 ==="
if [ -d "$fetch_dir/.git" ]; then
echo "cd \"$fetch_dir\""
cd "$fetch_dir"
echo "git pull"
git pull
if [ -n "$5" ]; then
echo "git submodule foreach git pull origin master"
git submodule foreach git pull origin master
echo_cmd "cd \"$fetch_dir\""
echo_cmd "git pull"
if [ -n "$4" ]; then
echo_cmd "git submodule foreach git pull origin master"
fi
else
clone_type=
[ -n "$SHALLOW_CLONE" ] && depth="--depth 1"
echo "git clone $depth \"$1\" \"$WORKDIR/$2\""
git clone $depth "$1" "$WORKDIR/$2"
if [ -n "$4" ]; then
echo "cd \"$fetch_dir\""
cd "$fetch_dir"
echo "git submodule update --init"
git submodule update --init
[ -n "$SHALLOW_CLONE" ] && depth="--depth 1 "
echo_cmd "git clone $depth\"$1\" \"$WORKDIR/$2\""
if [ -n "$3" ]; then
echo_cmd "cd \"$fetch_dir\""
echo_cmd "git submodule update --init"
fi
fi
}

7
script-modules/util.sh Normal file
View File

@ -0,0 +1,7 @@
# vim: set ts=3 sw=3 noet ft=sh : bash
echo_cmd() {
eval 'echo "$@"'
eval "$@"
return $?
}