Bugzilla – Attachment 65196 Details for
Bug 18964
Add a --debugger flag to koha-plack
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18964: Add --debugger option to koha-plack
Bug-18964-Add---debugger-option-to-koha-plack.patch (text/plain), 5.92 KB, created by
Tomás Cohen Arazi (tcohen)
on 2017-07-24 14:56:57 UTC
(
hide
)
Description:
Bug 18964: Add --debugger option to koha-plack
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2017-07-24 14:56:57 UTC
Size:
5.92 KB
patch
obsolete
>From 360d29fa61c1978de6afe664d89016124e4c9bdc Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 21 Jul 2017 16:28:31 -0300 >Subject: [PATCH] Bug 18964: Add --debugger option to koha-plack > >This patch is WIP for people to take a look! >The explanation on how to use it assumes you are running kohadevbox. > >This patch adds the following option switches to koha-plack: > >--debugger >---------- >Toggle debugging > >--debugger-key >-------------- >Some IDEs require a key, this needs to match because they are picky about it > >--debugger-location >------------------- >This option switch is used to specify the host:port your IDE is listening at. >Inside kohadevbox (using Vdebug with Vim) this would be localhost:9000. Outside >kohadevbox it would be 192.168.50.1:9000 > >--debugger-path >--------------- >This is the path in which you installed the Komodo Remote Debugger libraryi [1]. In kohadevbox >you could put the contents of the downloaded .tar.gz in /home/vagrant/dbgp/perllib. That >perllib seems to be required for things to work [2]. > >You can test with a simple CLI script things work: > >PERL5LIB=/home/vagrant/dbgp/perllib:$PERL5LIB \ >PERLDB="BEGIN { require q(/home/vagrant/dbgp/perllib/perl5db.pl) }" \ >PERLDB_OPTS="RemotePort=192.168.50.1:9000" perl -d t/Prices.t > >If you see action on your IDE, you are on the right track. > >WARNING: The main difficulty I found was setting the right dir/file mappings. > >[1] http://code.activestate.com/komodo/remotedebugging/ >[2] https://github.com/Komodo/KomodoEdit/issues/644#issuecomment-236268012 >--- > debian/scripts/koha-plack | 63 +++++++++++++++++++++++++++++++++++++++++------ > 1 file changed, 56 insertions(+), 7 deletions(-) > >diff --git a/debian/scripts/koha-plack b/debian/scripts/koha-plack >index 5e1fc9c..40afdac 100755 >--- a/debian/scripts/koha-plack >+++ b/debian/scripts/koha-plack >@@ -1,6 +1,7 @@ > #!/bin/bash > # > # Copyright 2015 Theke Solutions >+# Copyright 2016 Koha-Suomi > # > # This file is part of Koha. > # >@@ -51,6 +52,11 @@ $scriptname -h|--help > --restart Restart the plack daemon for the specified instances > --enable Enable plack for the specified instances > --disable Disable plack for the specified instances >+ --debugger Enable running Plack in debug mode >+ --debugger-key Specify the key the IDE is expecting >+ --debugger-location Specify the host:port for your debugger tool (defaults >+ to localhost:9000) >+ --debugger-path Specify the path for the debugger library > --quiet|-q Make the script quiet about non existent instance names > (useful for calling from another scripts). > --help|-h Display this help message >@@ -79,13 +85,24 @@ start_plack() > PLACK_WORKERS=$(run_safe_xmlstarlet $instancename plack_workers) > [ -z $PLACK_WORKERS ] && PLACK_WORKERS="2" > >- STARMANOPTS="-M FindBin --max-requests ${PLACK_MAX_REQUESTS} --workers ${PLACK_WORKERS} \ >+ environment="deployment" >+ daemonize="--daemonize" >+ logging="--access-log /var/log/koha/${instancename}/plack.log \ >+ --error-log /var/log/koha/${instancename}/plack-error.log" >+ max_requests_and_workers="--max-requests ${PLACK_MAX_REQUESTS} --workers ${PLACK_WORKERS}" >+ >+ if [ "$debug_mode" = "yes" ]; then >+ environment="development" >+ daemonize="" >+ logging="" # remote debugger takes care >+ max_requests_and_workers="--workers 1" >+ STARMAN="/usr/bin/perl -d ${STARMAN}" >+ fi >+ >+ STARMANOPTS="-M FindBin ${max_requests_and_workers} \ > --user=${instancename}-koha --group ${instancename}-koha \ >- --pid ${PIDFILE} \ >- --daemonize \ >- --access-log /var/log/koha/${instancename}/plack.log \ >- --error-log /var/log/koha/${instancename}/plack-error.log \ >- -E deployment --socket ${PLACKSOCKET} ${PSGIFILE}" >+ --pid ${PIDFILE} ${daemonize} ${logging} \ >+ -E ${environment} --socket ${PLACKSOCKET} ${PSGIFILE}" > > if ! is_plack_running ${instancename}; then > export KOHA_CONF="/etc/koha/sites/${instancename}/koha-conf.xml" >@@ -239,6 +256,10 @@ set_action() > STARMAN=$(which starman) > op="" > quiet="no" >+debug_mode="no" >+debugger_key="" >+debugger_location="localhost:9000" >+debugger_path="" > > # Read command line parameters > while [ $# -gt 0 ]; do >@@ -264,6 +285,18 @@ while [ $# -gt 0 ]; do > --disable) > set_action "disable" > shift ;; >+ --debugger) >+ debug_mode="yes" >+ shift ;; >+ --debugger-key) >+ debugger_key="$2" >+ shift 2 ;; >+ --debugger-location) >+ debugger_location="$2" >+ shift 2 ;; >+ --debugger-path) >+ debugger_path="$2" >+ shift 2 ;; > -*) > die "Error: invalid option switch ($1)" ;; > *) >@@ -282,7 +315,23 @@ if [ $# -gt 0 ]; then > if is_instance $name; then > > adjust_paths_dev_install $name >- export DEV_INSTALL KOHA_HOME PERL5LIB=$PERL5LIB:$KOHA_HOME/installer:$KOHA_HOME/lib/installer >+ export DEV_INSTALL >+ export KOHA_HOME >+ PERL5LIB=$PERL5LIB:$KOHA_HOME/installer:$KOHA_HOME/lib/installer >+ # If debug mode is enabled, add the debugger lib path >+ # to PERL5LIB if appropriate >+ if [ "$debug_mode" = "yes" ]; then >+ if [ "$debugger_path" != "" ]; then >+ PERL5LIB="${debugger_path}":$PERL5LIB >+ fi >+ export PERL5DB="BEGIN { require q(${debugger_path}/perl5db.pl) }" >+ export PERLDB_OPTS="RemotePort=${debugger_location}" >+ export DBGP_IDEKEY=${debugger_key} >+ export PLACK_DEBUG=1 >+ export PERL5OPT="-d" >+ fi >+ >+ export PERL5LIB > > case $op in > "start") >-- >2.7.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 18964
:
65190
|
65196
|
65318
|
70401