Package portage :: Package dbapi :: Module vartree :: Class vardbapi
[hide private]

Class vardbapi

source code

object --+    
         |    
     dbapi --+
             |
            vardbapi

Nested Classes [hide private]
  _owners_cache
This class maintains an hash table that serves to index package contents by mapping the basename of file to a list of possible packages that own it.
  _owners_db
Instance Methods [hide private]
 
__init__(self, _unused_param=<type 'exceptions.DeprecationWarning'>, categories=None, settings=None, vartree=None)
The categories parameter is unused since the dbapi class now has a categories property that is generated from the available packages.
source code
 
getpath(self, mykey, filename=None) source code
 
lock(self)
Acquire a reentrant lock, blocking, for cooperation with concurrent processes.
source code
 
unlock(self)
Release a lock, decrementing the recursion level.
source code
 
_fs_lock(self)
Acquire a reentrant lock, blocking, for cooperation with concurrent processes.
source code
 
_fs_unlock(self)
Release a lock, decrementing the recursion level.
source code
 
_bump_mtime(self, cpv)
This is called before an after any modifications, so that consumers can use directory mtimes to validate caches.
source code
 
cpv_exists(self, mykey, myrepo=None)
Tells us whether an actual ebuild exists on disk (no masking)
source code
 
cpv_counter(self, mycpv)
This method will grab the COUNTER.
source code
 
cpv_inject(self, mycpv)
injects a real package into our on-disk database; assumes mycpv is valid and doesn't already exist
source code
 
isInjected(self, mycpv) source code
 
move_ent(self, mylist, repo_match=None) source code
 
cp_list(self, mycp, use_cache=1) source code
 
cpv_all(self, use_cache=1)
Set use_cache=0 to bypass the portage.cachedir() cache in cases when the accuracy of mtime staleness checks should not be trusted (generally this is only necessary in critical sections that involve merge or unmerge of packages).
source code
 
cp_all(self, use_cache=1)
Implement this in a child class...
source code
 
checkblockers(self, origdep) source code
 
_clear_cache(self) source code
 
_add(self, pkg_dblink) source code
 
_remove(self, pkg_dblink) source code
 
_clear_pkg_cache(self, pkg_dblink) source code
 
match(self, origdep, use_cache=1)
caching match function
source code
 
findname(self, mycpv, myrepo=None) source code
 
flush_cache(self)
If the current user has permission and the internal aux_get cache has been updated, save it to disk and mark it unmodified.
source code
 
_aux_cache_init(self) source code
 
aux_get(self, mycpv, wants, myrepo=None)
This automatically caches selected keys that are frequently needed by emerge for dependency calculations.
source code
 
_aux_get(self, mycpv, wants, st=None) source code
 
_aux_env_search(self, cpv, variables)
Search environment.bz2 for the specified variables.
source code
 
aux_update(self, cpv, values)
Args:...
source code
 
counter_tick(self, myroot=None, mycpv=None) source code
 
get_counter_tick_core(self, myroot=None, mycpv=None)
Use this method to retrieve the counter instead of having to trust the value of a global counter file that can lead to invalid COUNTER generation.
source code
int
counter_tick_core(self, myroot=None, incrementing=1, mycpv=None)
This method will grab the next COUNTER value and record it back to the global file.
source code
 
_dblink(self, cpv) source code
 
removeFromContents(self, pkg, paths, relative_paths=True) source code
 
writeContentsToContentsFile(self, pkg, new_contents) source code

Inherited from dbapi: close_caches, invalidentry, move_slot_ent, update_ents

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]

Inherited from dbapi (private): _cmp_cpv, _cpv_sort_ascending

Class Variables [hide private]
  _excluded_dirs = re.compile(r'^(\..*|-MERGING-.*|CVS|lost\+fou...
  _aux_cache_version = u'1'
  _owners_cache_version = u'1'
  _aux_cache_threshold = 5
  _aux_cache_keys_re = re.compile(r'^NEEDED\..*$')
  _aux_multi_line_re = re.compile(r'^(CONTENTS|NEEDED\..*)$')
  x = u'lost+found'
Properties [hide private]
  root
  _aux_cache

Inherited from dbapi: categories

Inherited from object: __class__

Method Details [hide private]

__init__(self, _unused_param=<type 'exceptions.DeprecationWarning'>, categories=None, settings=None, vartree=None)
(Constructor)

source code 

The categories parameter is unused since the dbapi class now has a categories property that is generated from the available packages.

Overrides: object.__init__

lock(self)

source code 

Acquire a reentrant lock, blocking, for cooperation with concurrent processes. State is inherited by subprocesses, allowing subprocesses to reenter a lock that was acquired by a parent process. However, a lock can be released only by the same process that acquired it.

unlock(self)

source code 

Release a lock, decrementing the recursion level. Each unlock() call must be matched with a prior lock() call, or else an AssertionError will be raised if unlock() is called while not locked.

_bump_mtime(self, cpv)

source code 

This is called before an after any modifications, so that consumers can use directory mtimes to validate caches. See bug #290428.

cpv_counter(self, mycpv)

source code 

This method will grab the COUNTER. Returns a counter value.

cp_list(self, mycp, use_cache=1)

source code 
Overrides: dbapi.cp_list

cpv_all(self, use_cache=1)

source code 

Set use_cache=0 to bypass the portage.cachedir() cache in cases when the accuracy of mtime staleness checks should not be trusted (generally this is only necessary in critical sections that involve merge or unmerge of packages).

Overrides: dbapi.cpv_all

cp_all(self, use_cache=1)

source code 
Implement this in a child class
Args
        None
Returns:
        A list of strings 1 per CP in the datastore

Overrides: dbapi.cp_all
(inherited documentation)

match(self, origdep, use_cache=1)

source code 

caching match function

Overrides: dbapi.match

flush_cache(self)

source code 

If the current user has permission and the internal aux_get cache has been updated, save it to disk and mark it unmodified. This is called by emerge after it has loaded the full vdb for use in dependency calculations. Currently, the cache is only written if the user has superuser privileges (since that's required to obtain a lock), but all users have read access and benefit from faster metadata lookups (as long as at least part of the cache is still valid).

aux_get(self, mycpv, wants, myrepo=None)

source code 

This automatically caches selected keys that are frequently needed by emerge for dependency calculations. The cached metadata is considered valid if the mtime of the package directory has not changed since the data was cached. The cache is stored in a pickled dict object with the following format:

{version:"1", "packages":{cpv1:(mtime,{k1,v1, k2,v2, ...}), cpv2...}}

If an error occurs while loading the cache pickle or the version is unrecognized, the cache will simple be recreated from scratch (it is completely disposable).

Overrides: dbapi.aux_get

_aux_env_search(self, cpv, variables)

source code 

Search environment.bz2 for the specified variables. Returns a dict mapping variables to values, and any variables not found in the environment will not be included in the dict. This is useful for querying variables like ${SRC_URI} and ${A}, which are not saved in separate files but are available in environment.bz2 (see bug #395463).

aux_update(self, cpv, values)

source code 

Args:
  cpv - "sys-apps/foo-1.0"
        metadata_updates = { key : newvalue }
Returns:
        None

Overrides: dbapi.aux_update
(inherited documentation)

counter_tick(self, myroot=None, mycpv=None)

source code 
Parameters:
  • myroot - ignored, self._eroot is used instead

get_counter_tick_core(self, myroot=None, mycpv=None)

source code 

Use this method to retrieve the counter instead of having to trust the value of a global counter file that can lead to invalid COUNTER generation. When cache is valid, the package COUNTER files are not read and we rely on the timestamp of the package directory to validate cache. The stat calls should only take a short time, so performance is sufficient without having to rely on a potentially corrupt global counter file.

The global counter file located at $CACHE_PATH/counter serves to record the counter of the last installed package and it also corresponds to the total number of installation actions that have occurred in the history of this package database.

Parameters:
  • myroot - ignored, self._eroot is used instead

counter_tick_core(self, myroot=None, incrementing=1, mycpv=None)

source code 

This method will grab the next COUNTER value and record it back to the global file. Note that every package install must have a unique counter, since a slotmove update can move two packages into the same SLOT and in that case it's important that both packages have different COUNTER metadata.

Parameters:
  • myroot - ignored, self._eroot is used instead
  • mycpv - ignored
Returns: int
new counter value

removeFromContents(self, pkg, paths, relative_paths=True)

source code 
Parameters:
  • pkg (string) - cpv for an installed package
  • paths (iterable) - paths of files to remove from contents

writeContentsToContentsFile(self, pkg, new_contents)

source code 
Parameters:
  • pkg (dblink) - package to write contents file for
  • new_contents (contents dictionary of the form {u'/path/to/file' : (contents_attribute 1, ...), ...}) - contents to write to CONTENTS file

Class Variable Details [hide private]

_excluded_dirs

Value:
re.compile(r'^(\..*|-MERGING-.*|CVS|lost\+found)$')

Property Details [hide private]

root

Get Method:
unreachable.root(self)

_aux_cache

Get Method:
unreachable._aux_cache(self)