Bug #220671 - Fix 'RuntimeError: Set changed size during iteration' error.
authorZac Medico <zmedico@gentoo.org>
Fri, 23 May 2008 18:51:58 +0000 (18:51 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 23 May 2008 18:51:58 +0000 (18:51 -0000)
svn path=/main/trunk/; revision=10388

pym/portage/dbapi/vartree.py

index f1923b17f4e17f305221bbec7ba373ab2b8c7984..a5d73843ad0bfef46d77d66371cab379125f83e1 100644 (file)
@@ -1779,7 +1779,9 @@ class dblink(object):
                # inject files that should be preserved into our image dir
                import shutil
                missing_paths = []
-               for x in candidates:
+               candidates_stack = list(candidates)
+               while candidates_stack:
+                       x = candidates_stack.pop()
                        # skip existing files so the 'new' libs aren't overwritten
                        if os.path.exists(os.path.join(srcroot, x.lstrip(os.sep))):
                                missing_paths.append(x)
@@ -1802,6 +1804,7 @@ class dblink(object):
                                if linktarget[0] != os.sep:
                                        linktarget = os.path.join(os.path.dirname(x), linktarget)
                                candidates.add(linktarget)
+                               candidates_stack.append(linktarget)
                        else:
                                shutil.copy2(os.path.join(destroot, x.lstrip(os.sep)),
                                        os.path.join(srcroot, x.lstrip(os.sep)))