Эх сурвалжийг харах

Fixed installer and updated compojure

We need to install as our testrunner user so that
he can delete/add/write/etc.
msmith-techempower 11 жил өмнө
parent
commit
94f0b15535

+ 0 - 23
frameworks/Clojure/compojure/setup.py

@@ -1,23 +0,0 @@
-
-import subprocess
-import sys
-import setup_util
-
-def start(args, logfile, errfile):
-  setup_util.replace_text("compojure/hello/src/hello/handler.clj", ":subname \"//.*:3306", ":subname \"//" + args.database_host + ":3306")
-
-  try:
-    subprocess.check_call("$IROOT/bin/lein clean", shell=True, cwd="compojure/hello", stderr=errfile, stdout=logfile)
-    subprocess.check_call("$IROOT/bin/lein ring uberwar", shell=True, cwd="compojure/hello", stderr=errfile, stdout=logfile)
-    subprocess.check_call("rm -rf $RESIN_HOME/webapps/*", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("cp compojure/hello/target/hello-compojure-standalone.war $RESIN_HOME/webapps/compojure.war", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("$RESIN_HOME/bin/resinctl start", shell=True, stderr=errfile, stdout=logfile)
-    return 0
-  except subprocess.CalledProcessError:
-    return 1
-def stop(logfile, errfile):
-  try:
-    subprocess.check_call("$RESIN_HOME/bin/resinctl shutdown", shell=True, stderr=errfile, stdout=logfile)
-    return 0
-  except subprocess.CalledProcessError:
-    return 1

+ 13 - 0
frameworks/Clojure/compojure/setup.sh

@@ -0,0 +1,13 @@
+#!/bin/bash
+
+# Path vars must be set here
+export PATH="$JAVA_HOME/bin:$LEIN_HOME:$PATH"
+
+sed -i 's|:subname "//.*:3306|:subname "//'"${DBHOST}"':3306|g' hello/src/hello/handler.clj
+
+cd hello
+$IROOT/bin/lein clean
+$IROOT/bin/lein ring uberwar
+rm -rf $RESIN_HOME/webapps/*
+cp target/hello-compojure-standalone.war $RESIN_HOME/webapps/compojure.war
+$RESIN_HOME/bin/resinctl start

+ 4 - 6
toolset/setup/linux/installer.py

@@ -111,12 +111,10 @@ class Installer:
       #   FWROOT - Path of the FwBm root
       #   FWROOT - Path of the FwBm root
       #   IROOT  - Path of this test's install directory
       #   IROOT  - Path of this test's install directory
       #   TROOT  - Path to this test's directory 
       #   TROOT  - Path to this test's directory 
-      self.__run_command('''
-        export TROOT=%s && 
-        export IROOT=%s && 
-        source %s && 
-        source %s''' % 
-        (test_dir, test_install_dir, 
+      # Note: Cannot use ''' for newlines here or the script
+      # passed to `bash -c` will fail.
+      self.__run_command('sudo -u %s -E bash -c "export TROOT=%s && export IROOT=%s && source %s && source %s"' % 
+        (self.benchmarker.runner_user, test_dir, test_install_dir, 
           bash_functions_path, test_install_file),
           bash_functions_path, test_install_file),
           cwd=test_install_dir)
           cwd=test_install_dir)
 
 

+ 7 - 5
toolset/setup/linux/systools/leiningen.sh

@@ -1,9 +1,11 @@
 #!/bin/bash
 #!/bin/bash
 
 
-RETCODE=$(fw_exists bin/lein)
+RETCODE=$(fw_exists ${IROOT}/lein.installed)
 [ ! "$RETCODE" == 0 ] || { return 0; }
 [ ! "$RETCODE" == 0 ] || { return 0; }
 
 
-mkdir -p bin
-fw_get https://raw.github.com/technomancy/leiningen/stable/bin/lein
-mv lein bin/lein
-chmod +x bin/lein
+mkdir -p lein/bin
+fw_get https://raw.github.com/technomancy/leiningen/stable/bin/lein -O leinbin
+mv leinbin lein/bin/lein
+chmod +x lein/bin/lein
+
+touch ${IROOT}/lein.installed

+ 3 - 1
toolset/setup/linux/webservers/resin.sh

@@ -2,7 +2,7 @@
 
 
 RVER=4.0.41
 RVER=4.0.41
 
 
-RETCODE=$(fw_exists resin-$RVER/conf/resin.xml)
+RETCODE=$(fw_exists ${IROOT}/resin-$RVER.installed)
 [ ! "$RETCODE" == 0 ] || { return 0; }
 [ ! "$RETCODE" == 0 ] || { return 0; }
 
 
 fw_depends java
 fw_depends java
@@ -20,3 +20,5 @@ cat $FWROOT/config/resin.properties > conf/resin.properties
 
 
 mv conf/resin.xml conf/resin.xml.orig
 mv conf/resin.xml conf/resin.xml.orig
 cat $FWROOT/config/resin.xml > conf/resin.xml
 cat $FWROOT/config/resin.xml > conf/resin.xml
+
+touch ${IROOT}/resin-$RVER.installed