[dunfell,13/42] scripts/oe-package-browser: Handle no packages being built

Message ID 4b6d3564c09dbea3794f2915b65cbd2314ccffb6.1638136329.git.steve@sakoman.com
State Accepted, archived
Commit 4b6d3564c09dbea3794f2915b65cbd2314ccffb6
Headers show
Series [dunfell,01/42] linux-yocto/5.4: update to v5.4.154 | expand

Commit Message

Steve Sakoman Nov. 28, 2021, 9:57 p.m. UTC
From: Richard Purdie <richard.purdie@linuxfoundation.org>

Give the user a proper error message if there aren't packages built,
rather than a less friendly traceback.

[YOCTO #14619]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit b14c176b7dd74b7d63ca0f72e6e00fbf209f5a0b)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 scripts/oe-pkgdata-browser | 2 ++
 1 file changed, 2 insertions(+)

Patch

diff --git a/scripts/oe-pkgdata-browser b/scripts/oe-pkgdata-browser
index 8d223185a4..65a6ee956e 100755
--- a/scripts/oe-pkgdata-browser
+++ b/scripts/oe-pkgdata-browser
@@ -236,6 +236,8 @@  class PkgUi():
         update_deps("RPROVIDES", "Provides: ", self.provides_label, clickable=False)
 
     def load_recipes(self):
+        if not os.path.exists(pkgdata):
+            sys.exit("Error: Please ensure %s exists by generating packages before using this tool." % pkgdata)
         for recipe in sorted(os.listdir(pkgdata)):
             if os.path.isfile(os.path.join(pkgdata, recipe)):
                 self.recipe_iters[recipe] = self.recipe_store.append([recipe])