Chris Hillery has proposed merging lp:~zorba-coders/zorba/download-modules into 
lp:zorba.

Requested reviews:
  Chris Hillery (ceejatec)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/download-modules/+merge/93335
-- 
https://code.launchpad.net/~zorba-coders/zorba/download-modules/+merge/93335
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'modules/DownloadModules.cmake'
--- modules/DownloadModules.cmake	2011-10-11 22:34:31 +0000
+++ modules/DownloadModules.cmake	2012-02-16 06:05:22 +0000
@@ -77,37 +77,56 @@
     # Download
     if (_getmod)
       message ("Downloading module '${_modname}'...")
-      if (${_modvc} STREQUAL "svn")
-        if (NOT svn)
-          message (FATAL_ERROR
-            "Subversion client not found - required for ${_modname} module!")
-        endif (NOT svn)
-        # QQQ Ridiculous and slow hack, but Sourceforge has been
-        # incredibly unreliable lately so this is the best choice I've
-        # got to make the remote queue semi-stable
-        foreach (s 1 2)
+      # We try three times, to account for network weirdnesses
+      foreach (i 1 2 3)
+	# First delete the output directory, in case there's a partial
+	# download from a previous attempt
+	file (REMOVE_RECURSE "${outdir}/${_modname}")
+
+	set (_status)
+
+	if (${_modvc} STREQUAL "svn")
+          if (NOT svn)
+            message (FATAL_ERROR
+              "Subversion client not found - required for ${_modname} module!")
+          endif (NOT svn)
           execute_process (COMMAND "${svn}" checkout "${_modurl}" "${_modname}"
-            WORKING_DIRECTORY "${outdir}" TIMEOUT 60)
-        endforeach (s 1 2)
-
-      elseif (${_modvc} STREQUAL "bzr")
-        if (NOT bzr)
-          message (FATAL_ERROR
-            "Bazaar client not found - required for ${_modname} module!")
-        endif (NOT bzr)
-
-        set (_modtagargs)
-        if (_modtag AND NOT notags)
-          set (_modtagargs "-r" "${_modtag}")
-        endif (_modtag AND NOT notags)
-        execute_process (COMMAND "${bzr}" branch "${_modurl}" "${_modname}"
-          ${_modtagargs} WORKING_DIRECTORY "${outdir}" TIMEOUT 60)
-
-      else (${_modvc} STREQUAL "svn")
-        message (FATAL_ERROR "Unknown vc-type '${_modvc}' for module "
-          "'${_modname}' in modules/ExternalModules.conf!")
-
-      endif (${_modvc} STREQUAL "svn")
+            WORKING_DIRECTORY "${outdir}" TIMEOUT 60 RESULT_VARIABLE _status)
+
+	elseif (${_modvc} STREQUAL "bzr")
+          if (NOT bzr)
+            message (FATAL_ERROR
+              "Bazaar client not found - required for ${_modname} module!")
+          endif (NOT bzr)
+
+          set (_modtagargs)
+          if (_modtag AND NOT notags)
+            set (_modtagargs "-r" "${_modtag}")
+          endif (_modtag AND NOT notags)
+          execute_process (COMMAND "${bzr}" branch "${_modurl}" "${_modname}"
+            ${_modtagargs} WORKING_DIRECTORY "${outdir}" TIMEOUT 60
+	    RESULT_VARIABLE _status)
+
+	else (${_modvc} STREQUAL "svn")
+          message (FATAL_ERROR "Unknown vc-type '${_modvc}' for module "
+            "'${_modname}' in modules/ExternalModules.conf!")
+
+	endif (${_modvc} STREQUAL "svn")
+
+	if ("${_status}" EQUAL 0)
+	  # Success
+	  break ()
+	else ("${_status}" EQUAL 0)
+	  message (WARNING "Attempt ${i}: Failed to download '${_modname}' (${_status})")
+	endif ("${_status}" EQUAL 0)
+
+      endforeach (i)
     endif (_getmod)
+
+    # Ensure we successfully downloaded something good
+    if (NOT EXISTS "${outdir}/${_modname}/CMakeLists.txt")
+      message (FATAL_ERROR "Failed to download '${_modname}' after 3 attempts, giving up.")
+    endif (NOT EXISTS "${outdir}/${_modname}/CMakeLists.txt")
+
   endif (modline)
 endforeach (modline)

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to