commit:     50854d7a8d7b83e0a598f4e1258d3e063a3fe9e0
Author:     Sheng Yu <syu.os <AT> protonmail <DOT> com>
AuthorDate: Fri Sep 16 12:19:19 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Sep 20 03:39:22 2022 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=50854d7a

Fix wrong creation of empty binpkg from binhost

Bug: https://bugs.gentoo.org/870283
Signed-off-by: Sheng Yu <syu.os <AT> protonmail.com>
Closes: https://github.com/gentoo/portage/pull/901
Signed-off-by: Sam James <sam <AT> gentoo.org>

 lib/_emerge/Binpkg.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/_emerge/Binpkg.py b/lib/_emerge/Binpkg.py
index 949ac8ee7..7ce0da15f 100644
--- a/lib/_emerge/Binpkg.py
+++ b/lib/_emerge/Binpkg.py
@@ -50,6 +50,7 @@ class Binpkg(CompositeTask):
         "_pkg_path",
         "_tree",
         "_verify",
+        "_pkg_allocated_path",
     )
 
     def _writemsg_level(self, msg, level=0, noiselevel=0):
@@ -68,6 +69,7 @@ class Binpkg(CompositeTask):
         self._tree = "bintree"
         self._bintree = self.pkg.root_config.trees[self._tree]
         self._verify = not self.opts.pretend
+        self._pkg_allocated_path = None
 
         # Use realpath like doebuild_environment() does, since we assert
         # that this path is literally identical to PORTAGE_BUILDDIR.
@@ -206,6 +208,7 @@ class Binpkg(CompositeTask):
         # --getbinpkg is enabled.
         if fetcher is not None:
             self._fetched_pkg = fetcher.pkg_path
+            self._pkg_allocated_path = fetcher.pkg_allocated_path
             if self._default_exit(fetcher) != os.EX_OK:
                 self._async_unlock_builddir(returncode=self.returncode)
                 return
@@ -246,7 +249,11 @@ class Binpkg(CompositeTask):
 
         if self._fetched_pkg:
             pkg_path = self._bintree.getname(
-                self._bintree.inject(pkg.cpv, 
current_pkg_path=self._fetched_pkg),
+                self._bintree.inject(
+                    pkg.cpv,
+                    current_pkg_path=self._fetched_pkg,
+                    allocated_pkg_path=self._pkg_allocated_path,
+                ),
                 allocate_new=False,
             )
         else:

Reply via email to