Debian::AptContents - parse/search through apt-file's Contents files
my $c = Debian::AptContents->new( { homedir => '~/.dh-make-perl' } ); my @pkgs = $c->find_file_packages('/usr/bin/foo'); my $dep = $c->find_perl_module_package('Foo::Bar');
This needs to really work not only for Perl modules.
A module specific to Perl modules is needed by dh-make-perl, but it can subclass Debian::AptContents, which needs to become more generic.
Constructs new instance of the class. Expects at least homedir option.
homedir
(mandatory) Directory where the object stores its cache.
Directory where apt-file stores Contents files are stored. Default is /var/cache/apt/apt-file
A path to a sources.list file or an array ref of paths to sources.list files. If not given uses AptPkg's Config to get the list.
Used for filtering on the distributon part of the repository paths listed in sources.list. Default is empty, meaning no filtering.
distributon
Arrayref of Contents file names. Default is to parse the files in sources and to look in contents_dir for matching files.
sources
contents_dir
Path to the file with cached parsed information from all Contents files. Default is Contents.cache under homedir.
Filled by read_cache. Used by find_file_packages and (obviously) store_cache
read_cache
find_file_packages
store_cache
Verbosity level. 0 means silent, the bigger the more the jabber. Default is 1.
Used internally. Given a verbosity level and a message, prints the message to STDERR if the verbosity level is greater than or equal of the value of verbose.
verbose
Given a line with Deban package repository path (typically taken from sources.list), converts it to the corresponding Contents file names.
Reads sources.list, gives the repository paths to repo_source_to_contents_paths and returns an arrayref of file names of Contents files.
repo_source_to_contents_paths
Reads the cached parsed Contents files. If there are Contents files with more recent mtime than that of the cache (or if there is no cache at all), parses all Contents and stores the cache via store_cache for later invocation.
Writes the contents of the parsed cache to the cache_file.
cache
cache_file
Storable is used to stream the data. Along woth the information from Contents files, a timestamp is stored.
Returns a list of packages where the given file was found.
Contents files store the package section together with package name. That is stripped.
Returns an empty list of the file is not found in any package.
Given Perl module name (e.g. Foo::Bar), returns a Debian::Dependency object representing the required Debian package and version. If the module is a core one, suitable dependency on perl is returned.
If the package is also available in a separate package, an alternative dependency is returned.
In case the version of the currently running Perl interpreter is lower than the version in which the wanted module is available in core, the separate package is preferred. Otherwise the perl dependency is the first alternative.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
To install DhMakePerl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DhMakePerl
CPAN shell
perl -MCPAN -e shell install DhMakePerl
For more information on module installation, please visit the detailed CPAN module installation guide.