portage.dbapi package

Submodules

Module contents

class portage.dbapi.dbapi

Bases: object

_categories = None
_category_re = re.compile('^\\w[-.+\\w]*$')
static _cmp_cpv(cpv1, cpv2)
static _cpv_sort_ascending(cpv_list)

Use this to sort self.cp_list() results in ascending order. It sorts in place and returns None.

_iter_match(atom, cpv_iter)
_iter_match_repo(atom, cpv_iter)
_iter_match_slot(atom, cpv_iter)
_iter_match_use(atom, cpv_iter)
  1. Check for required IUSE intersection (need implicit IUSE here).

  2. Check enabled/disabled flag states.

_iuse_implicit_cnstr(pkg, metadata)

Construct a callable that checks if a given USE flag should be considered to be a member of the implicit IUSE for the given package.

Parameters
Returns

a callable that accepts a single USE flag argument, and returns True only if the USE flag should be considered to be a member of the implicit IUSE for the given package.

Return type

callable

_known_keys = frozenset({'BDEPEND', 'DEFINED_PHASES', 'DEPEND', 'DESCRIPTION', 'EAPI', 'HOMEPAGE', 'IDEPEND', 'INHERIT', 'INHERITED', 'IUSE', 'KEYWORDS', 'LICENSE', 'PDEPEND', 'PROPERTIES', 'RDEPEND', 'REQUIRED_USE', 'RESTRICT', 'SLOT', 'SRC_URI'})
_match_use(atom, pkg, metadata, ignore_profile=False)
_pkg_str(cpv, repo)

This is used to contruct _pkg_str instances on-demand during matching. If cpv is a _pkg_str instance with slot attribute, then simply return it. Otherwise, fetch metadata and construct a _pkg_str instance. This may raise KeyError or InvalidData.

_pkg_str_aux_keys = ('EAPI', 'KEYWORDS', 'SLOT', 'repository')
_use_mutable = False
aux_get(mycpv, mylist, myrepo=None)

Return the metadata keys in mylist for mycpv Args:

mycpv - “sys-apps/foo-1.0” mylist - [“SLOT”,”DEPEND”,”HOMEPAGE”] myrepo - The repository name.

Returns:

a list of results, in order of keys in mylist, such as: [“0”,”>=sys-libs/bar-1.0”,”http://www.foo.com”] or [] if mycpv not found’

aux_update(cpv, metadata_updates)
Args:
cpv - “sys-apps/foo-1.0”

metadata_updates = { key : newvalue }

Returns:

None

property categories

Use self.cp_all() to generate a category list. Mutable instances can delete the self._categories attribute in cases when the cached categories become invalid and need to be regenerated.

close_caches()
cp_all(sort=False)

Implement this in a child class Args

sort - return sorted results

Returns:

A list of strings 1 per CP in the datastore

cp_list(cp, use_cache=1)
cpv_all()

Return all CPVs in the db Args:

None

Returns:

A list of Strings, 1 per CPV

This function relies on a subclass implementing cp_all, this is why the hasattr is there

invalidentry(mypath)
match(origdep, use_cache=1)

Given a dependency, try to find packages that match Args:

origdep - Depend atom use_cache - Boolean indicating if we should use the cache or not NOTE: Do we ever not want the cache?

Returns:

a list of packages that match origdep

move_slot_ent(mylist, repo_match=None)

This function takes a sequence: Args:

mylist: a sequence of (atom, originalslot, newslot) repo_match: callable that takes single repo_name argument

and returns True if the update should be applied

Returns:

The number of slotmoves this function did

update_ents(updates, onProgress=None, onUpdate=None)

Update metadata of all packages for package moves. :param updates: A list of move commands, or dict of {repo_name: list} :type updates: list or dict :param onProgress: A progress callback function :type onProgress: a callable that takes 2 integer arguments: maxval and curval :param onUpdate: A progress callback function called only

for packages that are modified by updates.