Merged from trunk -r15350:15360
authorFabian Groffen <grobian@gentoo.org>
Fri, 19 Feb 2010 10:14:15 +0000 (10:14 -0000)
committerFabian Groffen <grobian@gentoo.org>
Fri, 19 Feb 2010 10:14:15 +0000 (10:14 -0000)
|15351  |Evaluate conditional USE deps for *DEPEND atoms saved in vdb entries.                     |
|zmedico|                                                                                          |

|15352  |Bug #304981 - Truncate the build log after successful fetch, instead of removing it, so as|
|zmedico|not to interfere with tail -f.                                                            |

|15353  |Prevent CHOST vdb entries from being created for virtual packages.                        |
|zmedico|                                                                                          |

|15354  |Make sure that config._accept_chost() accepts empty CHOST.                                |
|zmedico|                                                                                          |

|15355  |Use config.environ() instead of config.items() when spawning FETCHCOMMAND.                |
|zmedico|                                                                                          |

|15356  |Add a 'trees' parameter to portdbapi.cp_all(). Thanks to Brian Dolbec (dol-sen) for this  |
|zmedico|patch.                                                                                    |

|15357  |Add a BUILD_TIME vdb entry containing the integer number of seconds since the unix Epoch. |
|zmedico|This will be useful for creating package sets that involve comparison of installed        |
|       |packages to binary packages, especially for binhost users. See discussion here:           |
|       |http://archives.gentoo.org/gentoo-portage-dev/msg_d068a8deefd179cc23808bc23f3de200.xml    |

|15358  |Cache BUILD_TIME in vdb_metadata.pickle.                                                  |
|zmedico|                                                                                          |

|15359  |Cache BUILD_TIME in Package.metadata.                                                     |
|zmedico|                                                                                          |

|15360  |Cache BUILD_TIME in $PKGDIR/Packages and inside bindbapi.                                 |
|zmedico|                                                                                          |

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

pym/_emerge/EbuildBuildDir.py
pym/_emerge/Package.py
pym/portage/__init__.py
pym/portage/dbapi/bintree.py
pym/portage/dbapi/porttree.py
pym/portage/dbapi/vartree.py

index d9e0fbb7bbed104e14c1d1e69b31a552ab6e9455..b6fad9c14c8fdba2deb7917617f9faf9d02af12f 100644 (file)
@@ -64,10 +64,11 @@ class EbuildBuildDir(SlotObject):
        def clean_log(self):
                """Discard existing log."""
                settings = self.settings
-
-               for x in ('.logid', 'temp/build.log'):
+               log_file = settings.get('PORTAGE_LOG_FILE')
+               if log_file is not None and os.path.isfile(log_file):
+                       # Truncate rather than unlink, so tail -f still works.
                        try:
-                               os.unlink(os.path.join(settings["PORTAGE_BUILDDIR"], x))
+                               open(log_file, 'wb')
                        except OSError:
                                pass
 
index f9844ce451f9fd2854683af6dc151f208f7e1eca..df8232feb409991bfb37b8d8267a23e31c39e87b 100644 (file)
@@ -28,7 +28,7 @@ class Package(Task):
        ("_use",)
 
        metadata_keys = [
-               "CHOST", "COUNTER", "DEPEND", "EAPI",
+               "BUILD_TIME", "CHOST", "COUNTER", "DEPEND", "EAPI",
                "INHERITED", "IUSE", "KEYWORDS",
                "LICENSE", "PDEPEND", "PROVIDE", "RDEPEND",
                "repository", "PROPERTIES", "RESTRICT", "SLOT", "USE", "_mtime_",
index 6f5ec6424f0a4bd9717839e99b616ceed49986a8..5d4ffc9675a033b5cfa48771b5bbcb478de1e0b0 100644 (file)
@@ -3264,8 +3264,9 @@ class config(object):
                                                (" ".join(accept_chost), e), noiselevel=-1)
                                        self._accept_chost_re = re.compile("^$")
 
-               return self._accept_chost_re.match(
-                       metadata.get('CHOST', '')) is not None
+               pkg_chost = metadata.get('CHOST', '')
+               return not pkg_chost or \
+                       self._accept_chost_re.match(pkg_chost) is not None
 
        def setinst(self,mycpv,mydbapi):
                """This updates the preferences for old-style virtuals,
@@ -4264,7 +4265,7 @@ def _spawn_fetch(settings, args, **kwargs):
                if args[0] != BASH_BINARY:
                        args = [BASH_BINARY, "-c", "exec \"$@\"", args[0]] + args
 
-       rval = spawn_func(args, env=dict(iter(settings.items())), **kwargs)
+       rval = spawn_func(args, env=settings.environ(), **kwargs)
 
        return rval
 
@@ -5883,6 +5884,9 @@ def _post_src_install_chost_fix(settings):
        CHOST variable, so revert it to the initial
        setting.
        """
+       if settings.get('CATEGORY') == 'virtual':
+               return
+
        chost = settings.get('CHOST')
        if chost:
                write_atomic(os.path.join(settings['PORTAGE_BUILDDIR'],
@@ -5890,6 +5894,7 @@ def _post_src_install_chost_fix(settings):
 
 _vdb_use_conditional_keys = ('DEPEND', 'LICENSE', 'PDEPEND',
        'PROPERTIES', 'PROVIDE', 'RDEPEND', 'RESTRICT',)
+_vdb_use_conditional_atoms = frozenset(['DEPEND', 'PDEPEND', 'RDEPEND'])
 
 def _post_src_install_uid_fix(mysettings, out=None):
        """
@@ -6001,6 +6006,11 @@ def _post_src_install_uid_fix(mysettings, out=None):
                'w', encoding=_encodings['repo.content'],
                errors='strict').write(str(size) + '\n')
 
+       codecs.open(_unicode_encode(os.path.join(build_info_dir,
+               'BUILD_TIME'), encoding=_encodings['fs'], errors='strict'),
+               'w', encoding=_encodings['repo.content'],
+               errors='strict').write(str(int(time.time())) + '\n')
+
        use = frozenset(mysettings['PORTAGE_USE'].split())
        for k in _vdb_use_conditional_keys:
                v = mysettings.configdict['pkg'].get(k)
@@ -6012,6 +6022,16 @@ def _post_src_install_uid_fix(mysettings, out=None):
                v = dep.paren_enclose(v)
                if not v:
                        continue
+               if v in _vdb_use_conditional_atoms:
+                       v_split = []
+                       for x in v.split():
+                               try:
+                                       x = dep.Atom(x)
+                               except exception.InvalidAtom:
+                                       v_split.append(x)
+                               else:
+                                       v_split.append(str(x.evaluate_conditionals(use)))
+                       v = ' '.join(v_split)
                codecs.open(_unicode_encode(os.path.join(build_info_dir,
                        k), encoding=_encodings['fs'], errors='strict'),
                        mode='w', encoding=_encodings['repo.content'],
index 41936d813ec3ebc9fc682b69ea9678bec5d3b7fd..283981a47e62e4a861291e5f62ee50372384975a 100644 (file)
@@ -50,7 +50,7 @@ class bindbapi(fakedbapi):
                self.cpdict={}
                # Selectively cache metadata in order to optimize dep matching.
                self._aux_cache_keys = set(
-                       ["CHOST", "DEPEND", "EAPI", "IUSE", "KEYWORDS",
+                       ["BUILD_TIME", "CHOST", "DEPEND", "EAPI", "IUSE", "KEYWORDS",
                        "LICENSE", "PDEPEND", "PROPERTIES", "PROVIDE",
                        "RDEPEND", "repository", "RESTRICT", "SLOT", "USE",
                        "EPREFIX"])
@@ -189,7 +189,7 @@ class binarytree(object):
                        self._pkgindex_keys = self.dbapi._aux_cache_keys.copy()
                        self._pkgindex_keys.update(["CPV", "MTIME", "SIZE"])
                        self._pkgindex_aux_keys = \
-                               ["CHOST", "DEPEND", "DESCRIPTION", "EAPI",
+                               ["BUILD_TIME", "CHOST", "DEPEND", "DESCRIPTION", "EAPI",
                                "IUSE", "KEYWORDS", "LICENSE", "PDEPEND", "PROPERTIES",
                                "PROVIDE", "RDEPEND", "repository", "SLOT", "USE",
                                "EPREFIX"]
@@ -203,6 +203,7 @@ class binarytree(object):
                                "CHOST", "CONFIG_PROTECT", "CONFIG_PROTECT_MASK", "FEATURES",
                                "GENTOO_MIRRORS", "INSTALL_MASK", "SYNC", "USE", "EPREFIX"])
                        self._pkgindex_default_pkg_data = {
+                               "BUILD_TIME"         : "",
                                "DEPEND"  : "",
                                "EAPI"    : "0",
                                "IUSE"    : "",
@@ -1052,6 +1053,16 @@ class binarytree(object):
                                writemsg("%s: %s\n" % (k, str(e)),
                                        noiselevel=-1)
                                raise
+                       if k in portage._vdb_use_conditional_atoms:
+                               v_split = []
+                               for x in deps.split():
+                                       try:
+                                               x = portage.dep.Atom(x)
+                                       except portage.exception.InvalidAtom:
+                                               v_split.append(x)
+                                       else:
+                                               v_split.append(str(x.evaluate_conditionals(raw_use)))
+                               deps = ' '.join(v_split)
                        metadata[k] = deps
 
        def exists_specific(self, cpv):
index 5a845118daad863353dbfe744e05699a325f33ce..6012cd41411de6225ef578acbff2b98db5b54f9a 100644 (file)
@@ -901,13 +901,22 @@ class portdbapi(dbapi):
                else:
                        return 0
 
-       def cp_all(self, categories=None):
-               "returns a list of all keys in our tree"
+       def cp_all(self, categories=None, trees=None):
+               """
+               This returns a list of all keys in our tree or trees
+               @param categories: optional list of categories to search or 
+                       defaults to self.settings.categories
+               @param trees: optional list of trees to search the categories in or
+                       defaults to self.porttrees
+               @rtype list of [cat/pkg,...]
+               """
                d = {}
                if categories is None:
                        categories = self.settings.categories
+               if trees is None:
+                       trees = self.porttrees
                for x in categories:
-                       for oroot in self.porttrees:
+                       for oroot in trees:
                                for y in listdir(oroot+"/"+x, EmptyOnError=1, ignorecvs=1, dirsonly=1):
                                        if not self._pkg_dir_name_re.match(y) or \
                                                y == "CVS":
index 25f92d402386f740d42f236a9367d9bb56147a68..e054db5873c3fc00929a67d26f361bf6341c28d0 100644 (file)
@@ -1816,7 +1816,7 @@ class vardbapi(dbapi):
                        vartree = db[root]["vartree"]
                self.vartree = vartree
                self._aux_cache_keys = set(
-                       ["CHOST", "COUNTER", "DEPEND", "DESCRIPTION",
+                       ["BUILD_TIME", "CHOST", "COUNTER", "DEPEND", "DESCRIPTION",
                        "EAPI", "HOMEPAGE", "IUSE", "KEYWORDS",
                        "LICENSE", "PDEPEND", "PROPERTIES", "PROVIDE", "RDEPEND",
                        "repository", "RESTRICT" , "SLOT", "USE"])
@@ -4450,6 +4450,13 @@ class dblink(object):
 
                slot = ''
                for var_name in ('CHOST', 'SLOT'):
+                       if var_name == 'CHOST' and self.cat == 'virtual':
+                               try:
+                                       os.unlink(os.path.join(inforoot, var_name))
+                               except OSError:
+                                       pass
+                               continue
+
                        try:
                                val = codecs.open(_unicode_encode(
                                        os.path.join(inforoot, var_name),