From 9afbf19ae7eab03eb9119b2d853427c4b78d1449 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Thu, 10 Dec 2015 21:08:29 +0100 Subject: [PATCH] Removing header hooks, as they're useless Considering finish hooks, to only update the rev file if compile was successful for vcs. Not sure yet. --- astronaut/astronaut | 19 ++---------------- astronaut/functions/say_hello.sh | 10 ---------- satellites/functions/vcs/git.sh | 34 ++++++++++++++++++-------------- satellites/vcs/armips.sat | 2 +- satellites/vcs/ctr.sat | 3 +-- satellites/vcs/ctrff.sat | 3 +-- satellites/vcs/ctrtool.sat | 3 +-- satellites/vcs/ctrulib-git.sat | 3 +-- satellites/vcs/makerom.sat | 3 +-- satellites/vcs/neovim-git.sat | 4 ++-- satellites/vcs/sockfile.sat | 2 +- 11 files changed, 30 insertions(+), 56 deletions(-) diff --git a/astronaut/astronaut b/astronaut/astronaut index 836df3e..bab1157 100755 --- a/astronaut/astronaut +++ b/astronaut/astronaut @@ -157,25 +157,13 @@ do_check() { } import() { - unset _hooks . "$(dirname "$_satellite")/functions/$1.sh" - if [ "$_hooks" ]; then - _header_end_hooks="$_header_end_hooks $_hooks" - fi -} - -_run_header_end_hooks() { - for _hook in $_header_end_hooks; do - $_hook - done - unset _hook } # Set some functions in accordance to the _download_only option. -header_end() { _run_header_end_hooks; } +header_end() { :; } if [ "$_vcs_only" = true ]; then header_end() { - _run_header_end_hooks if [ ! "$vcs_compile" = true ]; then exit fi @@ -188,10 +176,7 @@ if [ "$_download_only" = true ]; then extrafile() { :; } # Exit at the end of the header - header_end() { - _run_header_end_hooks - exit - } + header_end() { exit; } fi _satellite="$(realpath "$1")" diff --git a/astronaut/functions/say_hello.sh b/astronaut/functions/say_hello.sh index 26fe622..5a90a9d 100644 --- a/astronaut/functions/say_hello.sh +++ b/astronaut/functions/say_hello.sh @@ -6,13 +6,3 @@ say_hello() { _func_tmp="Hello, there!" echo "Function ran! $_func_tmp" } - -# Any hook is prefixed with "_hook_" -_hook_hello() { - echo "The hook ran at header_end!" -} - -# This is a space-separated list of all the hooks. -_hooks="_hook_hello" -# Hooks are functions with code that is run at header_end, regardless if you're in download-only mode. So don't go messing in the build directory here. -# This is purely to set variables (like update_url), maybe download code, or something else. diff --git a/satellites/functions/vcs/git.sh b/satellites/functions/vcs/git.sh index c9851a6..b4b7249 100644 --- a/satellites/functions/vcs/git.sh +++ b/satellites/functions/vcs/git.sh @@ -1,22 +1,26 @@ vcs_git() { - if [ ! -d "$dir_source/$name/vcs" ]; then - rm -rf "$dir_source/$name/vcs" - git clone --recursive --depth=1 "$1" "$dir_source/$name/vcs" - vcs_compile=true - fi -} - -_hook_git() { - cd "$dir_source/$name/vcs" + _func_reponame="$(basename "$1")" + _func_dir="$dir_source/$name/$_func_reponame" - git pull > /dev/null - _func_rev="$(git rev-parse @)" - if [ "$_func_rev" != "$(cat "$dir_source/$name/vcs_rev_$_satname" 2> /dev/null || true)" ]; then - echo "$_func_rev" > "$dir_source/$name/vcs_rev_$_satname" + if [ ! -d "$_func_dir" ]; then + # Clone new repo + git clone --recursive --depth=1 "$1" "$_func_dir" + cd "$_func_dir" + echo "$(git rev-parse @)" > "${_func_dir}_rev_$_satname" vcs_compile=true + else + cd "$_func_dir" + + git pull > /dev/null + _func_rev="$(git rev-parse @)" + if [ "$_func_rev" != "$(cat "${_func_dir}_rev_$_satname" 2> /dev/null || true)" ]; then + echo "$_func_rev" > "${_func_dir}_rev_$_satname" + vcs_compile=true + fi fi + version="$(git rev-list HEAD --count)_$(git rev-parse --short HEAD)" cd "$OLDPWD" -} -_hooks="_hook_git" + getfile "$_func_dir" +} diff --git a/satellites/vcs/armips.sat b/satellites/vcs/armips.sat index 11d6872..67edc31 100644 --- a/satellites/vcs/armips.sat +++ b/satellites/vcs/armips.sat @@ -6,7 +6,7 @@ name=armips vcs_git "https://github.com/Kingcom/$name" header_end -getfile vcs; cd vcs +cd "$name" compile_cmake_installbin "$name" # vim:set tabstop=4 shiftwidth=4 syntax=sh et: diff --git a/satellites/vcs/ctr.sat b/satellites/vcs/ctr.sat index 2e84bc2..95ba222 100644 --- a/satellites/vcs/ctr.sat +++ b/satellites/vcs/ctr.sat @@ -5,8 +5,7 @@ name=ctr vcs_git "https://github.com/b1l1s/$name" header_end -getfile vcs; cd vcs - +cd "$name" mkdir -p "$dir_install/$dir_sysroot/opt/devkitPRO/devkitARM/arm-none-eabi/include" "$dir_install/$dir_sysroot/opt/devkitPRO/devkitARM/arm-none-eabi/lib" make DEVKITARM="$dir_install/$dir_sysroot/opt/devkitPRO/devkitARM" install diff --git a/satellites/vcs/ctrff.sat b/satellites/vcs/ctrff.sat index 2cfec78..ed63e40 100644 --- a/satellites/vcs/ctrff.sat +++ b/satellites/vcs/ctrff.sat @@ -5,8 +5,7 @@ name=ctrff vcs_git "https://github.com/b1l1s/$name" header_end -getfile vcs; cd vcs - +cd "$name" mkdir -p "$dir_install/$dir_sysroot/opt/devkitPRO/devkitARM/arm-none-eabi/include" "$dir_install/$dir_sysroot/opt/devkitPRO/devkitARM/arm-none-eabi/lib" make DEVKITARM="$dir_install/$dir_sysroot/opt/devkitPRO/devkitARM" install diff --git a/satellites/vcs/ctrtool.sat b/satellites/vcs/ctrtool.sat index 00b8825..e2678bb 100644 --- a/satellites/vcs/ctrtool.sat +++ b/satellites/vcs/ctrtool.sat @@ -5,8 +5,7 @@ name=Project_CTR vcs_git "https://github.com/profi200/$name" header_end -getfile vcs; cd vcs/ctrtool - +cd "$name/ctrtool" make install -D ctrtool "$dir_install/$dir_prefix/bin/ctrtool" diff --git a/satellites/vcs/ctrulib-git.sat b/satellites/vcs/ctrulib-git.sat index a25945e..80eb226 100644 --- a/satellites/vcs/ctrulib-git.sat +++ b/satellites/vcs/ctrulib-git.sat @@ -5,8 +5,7 @@ name=ctrulib vcs_git "https://github.com/smealum/$name" header_end -getfile vcs; cd vcs/libctru - +cd "$name/libctru" make DEVKITPRO="$dir_install/$dir_sysroot/opt/devkitPRO" install # vim:set tabstop=4 shiftwidth=4 syntax=sh et: diff --git a/satellites/vcs/makerom.sat b/satellites/vcs/makerom.sat index a271530..e4eb3db 100644 --- a/satellites/vcs/makerom.sat +++ b/satellites/vcs/makerom.sat @@ -5,8 +5,7 @@ name=Project_CTR vcs_git "https://github.com/profi200/$name" header_end -getfile vcs; cd vcs/makerom - +cd "$name/makerom" make install -D makerom "$dir_install/$dir_prefix/bin/makerom" diff --git a/satellites/vcs/neovim-git.sat b/satellites/vcs/neovim-git.sat index 4a0db63..70cd26b 100644 --- a/satellites/vcs/neovim-git.sat +++ b/satellites/vcs/neovim-git.sat @@ -3,10 +3,10 @@ import "vcs/git" name=neovim -vcs_git "https://github.com/neovim/neovim" +vcs_git "https://github.com/$name/$name" header_end -getfile vcs; cd vcs +cd "$name" make CMAKE_BUILD_TYPE=Release CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX='$dir_prefix'" make DESTDIR="$dir_install" install diff --git a/satellites/vcs/sockfile.sat b/satellites/vcs/sockfile.sat index 717563a..0b0e92d 100644 --- a/satellites/vcs/sockfile.sat +++ b/satellites/vcs/sockfile.sat @@ -6,7 +6,7 @@ name=sockfile vcs_git "https://github.com/mid-kid/$name" header_end -getfile vcs; cd vcs +cd "$name" compile_cmake_installbin "$name" # vim:set tabstop=4 shiftwidth=4 syntax=sh et: