Bug 19735: Move Perl deps definitions into a cpanfile
authorJulian Maurice <julian.maurice@biblibre.com>
Thu, 26 Oct 2017 16:28:02 +0000 (16:28 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Wed, 12 Feb 2020 16:33:02 +0000 (16:33 +0000)
commita34d086a24b1e4519f8b31331d4c42b87b8e4a83
tree7b283589b499416990b4734bed372431d9f8b759
parentf9dd77cfab2c02ce7644a454612b40ec3b5627aa
Bug 19735: Move Perl deps definitions into a cpanfile

cpanfile is a format for describing CPAN dependencies for Perl
applications.
It is more concise - thus easier to read and maintain - than
C4::Installer::PerlDependencies, and allows to describe requirements
more accurately (using version ranges or features for instance)
Additionally it can be read by tools such as cpanm or carton for an
easy way to install dependencies on non-Debian-based systems.

For more information on cpanfile, see
http://search.cpan.org/~miyagawa/Module-CPANfile-1.1002/lib/cpanfile.pod

This patch replace C4::Installer::PerlDependencies by an equivalent
cpanfile and update all scripts/modules that were using PerlDependencies
It also removes dead code from C4::Installer::PerlModules (some
subroutines were not used at all, except in unit tests)

Added dependencies:
 - Module::CPANfile
 - CPAN::Meta (dependency of Module::CPANfile, but we need a more recent
   version than the one Module::CPANfile requires)

Test plan:
  1. Go to About page, tab Perl modules and keep this browser tab open
  2. Apply patch
  3. Install Module::CPANfile and CPAN::Meta
    a. On Debian-based systems:
       # will install libcpan-meta-perl as a dependency
       sudo apt install libmodule-cpanfile-perl
    b. Others:
       # will install CPAN::Meta as a dependency
       sudo cpanm Module::CPANfile
  4. In a new browser tab, go to About page, tab Perl modules and compare
     the table with the one in the previous browser tab
     They should be identical, except for newly added dependencies
     (Module::CPANfile and CPAN::Meta)
  5. Do a 'standard' install
    a. perl Makefile.PL (select 'standard')
    b. make
    c. sudo make install
    d. Configure your database, web server, ... and go through the web
       install process
  6. Verify that the cpanfile got copied into PERL_MODULE_DIR (which
     should be /usr/share/koha/lib)
  7. Go to the about page of this fresh install and compare it with your
     dev install
  8. Verify that debian/list-deps still works
     This takes a lot of time and it may not be necessary to wait until
     the end. If you see some Debian package names that correspond to
     modules in cpanfile, it means it still works
     (you need apt-file for this script to work)
  9. Verify that koha_perl_deps.pl still works
 10. prove t/Installer_pm.t t/Installer_PerlModules.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
C4/Installer.pm
C4/Installer/PerlModules.pm
Makefile.PL
about.pl
cpanfile [new file with mode: 0644]
debian/list-deps
installer/install.pl
t/Installer_PerlDependencies.t [deleted file]
t/Installer_PerlModules.t
t/Installer_pm.t