]> https://gitweb.dealii.org/ - candi.git/commitdiff
candi: optimised downloader handling; output package list
authorUwe Köcher <koecher@hsu-hamburg.de>
Tue, 10 Nov 2015 16:54:42 +0000 (17:54 +0100)
committerUwe Köcher <koecher@hsu-hamburg.de>
Tue, 10 Nov 2015 16:54:42 +0000 (17:54 +0100)
candi.sh

index c4a9cda5b8e2dad81723920b0fd52c46c17cc47c..ad2326c85466f7d85d0f0318fd14c4a03028598a 100755 (executable)
--- a/candi.sh
+++ b/candi.sh
@@ -71,25 +71,24 @@ PREFIX_PATH=${PREFIX:-~/apps/candi}
 PROCS=${NP:-1}
 
 ################################################################################
+# Set download tool
+
+# Set given DOWNLOADER as preferred tool
+DOWNLOADERS="${DOWNLOADER}"
+
 # Check if the curl download is available
 if builtin command -v curl > /dev/null; then
-    CURL_DOWNLOADER_AVAILABLE=true
-    
     # Set curl as the prefered download tool, if nothing else is specified
-    if [ -z ${DOWNLOADER} ]; then
-        DOWNLOADER=curl
-    fi
-else
-    CURL_DOWNLOADER_AVAILABLE=false
+    DOWNLOADERS="${DOWNLOADERS} curl"
 fi
 
 # Check if the wget download is available
 if builtin command -v wget > /dev/null; then
     # Set wget as the prefered download tool, if nothing else is specified
-    if [ -z ${DOWNLOADER} ]; then
-        DOWNLOADER=wget
-    fi
-else
+    DOWNLOADERS="${DOWNLOADERS} wget"
+fi
+
+if [ -z "${DOWNLOADERS}" ]; then
     cecho ${BAD} "Please install wget or curl."
     exit 1
 fi
@@ -205,6 +204,7 @@ download_archive () {
         SOURCE="${MIRROR} ${SOURCE}"
     fi
     
+    for DOWNLOADER in ${DOWNLOADERS[@]}; do
     for source in ${SOURCE}; do
         # verify_archive:
         # * Skip loop if the ARCHIVE_FILE is already downloaded
@@ -241,10 +241,13 @@ download_archive () {
         
         # Download.
         # If curl or wget is failing, continue this loop for trying an other mirror.
-        if [ ${DOWNLOADER} = "curl" ] && [ ${CURL_DOWNLOADER_AVAILABLE} = "true" ]; then
+        if [ ${DOWNLOADER} = "curl" ]; then
             curl -k -O ${url} || continue
-        else
+        elif [ ${DOWNLOADER} = "wget" ]; then
             wget --no-check-certificate ${url} -O ${ARCHIVE_FILE} || continue
+        else
+            cecho ${BAD} "candi: Unknown downloader: ${DOWNLOADER}"
+            exit 1
         fi
         
         unset url
@@ -258,6 +261,7 @@ download_archive () {
         fi
         unset archive_state
     done
+    done
     
     # Unfortunately it seems that (all) download tryouts finally failed for some reason:
     verify_archive ${ARCHIVE_FILE}
@@ -654,10 +658,12 @@ else
     fi
 fi
 
-# Source default PLATFORM variables, if present
-DEFAULT_PACKAGES=${PROJECT}/packages/default.packages
-if [ -e ${DEFAULT_PACKAGES} ]; then
-    source ${DEFAULT_PACKAGES}
+# Source default PACKAGES variables, if none were given so far
+if [ ! -z ${PACKAGES} ]; then
+    DEFAULT_PACKAGES=${PROJECT}/packages/default.packages
+    if [ -e ${DEFAULT_PACKAGES} ]; then
+        source ${DEFAULT_PACKAGES}
+    fi
 fi
 
 # Source PLATFORM variables if set up correctly
@@ -713,6 +719,14 @@ echo "--------------------------------------------------------------------------
 cecho ${INFO} "Number of (at most) build processes to use: PROCS=${PROCS}"
 echo
 
+echo "-------------------------------------------------------------------------------"
+cecho ${INFO} "Packages:"
+for PACKAGE in ${PACKAGES[@]}; do
+    echo ${PACKAGE}
+done
+echo
+
+
 echo "-------------------------------------------------------------------------------"
 if [ ${STABLE_BUILD} = true ]; then
     cecho ${INFO} "Building stable releases of ${PROJECT} packages."

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.