Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find (Debian/Ubuntu/...) packages that provide required Perl modules

I found that installing native Debian or Ubuntu Perl packages, such is often more reliable and convenient than "manually" installing Perl modules via cpanm (especially for XS-Modules). Is there an easy way to find these modules given a list of required Perl modules? The most convenient way would be to map a cpanfile, such as

requires 'XML::LibXSLT', '1.78';

to a list of distributions and packages that provide the modules for different target platforms:

XML::LibXSLT, Ubuntu 13.04, libxml-libxslt-perl, 1.78
XML::LibXSLT, Ubuntu 13.10, libxml-libxslt-perl, 1.78
XML::LibXSLT, Ubuntu 14.04, libxml-libxslt-perl, 1.84
XML::LibXSLT, Debian squeeze, libxml-libxslt-perl, 1.70
XML::LibXSLT, Debian wheezy, libxml-libxslt-perl, 1.77
XML::LibXSLT, Debian jessie, libxml-libxslt-perl, 1.92
XML::LibXSLT, Debian sid, libxml-libxslt-perl, 1.92

P.S.: I guess the information can somehow be looked up from the package repositories of each distribution, e.g. http://packages.ubuntu.com/ and https://packages.debian.org but is there a scriptable solution that already does this lookup?

like image 651
Jakob Avatar asked Sep 18 '14 06:09

Jakob


2 Answers

On Debian-based systems, install the dh-make-perl package and try

dh-make-perl locate XML::LibXSLT

On my LMDE box, it outputs:

== dh-make-perl 0.80 ==
Using cached Contents from Thu Sep 18 13:23:19 2014
XML::LibXSLT is in libxml-libxslt-perl package

For mapping this package name to other Linux distros, you could use distromatch. It also seems to support Perl (CPAN) and Python package names. Unfortunately, distromatch seems to be unmaintained and does not work out-of-the-box now. Recently I did manage to make it work well enough for translating Debian to openSUSE package names.

like image 144
Christian Pietsch Avatar answered Nov 15 '22 09:11

Christian Pietsch


Simple. Just search with the keyword. It will list all relevant packages. Then you can install the one you want.

e.g. on my ubuntu 12.04, I searched for LibXSLT:

$ sudo aptitude search LibXSLT
p   libxml-libxslt-perl                                                           - Perl interface to the GNOME libxslt library                                             
v   libxslt-dev                                                                   -                                                                                         
p   libxslt1-dbg                                                                  - XSLT 1.0 processing library - debugging symbols                                         
p   libxslt1-dev                                                                  - XSLT 1.0 processing library - development kit                                           
i A libxslt1.1                                                                    - XSLT 1.0 processing library - runtime library                                           
p   libxsltc-java                                                                 - XSL Transformations (XSLT) compiler from Xalan-Java                                     
p   libxslthl-java                                                                - XSLT syntax highlighting                                                                
p   python-libxslt1                                                               - Python bindings for libxslt1                                                            
p   python-libxslt1-dbg                                                           - Python bindings for libxslt1 (debug extension)                                          
v   python2.7-libxslt1                                                            -                                                                                         
v   python2.7-libxslt1-dbg                                                        -                           

So, as listed above, it is quite evident that you want to install libxml-libxslt-perl.

like image 27
slayedbylucifer Avatar answered Nov 15 '22 09:11

slayedbylucifer