Package portage :: Package package :: Package ebuild :: Module fetch
[hide private]

Module fetch

source code

Functions [hide private]
 
_hide_url_passwd(url) source code
 
_spawn_fetch(settings, args, **kwargs)
Spawn a process with appropriate settings for fetching, including userfetch and selinux support.
source code
 
_userpriv_test_write_file(settings, file_path)
Drop privileges and try to open a file for writing.
source code
 
_checksum_failure_temp_file(distdir, basename)
First try to find a duplicate temp file with the same checksum and return that filename if available.
source code
 
_check_digests(filename, digests, show_errors=1)
Check digests and display a message if an error occurs.
source code
 
_check_distfile(filename, digests, eout, show_errors=1, hash_filter=None)
@return a tuple of (match, stat_obj) where match is True if filename matches all given digests (if any) and stat_obj is a stat result, or None if the file does not exist.
source code
 
fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir='.locks', use_locks=1, try_mirrors=1, digests=None, allow_missing_digests=True)
fetch files.
source code
Variables [hide private]
  _userpriv_spawn_kwargs = (('uid', 250), ('gid', 250), ('groups...
  _userpriv_test_write_file_cache = {}
  _userpriv_test_write_cmd_script = '>> %(file_path)s 2>/dev/nul...
  _fetch_resume_size_re = re.compile(r'(^\d+)([KMGTPEZY]?$)')
  _size_suffix_map = {'': 0, 'E': 60, 'G': 30, 'K': 10, 'M': 20,...
  __package__ = 'portage.package.ebuild'

Imports: errno, io, logging, random, re, stat, sys, tempfile, urlparse, portage, OrderedDict, os, selinux, shutil, _encodings, _shell_quote, _unicode_encode, hashfunc_map, perform_md5, verify_all, _filter_unaccelarated_hashes, _hash_filter, _apply_hash_filter, BASH_BINARY, CUSTOM_MIRRORS_FILE, GLOBAL_CONFIG_PATH, portage_gid, portage_uid, secpass, userpriv_groups, FileNotFound, OperationNotPermitted, PortageException, TryAgain, _, lockfile, unlockfile, colorize, EOutput, apply_recursive_permissions, apply_secpass_permissions, ensure_dirs, grabdict, shlex_split, varexpand, writemsg, writemsg_level, writemsg_stdout, spawn, _doebuild_spawn, check_config_instance, config, doebuild_environment, prepare_build_dirs


Function Details [hide private]

_userpriv_test_write_file(settings, file_path)

source code 

Drop privileges and try to open a file for writing. The file may or may not exist, and the parent directory is assumed to exist. The file is removed before returning.

Parameters:
  • settings - A config instance which is passed to _spawn_fetch()
  • file_path - A file path to open and write.
Returns:
True if write succeeds, False otherwise.

_checksum_failure_temp_file(distdir, basename)

source code 

First try to find a duplicate temp file with the same checksum and return that filename if available. Otherwise, use mkstemp to create a new unique filename._checksum_failure_.$RANDOM, rename the given file, and return the new filename. In any case, filename will be renamed or removed before this function returns a temp filename.

_check_digests(filename, digests, show_errors=1)

source code 

Check digests and display a message if an error occurs. @return True if all digests match, False otherwise.

fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir='.locks', use_locks=1, try_mirrors=1, digests=None, allow_missing_digests=True)

source code 

fetch files. Will use digest file if available.


Variables Details [hide private]

_userpriv_spawn_kwargs

Value:
(('uid', 250), ('gid', 250), ('groups', [250]), ('umask', 2))

_userpriv_test_write_cmd_script

Value:
'>> %(file_path)s 2>/dev/null ; rval=$? ; rm -f  %(file_path)s ; exit \
$rval'

_size_suffix_map

Value:
{'': 0,
 'E': 60,
 'G': 30,
 'K': 10,
 'M': 20,
 'P': 50,
 'T': 40,
 'Y': 80,
...