Reference

Debian::Package::List(3pm)

  Debian::Package::List - List of packages.

  use Debian::Package::List;
    

This module implements lists of packages. There is the base class Debian::Package::List, and two derived classes, namely Debian::Package::Installed and Debian::Package::New, corresponding to the installed and new packages. This is the base class that implements lists of Packages. This provides two virtual methods check and extra to be nstantiated in the derived classes.
new This is the constructor for the package. This takes a named parameter, filename, which should be the path of a Packages file to use as the data for the list. This is optional. Also, an optional parameter 'Ignored Headers' shall prevent recording those Headers (useful to reduce memory usage by not recording descriptions). The argument of Ignored headers is parsed to not ignore headers we consider vital, like Package Status Version Provides Pre-Depends Conflicts Depends Recommends Suggests
check and extra These are virtual functions to be instantiated in the derived classes. They are no-ops in the base class.
initialize Internally, new uses the method initialize. This routine opens the file passed in as a named parameter filename, reads it in paragraph mode (split on empty lines), and creates a package object with each chunk.
add_ignored_headers This routine adds to the current set of headers which are ignored if they appear in the Package file. Certain headers can not be ignored, currently Package Status Version Provides Pre-Depends Conflicts Depends Recommends Suggests. It takes in a required named parameter, Ignored Headers, which is a space separated list of headers to be ignored.
delete_ignored_headers This routine deletes from the current set of headers which are ignored if they appear in the Package file. It takes in a required named parameter, Remove Headers, which is a space separated list of headers to be removed from the list.
show_ignored_headers This routine shows the current set of headers which are ignored if they appear in the Package file.
set_compare_method This method sets the routine which is used for comparing versions. Using 'undef' as parameter selects the default method, which uses dpkg --compare-versions.
compare_versions This is the generic function for comparing version numbers. It takes three arguments, one version number, a relation, and another version number. Relation can be what dpkg would accept as relations (i.e., <, <<, <=, =, >=, >>, and >). The result is a boolean value.
dpkg_compare_method This is the default method for comparing versions. It simply calls dpkg --compare-versions, which is the right thing to do in most cases. It just does not work on non-Debian systems, so it has to be replaced (with set_compare_method) for this case.

=cut sub dpkg_compare_method {
my($vers1, $rel, $vers2) = @_;
my $rv;

        $rv = system 'dpkg', '--compare-versions', $vers1, $rel, $vers2;
        # need to invert exit status returned by system
        return !$rv if $rv == 0 ⎪⎪ $rv == 1<<8;
        croak( "Bad exit status $rv from dpkg --compare-versions");
}

set_break_on_types This routine adds to the current set of Types which, if they appear as targets, force installation to break at that point into a separate run. It takes one required named argument, Type List.
insert_breaks This routine takes a ordered list of package names, and inserts breaks into the list for the types specified by the internal variable array ' _Separate Runs'. It takes one required named argument, 'Ordered List'.
add Internally, initializeuses the method add. This routine creates a package object with the required named argument 'Package_desc'. Next, the package object is passed to virtual method check, and, if it passes, it is added to this instance of the list, and also adds in any symbols provided as virtual packages present. It is then passed to the virtual method extra for any extra processing of the package object.
delete This routine take a required named argument Name and deletes a package with that name from the list if it exists. It also take care of erasing the package from the provides list, if indeed this package provided a virtual package.
mark This routine takes two required parameters, Package, and Mark and marks Package with Mark. This is usually used to mark packages in some fashion so they will not satisfy dependencies (for packages in the installed list marked for removal, for example)
unmark This routine takes two required parameters, Package, and Mark and removes Mark from Package.
test_mark This routine takes two required parameters, Package, and Mark and tests to see if the Package is marked with Mark.
show_mark This routine takes one required parameter, Package, and shows all marks on it.
list_marks This routine collects information in a package list about all packages with a mark on it. It returns a hash keyed on package names.
print This routine loops through the packages in the list, calling the print function of each package object. It then runs through the list of provided packages, printing the name of each package provided.
print_name This routine loops through the packages in the list, printing the name. It then runs through the list of providedpackages, printing the name of each package provided.
names_as_string This routine loops through the packages in the list and returns the names of all packages as a string.
init_depends As an extra processing of every package, the method extra creates a dependeny list object for the fields Depends, Pre-Depends, Recommends, Suggests, Conflicts, and Replaces. (Stored in internal fields whose names start with a blank followed by an underscore " _")
get_dependency_information This method extra creates a dependeny list object for the fields Depends, Pre-Depends, Recommends, Suggests, Conflicts, and Replaces. (Stored in internal fields whose names start with a blank followed by an underscore " _")
check_relations This routine performs the dependency checks for the new packages. For each package in the list it calls the corresponding function in the package, and stores the results in an associative array (keyed on package name). It takes a required named argument Field, whose value should be one of Pre-Depends, Depends, Recommends, Suggests, Conflicts, or Replaces. It takes optional named arguments Consistent, (true if inconsistency in the new list should cause a warning), Installed, (a package list of installed packages), and Warn, which just sends a warning, and does not exclude a Package.
order This routine takes one named argument Field, which contains the name of the package field to generate ordering information about (usually one of Pre-Depends Depends Recommends Suggests) and appends the ordering information so obtained to the package. This method is typically called multiple times with different arguments. The method order_string below can be used to retrieve the accumulated information.
order_string This routine takes the ordering information accumulated in a package list and returns it as a string.
get_ordering This routine gathers ordering information from the packages in the list, and runs tsort on the gathered data, and returns the output of tsort.
set_fatal_failure_on_types This routine adds to the current set of Show stopper Types, taking one required named argument, Type List.
print_result This routine prints out the current set of dependency failures for this package list. It takes 2 named arguments, both required: Type, one of Conflicts Pre-Depends Depends Recommends Suggests Category, one of Failed Found Warn Conflict (note, no trailing s). Also, there are two special Typea, All Critical, which print All and Show Stoppers types respectively.
result_as_string This routine returns the current set of dependency failures for this package list as a string. It takes 2 named arguments, both required: Type, one of Conflicts Pre-Depends Depends Recommends Suggests Category, one of Failed Found Warn Conflict (note, no trailing s). Also, there are two special Typea, All Critical, which print All and Show Stoppers types respectively.
check_result This routine returns the number of the current set of dependency failures for this package list. It takes 2 named arguments, both required: Type, one of Conflicts Pre-Depends Depends Recommends Suggests Category, one of Failed Found Warn Conflict (note, no trailing s). Also, there are two special Typea, All Critical, which print All and Show Stoppers types respectively.
reset_result This routine recalculates the results field for all the packages in the list.
non_target_as_string This routine returns the current set packages in this package list which are not targets of the dependency checks run on this list. One may select which of the results are reported, by selecting the Type, but, the result will be nothing unless the corresponding check_relations has been run.
target_as_string This routine returns the current set packages in this package list which are targets of the dependency checks run on this list. One may select which of the results are reported, by selecting the Type, but, the result will be nothing unless the corresponding check_relations has been run.
test This routine exercises the list class, initializing it with /var/lib/dpkg/status, .and then printing the names of all packages known. This is also a virtual function, in the sense that each derived class should provide an implementation. This module is a derived class of the Debian::Package::List class. This overrides the constructor new, the test function, and provides an instantiation of the virtual function check.
new The constructor is over ridden to not require the named filename parameter, instead we use the constant /var/lib/dpkg/status as a default (the provided filename is still used if it exists).
check The virtual function check is instantiated, and ensures that the package is in an ok installed status before it is included in the package list.
test This routine exercises the installed list class, initializing it, and then printing the names of all packages installed. This module is a derived class of the Debian::Package::List class. This provides an instantiation of the virtual function extra, and also the test method.
extra As an extra processing of every package, the method extra creates a dependeny list object for the fields Depends, Pre-Depends, Recommends, Suggests, Conflicts, and Replaces. (Stored in internal fields whose names start with a blank followed by an underscore " _")
test This routine exercises the new list class, initializing it with a file named Packages, and then printing the names of all packages therein.

  use Debian::Package::List::Targets;
    

This module is used internally to hold reverse information about dependency (or conflict) hits..
new This is the constructor for the package. It takes one named required argument, 'Package List', which is a pointer to the containing package list.
set_break_on_types This routine adds to the current set of Types which, if they appear as targets, force installation to break at that point into a separate run. It takes one required named argument, Type List.
insert_breaks This routine takes a ordered list of package names, and inserts breaks into the list for the types specified by the internal variable array ' _Separate Runs'. It takes one required named argument, 'Ordered List'.
add This routine adds to the current set of dependency targets for this package. It takes 3 named arguments, all of them required: Type, one of Conflicts Pre-Depends Depends Recommends Suggests Target, and Dependant.
remove This routine deletes a target from the current set of dependency targets for this package list. It takes 2 named arguments, both required: Type, one of Conflicts Pre-Depends Depends Recommends Suggests and Target.
is_target This routine . It takes 2 named arguments, both required: Type, one of Conflicts Pre-Depends Depends Recommends Suggests and Target. There is an undocumented Type All, which cycles over it all.
print_target This routine prints out the current set of dependency targets for this package list. It takes one required named argument: Type, one of Conflicts Pre-Depends Depends Recommends Suggests Also, there is a special Type, All, which prints All types. Actually, this procedure merely handles the Special types, and passes the work to the next routine.
do_print This routine prints out the current set of dependency targets for this package. It takes one required named argument: Type, one of Conflicts Pre-Depends Depends Recommends Suggests This is very inchoate, at the moment, and needs testing. None Known so far. Manoj Srivastava <[email protected]>

History