Browse Source

I honestly forgot locals were a thing

master
mid-kid 9 years ago
parent
commit
0857dddd72
  1. 5
      astronaut/functions/say_hello.sh
  2. 4
      satellites/functions/compile/cmake.sh
  3. 4
      satellites/functions/compile/python.sh
  4. 4
      satellites/functions/compile/qt.sh
  5. 14
      satellites/functions/download/git.sh
  6. 22
      satellites/functions/vcs/git.sh

5
astronaut/functions/say_hello.sh

@ -2,7 +2,6 @@
# You define a function here, and it becomes available in any script that imports it.
say_hello() {
# Any function or variable that shouldn't be seen by the satellite is prefixed with "_func_"
_func_tmp="Hello, there!"
echo "Function ran! $_func_tmp"
local tmp="Hello, there!"
echo "Function ran! $tmp"
}

4
satellites/functions/compile/cmake.sh

@ -10,7 +10,7 @@ compile_cmake() {
}
compile_cmake_installbin() {
_func_file="$1"; shift
local file="$1"; shift
compile_cmake_base $@
install -D "$_func_file" "$dir_install/$dir_prefix/bin/$_func_file"
install -D "$file" "$dir_install/$dir_prefix/bin/$_func_file"
}

4
satellites/functions/compile/python.sh

@ -1,4 +1,4 @@
compile_python() {
_func_ver="$1"; shift
python$_func_ver setup.py install --prefix="$dir_prefix" --root="$dir_install" $@
local ver="$1"; shift
python$ver setup.py install --prefix="$dir_prefix" --root="$dir_install" $@
}

4
satellites/functions/compile/qt.sh

@ -1,6 +1,6 @@
compile_qt() {
_func_ver="$1"; shift
qmake-qt$_func_ver PREFIX="$dir_prefix" build_mode=release build_type=shared $@
local ver="$1"; shift
qmake-qt$ver PREFIX="$dir_prefix" build_mode=release build_type=shared $@
make
make INSTALL_ROOT="$dir_install" install
}

14
satellites/functions/download/git.sh

@ -1,15 +1,15 @@
download_git() {
_func_reponame="$(basename "$1")"
_func_dir="$dir_source/$name/$_func_reponame-$2"
local reponame="$(basename "$1")"
local dir="$dir_source/$name/$_func_reponame-$2"
if [ ! -d "$_func_dir" ]; then
rm -rf "$_func_dir"
git clone --recursive --depth=1 -b "v$2" "$1" "$_func_dir"
if [ ! -d "$dir" ]; then
rm -rf "$dir"
git clone --recursive --depth=1 -b "v$2" "$1" "$dir"
else
cd "$_func_dir"
cd "$dir"
git checkout "tags/v$2"
cd "$OLDPWD"
fi
getfile "$_func_reponame-$2"
getfile "$reponame-$2"
}

22
satellites/functions/vcs/git.sh

@ -1,20 +1,20 @@
vcs_git() {
_func_reponame="$(basename "$1")"
_func_dir="$dir_source/$name/$_func_reponame"
local reponame="$(basename "$1")"
local dir="$dir_source/$name/$reponame"
if [ ! -d "$_func_dir" ]; then
if [ ! -d "$dir" ]; then
# Clone new repo
git clone --recursive --depth=1 "$1" "$_func_dir"
cd "$_func_dir"
echo "$(git rev-parse @)" > "${_func_dir}_rev_$_satname"
git clone --recursive --depth=1 "$1" "$dir"
cd "$dir"
echo "$(git rev-parse @)" > "${dir}_rev_$_satname"
vcs_compile=true
else
cd "$_func_dir"
cd "$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"
local rev="$(git rev-parse @)"
if [ "$rev" != "$(cat "${dir}_rev_$_satname" 2> /dev/null || true)" ]; then
echo "$rev" > "${dir}_rev_$_satname"
vcs_compile=true
fi
fi
@ -22,5 +22,5 @@ vcs_git() {
version="$(git rev-list HEAD --count)_$(git rev-parse --short HEAD)"
cd "$OLDPWD"
getfile "$_func_reponame"
getfile "$reponame"
}

Loading…
Cancel
Save