installer.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  1. import subprocess
  2. import os
  3. import time
  4. import sys
  5. class Installer:
  6. ############################################################
  7. # install_software
  8. ############################################################
  9. def install_software(self):
  10. if self.benchmarker.install == 'all' or self.benchmarker.install == 'server':
  11. self.__install_server_software()
  12. if self.benchmarker.install == 'all' or self.benchmarker.install == 'client':
  13. self.__install_client_software()
  14. ############################################################
  15. # End install_software
  16. ############################################################
  17. ############################################################
  18. # __install_server_software
  19. ############################################################
  20. def __install_server_software(self):
  21. print("\nINSTALL: Installing server software\n")
  22. #######################################
  23. # Prerequisites
  24. #######################################
  25. self.__run_command("sudo apt-get update", True)
  26. self.__run_command("sudo apt-get upgrade", True)
  27. self.__run_command("sudo apt-get install build-essential libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlib1g-dev python-software-properties unzip git-core libcurl4-openssl-dev libbz2-dev libmysqlclient-dev mongodb-clients libreadline6-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev libgdbm-dev ncurses-dev automake libffi-dev htop libtool bison libevent-dev libgstreamer-plugins-base0.10-0 libgstreamer0.10-0 liborc-0.4-0 libwxbase2.8-0 libwxgtk2.8-0 libgnutls-dev libjson0-dev libmcrypt-dev libicu-dev cmake gettext curl libpq-dev mercurial", True)
  28. self.__run_command("sudo add-apt-repository ppa:ubuntu-toolchain-r/test", True)
  29. self.__run_command("sudo apt-get update", True)
  30. self.__run_command("sudo apt-get install gcc-4.8 g++-4.8", True)
  31. self.__run_command("cp ../config/benchmark_profile ../../.bash_profile")
  32. self.__run_command("sudo sh -c \"echo '* - nofile 16384' >> /etc/security/limits.conf\"")
  33. ##############################################################
  34. #
  35. # System Tools
  36. #
  37. ##############################################################
  38. #
  39. # Leiningen
  40. #
  41. self.__run_command("mkdir -p bin")
  42. self.__run_command("wget https://raw.github.com/technomancy/leiningen/stable/bin/lein")
  43. self.__run_command("mv lein bin/lein")
  44. self.__run_command("chmod +x bin/lein")
  45. #
  46. # Maven
  47. #
  48. self.__run_command("sudo apt-get install maven -qq")
  49. self.__run_command("mvn -version")
  50. #######################################
  51. # Languages
  52. #######################################
  53. self._install_python()
  54. #
  55. # Dart
  56. #
  57. self.__run_command("curl https://storage.googleapis.com/dart-editor-archive-integration/latest/dartsdk-linux-64.tar.gz | tar xvz")
  58. #
  59. # Erlang
  60. #
  61. self.__run_command("sudo cp ../config/erlang.list /etc/apt/sources.list.d/erlang.list")
  62. self.__run_command("wget -O - http://binaries.erlang-solutions.com/debian/erlang_solutions.asc | sudo apt-key add -")
  63. self.__run_command("sudo apt-get update")
  64. self.__run_command("sudo apt-get install esl-erlang", True)
  65. #
  66. # nodejs
  67. #
  68. self.__run_command("curl http://nodejs.org/dist/v0.10.8/node-v0.10.8-linux-x64.tar.gz | tar xvz")
  69. #
  70. # Java
  71. #
  72. self.__run_command("sudo apt-get install openjdk-7-jdk", True)
  73. self.__run_command("sudo apt-get remove --purge openjdk-6-jre openjdk-6-jre-headless", True)
  74. #
  75. # Ruby/JRuby
  76. #
  77. self.__run_command("curl -L get.rvm.io | bash -s head")
  78. self.__run_command("echo rvm_auto_reload_flag=2 >> ~/.rvmrc")
  79. self.__bash_from_string("source ~/.rvm/scripts/'rvm' && rvm install 2.0.0-p0")
  80. self.__bash_from_string("source ~/.rvm/scripts/'rvm' && rvm 2.0.0-p0 do gem install bundler")
  81. self.__bash_from_string("source ~/.rvm/scripts/'rvm' && rvm install jruby-1.7.4")
  82. self.__bash_from_string("source ~/.rvm/scripts/'rvm' && rvm jruby-1.7.4 do gem install bundler")
  83. # We need a newer version of jruby-rack
  84. self.__run_command("git clone git://github.com/jruby/jruby-rack.git")
  85. self.__bash_from_string("cd jruby-rack && source ~/.rvm/scripts/'rvm' && rvm jruby-1.7.4 do bundle install")
  86. self.__bash_from_string("cd jruby-rack && source ~/.rvm/scripts/'rvm' && rvm jruby-1.7.4 do jruby -S bundle exec rake clean gem SKIP_SPECS=true")
  87. self.__bash_from_string("cd jruby-rack/target && source ~/.rvm/scripts/'rvm' && rvm jruby-1.7.4 do gem install jruby-rack-1.2.0.SNAPSHOT.gem")
  88. #
  89. # go
  90. #
  91. self.__run_command("curl http://go.googlecode.com/files/go1.1.1.linux-amd64.tar.gz | tar xvz")
  92. #
  93. # Perl
  94. #
  95. # Sometimes this HTTP server returns 404, so retry a few times until it works, but don't retry forever
  96. tries = 0
  97. while True:
  98. self.__run_command("curl http://downloads.activestate.com/ActivePerl/releases/5.16.3.1603/ActivePerl-5.16.3.1603-x86_64-linux-glibc-2.3.5-296746.tar.gz | tar xvz");
  99. if os.path.exists(os.path.join('installs', 'ActivePerl-5.16.3.1603-x86_64-linux-glibc-2.3.5-296746')):
  100. break
  101. tries += 1
  102. if tries >= 30:
  103. raise Exception('Could not download ActivePerl after many retries')
  104. time.sleep(5)
  105. self.__run_command("sudo ./install.sh --license-accepted --prefix /opt/ActivePerl-5.16 --no-install-html", cwd="ActivePerl-5.16.3.1603-x86_64-linux-glibc-2.3.5-296746", send_yes=True)
  106. self.__run_command("curl -L http://cpanmin.us | perl - --sudo App::cpanminus")
  107. self.__run_command("cpanm -f -S DBI DBD::mysql Kelp Dancer Mojolicious Kelp::Module::JSON::XS Dancer::Plugin::Database Starman Plack JSON Web::Simple DBD::Pg JSON::XS EV HTTP::Parser::XS Monoceros EV IO::Socket::IP IO::Socket::SSL")
  108. #
  109. # php
  110. #
  111. self.__run_command("wget --trust-server-names http://www.php.net/get/php-5.4.13.tar.gz/from/us1.php.net/mirror")
  112. self.__run_command("tar xvf php-5.4.13.tar.gz")
  113. self.__run_command("./configure --with-pdo-mysql --with-mysql --with-mcrypt --enable-intl --enable-mbstring --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --with-openssl", cwd="php-5.4.13")
  114. self.__run_command("make", cwd="php-5.4.13")
  115. self.__run_command("sudo make install", cwd="php-5.4.13")
  116. self.__run_command("printf \"\\n\" | sudo pecl install apc-beta", cwd="php-5.4.13")
  117. self.__run_command("sudo cp ../config/php.ini /usr/local/lib/php.ini")
  118. self.__run_command("sudo cp ../config/php-fpm.conf /usr/local/lib/php-fpm.conf")
  119. self.__run_command("rm php-5.4.13.tar.gz")
  120. # Composer
  121. self.__run_command("curl -sS https://getcomposer.org/installer | php -- --install-dir=bin")
  122. # Phalcon
  123. self.__run_command("git clone git://github.com/phalcon/cphalcon.git")
  124. self.__run_command("sudo ./install", cwd="cphalcon/build")
  125. # YAF
  126. self.__run_command("sudo pecl install yaf")
  127. #
  128. # Haskell
  129. #
  130. self.__run_command("sudo apt-get install ghc cabal-install", True)
  131. #
  132. # RingoJs
  133. #
  134. self.__run_command("wget http://www.ringojs.org/downloads/ringojs_0.9-1_all.deb")
  135. self.__run_command("sudo apt-get install jsvc", True)
  136. self.__run_command("sudo dpkg -i ringojs_0.9-1_all.deb", True)
  137. self.__run_command("rm ringojs_0.9-1_all.deb")
  138. #
  139. # Mono
  140. #
  141. self.__run_command("git clone git://github.com/mono/mono")
  142. self.__run_command("git checkout mono-3.0.10", cwd="mono")
  143. self.__run_command("./autogen.sh --prefix=/usr/local", cwd="mono")
  144. self.__run_command("make get-monolite-latest", cwd="mono")
  145. self.__run_command("make EXTERNAL_MCS=${PWD}/mcs/class/lib/monolite/gmcs.exe", cwd="mono")
  146. self.__run_command("sudo make install", cwd="mono")
  147. self.__run_command("mozroots --import --sync")
  148. self.__run_command("git clone git://github.com/mono/xsp")
  149. self.__run_command("git checkout 3.0", cwd="xsp")
  150. self.__run_command("./autogen.sh --prefix=/usr/local", cwd="xsp")
  151. self.__run_command("make", cwd="xsp")
  152. self.__run_command("sudo make install", cwd="xsp")
  153. #
  154. # Nimrod
  155. #
  156. self.__run_command("wget http://www.nimrod-code.org/download/nimrod_0.9.2.zip")
  157. self.__run_command("unzip nimrod_0.9.2.zip")
  158. self.__run_command("chmod +x build.sh", cwd="nimrod")
  159. self.__run_command("./build.sh", cwd="nimrod")
  160. self.__run_command("chmod +x install.sh", cwd="nimrod")
  161. self.__run_command("sudo ./install.sh /usr/bin", cwd="nimrod")
  162. #######################################
  163. # Webservers
  164. #######################################
  165. #
  166. # Nginx
  167. #
  168. self.__run_command("curl http://nginx.org/download/nginx-1.4.1.tar.gz | tar xvz")
  169. self.__run_command("./configure", cwd="nginx-1.4.1")
  170. self.__run_command("make", cwd="nginx-1.4.1")
  171. self.__run_command("sudo make install", cwd="nginx-1.4.1")
  172. #
  173. # Openresty (nginx with openresty stuff)
  174. #
  175. self.__run_command("curl http://openresty.org/download/ngx_openresty-1.2.7.5.tar.gz | tar xvz")
  176. self.__run_command("./configure --with-luajit", cwd="ngx_openresty-1.2.7.5")
  177. self.__run_command("make", cwd="ngx_openresty-1.2.7.5")
  178. self.__run_command("sudo make install", cwd="ngx_openresty-1.2.7.5")
  179. #
  180. # Resin
  181. #
  182. self.__run_command("sudo cp -r /usr/lib/jvm/java-1.7.0-openjdk-amd64/include /usr/lib/jvm/java-1.7.0-openjdk-amd64/jre/bin/")
  183. self.__run_command("curl http://www.caucho.com/download/resin-4.0.36.tar.gz | tar xz")
  184. self.__run_command("./configure --prefix=`pwd`", cwd="resin-4.0.36")
  185. self.__run_command("make", cwd="resin-4.0.36")
  186. self.__run_command("make install", cwd="resin-4.0.36")
  187. self.__run_command("mv conf/resin.properties conf/resin.properties.orig", cwd="resin-4.0.36")
  188. self.__run_command("cat ../config/resin.properties > resin-4.0.36/conf/resin.properties")
  189. self.__run_command("mv conf/resin.xml conf/resin.xml.orig", cwd="resin-4.0.36")
  190. self.__run_command("cat ../config/resin.xml > resin-4.0.36/conf/resin.xml")
  191. ##############################################################
  192. #
  193. # Frameworks
  194. #
  195. ##############################################################
  196. ##############################
  197. # Grails
  198. ##############################
  199. self.__run_command("wget http://dist.springframework.org.s3.amazonaws.com/release/GRAILS/grails-2.1.1.zip")
  200. self.__run_command("unzip -o grails-2.1.1.zip")
  201. self.__run_command("rm grails-2.1.1.zip")
  202. ##############################
  203. # Play 2
  204. ##############################
  205. self.__run_command("wget http://downloads.typesafe.com/play/2.1.2-RC1/play-2.1.2-RC1.zip")
  206. self.__run_command("unzip -o play-2.1.2-RC1.zip")
  207. self.__run_command("rm play-2.1.2-RC1.zip")
  208. ##############################
  209. # Play 1
  210. ##############################
  211. self.__run_command("wget http://downloads.typesafe.com/releases/play-1.2.5.zip")
  212. self.__run_command("unzip -o play-1.2.5.zip")
  213. self.__run_command("rm play-1.2.5.zip")
  214. self.__run_command("mv play-1.2.5/play play-1.2.5/play1")
  215. # siena
  216. self.__run_command("yes | play-1.2.5/play1 install siena")
  217. ##############################
  218. # TreeFrog Framework
  219. ##############################
  220. self.__run_command("sudo apt-get install qt4-qmake libqt4-dev libqt4-sql-mysql g++", True)
  221. self.__run_command("wget http://downloads.sourceforge.net/project/treefrog/src/treefrog-1.6.tar.gz")
  222. self.__run_command("tar xzf treefrog-1.6.tar.gz")
  223. self.__run_command("rm treefrog-1.6.tar.gz")
  224. self.__run_command("./configure --enable-mongo", cwd="treefrog-1.6")
  225. self.__run_command("make", cwd="treefrog-1.6/src")
  226. self.__run_command("sudo make install", cwd="treefrog-1.6/src")
  227. self.__run_command("make", cwd="treefrog-1.6/tools")
  228. self.__run_command("sudo make install", cwd="treefrog-1.6/tools")
  229. ##############################
  230. # Vert.x
  231. ##############################
  232. self.__run_command("curl http://vertx.io/vertx-downloads/downloads/vert.x-1.3.1.final.tar.gz | tar xvz")
  233. ##############################
  234. # Yesod
  235. ##############################
  236. self.__run_command("cabal update")
  237. self.__run_command("cabal install yesod persistent-mysql")
  238. ##############################
  239. # Jester
  240. ##############################
  241. self.__run_command("git clone git://github.com/dom96/jester.git jester/jester")
  242. print("\nINSTALL: Finished installing server software\n")
  243. ############################################################
  244. # End __install_server_software
  245. ############################################################
  246. def _install_python(self):
  247. # .profile is not loaded yet. So we should use full path.
  248. pypy_bin = "~/FrameworkBenchmarks/installs/pypy/bin"
  249. python_bin = "~/FrameworkBenchmarks/installs/py2/bin"
  250. python3_bin= "~/FrameworkBenchmarks/installs/py3/bin"
  251. def easy_install(pkg, two=True, three=False, pypy=False):
  252. cmd = "/easy_install -ZU '" + pkg + "'"
  253. if two: self.__run_command(python_bin + cmd)
  254. if three: self.__run_command(python3_bin + cmd)
  255. if pypy: self.__run_command(pypy_bin + cmd)
  256. self.__run_command("curl -L http://bitbucket.org/pypy/pypy/downloads/pypy-2.0.2-linux64.tar.bz2 | tar xj")
  257. self.__run_command('ln -sf pypy-2.0.2 pypy')
  258. self.__run_command("curl -L http://www.python.org/ftp/python/2.7.5/Python-2.7.5.tgz | tar xz")
  259. self.__run_command("curl -L http://www.python.org/ftp/python/3.3.2/Python-3.3.2.tar.xz | tar xJ")
  260. self.__run_command("./configure --prefix=$HOME/FrameworkBenchmarks/installs/py2 --disable-shared CC=gcc-4.8", cwd="Python-2.7.5")
  261. self.__run_command("./configure --prefix=$HOME/FrameworkBenchmarks/installs/py3 --disable-shared CC=gcc-4.8", cwd="Python-3.3.2")
  262. self.__run_command("make -j", cwd="Python-2.7.5")
  263. self.__run_command("make install", cwd="Python-2.7.5")
  264. self.__run_command("make -j", cwd="Python-3.3.2")
  265. self.__run_command("make install", cwd="Python-3.3.2")
  266. self.__run_command("wget https://bitbucket.org/pypa/setuptools/downloads/ez_setup.py")
  267. self.__run_command(pypy_bin + "/pypy ez_setup.py")
  268. self.__run_command(python_bin + "/python ez_setup.py")
  269. self.__run_command(python3_bin + "/python3 ez_setup.py")
  270. easy_install('pip==1.3.1', two=True, three=True, pypy=True)
  271. easy_install('MySQL-python==1.2.4', two=True, three=False, pypy=True)
  272. easy_install('https://github.com/clelland/MySQL-for-Python-3/archive/master.zip',
  273. two=False, three=True, pypy=False)
  274. easy_install('PyMySQL==0.5', pypy=True)
  275. easy_install('PyMySQL3==0.5', two=False, three=True)
  276. easy_install('simplejson==3.3.0', two=True, three=True, pypy=False)
  277. easy_install('psycopg2==2.5.1', three=True)
  278. easy_install('ujson==1.33', three=True)
  279. easy_install('https://github.com/downloads/surfly/gevent/gevent-1.0rc2.tar.gz', three=True)
  280. easy_install('uwsgi', three=True) # uwsgi is released too often to stick on single version.
  281. # Gunicorn
  282. easy_install('gunicorn==17.5', two=True, three=True, pypy=True)
  283. # meinheld HEAD supports gunicorn worker on Python 3
  284. easy_install('https://github.com/mopemope/meinheld/archive/master.zip',
  285. two=True, three=True, pypy=True)
  286. # Tornado
  287. easy_install('tornado==3.1', two=True, three=True, pypy=True)
  288. easy_install('motor==0.1.1', two=True, three=True, pypy=True)
  289. easy_install('pymongo==2.5.2', two=True, three=True, pypy=True)
  290. # Django
  291. easy_install("https://www.djangoproject.com/download/1.6b1/tarball/", two=True, three=True, pypy=True)
  292. # Flask
  293. easy_install('Werkzeug==0.9.2', two=True, three=True, pypy=True)
  294. easy_install('flask==0.10.1', two=True, three=True, pypy=True)
  295. easy_install('sqlalchemy==0.8.2', two=True, three=True, pypy=True)
  296. easy_install('Jinja2==2.7', two=True, three=True, pypy=True)
  297. easy_install('Flask-SQLAlchemy==1.0', two=True, three=True, pypy=True)
  298. # Bottle
  299. easy_install('bottle==0.11.6', two=True, three=True, pypy=True)
  300. easy_install('bottle-sqlalchemy==0.4', two=True, three=True, pypy=True)
  301. ############################################################
  302. # __install_error
  303. ############################################################
  304. def __install_error(self, message):
  305. print("\nINSTALL ERROR: %s\n" % message)
  306. if self.benchmarker.install_error_action == 'abort':
  307. sys.exit("Installation aborted.")
  308. ############################################################
  309. # End __install_error
  310. ############################################################
  311. ############################################################
  312. # __install_client_software
  313. ############################################################
  314. def __install_client_software(self):
  315. print("\nINSTALL: Installing client software\n")
  316. self.__run_command("cd .. && " + self.benchmarker.sftp_string(batch_file="config/client_sftp_batch"), True)
  317. remote_script = """
  318. ##############################
  319. # Prerequisites
  320. ##############################
  321. yes | sudo apt-get update
  322. yes | sudo apt-get install build-essential git libev-dev libpq-dev libreadline6-dev postgresql
  323. sudo sh -c "echo '* - nofile 16384' >> /etc/security/limits.conf"
  324. sudo mkdir -p /ssd
  325. sudo mkdir -p /ssd/log
  326. ##############################
  327. # MySQL
  328. ##############################
  329. sudo sh -c "echo mysql-server mysql-server/root_password_again select secret | debconf-set-selections"
  330. sudo sh -c "echo mysql-server mysql-server/root_password select secret | debconf-set-selections"
  331. yes | sudo apt-get install mysql-server
  332. sudo stop mysql
  333. # use the my.cnf file to overwrite /etc/mysql/my.cnf
  334. sudo mv /etc/mysql/my.cnf /etc/mysql/my.cnf.orig
  335. sudo mv my.cnf /etc/mysql/my.cnf
  336. sudo cp -R -p /var/lib/mysql /ssd/
  337. sudo cp -R -p /var/log/mysql /ssd/log
  338. sudo cp usr.sbin.mysqld /etc/apparmor.d/
  339. sudo /etc/init.d/apparmor reload
  340. sudo start mysql
  341. # Insert data
  342. mysql -uroot -psecret < create.sql
  343. ##############################
  344. # Postgres
  345. ##############################
  346. sudo useradd benchmarkdbuser -p benchmarkdbpass
  347. sudo -u postgres psql template1 < create-postgres-database.sql
  348. sudo -u benchmarkdbuser psql hello_world < create-postgres.sql
  349. sudo -u postgres -H /etc/init.d/postgresql stop
  350. sudo mv postgresql.conf /etc/postgresql/9.1/main/postgresql.conf
  351. sudo mv pg_hba.conf /etc/postgresql/9.1/main/pg_hba.conf
  352. sudo cp -R -p /var/lib/postgresql/9.1/main /ssd/postgresql
  353. sudo -u postgres -H /etc/init.d/postgresql start
  354. ##############################
  355. # wrk
  356. ##############################
  357. git clone https://github.com/wg/wrk.git
  358. cd wrk
  359. make
  360. sudo cp wrk /usr/local/bin
  361. cd ~
  362. git clone https://github.com/wg/wrk.git wrk-pipeline
  363. cd wrk-pipeline
  364. git checkout pipeline
  365. make
  366. sudo cp wrk /usr/local/bin/wrk-pipeline
  367. cd ~
  368. ##############################
  369. # MongoDB
  370. ##############################
  371. sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
  372. sudo cp 10gen.list /etc/apt/sources.list.d/10gen.list
  373. sudo apt-get update
  374. yes | sudo apt-get install mongodb-10gen
  375. sudo stop mongodb
  376. sudo mv /etc/mongodb.conf /etc/mongodb.conf.orig
  377. sudo mv mongodb.conf /etc/mongodb.conf
  378. sudo cp -R -p /var/lib/mongodb /ssd/
  379. sudo cp -R -p /var/log/mongodb /ssd/log/
  380. sudo start mongodb
  381. """
  382. print("\nINSTALL: %s" % self.benchmarker.ssh_string)
  383. p = subprocess.Popen(self.benchmarker.ssh_string.split(" "), stdin=subprocess.PIPE)
  384. p.communicate(remote_script)
  385. returncode = p.returncode
  386. if returncode != 0:
  387. self.__install_error("status code %s running subprocess '%s'." % (returncode, self.benchmarker.ssh_string))
  388. print("\nINSTALL: Finished installing client software\n")
  389. ############################################################
  390. # End __install_client_software
  391. ############################################################
  392. ############################################################
  393. # __run_command
  394. ############################################################
  395. def __run_command(self, command, send_yes=False, cwd=None):
  396. try:
  397. cwd = os.path.join(self.install_dir, cwd)
  398. except AttributeError:
  399. cwd = self.install_dir
  400. print("\nINSTALL: %s (cwd=%s)" % (command, cwd))
  401. if send_yes:
  402. process = subprocess.Popen(command, shell=True, stdin=subprocess.PIPE, cwd=cwd)
  403. process.communicate("yes")
  404. returncode = process.returncode
  405. else:
  406. returncode = subprocess.call(command, shell=True, cwd=cwd)
  407. if returncode != 0:
  408. self.__install_error("status code %s running command '%s' in directory '%s'." % (returncode, command, cwd))
  409. ############################################################
  410. # End __run_command
  411. ############################################################
  412. ############################################################
  413. # __bash_from_string
  414. # Runs bash -c "command" in install_dir.
  415. ############################################################
  416. def __bash_from_string(self, command):
  417. self.__run_command('bash -c "%s"' % command)
  418. ############################################################
  419. # End __bash_from_string
  420. ############################################################
  421. ############################################################
  422. # __init__(benchmarker)
  423. ############################################################
  424. def __init__(self, benchmarker):
  425. self.benchmarker = benchmarker
  426. self.install_dir = "installs"
  427. try:
  428. os.mkdir(self.install_dir)
  429. except OSError:
  430. pass
  431. ############################################################
  432. # End __init__
  433. ############################################################
  434. # vim: sw=2