Merged from trunk -r13784:13794
authorFabian Groffen <grobian@gentoo.org>
Mon, 6 Jul 2009 18:38:26 +0000 (18:38 -0000)
committerFabian Groffen <grobian@gentoo.org>
Mon, 6 Jul 2009 18:38:26 +0000 (18:38 -0000)
   | 13785   | Assume utf_8 encoding when reading raw ebuild metadata.      |
   | zmedico |                                                              |

   | 13786   | Make dblink.setfile() write environment.bz2 in binary mode.  |
   | zmedico |                                                              |

   | 13787   | Remove set operator support since the current implementation |
   | zmedico | does not meet user expectations, as mentioned in bug         |
   |         | #253802, comment #5: Package set operators currently operate |
   |         | on atoms, but what users really need is for them to operate  |
   |         | on the packages themselves. This will allow one set to add   |
   |         | or subtract packages from another even though the sets to    |
   |         | not use the exact same atoms to refer to the given packages. |
   |         | I imagine the way this should be done is to create a mapping |
   |         | of atom -> package for each set, perform the intersection    |
   |         | using the packages, and then map the package intersection    |
   |         | back into a set of atoms.                                    |

   | 13788   | Bug #276264 - Note that eclass-overrides may make it         |
   | zmedico | necessary to set                                             |
   |         | PORTAGE_RSYNC_EXTRA_OPTS="--exclude=/metadata/cache" in      |
   |         | make.conf.                                                   |

   | 13789   | Make sure avoid_update always returns existing_node if       |
   | zmedico | available.                                                   |

   | 13790   | Fix broken reference to possible_upgrades inside             |
   | zmedico | dep_zapdeps().                                               |

   | 13791   | Assume utf_8 encoding in alls reads/writes (unicode handling |
   | zmedico | required for py3k).                                          |

   | 13792   | Hardcode utf_8 encoding inside _setitem().                   |
   | zmedico |                                                              |

   | 13793   | Always exit unsuccessfully if there are any failures.        |
   | zmedico |                                                              |

   | 13794   | Use PackageSet.findAtomForPackage() when matching the        |
   | zmedico | existing node against the atom inside                        |
   |         | _select_pkg_highest_available_imp(), for PROVIDE support.    |

svn path=/main/branches/prefix/; revision=13797

man/portage.5
pym/_emerge/EbuildMetadataPhase.py
pym/_emerge/Scheduler.py
pym/_emerge/depgraph.py
pym/_emerge/main.py
pym/portage/__init__.py
pym/portage/cache/flat_hash.py
pym/portage/cache/metadata.py
pym/portage/dbapi/vartree.py

index 6f64af6bd03877210a8e30e9788327399a8d449f..3a70439956a4bcb4317592e05d2cb2a1d23281ef 100644 (file)
@@ -556,7 +556,12 @@ performed by these tools
 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
index 46db6a0f3648601a904e928bf827b417f17474cb..5d9401a07957b12295f6a2fac99b63de16495f74 100644 (file)
@@ -123,7 +123,9 @@ class EbuildMetadataPhase(SubProcess):
        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.
index 9b329a3355f2e26aa3c5394d3c179fe02b6e4c49..cb5db078b912dd4bd9702e3cb9b797e0cd0ac720 100644 (file)
@@ -926,7 +926,9 @@ class Scheduler(PollScheduler):
                                        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"])
index 96a0967c57d35799a0c63884d7f5782b1edbd1ef..47ddc4907963b5891f513b17ef975069b93aa3d2 100644 (file)
@@ -2002,6 +2002,7 @@ class depgraph(object):
                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
@@ -2137,7 +2138,9 @@ class depgraph(object):
                                                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 \
@@ -2225,6 +2228,8 @@ class depgraph(object):
 
                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
index c71f67b743da576d50a7d13ada5dd9b22e7c635a..19b9cf52476c9d9bc8e510bccd4ffe98c2ae9327 100644 (file)
@@ -671,11 +671,6 @@ def expand_set_arguments(myfiles, myaction, root_config):
        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
@@ -740,44 +735,7 @@ def expand_set_arguments(myfiles, myaction, root_config):
        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)
index 762c3c1aaa0fdb419f759631bc2d8940d15f5a77..dc47cb13a86776016998d433453216c1b99b37bf 100644 (file)
@@ -6095,7 +6095,8 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
                                        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
@@ -7188,7 +7189,7 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
                                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:
index ac1b7f190e055d6a7b527199147ca9acd6feb543..71ddf6023afc0387139053166e00fdbbcc918d5c 100644 (file)
@@ -3,6 +3,7 @@
 # License: GPL2
 # $Id$
 
+import codecs
 from portage.cache import fs_template
 from portage.cache import cache_errors
 import errno, os, stat
@@ -26,7 +27,7 @@ class database(fs_template.FsBased):
        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:
@@ -54,12 +55,14 @@ class database(fs_template.FsBased):
                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:
index e988451f4a163b5630da7910eab7f0427489ebe4..724dce3ccbcbaa2a8e42d06a9c2aeb647835bc76 100644 (file)
@@ -78,13 +78,12 @@ class database(flat_hash.database):
 
                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:
index 76d2b5d8a94f4acf74c5a73924f343e78274c1ba..62fcd9b447e284b9fa5c8d5d6624477987b9d343 100644 (file)
@@ -4549,7 +4549,10 @@ class dblink(object):
                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):