From e87d8c0d93910c39f851105f15a0455e380e6c2a Mon Sep 17 00:00:00 2001
From: Jeremy Soller <jackpot51@gmail.com>
Date: Wed, 7 Jun 2017 20:08:00 -0600
Subject: [PATCH] Fix skipping method

---
 cook.sh                        | 36 ++++++----------------------------
 recipes/dash/recipe.sh         | 12 ++++++------
 recipes/drivers/recipe.sh      |  2 +-
 recipes/gcc/recipe.sh          | 12 ++++++------
 recipes/gnu-binutils/recipe.sh | 12 ++++++------
 recipes/gnu-make/recipe.sh     | 12 ++++++------
 recipes/lua/recipe.sh          | 12 ++++++------
 recipes/newlib/recipe.sh       | 12 ++++++------
 recipes/orbdata/recipe.sh      | 12 ++++++------
 9 files changed, 49 insertions(+), 73 deletions(-)

diff --git a/cook.sh b/cook.sh
index 8fc93feb6..f63fd38d8 100755
--- a/cook.sh
+++ b/cook.sh
@@ -94,14 +94,10 @@ function op {
             ;;
         version)
             pushd build > /dev/null
-            skip="0"
+            skip=0
             if [ "$(type -t recipe_version)" = "function" ]
             then
                 recipe_version
-                if [ "$?" -ne "0" ]
-                then
-                    skip="1"
-                fi
             fi
             if [ "$skip" -eq "0" ]
             then
@@ -119,14 +115,10 @@ function op {
             ;;
         update)
             pushd build > /dev/null
-            skip="0"
+            skip=0
             if [ "$(type -t recipe_update)" = "function" ]
             then
                 recipe_update
-                if [ "$?" -ne "0" ]
-                then
-                    skip="1"
-                fi
             fi
             if [ "$skip" -eq "0" ]
             then
@@ -136,14 +128,10 @@ function op {
             ;;
         build)
             pushd build > /dev/null
-            skip="0"
+            skip=0
             if [ "$(type -t recipe_build)" = "function" ]
             then
                 recipe_build
-                if [ "$?" -ne "0" ]
-                then
-                    skip="1"
-                fi
             fi
             if [ "$skip" -eq "0" ]
             then
@@ -154,14 +142,10 @@ function op {
             ;;
         test)
             pushd build > /dev/null
-            skip="0"
+            skip=0
             if [ "$(type -t recipe_test)" = "function" ]
             then
                 recipe_test
-                if [ "$?" -ne "0" ]
-                then
-                    skip="1"
-                fi
             fi
             if [ "$skip" -eq "0" ]
             then
@@ -172,14 +156,10 @@ function op {
             ;;
         clean)
             pushd build > /dev/null
-            skip="0"
+            skip=0
             if [ "$(type -t recipe_clean)" = "function" ]
             then
                 recipe_clean
-                if [ "$?" -ne "0" ]
-                then
-                    skip="1"
-                fi
             fi
             if [ "$skip" -eq "0" ]
             then
@@ -190,14 +170,10 @@ function op {
         stage)
             mkdir -p stage
             pushd build > /dev/null
-            skip="0"
+            skip=0
             if [ "$(type -t recipe_stage)" = "function" ]
             then
                 recipe_stage ../stage
-                if [ "$?" -ne "0" ]
-                then
-                    skip="1"
-                fi
             fi
             if [ "$skip" -eq "0" ]
             then
diff --git a/recipes/dash/recipe.sh b/recipes/dash/recipe.sh
index 459a789f4..639bc8ecb 100644
--- a/recipes/dash/recipe.sh
+++ b/recipes/dash/recipe.sh
@@ -16,33 +16,33 @@ export STRIP="${HOST}-strip"
 
 function recipe_version {
     printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
-    return 1
+    skip=1
 }
 
 function recipe_update {
     echo "skipping update"
-    return 1
+    skip=1
 }
 
 function recipe_build {
     ./autogen.sh
     ./configure --host=${HOST} --prefix=/
     make
-    return 1
+    skip=1
 }
 
 function recipe_test {
     echo "skipping test"
-    return 1
+    skip=1
 }
 
 function recipe_clean {
     make clean
-    return 1
+    skip=1
 }
 
 function recipe_stage {
     dest="$(realpath $1)"
     make DESTDIR="$dest" install
-    return 1
+    skip=1
 }
diff --git a/recipes/drivers/recipe.sh b/recipes/drivers/recipe.sh
index cdbba51c3..cd3778eac 100644
--- a/recipes/drivers/recipe.sh
+++ b/recipes/drivers/recipe.sh
@@ -3,7 +3,7 @@ CARGOFLAGS=--all
 
 function recipe_version {
     echo "0.1.1"
-    return 1
+    skip=1
 }
 
 function recipe_stage {
diff --git a/recipes/gcc/recipe.sh b/recipes/gcc/recipe.sh
index 7554b5cd9..a40cf054f 100644
--- a/recipes/gcc/recipe.sh
+++ b/recipes/gcc/recipe.sh
@@ -16,12 +16,12 @@ export STRIP="${HOST}-strip"
 
 function recipe_version {
     printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
-    return 1
+    skip=1
 }
 
 function recipe_update {
     echo "skipping update"
-    return 1
+    skip=1
 }
 
 function recipe_build {
@@ -38,23 +38,23 @@ function recipe_build {
     cd build
     ../configure --host=${HOST} --target=${HOST} --prefix=/ --enable-static --disable-shared --disable-dlopen --disable-nls --enable-languages=c --without-headers
     make all-gcc all-target-libgcc
-    return 1
+    skip=1
 }
 
 function recipe_test {
     echo "skipping test"
-    return 1
+    skip=1
 }
 
 function recipe_clean {
     cd build
     make clean
-    return 1
+    skip=1
 }
 
 function recipe_stage {
     dest="$(realpath $1)"
     cd build
     make DESTDIR="$dest" install-gcc install-target-libgcc
-    return 1
+    skip=1
 }
diff --git a/recipes/gnu-binutils/recipe.sh b/recipes/gnu-binutils/recipe.sh
index 51040bb82..0c6e98ff3 100644
--- a/recipes/gnu-binutils/recipe.sh
+++ b/recipes/gnu-binutils/recipe.sh
@@ -15,12 +15,12 @@ export STRIP="${HOST}-strip"
 
 function recipe_version {
     printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
-    return 1
+    skip=1
 }
 
 function recipe_update {
     echo "skipping update"
-    return 1
+    skip=1
 }
 
 function recipe_build {
@@ -28,23 +28,23 @@ function recipe_build {
     cd build
     ../configure --host=${HOST} --target=${HOST} --prefix=/ --with-sysroot=/usr/x86_64-elf-redox --disable-gdb --disable-nls --disable-werror
     make
-    return 1
+    skip=1
 }
 
 function recipe_test {
     echo "skipping test"
-    return 1
+    skip=1
 }
 
 function recipe_clean {
     cd build
     make clean
-    return 1
+    skip=1
 }
 
 function recipe_stage {
     dest="$(realpath $1)"
     cd build
     make DESTDIR="$dest" install
-    return 1
+    skip=1
 }
diff --git a/recipes/gnu-make/recipe.sh b/recipes/gnu-make/recipe.sh
index fe52243c5..3e3ab47e4 100644
--- a/recipes/gnu-make/recipe.sh
+++ b/recipes/gnu-make/recipe.sh
@@ -17,33 +17,33 @@ export STRIP="${HOST}-strip"
 
 function recipe_version {
     echo "$VERSION"
-    return 1
+    skip=1
 }
 
 function recipe_update {
     echo "skipping update"
-    return 1
+    skip=1
 }
 
 function recipe_build {
     patch -p1 < ../make.patch
     ./configure --host=${HOST} --prefix=/ CFLAGS=-DPOSIX --without-guile
     make
-    return 1
+    skip=1
 }
 
 function recipe_test {
     echo "skipping test"
-    return 1
+    skip=1
 }
 
 function recipe_clean {
     make clean
-    return 1
+    skip=1
 }
 
 function recipe_stage {
     dest="$(realpath $1)"
     make DESTDIR="$dest" install
-    return 1
+    skip=1
 }
diff --git a/recipes/lua/recipe.sh b/recipes/lua/recipe.sh
index b15314105..d976d114c 100644
--- a/recipes/lua/recipe.sh
+++ b/recipes/lua/recipe.sh
@@ -5,31 +5,31 @@ HOST=x86_64-elf-redox
 
 function recipe_version {
     echo "$VERSION"
-    return 1
+    skip=1
 }
 
 function recipe_update {
     echo "skipping update"
-    return 1
+    skip=1
 }
 
 function recipe_build {
     make generic CC="${HOST}-gcc -std=gnu99"
-    return 1
+    skip=1
 }
 
 function recipe_test {
     echo "skipping test"
-    return 1
+    skip=1
 }
 
 function recipe_clean {
     make clean
-    return 1
+    skip=1
 }
 
 function recipe_stage {
     mkdir -pv "$1/bin"
     cp src/lua src/luac "$1/bin"
-    return 1
+    skip=1
 }
diff --git a/recipes/newlib/recipe.sh b/recipes/newlib/recipe.sh
index 77aadcebb..78950b9a6 100644
--- a/recipes/newlib/recipe.sh
+++ b/recipes/newlib/recipe.sh
@@ -5,12 +5,12 @@ HOST=x86_64-elf-redox
 
 function recipe_version {
     printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
-    return 1
+    skip=1
 }
 
 function recipe_update {
     echo "skipping update"
-    return 1
+    skip=1
 }
 
 function recipe_build {
@@ -29,17 +29,17 @@ function recipe_build {
     CC= ./configure --target="${HOST}" --prefix=/
     make all
 
-    return 1
+    skip=1
 }
 
 function recipe_test {
     echo "skipping test"
-    return 1
+    skip=1
 }
 
 function recipe_clean {
     make clean
-    return 1
+    skip=1
 }
 
 function recipe_stage {
@@ -48,5 +48,5 @@ function recipe_stage {
     cd "$dest"
     mv x86_64-elf-redox/* ./
     rmdir x86_64-elf-redox
-    return 1
+    skip=1
 }
diff --git a/recipes/orbdata/recipe.sh b/recipes/orbdata/recipe.sh
index 77212e17f..46715963c 100644
--- a/recipes/orbdata/recipe.sh
+++ b/recipes/orbdata/recipe.sh
@@ -2,31 +2,31 @@ GIT=https://github.com/redox-os/orbdata.git
 
 function recipe_version {
     echo "0.0.1"
-    return 1
+    skip=1
 }
 
 function recipe_update {
     echo "skipping update"
-    return 1
+    skip=1
 }
 
 function recipe_build {
     echo "skipping build"
-    return 1
+    skip=1
 }
 
 function recipe_test {
     echo "skipping test"
-    return 1
+    skip=1
 }
 
 function recipe_clean {
     echo "skipping clean"
-    return 1
+    skip=1
 }
 
 function recipe_stage {
     mkdir -pv "$1/ui"
     cp -Rv ./* "$1/ui"
-    return 1
+    skip=1
 }
-- 
GitLab