summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-12-10 22:13:09 +0000
committerSam James <sam@gentoo.org>2023-12-10 22:29:08 +0000
commit69ce8a71cc806b4b333c2e707e7a9291c3d84664 (patch)
treea154a11856be5c09df3e67c5ffc0fa4bf1b34c74
parentNEWS: update (diff)
downloadportage-69ce8a71cc806b4b333c2e707e7a9291c3d84664.tar.gz
portage-69ce8a71cc806b4b333c2e707e7a9291c3d84664.tar.bz2
portage-69ce8a71cc806b4b333c2e707e7a9291c3d84664.zip
_emerge: BinpkgVerifier: give better error message on stale binpkg index
portage-3.0.52 defaults to FEATURES="pkgdir-index-trusted" (see NEWS) which has a few benefits, but means that manually editing PKGDIR without regenerating the index with 'emaint binhost -f' will confuse Portage. Give a better error message mentioning that command if we fail to fetch a binpkg but bintree.dbapi.cpv_exists says it should exist. Bug: https://bugs.gentoo.org/915474 Bug: https://bugs.gentoo.org/918597 Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--lib/_emerge/BinpkgVerifier.py22
1 files changed, 17 insertions, 5 deletions
diff --git a/lib/_emerge/BinpkgVerifier.py b/lib/_emerge/BinpkgVerifier.py
index a7917453a..7e044c6c4 100644
--- a/lib/_emerge/BinpkgVerifier.py
+++ b/lib/_emerge/BinpkgVerifier.py
@@ -41,11 +41,23 @@ class BinpkgVerifier(CompositeTask):
except OSError as e:
if e.errno not in (errno.ENOENT, errno.ESTALE):
raise
- self.scheduler.output(
- f"!!! Fetching Binary failed for '{self.pkg.cpv}'\n",
- log_path=self.logfile,
- background=self.background,
- )
+
+ # We might end up here with FEATURES="pkgdir-index-trusted" if
+ # binpkgs have been removed manually without refreshing the index.
+ if bintree.dbapi.cpv_exists(self.pkg.cpv):
+ self.scheduler.output(
+ f"!!! Tried to use non-existent binary for '{self.pkg.cpv}'\n"
+ + f"!!! Likely caused by an outdated index. Run 'emaint binhost -f'.\n",
+ log_path=self.logfile,
+ background=self.background,
+ )
+ else:
+ self.scheduler.output(
+ f"!!! Fetching Binary failed for '{self.pkg.cpv}'\n",
+ log_path=self.logfile,
+ background=self.background,
+ )
+
self.returncode = 1
self._async_wait()
return