Merged from trunk -r14813:14819
authorFabian Groffen <grobian@gentoo.org>
Wed, 18 Nov 2009 21:17:00 +0000 (21:17 -0000)
committerFabian Groffen <grobian@gentoo.org>
Wed, 18 Nov 2009 21:17:00 +0000 (21:17 -0000)
   | 14814   | Bug #292664 - Show ACCEPT_LICENSE in emerge --info.          |
   | zmedico |                                                              |

   | 14815   | Inside iter_owners, only cache a maximum of 25 dblink        |
   | zmedico | instances, in order to avoid potentially running out of      |
   |         | memory.                                                      |

   | 14816   | Add setup phases to the tail of the merge queue instead of   |
   | zmedico | the front, since otherwise when merging binary packages we   |
   |         | sometimes tend to get a large number of setup phases         |
   |         | flooding the queue and preventing queued installs from       |
   |         | running.                                                     |

   | 14817   | Implement dblink.__hash__ and __eq__, so that `portageq      |
   | zmedico | owners` correctly groups search results. Also, increase      |
   |         | iter_owners dblink cache size from 25 to 100 instances.      |

   | 14818   | Bug #292910 - Don't mix print() and writemsg_stdout(), in    |
   | zmedico | order to avoid buffering issues.                             |

   | 14819   | Bug #292820 - Make the Package constructor handle invalid    |
   | zmedico | SLOT values.                                                 |

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

bin/repoman
man/repoman.1
pym/_emerge/Package.py
pym/_emerge/Scheduler.py
pym/_emerge/actions.py
pym/_emerge/search.py
pym/portage/dbapi/vartree.py

index 18a37df7b34b0ff2592dc3df021d8ce2c4265189..8033a76791bc6ba8661f8549ffeedda21e4fd8a8 100755 (executable)
@@ -281,6 +281,7 @@ qahelp={
        "EAPI.definition":"EAPI is defined after an inherit call (must be defined before)",
        "EAPI.incompatible":"Ebuilds that use features that are only available with a different EAPI",
        "EAPI.unsupported":"Ebuilds that have an unsupported EAPI version (you must upgrade portage)",
+       "SLOT.invalid":"Ebuilds that have an invalid SLOT variable value",
        "SLOT.missing":"Ebuilds that have a missing or empty SLOT variable",
        "HOMEPAGE.missing":"Ebuilds that have a missing or empty HOMEPAGE variable",
        "DEPEND.bad":"User-visible ebuilds with bad DEPEND settings (matched against *visible* ebuilds)",
index 4ca110fab34972120b98365fb8ae891694203e93..5fab376b605a63e71f7ea4b676dd48321d25b476 100644 (file)
@@ -206,6 +206,8 @@ Syntax error in PROPERTIES (usually an extra/missing space/parenthesis)
 .TP
 .B RESTRICT.syntax
 Syntax error in RESTRICT (usually an extra/missing space/parenthesis)
+.B SLOT.invalid
+Ebuilds that have an invalid SLOT variable value
 .TP
 .B SLOT.missing
 Ebuilds that have a missing or empty SLOT variable
index e07c8fc4b22e980d8379f82f1d1c586a260c130c..be678185d3083cd7d690772d1999e76b51ce8b19 100644 (file)
@@ -8,7 +8,7 @@ from itertools import chain
 import portage
 from portage.cache.mappings import slot_dict_class
 from portage.dep import paren_reduce, use_reduce, \
-       paren_normalize, paren_enclose
+       paren_normalize, paren_enclose, _slot_re
 from _emerge.Task import Task
 
 if sys.hexversion >= 0x3000000:
@@ -41,7 +41,9 @@ class Package(Task):
                        self.metadata['CHOST'] = self.root_config.settings.get('CHOST', '')
                self.cp = portage.cpv_getkey(self.cpv)
                slot = self.slot
-               if not slot:
+               if _slot_re.match(slot) is None:
+                       self._invalid_metadata('SLOT.invalid',
+                               "SLOT: invalid value: '%s'" % slot)
                        # Avoid an InvalidAtom exception when creating slot_atom.
                        # This package instance will be masked due to empty SLOT.
                        slot = '0'
index 1f37a5f0c1afb6188418683dd246ff6e12ed6780..dcd2e47c7ae126d1bf5215d481de4dfbd891c863 100644 (file)
@@ -436,7 +436,7 @@ class Scheduler(PollScheduler):
                Schedule a setup phase on the merge queue, in order to
                serialize unsandboxed access to the live filesystem.
                """
-               self._task_queues.merge.addFront(setup_phase)
+               self._task_queues.merge.add(setup_phase)
                self._schedule()
 
        def _schedule_unpack(self, unpack_phase):
index 0e3a043d63d8af8a0eef47c5c97f0f5caf0ab642..6aa247c095691a1748f8175c5cca451db45bd3c1 100644 (file)
@@ -1269,7 +1269,8 @@ def action_info(settings, trees, myopts, myfiles):
                myvars = ['GENTOO_MIRRORS', 'CONFIG_PROTECT', 'CONFIG_PROTECT_MASK',
                          'PORTDIR', 'DISTDIR', 'PKGDIR', 'PORTAGE_TMPDIR',
                          'PORTDIR_OVERLAY', 'USE', 'CHOST', 'CFLAGS', 'CXXFLAGS',
-                         'ACCEPT_KEYWORDS', 'SYNC', 'FEATURES', 'EMERGE_DEFAULT_OPTS']
+                         'ACCEPT_KEYWORDS', 'ACCEPT_LICENSE', 'SYNC', 'FEATURES',
+                         'EMERGE_DEFAULT_OPTS']
 
                myvars.extend(portage.util.grabfile(settings["PORTDIR"]+"/profiles/info_vars"))
 
index f0611f28a946143c3a9b83df56cbb9624bf838fe..e5ad91da2d56ab94a4fb93a5af24bb3693c64474 100644 (file)
@@ -262,9 +262,11 @@ class search(object):
 
        def output(self):
                """Outputs the results of the search."""
-               print("\b\b  \n[ Results for search key : "+white(self.searchkey)+" ]")
-               print("[ Applications found : "+white(str(self.mlen))+" ]")
-               print(" ")
+               msg = []
+               msg.append("\b\b  \n[ Results for search key : " + \
+                       bold(self.searchkey) + " ]\n")
+               msg.append("[ Applications found : " + \
+                       bold(str(self.mlen)) + " ]\n\n")
                vardb = self.vartree.dbapi
                for mtype in self.matches:
                        for match,masked in self.matches[mtype]:
@@ -282,7 +284,6 @@ class search(object):
                                        full_package = match
                                        match        = portage.cpv_getkey(match)
                                elif mtype == "set":
-                                       msg = []
                                        msg.append(green("*") + "  " + bold(match) + "\n")
                                        if self.verbose:
                                                msg.append("      " + darkgreen("Description:") + \
@@ -295,12 +296,13 @@ class search(object):
                                                desc, homepage, license = self.portdb.aux_get(
                                                        full_package, ["DESCRIPTION","HOMEPAGE","LICENSE"])
                                        except KeyError:
-                                               print("emerge: search: aux_get() failed, skipping")
+                                               msg.append("emerge: search: aux_get() failed, skipping\n")
                                                continue
                                        if masked:
-                                               print(green("*")+"  "+white(match)+" "+red("[ Masked ]"))
+                                               msg.append(green("*") + "  " + \
+                                                       white(match) + " " + red("[ Masked ]") + "\n")
                                        else:
-                                               print(green("*")+"  "+white(match))
+                                               msg.append(green("*") + "  " + bold(match) + "\n")
                                        myversion = self.getVersion(full_package, search.VERSION_RELEASE)
 
                                        mysum = [0,0]
@@ -349,12 +351,14 @@ class search(object):
                                                file_size_str = mystr + " kB"
 
                                        if self.verbose:
-                                               msg = []
                                                if available:
-                                                       print("     ", darkgreen("Latest version available:"),myversion)
-                                               print("     ", self.getInstallationStatus(mycat+'/'+mypkg))
+                                                       msg.append("      %s %s\n" % \
+                                                               (darkgreen("Latest version available:"),
+                                                               myversion))
+                                               msg.append("      %s\n" % \
+                                                       self.getInstallationStatus(mycat+'/'+mypkg))
                                                if myebuild:
-                                                       print("      %s %s" % \
+                                                       msg.append("      %s %s\n" % \
                                                                (darkgreen("Size of files:"), file_size_str))
                                                msg.append("      " + darkgreen("Homepage:") + \
                                                        "      " + homepage + "\n")
@@ -362,7 +366,7 @@ class search(object):
                                                        + "   " + desc + "\n")
                                                msg.append("      " + darkgreen("License:") + \
                                                        "       " + license + "\n\n")
-                                               writemsg_stdout(''.join(msg), noiselevel=-1)
+               writemsg_stdout(''.join(msg), noiselevel=-1)
        #
        # private interface
        #
index c42a85ac377a5b762f90159ae943a77c9fb766d2..a2a40c540f1d7703235c11d85270d6ac7eeb29ef 100644 (file)
@@ -49,6 +49,7 @@ from portage import _unicode_encode
 from portage.cache.mappings import slot_dict_class
 
 import codecs
+from collections import deque
 import re, shutil, stat, errno, copy, subprocess
 import logging
 import os as _os
@@ -2582,12 +2583,17 @@ class vardbapi(dbapi):
                        base_names = self._vardb._aux_cache["owners"]["base_names"]
 
                        dblink_cache = {}
+                       dblink_fifo = deque()
 
                        def dblink(cpv):
                                x = dblink_cache.get(cpv)
                                if x is None:
+                                       if len(dblink_fifo) >= 100:
+                                               # Ensure that we don't run out of memory.
+                                               del dblink_cache[dblink_fifo.popleft().mycpv]
                                        x = self._vardb._dblink(cpv)
                                        dblink_cache[cpv] = x
+                                       dblink_fifo.append(x)
                                return x
 
                        for path in path_iter:
@@ -2876,6 +2882,14 @@ class dblink(object):
                self._contents_basenames = None
                self._linkmap_broken = False
                self._md5_merge_map = {}
+               self._hash_key = (self.myroot, self.mycpv)
+
+       def __hash__(self):
+               return hash(self._hash_key)
+
+       def __eq__(self, other):
+               return isinstance(other, dblink) and \
+                       self._hash_key == other._hash_key
 
        def lockdb(self):
                if self._lock_vdb: