Bug 13216 - fix koha-shell to work with git/dev installs
Summary: fix koha-shell to work with git/dev installs
Status: CLOSED WONTFIX
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Liz Rea
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-07 00:46 UTC by Mason James
Modified: 2017-06-14 22:11 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 13216 - fix koha shell to accept alternative perl5lib paths (2.86 KB, patch)
2015-10-16 02:47 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 13216 - fix koha shell to accept alternative perl5lib paths (2.94 KB, patch)
2016-03-25 09:07 UTC, Mirko Tietgen
Details | Diff | Splinter Review
Bug 13216 - fix koha-shell to work with git/dev installs (3.14 KB, patch)
2016-04-11 11:19 UTC, Mason James
Details | Diff | Splinter Review
Bug 13216 - fix koha-shell to work with git/dev installs (3.09 KB, patch)
2016-04-11 12:06 UTC, Mason James
Details | Diff | Splinter Review
Bug 13216 - fix koha-shell to work with git/dev installs (3.76 KB, patch)
2016-04-13 14:51 UTC, Mason James
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Mason James 2014-11-07 00:46:08 UTC
koha-shell assumes PERL5LIB is '/usr/share/koha', which if often incorrect in a git/dev install

this patch attempts to fix this issue, by using the correct path
Comment 1 Mason James 2014-11-07 00:47:30 UTC
(In reply to Mason James from comment #0)
> koha-shell assumes PERL5LIB is '/usr/share/koha', which if often incorrect
> in a git/dev install
> 
> this patch attempts to fix this issue, by using the correct path


oops, which *is* often incorrect in a git/dev install
Comment 2 Liz Rea 2015-10-16 02:47:49 UTC Comment hidden (obsolete)
Comment 3 Mirko Tietgen 2016-03-25 09:07:33 UTC
Created attachment 49578 [details] [review]
Bug 13216 - fix koha shell to accept alternative perl5lib paths

To test:
gitify an install

run sudo koha-shell instance
run env | grep PERL5LIB it should be set to /usr/share/koha/lib

run sudo koha-shell -d /path/to/your/git/install
run env | grep PERL5LIB it should be set to /path/to/your/git/install

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Comment 4 Marcel de Rooy 2016-03-25 10:07:34 UTC
This is an interesting change.
I added an see-also to a blocked bug 13971 from myself. I was not yet satisfied with the solution there.

Instead of passing the kohadir on all individual scripts like koha-shell here, koha-rebuild-zebra or even another one in the other see-also, imo we would benefit from a more general approach.
The get_perl5lib function in koha-functions.sh would do (from 13971); we should forget the other function is_gitified.

Instead of passing the alternative path all the time, why not once record it in koha-conf.xml ? What do you think ?
Comment 5 Marcel de Rooy 2016-04-08 07:04:03 UTC
For following through in QA, a reply would be welcome..
Comment 6 Liz Rea 2016-04-10 21:18:22 UTC
That's fine with me, I just wanted to avoid cruft in koha-conf.

Liz
Comment 7 Mason James 2016-04-11 02:53:56 UTC
(In reply to Marcel de Rooy from comment #4)
> This is an interesting change.
> I added an see-also to a blocked bug 13971 from myself. I was not yet
> satisfied with the solution there.
> 
> Instead of passing the kohadir on all individual scripts like koha-shell
> here, koha-rebuild-zebra or even another one in the other see-also, imo we
> would benefit from a more general approach.
> The get_perl5lib function in koha-functions.sh would do (from 13971); we
> should forget the other function is_gitified.
> 
> Instead of passing the alternative path all the time, why not once record it
> in koha-conf.xml ? What do you think ?

just my 2 cents...  we need to know 2 things here...

1/ what the base directory of the Koha is?
2/ what kind of install type the Koha is? (eg: tar, git, .deb), as the directory structure is difference for each type

we do need something like a is_gitified() function, that checks the koha-conf.xml file for some value

knowing the base directory of the Koha, and 'guessing' the install type - wont give us enough info to sort this problem?
Comment 8 Mason James 2016-04-11 03:07:31 UTC
(In reply to Mason James from comment #7)
> (In reply to Marcel de Rooy from comment #4)
> > This is an interesting change.
> > I added an see-also to a blocked bug 13971 from myself. I was not yet
> > satisfied with the solution there.
> > 
> > Instead of passing the kohadir on all individual scripts like koha-shell
> > here, koha-rebuild-zebra or even another one in the other see-also, imo we
> > would benefit from a more general approach.
> > The get_perl5lib function in koha-functions.sh would do (from 13971); we
> > should forget the other function is_gitified.
> > 
> > Instead of passing the alternative path all the time, why not once record it
> > in koha-conf.xml ? What do you think ?
> 
> just my 2 cents...  we need to know 2 things here...
> 
> 1/ what the base directory of the Koha is?
> 2/ what kind of install type the Koha is? (eg: tar, git, .deb), as the
> directory structure is difference for each type
> 
> we do need something like a is_gitified() function, that checks the
> koha-conf.xml file for some value
> 
> knowing the base directory of the Koha, and 'guessing' the install type -
> wont give us enough info to sort this problem?

specifically scripts like koha-update-schema and koha-translate will need to know these 2 things, to work correctly with a gitified Koha; as the dir structure is different for each type
Comment 9 Liz Rea 2016-04-11 04:00:24 UTC
I feel like that's a bit of scope creep - but I"m not opposed to adding something like a "check if gitified" function.
Comment 10 Mason James 2016-04-11 06:52:32 UTC
(In reply to Liz Rea from comment #9)
> I feel like that's a bit of scope creep - but I"m not opposed to adding
> something like a "check if gitified" function.

yes, and yes 

ps: i'm not suggesting my recommendations need to happen before this bug should be accepted
Comment 11 Mason James 2016-04-11 11:19:59 UTC Comment hidden (obsolete)
Comment 12 Mason James 2016-04-11 12:06:47 UTC Comment hidden (obsolete)
Comment 13 David Cook 2016-04-11 23:19:49 UTC
Wouldn't it be nice if all the Debian special scripts worked regardless of type of install? 

I imagine there are a lot of hard-coded fields though, so that's probably a lot more work than one would imagine...
Comment 14 Mason James 2016-04-12 02:05:59 UTC
(In reply to Marcel de Rooy from comment #4)
> This is an interesting change...
>..
> Instead of passing the alternative path all the time, why not once record it
> in koha-conf.xml ? What do you think ?

Hi Marcel, I forgot to mention that I basically agree with your idea :)

i think its possible to handle both options (koha.conf and shell), with a preference/override for the koha.conf values

I would be happy to implement this, (perhaps in a separate bug?)
Comment 15 Owen Leonard 2016-04-12 14:57:50 UTC
I would like to test this but the test plan is confusing to me. Could you revise it with some more specific instructions? For instance:

run a "koha-shell -c 'which koha-*'" on a Koha tool, with -d arg

The actual command would make a lot more sense to me.
Comment 16 Mason James 2016-04-13 07:40:06 UTC
(In reply to Owen Leonard from comment #15)
> I would like to test this but the test plan is confusing to me. Could you
> revise it with some more specific instructions? For instance:
> 
> run a "koha-shell -c 'which koha-*'" on a Koha tool, with -d arg
> 
> The actual command would make a lot more sense to me.

I did provide an actual command - its the following line, after the line you quoted

2/ run a "koha-shell -c 'which koha-*'" on a Koha tool, with -d arg

# perl ~/koha-master/debian/scripts/koha-shell  -d ~/koha-master  -c 'which koha-list ' moof
Comment 17 Mason James 2016-04-13 14:51:07 UTC
Created attachment 50202 [details] [review]
Bug 13216 - fix koha-shell to work with git/dev installs

The aim of this patch is to enable developers to begin testing Koha tools from a gitified Koha directory, using koha-shell

this patch set adds a --gitify arg and a --kohadir arg to koha-shell

To test:
gitify an install
apply both patches, then copy patched koha-shell to /usr/sbin dir

run sudo koha-shell instance
run env | grep PERL5LIB, it should be set to /usr/share/koha/lib

run sudo koha-shell -d /path/to/your/git/install instance
 run env | grep PERL5LIB, it should be set to /path/to/your/git/install
 run which koha-list, it should be set to /usr/sbin/koha-list

run sudo koha-shell -g -d /path/to/your/git/install instance
 run env | grep PERL5LIB, it should be set to /path/to/your/git/install
 run env | grep PATH, it should be set to /path/to/your/git/install/debian/scripts:$PATH
 run env | grep KOHA_GITIFY, it should be set to 1
 run which koha-list, it should be set to /path/to/your/git/install/debian/scripts/koha-list
 run koha-list, it should work as expected

run sudo koha-shell -g instance, it should give error...
 'You must supply --kohadir when using --gitify'

https://bugs.koha-community.org/show_bug.cgi?id=13295
Comment 18 Owen Leonard 2016-04-13 16:06:15 UTC
Thank you very much for the clarified test plan. This looks like it's working. Once piece is missing: What should I be able to do with these patches that I couldn't do before?
Comment 19 Marcel de Rooy 2016-06-20 11:46:28 UTC
Submitted some patches on bug 16733 to deal with the same issue in a broader perspective.