[Swift-commit] r5249 - in SwiftApps/SwiftR: . Swift Swift/R Swift/src Swift/tests

tga at ci.uchicago.edu tga at ci.uchicago.edu
Wed Oct 19 15:11:19 CDT 2011


Author: tga
Date: 2011-10-19 15:11:19 -0500 (Wed, 19 Oct 2011)
New Revision: 5249

Added:
   SwiftApps/SwiftR/Swift/src/geturl.sh
Modified:
   SwiftApps/SwiftR/Makefile
   SwiftApps/SwiftR/Swift/DESCRIPTION
   SwiftApps/SwiftR/Swift/R/Tests.R
   SwiftApps/SwiftR/Swift/src/Makefile
   SwiftApps/SwiftR/Swift/tests/runtests.R
Log:
Added test for prerequisites - bash/java/perl to test suite.  Made a bit more portable by not relying exclusively on wget for build.

Modified: SwiftApps/SwiftR/Makefile
===================================================================
--- SwiftApps/SwiftR/Makefile	2011-10-19 20:11:17 UTC (rev 5248)
+++ SwiftApps/SwiftR/Makefile	2011-10-19 20:11:19 UTC (rev 5249)
@@ -7,7 +7,8 @@
 
 PKG_FILES += Swift/DESCRIPTION
 PKG_FILES += Swift/NAMESPACE 
-PKG_FILES +=  Swift/src/Makefile Swift/src/make.include
+PKG_FILES +=  Swift/src/Makefile Swift/src/make.include Swift/src/geturl.sh
+PKG_FILES +=  $(shell find Swift/src/ -name '*.shasum')
 PKG_FILES += $(shell find Swift/src/swift-patches -not -path '*/.svn*') 
 
 PACKAGE_DEPS = $(PKG_FILES) Makefile

Modified: SwiftApps/SwiftR/Swift/DESCRIPTION
===================================================================
--- SwiftApps/SwiftR/Swift/DESCRIPTION	2011-10-19 20:11:17 UTC (rev 5248)
+++ SwiftApps/SwiftR/Swift/DESCRIPTION	2011-10-19 20:11:19 UTC (rev 5249)
@@ -2,7 +2,7 @@
 Type: Package
 Title: R interface to Swift parallel scripting languaage
 Version: 0.3.2
-Date: 2011-10-18
+Date: 2011-10-19
 Author: Michael Wilde
 Maintainer: Michael Wilde <wilde at mcs.anl.gov>
 Depends: R (>= 2.11)
@@ -10,5 +10,4 @@
 Description: Routines to invoke R functions on remote resources through Swift.
 License: Apache License
 LazyLoad: yes
-Packaged: 2011-10-18; Tim Armstrong
-
+Packaged: 2011-10-19; Tim Armstrong

Modified: SwiftApps/SwiftR/Swift/R/Tests.R
===================================================================
--- SwiftApps/SwiftR/Swift/R/Tests.R	2011-10-19 20:11:17 UTC (rev 5248)
+++ SwiftApps/SwiftR/Swift/R/Tests.R	2011-10-19 20:11:19 UTC (rev 5249)
@@ -1,7 +1,24 @@
 
 
+prereqTest <- function() {
+    # Check that prerequisites exist
+    java <- system("java -version")
+    if (java != 0) {
+        cat("Java could not be found on path, Swift will not work\n")
+    }
+    perl <- system("/usr/bin/perl -v")
+    if (perl != 0) {
+        cat("Perl could not be found in /usr/bin, Swift will not work\n")
+    }
 
+    bash <- system("/usr/bin/env bash -version")
+    if (bash != 0) {
+        cat("Bash could not be found on path, Swift will not work\n")
+    }
 
+    return (java == 0) && (perl == 0) && (bash == 0)
+}
+
 basicSwiftTest <- function(...) { 
     swiftInit(...)
     swiftTest_1.1() 

Modified: SwiftApps/SwiftR/Swift/src/Makefile
===================================================================
--- SwiftApps/SwiftR/Swift/src/Makefile	2011-10-19 20:11:17 UTC (rev 5248)
+++ SwiftApps/SwiftR/Swift/src/Makefile	2011-10-19 20:11:19 UTC (rev 5249)
@@ -8,7 +8,7 @@
 ANT_PKG = apache-ant-1.8.2-bin.tar.bz2
 ANT_PKG_SHASUM = apache-ant-1.8.2-bin.shasum
 
-ANT_PKG_URL = http://www.apache.org/dist//ant/binaries/$(ANT_PKG)
+ANT_PKG_URL = http://www.apache.org/dist/ant/binaries/$(ANT_PKG)
 
 SWIFT_MODULE_SRC = $(SWIFT_SRC_NAME)/modules/swift
 
@@ -27,7 +27,7 @@
 	# hack to avoid redoing
 	if [ ! -f $(SWIFT_BIN) ]; then \
 	  rm -f $(SWIFT_SRC_NAME).tar.gz && \
-	  wget http://cs.uchicago.edu/~tga/swiftR/swift-source/$(SWIFT_SRC_NAME).tar.gz && \
+	  sh geturl.sh "http://people.cs.uchicago.edu/~tga/swiftR/swift-source/$(SWIFT_SRC_NAME).tar.gz" && \
     	  $(SHASUM) --check ${SWIFT_SRC_NAME}.shasum && \
 	  tar xvzf ${SWIFT_SRC_NAME}.tar.gz && \
 	  touch $(SWIFT_SRC_NAME)/.downloadedok ; \
@@ -67,7 +67,7 @@
 	# hack to avoid redoing
 	if [ ! -f $(SWIFT_BIN) ]; then \
 	    rm -f $(ANT_PKG) && \
-	    wget $(ANT_PKG_URL) && \
+	    sh geturl.sh $(ANT_PKG_URL) && \
 	    $(SHASUM) --check $(ANT_PKG_SHASUM) && \
 	    rm -rf $(ANT_DIR) && \
 	    tar xjf $(ANT_PKG) && \

Added: SwiftApps/SwiftR/Swift/src/geturl.sh
===================================================================
--- SwiftApps/SwiftR/Swift/src/geturl.sh	                        (rev 0)
+++ SwiftApps/SwiftR/Swift/src/geturl.sh	2011-10-19 20:11:19 UTC (rev 5249)
@@ -0,0 +1,21 @@
+#!/bin/sh
+# Fetch a file from a url, trying wget, curl and fetch
+
+WGET=${WGET:-wget}
+CURL=${CURL:-curl}
+FETCH=${FETCH:-fetch}
+
+URL="$1"
+
+if which ${WGET} > /dev/null ; then
+    ${WGET} "$URL" || die "Could not download $URL with $WGET"
+elif which ${CURL} > /dev/null ; then
+    ${CURL} -O "$URL" || die "Could not download $URL with $CURL"
+elif which ${FETCH} > /dev/null ; then
+    ${FETCH} "$URL" || die "Could not download $URL with $FETCH"
+else
+    echo Could not find a utility to fetch from URLs.  Tried to locate echo wget, curl 
+    echo and fetch. Utility must be on path, or specified with WGET, CURL or FETCH 
+    echo environment variable.
+    exit 1
+fi


Property changes on: SwiftApps/SwiftR/Swift/src/geturl.sh
___________________________________________________________________
Added: svn:executable
   + *

Modified: SwiftApps/SwiftR/Swift/tests/runtests.R
===================================================================
--- SwiftApps/SwiftR/Swift/tests/runtests.R	2011-10-19 20:11:17 UTC (rev 5248)
+++ SwiftApps/SwiftR/Swift/tests/runtests.R	2011-10-19 20:11:19 UTC (rev 5249)
@@ -1,5 +1,10 @@
 #!/usr/bin/env Rscript
 
 library(Swift)
+
+if (!Swift:::prereqTest()) {
+    stop("System requirements for Swift not all available!")
+}
+
 #TODO: take command line options to setup options
 Swift:::runAllSwiftTests()




More information about the Swift-commit mailing list