Browse Source

Ugh, none of these work - Perl, amirite?

msmith-techempower 10 years ago
parent
commit
27474ca7b7

+ 1 - 2
frameworks/Perl/dancer/bash_profile.sh

@@ -1,5 +1,4 @@
 #!/bin/bash
 #!/bin/bash
 
 
 export PERL_HOME=${IROOT}/perl-5.18
 export PERL_HOME=${IROOT}/perl-5.18
-
-export PATH="$PERL_HOME/bin:$PATH"
+export NGINX_HOME=${IROOT}/nginx

+ 1 - 1
frameworks/Perl/dancer/install.sh

@@ -2,5 +2,5 @@
 
 
 fw_depends perl nginx
 fw_depends perl nginx
 
 
-cpanm --notest --no-man-page Dancer Dancer::Plugin::Database DBI DBD::mysql JSON::XS Plack Starman
+${PERL_HOME}/bin/cpanm --notest --no-man-page Dancer Dancer::Plugin::Database DBI DBD::mysql JSON::XS Plack Starman
 echo installed Dancer app dependencies
 echo installed Dancer app dependencies

+ 0 - 1
frameworks/Perl/dancer/nginx.conf

@@ -1,5 +1,4 @@
 # Replaced by setup.py
 # Replaced by setup.py
-user USR;
 error_log stderr error;
 error_log stderr error;
 
 
 worker_processes 2;
 worker_processes 2;

+ 0 - 30
frameworks/Perl/dancer/setup.py

@@ -1,30 +0,0 @@
-import subprocess
-import sys
-import setup_util
-from os.path import expanduser
-import os
-import getpass
-
-def start(args, logfile, errfile):
-  setup_util.replace_text("dancer/app.pl", "localhost", args.database_host)
-  setup_util.replace_text("dancer/nginx.conf", "USR", getpass.getuser())
-  setup_util.replace_text("dancer/nginx.conf", "server unix:.*\/FrameworkBenchmarks/dancer", "server unix:" + args.troot)
-
-  try:
-    subprocess.Popen("plackup -E production -s Starman --workers=" + str(args.max_threads) + " -l $TROOT/frameworks-benchmark.sock -a ./app.pl", shell=True, cwd="dancer", stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
-    return 0
-  except subprocess.CalledProcessError:
-    return 1
-def stop(logfile, errfile):
-  try:
-    subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True)
-    p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
-    out, err = p.communicate()
-    for line in out.splitlines():
-      if 'starman' in line:
-        pid = int(line.split(None, 2)[1])
-        os.kill(pid, 15)
-    return 0
-  except subprocess.CalledProcessError:
-    return 1

+ 9 - 0
frameworks/Perl/dancer/setup.sh

@@ -0,0 +1,9 @@
+#!/bin/bash
+
+sed -i 's|localhost|'"${DBHOST}"'|g' app.pl
+#sed -i 's|user .*;|user '"$(id -u -n)"';|g' nginx.conf
+sed -i 's|server unix.*frameworks-benchmark.sock;|server unix:'"${TROOT}"'/frameworks-benchmark.sock;|g' nginx.conf
+
+$NGINX_HOME/sbin/nginx -c ${TROOT}/nginx.conf
+
+$PERL_HOME/bin/plackup -E production -s Starman --workers=${MAX_THREADS} -l ${TROOT}/frameworks-benchmark.sock -a ./app.pl &

+ 1 - 2
frameworks/Perl/kelp/bash_profile.sh

@@ -1,5 +1,4 @@
 #!/bin/bash
 #!/bin/bash
 
 
 export PERL_HOME=${IROOT}/perl-5.18
 export PERL_HOME=${IROOT}/perl-5.18
-
-export PATH="$PERL_HOME/bin:$PATH"
+export NGINX_HOME=${IROOT}/nginx

+ 1 - 1
frameworks/Perl/kelp/install.sh

@@ -2,7 +2,7 @@
 
 
 fw_depends perl nginx
 fw_depends perl nginx
 
 
-cpanm --notest --no-man-page \
+${PERL_HOME}/bin/cpanm --notest --no-man-page \
     Kelp \
     Kelp \
     DBI \
     DBI \
     DBD::mysql \
     DBD::mysql \

+ 0 - 1
frameworks/Perl/kelp/nginx.conf

@@ -1,5 +1,4 @@
 # Replaced by setup.py
 # Replaced by setup.py
-user USR;
 error_log stderr error;
 error_log stderr error;
 
 
 worker_processes 2;
 worker_processes 2;

+ 0 - 30
frameworks/Perl/kelp/setup.py

@@ -1,30 +0,0 @@
-import subprocess
-import sys
-import setup_util
-from os.path import expanduser
-import os
-import getpass
-
-def start(args, logfile, errfile):
-  setup_util.replace_text("kelp/app.pl", "localhost", args.database_host)
-  setup_util.replace_text("kelp/nginx.conf", "USR", getpass.getuser())
-  setup_util.replace_text("kelp/nginx.conf", "server unix:.*\/FrameworkBenchmarks/kelp", "server unix:" + args.troot)
-
-  try:
-    subprocess.Popen("plackup -E deployment -s Starman --workers=" + str(args.max_threads) + " -l $TROOT/frameworks-benchmark.sock -a $TROOT/app.pl", shell=True, cwd="kelp", stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
-    return 0
-  except subprocess.CalledProcessError:
-    return 1
-def stop(logfile, errfile):
-  try:
-    subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True, stderr=errfile, stdout=logfile)
-    p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
-    out, err = p.communicate()
-    for line in out.splitlines():
-      if 'starman' in line:
-        pid = int(line.split(None, 2)[1])
-        os.kill(pid, 15)
-    return 0
-  except subprocess.CalledProcessError:
-    return 1

+ 9 - 0
frameworks/Perl/kelp/setup.sh

@@ -0,0 +1,9 @@
+#!/bin/bash
+
+sed -i 's|localhost|'"${DBHOST}"'|g' app.pl
+#sed -i 's|user .*;|user '"$(id -u -n)"';|g' nginx.conf
+sed -i 's|server unix.*frameworks-benchmark.sock;|server unix:'"${TROOT}"'/frameworks-benchmark.sock;|g' nginx.conf
+
+$NGINX_HOME/sbin/nginx -c ${TROOT}/nginx.conf
+
+$PERL_HOME/bin/plackup -E production -s Starman --workers=${MAX_THREADS} -l ${TROOT}/frameworks-benchmark.sock -a ./app.pl &

+ 1 - 1
frameworks/Perl/mojolicious/bash_profile.sh

@@ -1,4 +1,4 @@
 #!/bin/bash
 #!/bin/bash
 
 
 export PERL_HOME=${IROOT}/perl-5.18
 export PERL_HOME=${IROOT}/perl-5.18
-export PATH="$PERL_HOME/bin:$PATH"
+export NGINX_HOME=${IROOT}/nginx

+ 1 - 1
frameworks/Perl/mojolicious/install.sh

@@ -2,5 +2,5 @@
 
 
 fw_depends perl
 fw_depends perl
 
 
-carton install --cpanfile $TROOT/cpanfile
+${PERL_HOME}/bin/carton install --cpanfile $TROOT/cpanfile
 echo installed Mojolicious app dependencies
 echo installed Mojolicious app dependencies

+ 1 - 2
frameworks/Perl/plack/bash_profile.sh

@@ -1,5 +1,4 @@
 #!/bin/bash
 #!/bin/bash
 
 
 export PERL_HOME=${IROOT}/perl-5.18
 export PERL_HOME=${IROOT}/perl-5.18
-
-export PATH="$PERL_HOME/bin:$PATH"
+export NGINX_HOME=${IROOT}/nginx

+ 1 - 1
frameworks/Perl/plack/install.sh

@@ -2,5 +2,5 @@
 
 
 fw_depends perl nginx
 fw_depends perl nginx
 
 
-cpanm --notest --no-man-page --installdeps $TROOT
+${PERL_HOME}/bin/cpanm --notest --no-man-page --installdeps $TROOT
 echo installed Plack app dependencies
 echo installed Plack app dependencies

+ 0 - 1
frameworks/Perl/plack/nginx.conf

@@ -1,5 +1,4 @@
 # Replaced by setup.py
 # Replaced by setup.py
-user USR;
 error_log stderr error;
 error_log stderr error;
 pid        /tmp/nginx.pid;
 pid        /tmp/nginx.pid;
 worker_processes 4;
 worker_processes 4;

+ 3 - 1
toolset/setup/linux/languages/perl.sh

@@ -1,6 +1,6 @@
 #!/bin/bash
 #!/bin/bash
 
 
-RETCODE=$(fw_exists perl-5.18)
+RETCODE=$(fw_exists ${IROOT}/perl-5.18.installed)
 [ ! "$RETCODE" == 0 ] || { return 0; }
 [ ! "$RETCODE" == 0 ] || { return 0; }
 
 
 fw_get https://raw.github.com/tokuhirom/Perl-Build/master/perl-build -O perl-build.pl
 fw_get https://raw.github.com/tokuhirom/Perl-Build/master/perl-build -O perl-build.pl
@@ -12,3 +12,5 @@ perl-5.18/bin/perl cpanminus.pl --notest --no-man-page App::cpanminus
 # Install only a bare-bones of Perl modules
 # Install only a bare-bones of Perl modules
 # Install others in the per-framework install script or cpanfile
 # Install others in the per-framework install script or cpanfile
 perl-5.18/bin/cpanm -f --notest --no-man-page Carton JSON JSON::XS IO::Socket::IP IO::Socket::SSL
 perl-5.18/bin/cpanm -f --notest --no-man-page Carton JSON JSON::XS IO::Socket::IP IO::Socket::SSL
+
+touch ${IROOT}/perl-5.18.installed