commit:     25ce021c8630fb75bab1bcce70f06fdafcd5c5a7
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 16 23:13:26 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Nov 16 23:15:12 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=25ce021c

quickpkg: fix stat sanity check for binpkg-multi-instance (bug 637902)

Fixes: 328dd4712f88 ("binpkg-multi-instance 3 of 7")
Bug: https://bugs.gentoo.org/637902

 bin/quickpkg | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/bin/quickpkg b/bin/quickpkg
index faf1eddd4..7e9aa1373 100755
--- a/bin/quickpkg
+++ b/bin/quickpkg
@@ -177,8 +177,12 @@ def quickpkg_atom(options, infos, arg, eout):
                finally:
                        if have_lock:
                                dblnk.unlockdb()
-               bintree.inject(cpv, filename=binpkg_tmpfile)
-               binpkg_path = bintree.getname(cpv)
+               pkg_info = bintree.inject(cpv, filename=binpkg_tmpfile)
+               # The pkg_info value ensures that the following getname call
+               # returns the correct path when FEATURES=binpkg-multi-instance
+               # is enabled, but fallback to cpv in case the inject call
+               # returned None due to some kind of failure.
+               binpkg_path = bintree.getname(pkg_info or cpv)
                try:
                        s = os.stat(binpkg_path)
                except OSError as e:

Reply via email to