API

logfs.fstracer

This module is a bridge between low-level logging services and high level handling dependency logic.

It can be used to launch a program and get all file events

logfs.fstracer.getfsevents(prog_name, arguments, approach='hooklib', filterproc=<function defaultfilter at 0x1dcb938>)[source]

Launches a program and gets file access events

Parameters:
  • prog_name – name of program
  • arguments – list of program’s arguments
  • approach – a logging approach(‘hooklib’ or ‘fusefs’)
  • filterproc – filter function, this function should take 3 strings: name of event, name of file and stage, and return a True if event is allowed and False instead. Name of event is one of ‘open’, ‘read’ or ‘write’. Default function always returns True.
Returns:

list with two elements - success events and failed events. Each element is dictionary stage->file information. File information is also a dictionary filename->type of events. Type of events for success events is a 2-element tuple: (was file readed, was file writed). For failed events it is also 2-element tuple: (was file not found, was file blocked by filterproc). Each element of tuple can be True or False. Both elements of tuple can be False. Stage can be ‘unknown’

package_utils

This package contains modules which work with the Portage system

package_utils.portage_log_parser.get_list_of_merged_packages(starttime=0, endtime=-1)[source]

Parses an emerge log and finds first successfully merged packages chain

Parameters:
  • starttime – start time for searching(in seconds since 1970)
  • starttime – end time for searching(in seconds since 1970).
Returns:

list of package names

package_utils.portage_utils.get_all_packages_files()

Memory-hungry operation

Returns:set of all files that belongs to package
package_utils.portage_utils.getfilesbypackage(packagename)[source]
Parameters:packagename – name of package
Returns:list of files in package with name packagename
package_utils.portage_utils.getpackagesbyfiles(files)[source]
Parameters:files – list of filenames
Returns:dictionary file->package, if file doesn’t belong to any package it not returned as key of this dictionary
class package_utils.portage_misc_functions.portage_api[source]

class for accessing the portage api

get_best_visible_pkg(pkg)

Gets best candidate on installing. Returns empty string if no found

Parameters:pkg – package name
get_dep(pkg, dep_type=['RDEPEND', 'DEPEND'])

Gets current dependencies of a package. Looks in portage db

Parameters:
  • pkg – name of package
  • dep_type – type of dependencies to recurse. Can be [“DEPEND”] or [“RDEPEND”, “DEPEND”]
Returns:

set of packages names

get_deps(pkg, dep_type=['RDEPEND', 'DEPEND'])[source]

Gets current dependencies of a package on any depth All dependencies must be installed

Parameters:
  • pkg – name of package
  • dep_type – type of dependencies to recurse. Can be [“DEPEND”] or [“RDEPEND”, “DEPEND”]
Returns:

set of packages names

get_merge_list(emergeargs)

Gets list of packages that emerge with emergeargs-arguments will merge This function uses very internal functions of portage so it may be unreliable in various portage versions

Parameters:emergeargs – list of raw args of emerge, for example, [‘-1’,’bash’]
get_system_packages_list()[source]

returns all packages from system set. They are always implicit dependencies

Returns:list of package names
parse_emerge_args(args)[source]

call emerge arguments parser

Parameters:args – arguments passed to emerge
Returns:tuple (action string, options dictionary, files or atoms list)

Table Of Contents

Previous topic

Internals

This Page