Fix broken binpkg path comparison in in binarytree.inject() so that duplicate
authorZac Medico <zmedico@gentoo.org>
Sun, 13 Jul 2008 07:30:43 +0000 (07:30 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 13 Jul 2008 07:30:43 +0000 (07:30 -0000)
entries are correctly from the Packages index.

svn path=/main/trunk/; revision=11034

pym/_emerge/__init__.py
pym/portage/dbapi/bintree.py

index ac2d63b28a72793213207c8f347a2547f7f44087..d8c5347f3cc48174b1c5c7d3846315faece574f0 100644 (file)
@@ -2760,6 +2760,8 @@ class EbuildBinpkg(EbuildPhase):
                pkg = self.pkg
                bintree = pkg.root_config.trees["bintree"]
                binpkg_tmpfile = self._binpkg_tmpfile
+               writemsg("EbuildBinpkg returncode %s binpkg_tmpfile '%s'\n" % \
+                       (self.returncode, binpkg_tmpfile))
                if self.returncode == os.EX_OK:
                        bintree.inject(pkg.cpv, filename=binpkg_tmpfile)
 
@@ -3361,7 +3363,23 @@ class PackageMerge(AsynchronousTask):
        __slots__ = ("merge",)
 
        def _start(self):
-               self.returncode = self.merge.merge()
+
+               log_path = self.merge.settings.get("PORTAGE_LOG_FILE")
+               log_file = None
+
+               orig_stdout = sys.stdout
+
+               if self.background and log_path is not None:
+                       log_file = open(log_path, 'a')
+                       sys.stdout = log_file
+
+               try:
+                       self.returncode = self.merge.merge()
+               finally:
+                       if log_file is not None:
+                               sys.stdout = orig_stdout
+                               log_file.close()
+
                self.wait()
 
 class DependencyArg(object):
@@ -8790,7 +8808,7 @@ class Scheduler(PollScheduler):
        def _build_exit(self, build):
                if build.returncode == os.EX_OK:
                        self.curval += 1
-                       merge = PackageMerge(merge=build)
+                       merge = PackageMerge(background=build.background, merge=build)
                        merge.addExitListener(self._merge_exit)
                        self._task_queues.merge.add(merge)
                else:
@@ -8926,7 +8944,7 @@ class Scheduler(PollScheduler):
                        task = self._task(pkg, background)
 
                        if pkg.installed:
-                               merge = PackageMerge(merge=task)
+                               merge = PackageMerge(background=background, merge=task)
                                merge.addExitListener(self._merge_exit)
                                task_queues.merge.add(merge)
                        elif pkg.built:
index 6de9b5d87253a81755dcc058e4ca6b3b9d73045e..86b8aba81d693086b198e41285ce2c334ad0b6fd 100644 (file)
@@ -822,7 +822,7 @@ class binarytree(object):
                                d2 = pkgindex.packages[i]
                                if d2["CPV"] != cpv:
                                        continue
-                               if d2.get("PATH") == d.get("PATH"):
+                               if d2.get("PATH", "") == d.get("PATH", ""):
                                        del pkgindex.packages[i]
                        pkgindex.packages.append(d)
                        self._update_pkgindex_header(pkgindex.header)