Bug 8840

Summary: ubuntu-pkg-check.sh fix and extend functionality
Product: Koha Reporter: Tomás Cohen Arazi <tomascohen>
Component: Command-line UtilitiesAssignee: Mark Tompsett <mtompset>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P5 - low CC: katrin.fischer, magnus, mtompset
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 18028    
Attachments: Bug 8840 - ubuntu-pkg-check.sh script doesn't work on non englush setups
Bug 8840 - ubuntu-pkg-check.sh script doesn't work on non english setups
Replaced ubuntu-pkg-check.sh with one that works properly.
Bug 8840 - ubuntu-pkg-check.sh fix and extend functionality
Bug 8840 - ubuntu-pkg-check.sh fix and extend functionality
Bug 8840 - ubuntu-pkg-check.sh fix and extend functionality
Tweak to patch to solve false "All dependencies installed!"
Fix and extend script functionality
Correct incorrect reporting
Bug 8840 - [SIGNED-OFF] ubuntu-pkg-check.sh fix and extend functionality
Bug 8840 - [SIGNED-OFF] Patch to solve false "All dependencies installed!"
Bug 8840 - [SIGNED-OFF] ubuntu-pkg-check.sh fix and extend functionality
[PASSED QA] Bug 8840 - [SIGNED-OFF] Patch to solve false "All dependencies installed!"

Description Tomás Cohen Arazi 2012-09-27 16:17:33 UTC
The script queries for the 'Installed:' string, which only appears on english setups.
Comment 1 Tomás Cohen Arazi 2012-09-27 18:05:03 UTC Comment hidden (obsolete)
Comment 2 Tomás Cohen Arazi 2012-09-28 16:06:06 UTC Comment hidden (obsolete)
Comment 3 Mark Tompsett 2012-09-28 17:37:41 UTC Comment hidden (obsolete)
Comment 4 Mark Tompsett 2012-09-29 04:38:12 UTC
Revised/Clarified Test Plan
---------------------------

Prove The Problem
=================
1) Fresh install of Ubuntu 12.04 (Spanish)
2) ./install_misc/ubuntu-pkg-check.sh
-- This is to get the base output to compare.
-- a whole bunch of library name = none.
3) sudo apt-get install libyaml-perl
4) ./install_misc/ubuntu-pkg-check.sh
-- Identical output, even though we installed a dependency!
5) apply patch
6) ./install_misc/ubuntu-packages.sh -r
-- libyaml-perl should show the correct version number.

7) Fresh install of Ubuntu 12.04 (English)
8) ./install_misc/ubuntu-pkg-check.sh
-- Indentical to first output, no dependencies installed yet.
9) sudo apt-get install libyaml-perl
10) ./install_misc/ubuntu-pkg-check.sh
-- libyaml-perl should show the correct version number.
11) apply patch
12) ./install_misc/ubuntu-packages.sh -r
-- libyaml-perl should show the correct version number.

Test New Features (Help)
========================
13) ./install_misc/ubuntu-packages.sh -h
14) echo $?
-- It should give a nice help screen. And the echo result of 0.
15) ./install_misc/ubuntu-packages.sh
16) echo $?
-- It should give a nice help screen. And the echo result of 1 -- based you gave incorrect parameters.
17) ./install_misc/ubuntu-packages.sh -badparm
18) echo $?
-- It should give a nice help screen. And the echo result of 1 -- based you gave incorrect parameters.

Test New Features (Sudo apt-get command output)
===============================================
19) ./install_misc/ubuntu-packages.sh -ic
-- It should output an appropriate sudo apt-get command to install the dependencies.
20) Cut and paste the command, then press enter!
-- install everything!
21) ./install_misc/ubuntu-packages.sh -ic
-- It should say it thinks everything is installed, and tell you to run a koha_perl_deps.pl -m -u.
Comment 5 Tomás Cohen Arazi 2012-09-30 00:59:27 UTC Comment hidden (obsolete)
Comment 6 Mark Tompsett 2012-09-30 03:41:06 UTC
I just noticed a minor typo in the comments. "dor" instead of "dot". I'll let you fix it, Tomás. And don't forget to set the status to "Needs Signoff" when you do. I don't think either of us should sign it off, since we both worked on this.
Comment 7 Tomás Cohen Arazi 2012-09-30 15:44:05 UTC Comment hidden (obsolete)
Comment 8 Jared Camins-Esakov 2012-11-02 11:49:38 UTC Comment hidden (obsolete)
Comment 9 Katrin Fischer 2012-12-10 21:57:49 UTC
Hi Tomas, 

I looked into your patch, testing on an Ubuntu 12.04 installation in German.

-h -r and -ic seem to work nicely. 

On my system all dependencies were installed, so I took a look at the ubuntu.12.04.packages file and picked something to remove it. 

'sudo apt-get remove libyaml-perl'

After this step ./koha_perl_deps.pl -c -a reports missing packages:
Test::YAML::Valid                             0                 0.04                    No
YAML                                          0                 0.71                    Yes

Next I ran your script: ./install_misc/ubuntu-packages.sh -ic

# Using the ./install_misc/ubuntu.12.04.packages file as source
#............................................................................................................................................
# All dependencies installed!
# Please confirm the version numbers are sufficient
# By running koha_perl_deps.pl -m -u.

So it doesn't seem to detect the missing package?

Maybe I am doing something wrong, please take a look at the patch and my test plan.
Comment 10 Mark Tompsett 2012-12-11 15:15:07 UTC
Greetings,

Your testplan is flawed in that you didn't confirm there were no missing discrepancies between CheckDependencies.pm  and the ubuntu[.blah].packages file.

This patch should generate identical perl library output as koha_perl_deps *IF* all the perl dependencies listed in CheckDependencies.pm are also listed in the .packages file. Sadly, you can't just count, because sometimes multiple libraries are contained in a single package. For example, Blah::Blah might also be in Blah's libBlah-perl package. And the .packages files (ubuntu.12.04.packages and ubuntu.packages) should generally be identical, though I could see ubuntu.packages being larger as it also may have to deal with older installations. Though, I think we've been lazy and just copying the latest .packages file to it. :)

What you have stumbled upon is the installation mess that needs cleaning up, and this is a tiny step towards it.

GPML...
Comment 11 Mark Tompsett 2012-12-17 20:28:05 UTC Comment hidden (obsolete)
Comment 12 Mark Tompsett 2012-12-17 21:17:51 UTC Comment hidden (obsolete)
Comment 13 Mark Tompsett 2012-12-17 21:18:35 UTC Comment hidden (obsolete)
Comment 14 Tomás Cohen Arazi 2013-03-14 18:53:31 UTC
This is almost signed.
Comment 15 Magnus Enger 2013-03-20 16:00:41 UTC
After applying the patches, I get:

$ perl koha_perl_deps.pl -m -u

                                              Installed         Required          Module is
Module Name                                   Version           Version            Required
--------------------------------------------------------------------------------------------
CHI                                           0 *               0.36                    No
CHI::Driver::Memcached                        0 *               0.12                    No
Data::Pagination                              0 *               0.44                    No

--------------------------------------------------------------------------------------------
Total modules reported: 3                      * Module is missing or requires an upgrade.

$ ./install_misc/ubuntu-packages.sh -ic
# Using the ./install_misc/ubuntu.12.04.packages file as source
#............................................................................................................................................
# Copy and paste the following command to install all Koha's dependencies on your system:
# Note: this command will run with admin privileges. Make sure your user has sudo rights
	sudo apt-get install libchi-perl libchi-driver-memcached-perl 

So the two tools agree on CHI and CHI::Driver::Memcached, but ubuntu-packages.sh does not pick up the missing Data::Pagination. As this dependency is not listed in ubuntu.12.04.packages this is actually to be expected, and as far as I understand, fixing the lists of dependencies is beyond the scope of this bug. 

ubuntu-packages.sh -h gives the help message
ubuntu-packages.sh -r prints dependencies and versions

As far as I can tell ubuntu-packages.sh does what it is supposed to do so I'll sign off.
Comment 16 Magnus Enger 2013-03-20 16:08:16 UTC Comment hidden (obsolete)
Comment 17 Magnus Enger 2013-03-20 16:08:27 UTC Comment hidden (obsolete)
Comment 18 Katrin Fischer 2013-05-12 15:48:18 UTC
Created attachment 18096 [details] [review]
Bug 8840 - [SIGNED-OFF] ubuntu-pkg-check.sh fix and extend functionality

First, reworked it into a newer script with parameters:
   ubuntu-packages.sh -r
This will generate output identical to the old script, except
that it is fixed for non-english setups.
   ubuntu-packages.sh -h
This adds a brief help, which all scripts should have.
   ubuntu-packages.sh -ic
This helps handle a multi-arch problem by printing out a
relevant command for installing missing dependencies.

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Signed-off-by: Magnus Enger <magnus@enger.priv.no>
Works as advertised, see Bugzilla for details.
Comment 19 Katrin Fischer 2013-05-12 15:48:31 UTC
Created attachment 18097 [details] [review]
[PASSED QA] Bug 8840 - [SIGNED-OFF] Patch to solve false "All dependencies installed!"

Reordered logic to accumulate MISSING_PATCHES variable and tweak
condition to be certain it was not failing.

Signed-off-by: Magnus Enger <magnus@enger.priv.no>
Works as advertised, see Bugzilla for details.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Comment 20 Jared Camins-Esakov 2013-05-13 01:16:07 UTC
This patch has been pushed to master and 3.12.x.