Show a summary of libretro-fetch success.
This commit is contained in:
parent
8c6284ac2f
commit
4aeeaa9cbd
|
@ -28,6 +28,30 @@ fi
|
||||||
. "$BASE_DIR/rules.d/lutro-rules.sh"
|
. "$BASE_DIR/rules.d/lutro-rules.sh"
|
||||||
. "$BASE_DIR/build-config.sh"
|
. "$BASE_DIR/build-config.sh"
|
||||||
|
|
||||||
|
|
||||||
|
summary_fetch() {
|
||||||
|
# fmt is external and may not be available
|
||||||
|
fmt_output="$(find_tool "fmt")"
|
||||||
|
local num_success="$(numwords $fetch_success)"
|
||||||
|
local fmt_success="${fmt_output:+$(echo " $fetch_success" | $fmt_output)}"
|
||||||
|
local num_fail="$(numwords $fetch_fail)"
|
||||||
|
local fmt_fail="${fmt_output:+$(echo " $fetch_fail" | $fmt_output)}"
|
||||||
|
|
||||||
|
if [[ -z "$fetch_success" && -z "$fetch_fail" ]]; then
|
||||||
|
secho "No fetch actions performed."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$fetch_success" ]; then
|
||||||
|
secho "$(color 32)$num_success core(s)$(color) successfully processed:"
|
||||||
|
secho "$fmt_success"
|
||||||
|
fi
|
||||||
|
if [ -n "$fetch_fail" ]; then
|
||||||
|
secho "$(color 31)$num_fail core(s)$(color) failed:"
|
||||||
|
secho "$fmt_fail"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# libretro_fetch: Download the given core using its fetch rules
|
# libretro_fetch: Download the given core using its fetch rules
|
||||||
#
|
#
|
||||||
# $1 Name of the core to fetch
|
# $1 Name of the core to fetch
|
||||||
|
@ -66,6 +90,10 @@ libretro_fetch() {
|
||||||
# TODO: Don't depend on fetch_rule being git
|
# TODO: Don't depend on fetch_rule being git
|
||||||
echo "Fetching ${1}..."
|
echo "Fetching ${1}..."
|
||||||
fetch_git "$git_url" "$module_dir" "$git_submodules"
|
fetch_git "$git_url" "$module_dir" "$git_submodules"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
@ -78,6 +106,9 @@ libretro_fetch() {
|
||||||
if [ -n "$post_fetch_cmd" ]; then
|
if [ -n "$post_fetch_cmd" ]; then
|
||||||
echo_cmd "cd \"$WORKDIR/$module_dir\""
|
echo_cmd "cd \"$WORKDIR/$module_dir\""
|
||||||
echo_cmd "$post_fetch_cmd"
|
echo_cmd "$post_fetch_cmd"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,4 +157,10 @@ done
|
||||||
|
|
||||||
for a in $fetch_cores; do
|
for a in $fetch_cores; do
|
||||||
libretro_fetch "${a%%:*}"
|
libretro_fetch "${a%%:*}"
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
export fetch_success="$fetch_success$a "
|
||||||
|
else
|
||||||
|
export fetch_fail="$fetch_fail$a "
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
summary_fetch
|
||||||
|
|
|
@ -14,18 +14,31 @@ fetch_git() {
|
||||||
if [ -d "$fetch_dir/.git" ]; then
|
if [ -d "$fetch_dir/.git" ]; then
|
||||||
echo_cmd "cd \"$fetch_dir\""
|
echo_cmd "cd \"$fetch_dir\""
|
||||||
echo_cmd "git pull"
|
echo_cmd "git pull"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
if [ "$3" = "yes" ]; then
|
if [ "$3" = "yes" ]; then
|
||||||
echo_cmd "git submodule foreach git pull origin master"
|
echo_cmd "git submodule foreach git pull origin master"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
clone_type=
|
clone_type=
|
||||||
[ -n "$SHALLOW_CLONE" ] && depth="--depth 1 "
|
[ -n "$SHALLOW_CLONE" ] && depth="--depth 1 "
|
||||||
echo_cmd "git clone $depth\"$1\" \"$WORKDIR/$2\""
|
echo_cmd "git clone $depth\"$1\" \"$WORKDIR/$2\""
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
if [[ "$3" = "yes" || "$3" = "clone" ]]; then
|
if [[ "$3" = "yes" || "$3" = "clone" ]]; then
|
||||||
echo_cmd "cd \"$fetch_dir\""
|
echo_cmd "cd \"$fetch_dir\""
|
||||||
echo_cmd "git submodule update --init --recursive"
|
echo_cmd "git submodule update --init --recursive"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
# fetch_revision_git: Output the hash of the last commit in a git repository
|
# fetch_revision_git: Output the hash of the last commit in a git repository
|
||||||
|
|
Loading…
Reference in New Issue