← Back to team overview

kicad-developers team mailing list archive

[PATCH] kicad-install.sh: Enhanced Error Handling with outcomes of cmake and make

 

Here is the patch (attached as well) for enhancing "kicad-install.sh" handling of two error situations with Debian/Ubuntu:
1.  The prerequisites are installed individually, rather than a grouped.  Thus it avoids failing for ALL of the group.2. The script stops when either cmake or make fails.  Thus it avoids a false installation. 

The patch has been tested and passed with Ubuntu 14.04 LTS.
--Joe 
--- old/kicad-install.sh    2014-10-14 18:41:37.834788832 -0600
+++ new/kicad-install.sh    2014-10-14 18:41:13.462986918 -0600
@@ -89,21 +89,26 @@
     # assume all these Debian, Mint, Ubuntu systems have same prerequisites
     if [ "$(expr match "$PM" '.*\(apt-get\)')" == "apt-get" ]; then
         #echo "debian compatible system"
-        sudo apt-get install \
-            bzr \
-            bzrtools \
-            build-essential \
-            cmake \
-            cmake-curses-gui \
-            debhelper \
-            doxygen \
-            grep \
-            libbz2-dev \
-            libcairo2-dev \
-            libglew-dev \
-            libssl-dev \
-            libwxgtk3.0-dev \
+        prerequisite_list="
+            bzr
+            bzrtools
+            build-essential
+            cmake
+            cmake-curses-gui
+            debhelper
+            doxygen
+            grep
+            libbz2-dev
+            libcairo2-dev
+            libglew-dev
+            libssl-dev
+            libwxgtk3.0-dev
             python-wxgtk3.0
+       "
+    for p in ${prerequisite_list}
+    do
+        sudo apt-get install $p
+    done
 
     # assume all yum systems have same prerequisites
     elif [ "$(expr match "$PM" '.*\(yum\)')" == "yum" ]; then
@@ -255,14 +260,14 @@
     cd kicad.bzr
     if [ ! -d "build" ]; then
         mkdir build && cd build
-        cmake $OPTS ../
+        cmake $OPTS ../ || exit 1
     else
         cd build
         # Although a "make clean" is sometimes needed, more often than not it slows down the update
         # more than it is worth.  Do it manually if you need to in this directory.
         # make clean
     fi
-    make -j4
+    make -j4 || exit 1
     echo " kicad compiled."
 
 
  
--- old/kicad-install.sh	2014-10-14 18:41:37.834788832 -0600
+++ new/kicad-install.sh	2014-10-14 18:41:13.462986918 -0600
@@ -89,21 +89,26 @@
     # assume all these Debian, Mint, Ubuntu systems have same prerequisites
     if [ "$(expr match "$PM" '.*\(apt-get\)')" == "apt-get" ]; then
         #echo "debian compatible system"
-        sudo apt-get install \
-            bzr \
-            bzrtools \
-            build-essential \
-            cmake \
-            cmake-curses-gui \
-            debhelper \
-            doxygen \
-            grep \
-            libbz2-dev \
-            libcairo2-dev \
-            libglew-dev \
-            libssl-dev \
-            libwxgtk3.0-dev \
+        prerequisite_list="
+            bzr
+            bzrtools
+            build-essential
+            cmake
+            cmake-curses-gui
+            debhelper
+            doxygen
+            grep
+            libbz2-dev
+            libcairo2-dev
+            libglew-dev
+            libssl-dev
+            libwxgtk3.0-dev
             python-wxgtk3.0
+       "
+	for p in ${prerequisite_list}
+	do
+	    sudo apt-get install $p
+	done
 
     # assume all yum systems have same prerequisites
     elif [ "$(expr match "$PM" '.*\(yum\)')" == "yum" ]; then
@@ -255,14 +260,14 @@
     cd kicad.bzr
     if [ ! -d "build" ]; then
         mkdir build && cd build
-        cmake $OPTS ../
+        cmake $OPTS ../ || exit 1
     else
         cd build
         # Although a "make clean" is sometimes needed, more often than not it slows down the update
         # more than it is worth.  Do it manually if you need to in this directory.
         # make clean
     fi
-    make -j4
+    make -j4 || exit 1
     echo " kicad compiled."
 
 

Follow ups