are inherently \fBnot\fR \fIsite\-specific\fR. \fBWARNING:\fR Use of
\fBrepos.conf\fR is generally not recommended since resulting changes in
eclass inheritance (especially due to \fBeclass\-overrides\fR) may trigger
-performance issues under some circumstances (see \fBbug #124041\fR).
+performance issues under some circumstances (see \fBbug #124041\fR). When
+using \fBeclass\-overrides\fR, due to bug #276264, you must ensure that
+your portage tree does not contain a metadata/cache/. For example, you
+should set PORTAGE_RSYNC_EXTRA_OPTS="\-\-exclude=/metadata/cache" in
+make.conf in order to exclude the metadata/cache/ directory during
+\fBemerge\fR(1) \-\-sync operations.
.I Example:
.nf
def _set_returncode(self, wait_retval):
SubProcess._set_returncode(self, wait_retval)
if self.returncode == os.EX_OK:
- metadata_lines = "".join(self._raw_metadata).splitlines()
+ metadata_lines = u''.join(unicode(chunk,
+ encoding='utf_8', errors='replace')
+ for chunk in self._raw_metadata).splitlines()
if len(portage.auxdbkeys) != len(metadata_lines):
# Don't trust bash's returncode if the
# number of lines is incorrect.
noiselevel=-1)
writemsg(prefix + "\n", noiselevel=-1)
- return rval
+ if self._failed_pkgs_all:
+ return 1
+ return os.EX_OK
def _elog_listener(self, mysettings, key, logentries, fulltext):
errors = portage.elog.filter_loglevels(logentries, ["ERROR"])
if not isinstance(atom, portage.dep.Atom):
atom = portage.dep.Atom(atom)
atom_cp = atom.cp
+ atom_set = InternalPackageSet(initial_atoms=(atom,))
existing_node = None
myeb = None
usepkgonly = "--usepkgonly" in self._frozen_config.myopts
e_pkg = self._dynamic_config._slot_pkg_map[root].get(pkg.slot_atom)
if not e_pkg:
break
- if portage.dep.match_from_list(atom, [e_pkg]):
+ # Use PackageSet.findAtomForPackage()
+ # for PROVIDE support.
+ if atom_set.findAtomForPackage(e_pkg):
if highest_version and \
e_pkg.cp == atom_cp and \
e_pkg < highest_version and \
if len(matched_packages) > 1:
if avoid_update:
+ if existing_node is not None:
+ return existing_node, existing_node
for pkg in matched_packages:
if pkg.installed:
return pkg, existing_node
ARG_START = "{"
ARG_END = "}"
- # WARNING: all operators must be of equal length
- IS_OPERATOR = "/@"
- DIFF_OPERATOR = "-@"
- UNION_OPERATOR = "+@"
-
for i in range(0, len(myfiles)):
if myfiles[i].startswith(SETPREFIX):
start = 0
unmerge_actions = ("unmerge", "prune", "clean", "depclean")
for a in myfiles:
- if a.startswith(SETPREFIX):
- # support simple set operations (intersection, difference and union)
- # on the commandline. Expressions are evaluated strictly left-to-right
- if IS_OPERATOR in a or DIFF_OPERATOR in a or UNION_OPERATOR in a:
- expression = a[len(SETPREFIX):]
- expr_sets = []
- expr_ops = []
- while IS_OPERATOR in expression or DIFF_OPERATOR in expression or UNION_OPERATOR in expression:
- is_pos = expression.rfind(IS_OPERATOR)
- diff_pos = expression.rfind(DIFF_OPERATOR)
- union_pos = expression.rfind(UNION_OPERATOR)
- op_pos = max(is_pos, diff_pos, union_pos)
- s1 = expression[:op_pos]
- s2 = expression[op_pos+len(IS_OPERATOR):]
- op = expression[op_pos:op_pos+len(IS_OPERATOR)]
- if not s2 in sets:
- display_missing_pkg_set(root_config, s2)
- return (None, 1)
- expr_sets.insert(0, s2)
- expr_ops.insert(0, op)
- expression = s1
- if not expression in sets:
- display_missing_pkg_set(root_config, expression)
- return (None, 1)
- expr_sets.insert(0, expression)
- result = set(setconfig.getSetAtoms(expression))
- for i in range(0, len(expr_ops)):
- s2 = setconfig.getSetAtoms(expr_sets[i+1])
- if expr_ops[i] == IS_OPERATOR:
- result.intersection_update(s2)
- elif expr_ops[i] == DIFF_OPERATOR:
- result.difference_update(s2)
- elif expr_ops[i] == UNION_OPERATOR:
- result.update(s2)
- else:
- raise NotImplementedError("unknown set operator %s" % expr_ops[i])
- newargs.extend(result)
- else:
+ if a.startswith(SETPREFIX):
s = a[len(SETPREFIX):]
if s not in sets:
display_missing_pkg_set(root_config, s)
if not mybytes[-1]:
break
os.close(pr)
- mybytes = "".join(mybytes)
+ mybytes = u''.join(unicode(chunk,
+ encoding='utf_8', errors='replace') for chunk in mybytes)
global auxdbkeys
for k, v in izip(auxdbkeys, mybytes.splitlines()):
dbkey[k] = v
else:
preferred_any_slot.append(this_choice)
elif graph_db is None:
- possible_upgrades.append(this_choice)
+ preferred_non_installed.append(this_choice)
else:
all_in_graph = True
for slot_atom in versions:
# License: GPL2
# $Id$
+import codecs
from portage.cache import fs_template
from portage.cache import cache_errors
import errno, os, stat
def _getitem(self, cpv):
fp = os.path.join(self.location, cpv)
try:
- myf = open(fp, "r")
+ myf = codecs.open(fp, mode='r', encoding='utf_8', errors='replace')
try:
d = self._parse_data(myf, cpv)
if '_mtime_' not in d:
s = cpv.rfind("/")
fp = os.path.join(self.location,cpv[:s],".update.%i.%s" % (os.getpid(), cpv[s+1:]))
try:
- myf = open(fp, 'w')
+ myf = codecs.open(fp, mode='w',
+ encoding='utf_8', errors='replace')
except (IOError, OSError), e:
if errno.ENOENT == e.errno:
try:
self._ensure_dirs(cpv)
- myf=open(fp,"w")
+ myf = codecs.open(fp, mode='w',
+ encoding='utf_8', errors='replace')
except (OSError, IOError),e:
raise cache_errors.CacheCorruption(cpv, e)
else:
new_content = []
for k in self.auxdbkey_order:
- new_content.append(unicode(values.get(k, ''), errors='replace'))
+ new_content.append(values.get(k, u''))
new_content.append(u'\n')
for i in xrange(magic_line_count - len(self.auxdbkey_order)):
new_content.append(u'\n')
new_content = u''.join(new_content)
- new_content = new_content.encode(
- sys.getdefaultencoding(), 'backslashreplace')
+ new_content = new_content.encode('utf_8', 'replace')
new_fp = os.path.join(self.location, cpv)
try:
return mydata
def setfile(self,fname,data):
- write_atomic(os.path.join(self.dbdir, fname), data)
+ mode = 'w'
+ if fname == 'environment.bz2' or not isinstance(data, basestring):
+ mode = 'wb'
+ write_atomic(os.path.join(self.dbdir, fname), data, mode=mode)
def getelements(self,ename):
if not os.path.exists(self.dbdir+"/"+ename):