Section: User Contributed Perl Documentation (3)
Updated: 2018-09-16
Page Index


URPM::Resolve - Resolve routines for URPM/urpmi  





The property functions

The property2name* functions parse things like ``mageia-release[>= 1]'' which is the format returned by URPM.xs for ->requires, ->provides, ->conflicts...
Returns the property name (eg: ``mageia-release'' in above example)
Returns the property name & range (eg: ``mageia-release'' & ``>= 1'' in above example)
Returns the property name, operator & range (eg: ``mageia-release'', ``>='', & ``1'' in above example)

The state functions

Those are wrappers around $state (cf ``The $state object'' in URPM).
Returns the ids of the packages to remove
Returns the ids of the packages that are either to remove or are obsoleted

Strict arch related functions

Is ``strict-arch'' wanted? (cf ``man urpmi'') Since it's slower we only force it on bi-arch
strict_arch_check_installed($db, $pkg)
Checks whether $pkg could be installed under strict-arch policy (ie check whether $pkg->name with different arch is not installed)
strict_arch_check($installed_pkg, $pkg) = @_;
Check whether $installed_pkg and $pkg have same arch (except for src/noarch of course)

Installed packages related functions

get_installed_arch($db, $n)
Returns the architecture of package $n in rpm DB
is_package_installed($db, $n)
Is $pkg->name installed?
provided_version_that_overlaps($pkg, $provide_name)
Finds $pkg ``provides'' that matches $provide_name, and returns the version provided. eg: $pkg provides ``a = 3'', $provide_name is ``a > 1'', returns ``3''
find_required_package($urpm, $db, $state, $id_prop)
Find the package (or packages) to install matching $id_prop. Returns (list ref of matches, list ref of preferred matches) (see also find_candidate_packages())

Choosing packages helpers

_find_required_package__kernel_source($urpm, $db, $choices)
Prefer the pkgs corresponding to installed/selected kernels
_find_required_package__kmod($urpm, $db, $choices)
Prefer the pkgs corresponding to installed/selected kernels
_score_for_locales($urpm, $db, $pkg)
Packages that require locales-xxx when the corresponding locales are already installed should be preferred over packages that require locales which are not installed.

eg: locales-fr & locales-de are installed,
     prefer firefox-fr & firefox-de which respectively require locales-fr & locales-de


Misc helpers

pkg2media($mediums, $pkg)
Return the medium that contains the URPM::Package $pkg

Dependancy resolver related functions

find_candidate_packages($urpm, $id_prop, $o_rejected)
Find candidates packages from a require string (or id). Takes care of choices using the '|' separator. (nb: see also find_required_package())
whatrequires($urpm, $state, $property_name)
Return packages requiring $property_name
whatrequires_id($state, $property_name)
Return ids of packages requiring $property_name
unsatisfied_requires($urpm, $db, $state, $pkg, %options)
Return unresolved requires of a package (a new one or an existing one).
with_db_unsatisfied_requires($urpm, $db, $state, $name, $do)
This function is ``recommends vs requires'' safe: Traversing DB on 'whatrequires' will give both requires & recommends, but ->unsatisfied_requires() will check $p->requires and so filter out recommends
with_state_unsatisfied_requires($urpm, $db, $state, $name, $do)
# LOG: do not ignore dropped provide from updated package (mdvbz#40842) #                        (http://svn.mandriva.com/viewvc/soft/rpm/perl-URPM/trunk/URPM/Resolve.pm?r1=242655&r2=242656&)
# TV: was introduced in order to replace one with_db_unsatisfied_requires() call by with_any_unsatisfied_requires()
with_any_unsatisfied_requires($urpm, $db, $state, $name, $do)
See above...
backtrack_selected($urpm, $db, $state, $dep, $diff_provides, %options)
Used when a require is not available
set_rejected($urpm, $state, $rdep)
Keep track of what causes closure. Set removed and obsoleted level.
resolve_rejected($urpm, $db, $state, $pkg, %rdep)
Close rejected (as urpme previously) for package to be removable without error.
resolve_requested($urpm, $db, $state, $requested, %options)
Resolve dependencies of requested packages; keep resolution state to speed up process.

A requested package is marked to be installed; once done, an upgrade flag or an installed flag is set according to the needs of the installation of this package.

Other required packages will have a required flag set along with an upgrade flag or an installed flag.

Base flag should always be ``installed'' or ``upgraded''.

The following options are recognized :

callback_choices : subroutine to be called to ask the user to choose between several possible packages. Returns an array of URPM::Package objects, or an empty list eventually.
keep :
nodeps :
no_recommends: ignore recommends tags

It actually calls resolve_requested__no_recommends() and resolve_requested_recommends().

resolve_requested_recommends($urpm, $db, $state, $selected, %options)
Select newly recommended package is installed as if (hard) required.
resolve_requested__no_recommends($urpm, $db, $state, $requested, %options)
Like resolve_requested() but doesn't handle recommends
disable_selected ($urpm, $db, $state, @pkgs_todo)
Do the opposite of the resolve_requested: unselect a package and extend to any package not requested that is no longer needed by any other package.

Return the packages that have been deselected.

disable_selected_and_unrequested_dependencies($urpm, $db, $state, @pkgs_todo)
Determine dependencies that can safely been removed and are not requested. Return the packages that have been deselected.

Dependancy related functions

_dep_to_name($urpm, $dep)
Take a string of package ids (eg: ``4897|4564|454'') that represent packages providing some dependancy. Return string of package names corresponding to package ids. eg: ``libgtk1-devel|libgtk2-devel|libgtk3-devel'' for ids corresponding to ``gtk-devel''

$dep is a hashref: { required => $ID, requested => $requested->{$ID} } # CHECK IT REALLY IS AN ID HERE => WE SHOULD REALLY DOCUMENT $requested

_id_to_name($urpm, $id_prop)
Returns package name corresponding to package ID (or ID if not numerical)
_ids_to_names($urpm, @ids)
Return package names corresponding to package ids
_ids_to_fullnames($urpm, @ids)
Return package fullnames corresponding to package ids. identical to _ids_to_names() modulo short name vs full name

Size related functions

selected_size($urpm, $state)
Compute selected size by removing any removed or obsoleted package. Returns total package size
selected_size_filesize($urpm, $state)
Compute selected size by removing any removed or obsoleted package. Returns both total package size & total filesize.

Other functions

compute_flags($urpm, $val, %options)
Adds packages flags according to an array containing packages names. $val is an array reference (as returned by get_packages_list) containing package names, or a regular expression matching against the fullname, if enclosed in slashes. %options :
callback : sub to be called for each package where the flag is set
skip : if true, set the 'skip' flag
disable_obsolete : if true, set the 'disable_obsolete' flag
request_packages_to_upgrade($urpm, $db, $state, $requested, %options)
Select packages to upgrade, according to package already registered. By default, only takes best package and its obsoleted and compute all installed or upgrade flag. (used for --auto-select)

Graph functions

sort_graph($nodes, $edges)
Sort the graph

nb: this handles $nodes list not containing all $nodes that can be seen in $edges

check_graph_is_sorted($sorted, $nodes, $edges)
sort_by_dependencies($urpm, $state, @list_unsorted)
sorted_rpms_to_string($urpm, @sorted)
build_transaction_set($urpm, $db, $state, %options)
Build transaction set for given selection Options: start, end, idlist, split_length, keep


Copyright (C) 2002-2005 MandrakeSoft SA

Copyright (C) 2005-2010 Mandriva SA

Copyright (C) 2011-2016 Mageia



The property functions
The state functions
Strict arch related functions
Installed packages related functions
Choosing packages helpers
Misc helpers
Dependancy resolver related functions
Dependancy related functions
Size related functions
Other functions
Graph functions