Merged from trunk -r13831:13839
authorFabian Groffen <grobian@gentoo.org>
Wed, 22 Jul 2009 17:32:51 +0000 (17:32 -0000)
committerFabian Groffen <grobian@gentoo.org>
Wed, 22 Jul 2009 17:32:51 +0000 (17:32 -0000)
   | 13832   | For unsatisfied USE dependencies, do not backtrack if only   |
   | zmedico | USE have to change in order to be satisfied. Thanks to       |
   |         | Thomas Sachau <tommy@gentoo.org> fo reporting.               |

   | 13833   | For consistency with emake, add ${MAKEOPTS} ${EXTRA_EMAKE}   |
   | zmedico | to make arguments inside einstall. Also, force -j1 in order  |
   |         | to override any --jobs settings from MAKEOPTS. Thanks to     |
   |         | Diego Pettenò <flameeyes@gentoo.org> for the suggestion.    |

   | 13834   | Use readlines() to optimize performance. Thanks to Marat     |
   | zmedico | Radchenko <slonopotamusorama@gmail.com> for this patch from  |
   |         | bug #276813.                                                 |

   | 13835   | In _check_manifests(), skip uninstall operations.            |
   | zmedico |                                                              |

   | 13836   | Use codecs.open for unicode support in FileLoader.load().    |
   | zmedico |                                                              |

   | 13837   | In grablines(), specify encoding=sys.getdefaultencoding() in |
   | zmedico | the codecs.open() parameters, since otherwise readlines      |
   |         | doesn't return unicode (at least in some cases, observed     |
   |         | with python-2.6.2). Also, fix grabfile() to return unicode   |
   |         | when it normalizes whitespace.                               |

   | 13838   | Fix Scheduler bug: the scheduler was adding prefetcher even  |
   | volkmar | for uninstall tasks                                          |

   | 13839   | Make portage.listdir() and dbapi.cp_list() return unicode.   |
   | zmedico |                                                              |

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

bin/ebuild.sh
pym/_emerge/Scheduler.py
pym/_emerge/depgraph.py
pym/portage/__init__.py
pym/portage/cache/flat_hash.py
pym/portage/cache/metadata.py
pym/portage/dbapi/porttree.py
pym/portage/dbapi/vartree.py
pym/portage/env/loaders.py
pym/portage/util.py

index eef0d5f8ca6976e558fcafd2c09c8f249d534da2..fc43d7f5ac725139eb600b07f57c644af2e448e8 100755 (executable)
@@ -568,6 +568,7 @@ einstall() {
                                mandir="${ED}usr/share/man" \
                                sysconfdir="${ED}etc" \
                                ${LOCAL_EXTRA_EINSTALL} \
+                               ${MAKEOPTS} ${EXTRA_EMAKE} -j1 \
                                "$@" install
                fi
                ${MAKE:-make} prefix="${ED}usr" \
@@ -577,6 +578,7 @@ einstall() {
                        mandir="${ED}usr/share/man" \
                        sysconfdir="${ED}etc" \
                        ${LOCAL_EXTRA_EINSTALL} \
+                       ${MAKEOPTS} ${EXTRA_EMAKE} -j1 \
                        "$@" install || die "einstall failed"
        else
                die "no Makefile found"
index cb5db078b912dd4bd9702e3cb9b797e0cd0ac720..79bbaebd656cd195e44f97354a764555ac3366d2 100644 (file)
@@ -608,6 +608,9 @@ class Scheduler(PollScheduler):
                                x.type_name != "ebuild":
                                continue
 
+                       if x.operation == "uninstall":
+                               continue
+
                        if not shown_verifying_msg:
                                shown_verifying_msg = True
                                self._status_msg("Verifying ebuild manifests")
@@ -636,6 +639,8 @@ class Scheduler(PollScheduler):
                        # at the beginning, which annoy users, never
                        # spawn a prefetcher for the first package.
                        for pkg in self._mergelist[1:]:
+                               if pkg.operation == "uninstall":
+                                       continue
                                prefetcher = self._create_prefetcher(pkg)
                                if prefetcher is not None:
                                        self._task_queues.fetch.add(prefetcher)
index b05cb46e56c4c24024ef6677cb50cddcd86bdd3a..a92888d00392eec4bb9b3de9df59b3dbdc234c06 100644 (file)
@@ -666,10 +666,22 @@ class depgraph(object):
                                                        self._dynamic_config._runtime_pkg_mask[
                                                        dep.parent]), noiselevel=-1)
                                else:
-                                       self._dynamic_config._runtime_pkg_mask.setdefault(
-                                               dep.parent, {})["missing dependency"] = \
-                                                       set([(dep.parent, dep.atom)])
-                                       self._dynamic_config._need_restart = True
+                                       # Do not backtrack if only USE have to be changed in
+                                       # order to satisfy the dependency.
+                                       atom_without_use = dep.atom
+                                       if dep.atom.use:
+                                               atom_without_use = portage.dep.remove_slot(dep.atom)
+                                               if dep.atom.slot:
+                                                       atom_without_use += ":" + dep.atom.slot
+                                               atom_without_use = portage.dep.Atom(atom_without_use)
+                                       dep_pkg, existing_node = \
+                                               self._select_package(dep.root, atom_without_use,
+                                                       onlydeps=dep.onlydeps)
+                                       if dep_pkg is None:
+                                               self._dynamic_config._runtime_pkg_mask.setdefault(
+                                                       dep.parent, {})["missing dependency"] = \
+                                                               set([(dep.parent, dep.atom)])
+                                               self._dynamic_config._need_restart = True
 
                        return 0
                # In some cases, dep_check will return deps that shouldn't
index 307a278bb03db1640f59514b1958c6ee9d2910a1..6fb82381f33fc4fcf5be3f491c345676bb393890 100644 (file)
@@ -247,6 +247,8 @@ def cacheddir(my_original_path, ignorecvs, ignorelist, EmptyOnError, followSymli
                        raise portage.exception.PermissionDenied(mypath)
                ftype = []
                for x in list:
+                       if not isinstance(x, unicode):
+                               x = unicode(x, errors='replace')
                        try:
                                if followSymlinks:
                                        pathstat = os.stat(mypath+"/"+x)
index 71ddf6023afc0387139053166e00fdbbcc918d5c..c3c5955fb211b4c970e812e087b3838714bf8bcd 100644 (file)
@@ -29,7 +29,7 @@ class database(fs_template.FsBased):
                try:
                        myf = codecs.open(fp, mode='r', encoding='utf_8', errors='replace')
                        try:
-                               d = self._parse_data(myf, cpv)
+                               d = self._parse_data(myf.readlines(), cpv)
                                if '_mtime_' not in d:
                                        # Backward compatibility with old cache
                                        # that uses mtime mangling.
index 724dce3ccbcbaa2a8e42d06a9c2aeb647835bc76..b51bf980f0ea0b8a245a8c4c7418f4ab5bd4fe2c 100644 (file)
@@ -34,7 +34,6 @@ class database(flat_hash.database):
 
        def _parse_data(self, data, cpv):
                _hashed_re_match = self._hashed_re.match
-               data = list(data)
                d = {}
 
                for line in data:
index e29377f72304c139b3136081fd0d36038ee6dd9a..1fd5938113adb539d0d4ff7e507f0b0101c9fe88 100644 (file)
@@ -873,6 +873,8 @@ class portdbapi(dbapi):
                        except OSError:
                                continue
                        for x in file_list:
+                               if not isinstance(x, unicode):
+                                       x = unicode(x, errors='replace')
 
                                pf = None
                                if glep55:
index c96cf2acca1ca47960ab1b6dd753620194e1e430..11ce804ddda6089da84d419571adaff8189dc11f 100644 (file)
@@ -1420,6 +1420,8 @@ class vardbapi(dbapi):
 
                returnme = []
                for x in dir_list:
+                       if not isinstance(x, unicode):
+                               x = unicode(x, errors='replace')
                        if self._excluded_dirs.match(x) is not None:
                                continue
                        ps = pkgsplit(x)
@@ -1451,7 +1453,8 @@ class vardbapi(dbapi):
                else:
                        def listdir(p, **kwargs):
                                try:
-                                       return [x for x in os.listdir(p) \
+                                       return [isinstance(x, unicode) and x or \
+                                               unicode(x, errors='replace') for x in os.listdir(p) \
                                                if os.path.isdir(os.path.join(p, x))]
                                except EnvironmentError, e:
                                        if e.errno == PermissionDenied.errno:
index 31d3b09aa6acb4e906c2fb28d2c21c00db0dd84b..7cd2600aefd237224ab9ce98cdb5bad6d22ade16 100644 (file)
@@ -3,6 +3,7 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
+import codecs
 import os
 import stat
 from portage.localization import _
@@ -138,7 +139,7 @@ class FileLoader(DataLoader):
                # once, which may be expensive due to digging in child classes.
                func = self.lineParser
                for fn in RecursiveFileLoader(self.fname):
-                       f = open(fn)
+                       f = codecs.open(fn, mode='r', errors='replace')
                        for line_num, line in enumerate(f):
                                func(line, line_num, data, errors)
                return (data, errors)
index c7c2387d412dbfe8340820b7cab19454240c69e9..fc69d7aef56d173dbf5b08f92b03b4ee0402b297 100644 (file)
@@ -104,7 +104,7 @@ def grabfile(myfilename, compat_level=0, recursive=0):
        for x in mylines:
                #the split/join thing removes leading and trailing whitespace, and converts any whitespace in the line
                #into single spaces.
-               myline=" ".join(x.split())
+               myline = u' '.join(x.split())
                if not len(myline):
                        continue
                if myline[0]=="#":
@@ -318,7 +318,8 @@ def grablines(myfilename,recursive=0):
                                        os.path.join(myfilename, f), recursive))
        else:
                try:
-                       myfile = codecs.open(myfilename, mode='r', errors='replace')
+                       myfile = codecs.open(myfilename, mode='r',
+                               encoding=sys.getdefaultencoding(), errors='replace')
                        mylines = myfile.readlines()
                        myfile.close()
                except IOError, e: