Package entropy :: Module const

Module const

source code

# DESCRIPTION: # Variables container

Copyright (C) 2007-2009 Fabio Erculiani

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Functions
 
initconfig_entropy_constants(rootdir)
Main constants configurators, this is the only function that you should call from the outside, everytime you want.
source code
 
initConfig_entropyConstants(rootdir)
@deprecated Please use initconfig_entropy_constants
source code
 
const_default_settings(rootdir)
Initialization of all the Entropy base settings.
source code
 
const_set_nice_level(nice_level=0)
Change current process scheduler "nice" level.
source code
 
const_extract_cli_repo_params(repostring, branch=None, product=None)
Extract repository information from the provided repository string, usually contained in the repository settings file, repositories.conf.
source code
 
const_read_entropy_release()
Read Entropy release file content and fill etpConst['entropyversion']
source code
 
const_setup_entropy_pid(just_read=False)
Setup Entropy pid file, if possible and if UID = 0 (root).
source code
 
const_secure_config_file(config_file)
Setup entropy file needing strict permissions, no world readable.
source code
 
const_chmod_entropy_pid()
Setup entropy pid file permissions, if possible.
source code
 
const_create_working_dirs()
Setup Entropy directory structure, as much automagically as possible.
source code
 
const_configure_lock_paths()
Setup Entropy lock file paths.
source code
 
const_extract_srv_repo_params(repostring, product=None)
Analyze a server repository string (usually contained in server.conf), extracting all the parameters.
source code
 
const_setup_perms(mydir, gid)
Setup permissions and group id (GID) to a directory, recursively.
source code
 
const_setup_file(myfile, gid, chmod)
Setup file permissions and group id (GID).
source code
 
const_get_chmod(myfile)
This function get the current permissions of the specified file.
source code
 
const_set_chmod(myfile, chmod)
This function sets specified permissions to a file.
source code
 
const_get_entropy_gid()
This function tries to retrieve the "entropy" user group GID.
source code
 
const_add_entropy_group()
This function looks for an "entropy" user group.
source code
 
const_islive()
Live environments (Operating System running off a CD/DVD) must feature the "cdroot" parameter in kernel /proc/cmdline
source code
 
const_kill_threads()
Entropy threads killer.
source code
 
const_handle_exception(etype, value, t_back)
Our default Python exception handler.
source code
Variables
  ETP_ARCH_CONST = 'amd64'
  etpSys = {'api': '3', 'arch': 'amd64', 'archs': ['x86', 'amd64...
  etpUi = {'ask': False, 'clean': False, 'debug': False, 'mute':...
  ETP_LOGLEVEL_NORMAL = 1
  ETP_LOGLEVEL_VERBOSE = 2
  ETP_LOGPRI_INFO = '[ INFO ]'
  ETP_LOGPRI_WARNING = '[ WARNING ]'
  ETP_LOGPRI_ERROR = '[ ERROR ]'
  etpCache = {'advisories': 'security/advisories_cache_', 'atomM...
  etpConst = {'applicationlock': False, 'backed_up': {}, 'branch...
Function Details

initconfig_entropy_constants(rootdir)

source code 

Main constants configurators, this is the only function that you should call from the outside, everytime you want. it will reset all the variables excluding those backed up previously.

@param rootdir current root directory, if any, or "" @type rootdir str @return None

const_default_settings(rootdir)

source code 

Initialization of all the Entropy base settings.

@param rootdir current root directory, if any, or "" @type rootdir str @return None

const_set_nice_level(nice_level=0)

source code 

Change current process scheduler "nice" level.

@param nice_level new valid nice level @type nice_level int @return current_nice new nice level

const_extract_cli_repo_params(repostring, branch=None, product=None)

source code 

Extract repository information from the provided repository string,
usually contained in the repository settings file, repositories.conf.

@param repostring basestring
@type repostring valid repository string
@return tuple composed by
    reponame => repository identifier (string),
    mydata => extracted repository information (dict)

const_read_entropy_release()

source code 

Read Entropy release file content and fill etpConst['entropyversion']

@return None

const_setup_entropy_pid(just_read=False)

source code 

Setup Entropy pid file, if possible and if UID = 0 (root). If the application is run with --no-pid-handling argument, this function will have no effect. If just_read is specified, this function will only try to read the current pid string in the Entropy pid file (etpConst['pidfile']). If any other entropy istance is currently owning the contained pid, etpConst['applicationlock'] becomes True.

@param just_read only read the current pid file, if any and if possible @type just_read bool

@return None

const_secure_config_file(config_file)

source code 

Setup entropy file needing strict permissions, no world readable.

@param config_file valid config file path @type config_file basestring @return None

const_chmod_entropy_pid()

source code 

Setup entropy pid file permissions, if possible.

@return None

const_create_working_dirs()

source code 

Setup Entropy directory structure, as much automagically as possible.

@return None

const_configure_lock_paths()

source code 

Setup Entropy lock file paths.

@return None

const_extract_srv_repo_params(repostring, product=None)

source code 

Analyze a server repository string (usually contained in server.conf), extracting all the parameters.

@param repostring repository string @type repostring basestring @return None

const_setup_perms(mydir, gid)

source code 

Setup permissions and group id (GID) to a directory, recursively.

@param mydir valid file path @type mydir basestring @param gid valid group id (GID) @type gid int @return None

const_setup_file(myfile, gid, chmod)

source code 

Setup file permissions and group id (GID).

@param myfile valid file path @type myfile basestring @param gid valid group id (GID) @type gid int @param chmod permissions @type chmod integer representing an octal @return None

const_get_chmod(myfile)

source code 

This function get the current permissions of the specified file. If you want to use the returning value with const_set_chmod you need to convert it back to int.

@param myfile valid file path @type myfile basestring @return octal representing permissions

const_set_chmod(myfile, chmod)

source code 

This function sets specified permissions to a file. If they differ from the current ones.

@param myfile valid file path @type myfile basestring @param chmod permissions @type chmod integer representing an octal @return None

const_get_entropy_gid()

source code 

This function tries to retrieve the "entropy" user group GID.

@return None or KeyError exception

const_add_entropy_group()

source code 

This function looks for an "entropy" user group. If not available, it tries to create one.

@return None

const_islive()

source code 

Live environments (Operating System running off a CD/DVD) must feature the "cdroot" parameter in kernel /proc/cmdline

@return bool stating if we are running Live or not

const_kill_threads()

source code 

Entropy threads killer. Even if Python threads cannot be stopped or killed, TimeScheduled ones can, exporting the kill() method.

@return None

const_handle_exception(etype, value, t_back)

source code 

Our default Python exception handler. It kills all the threads generated by Entropy before raising exceptions. Overloads sys.excepthook

@param etype exception type @param value exception value @param t_back traceback object? @return sys.__excepthook__


Variables Details

etpSys

Value:
{'api': '3',
 'arch': 'amd64',
 'archs': ['x86', 'amd64'],
 'dirstoclean': set([]),
 'killpids': set([]),
 'maxthreads': 100,
 'rootdir': '',
 'serverside': False}

etpUi

Value:
{'ask': False,
 'clean': False,
 'debug': False,
 'mute': False,
 'nolog': False,
 'pretend': False,
 'quiet': False,
 'verbose': False}

etpCache

Value:
{'advisories': 'security/advisories_cache_',
 'atomMatch': 'atom_match/atom_match_',
 'check_package_update': 'check_update/package_update_',
 'configfiles': 'conf/scanfs',
 'dbMatch': 'match/db',
 'dbSearch': 'search/db',
 'dep_tree': 'deptree/dep_tree_',
 'depends_tree': 'depends/depends_tree_',
...

etpConst

Value:
{'applicationlock': False,
 'backed_up': {},
 'branch': '4',
 'branches': [],
 'cachedumpext': '.dmp',
 'client_treeupdatescalled': set([]),
 'clientconf': '/etc/entropy/client.conf',
 'clientdbid': 'client',
...