Skip to contentSkip to conversation

package_manager.py: Adjust error message order

PATCH In review Mark Hatle 3 participants 4 messages Sep 15, 2016 – Sep 16, 2016

lore
Share & tools
lore

Mark Hatle

author
#0 lore raw

PATCH 1/2 package_manager.py: Adjust error message order

Move the debug before the error (as it can take many pages.) This makes it much easier for the user to see the actual error message as it is still on the screen.

---
 meta/lib/oe/package_manager.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
meta/lib/oe/package_manager.py +4 -4
index 2802254..d609593 100644
@@ -838,10 +838,10 @@ class RpmPM(PackageManager):
                     new_pkg = self._search_pkg_name_in_feeds(subst, feed_archs)
                     if not new_pkg:
                         # Failed to translate, package not found!
-                        err_msg = '%s not found in the %s feeds (%s).\n' % \
+                        err_msg = '%s not found in the %s feeds (%s).' % \
                                   (pkg, mlib, " ".join(feed_archs))
                         if not attempt_only:
-                            err_msg += " ".join(self.fullpkglist)
+                            bb.error("List of available packages: " + " ".join(self.fullpkglist))
                             bb.fatal(err_msg)
                         bb.warn(err_msg)
                     else:
@@ -855,10 +855,10 @@ class RpmPM(PackageManager):
                 default_archs = self.ml_prefix_list['default']
                 new_pkg = self._search_pkg_name_in_feeds(pkg, default_archs)
                 if not new_pkg:
-                    err_msg = '%s not found in the base feeds (%s).\n' % \
+                    err_msg = '%s not found in the feeds (%s).' % \
                               (pkg, ' '.join(default_archs))
                     if not attempt_only:
-                        err_msg += " ".join(self.fullpkglist)
+                        bb.error("List of available packages: " + " ".join(self.fullpkglist))
                         bb.fatal(err_msg)
                     bb.warn(err_msg)
                 else:
Signature · 1 line
2.5.5
author
#1 lore raw

PATCH 2/2 package_manager.py: Change diagnostic messages per IRC

Based on a discussion with IRC user: Ulfalizer

It was suggested that removing the diagnostic list, and replacing it with a simple hint to what might be causing the problem was a better solution.

---
 meta/lib/oe/package_manager.py | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
meta/lib/oe/package_manager.py +12 -8
index d609593..dc88f62 100644
@@ -838,11 +838,13 @@ class RpmPM(PackageManager):
                     new_pkg = self._search_pkg_name_in_feeds(subst, feed_archs)
                     if not new_pkg:
                         # Failed to translate, package not found!
-                        err_msg = '%s not found in the %s feeds (%s).' % \
-                                  (pkg, mlib, " ".join(feed_archs))
+                        err_msg = '%s not found in the %s feeds (%s) in %s.' % \
+                                  (pkg, mlib, " ".join(feed_archs), self.d.getVar('DEPLOY_DIR_RPM', True))
                         if not attempt_only:
-                            bb.error("List of available packages: " + " ".join(self.fullpkglist))
-                            bb.fatal(err_msg)
+                            bb.error(err_msg)
+                            bb.fatal("This is often caused by an empty package declared " \
+                                     "in a recipe's PACKAGES variable. (Empty packages are " \
+                                     "not constructed unless ALLOW_EMPTY_<pkg> = '1' is used.)")
                         bb.warn(err_msg)
                     else:
                         new_pkgs.append(new_pkg)
@@ -855,11 +857,13 @@ class RpmPM(PackageManager):
                 default_archs = self.ml_prefix_list['default']
                 new_pkg = self._search_pkg_name_in_feeds(pkg, default_archs)
                 if not new_pkg:
-                    err_msg = '%s not found in the feeds (%s).' % \
-                              (pkg, ' '.join(default_archs))
+                    err_msg = '%s not found in the feeds (%s) in %s.' % \
+                                  (pkg, " ".join(default_archs), self.d.getVar('DEPLOY_DIR_RPM', True))
                     if not attempt_only:
-                        bb.error("List of available packages: " + " ".join(self.fullpkglist))
-                        bb.fatal(err_msg)
+                        bb.error(err_msg)
+                        bb.fatal("This is often caused by an empty package declared " \
+                                 "in a recipe's PACKAGES variable. (Empty packages are " \
+                                 "not constructed unless ALLOW_EMPTY_<pkg> = '1' is used.)")
                     bb.warn(err_msg)
                 else:
                     new_pkgs.append(new_pkg)
Signature · 1 line
2.5.5
#2 lore raw

Re: [PATCH 2/2] package_manager.py: Change diagnostic messages per IRC

Quoted 53 lines · Mark Hatle

Based on a discussion with IRC user: Ulfalizer

It was suggested that removing the diagnostic list, and replacing it with a simple hint to what might be causing the problem was a better solution.

---
 meta/lib/oe/package_manager.py | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
meta/lib/oe/package_manager.py +12 -9
index d609593..dc88f62 100644
@@ -838,11 +838,13 @@ class RpmPM(PackageManager):
                     new_pkg = self._search_pkg_name_in_feeds(subst, feed_archs)
                     if not new_pkg:
                         # Failed to translate, package not found!
-                        err_msg = '%s not found in the %s feeds (%s).' % \
-                                  (pkg, mlib, " ".join(feed_archs))
+                        err_msg = '%s not found in the %s feeds (%s) in %s.' % \
+                                  (pkg, mlib, " ".join(feed_archs), self.d.getVar('DEPLOY_DIR_RPM', True))
                         if not attempt_only:
-                            bb.error("List of available packages: " + " ".join(self.fullpkglist))
-                            bb.fatal(err_msg)
+                            bb.error(err_msg)
+                            bb.fatal("This is often caused by an empty package declared " \
+                                     "in a recipe's PACKAGES variable. (Empty packages are " \
+                                     "not constructed unless ALLOW_EMPTY_<pkg> = '1' is used.)")
                         bb.warn(err_msg)
                     else:
                         new_pkgs.append(new_pkg)
@@ -855,11 +857,13 @@ class RpmPM(PackageManager):
                 default_archs = self.ml_prefix_list['default']
                 new_pkg = self._search_pkg_name_in_feeds(pkg, default_archs)
                 if not new_pkg:
-                    err_msg = '%s not found in the feeds (%s).' % \
-                              (pkg, ' '.join(default_archs))
+                    err_msg = '%s not found in the feeds (%s) in %s.' % \
+                                  (pkg, " ".join(default_archs), self.d.getVar('DEPLOY_DIR_RPM', True))
                     if not attempt_only:
-                        bb.error("List of available packages: " + " ".join(self.fullpkglist))
-                        bb.fatal(err_msg)
+                        bb.error(err_msg)
+                        bb.fatal("This is often caused by an empty package declared " \
+                                 "in a recipe's PACKAGES variable. (Empty packages are " \
+                                 "not constructed unless ALLOW_EMPTY_<pkg> = '1' is used.)")
                     bb.warn(err_msg)
                 else:
                     new_pkgs.append(new_pkg)
--

2.5.5

Quoted 5 lines

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Looks good to me.

Maybe the hint could be stored in a variable to avoid repeating it, or a helper function factored out. ALLOW_EMPTY_<pkg> = "1" instead of '1' avoids encouraging random single quotes in files too.

Cheers,
Ulf

#3 lore raw

Re: [PATCH 2/2] package_manager.py: Change diagnostic messages per IRC

In reply to Mark Hatle
Quoted 47 lines · On Thu, 15 Sep 2016 17:47:39 Mark Hatle wrote:

Based on a discussion with IRC user: Ulfalizer

It was suggested that removing the diagnostic list, and replacing it with a simple hint to what might be causing the problem was a better solution.

---
 meta/lib/oe/package_manager.py | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
meta/lib/oe/package_manager.py +0 -0
index d609593..dc88f62 100644
@@ -838,11 +838,13 @@ class RpmPM(PackageManager):
                     new_pkg = self._search_pkg_name_in_feeds(subst,

feed_archs) if not new_pkg:
# Failed to translate, package not found!

meta/lib/oe/package_manager.py +1 -2
-                        err_msg = '%s not found in the %s feeds (%s).' % \
-                                  (pkg, mlib, " ".join(feed_archs))
+                        err_msg = '%s not found in the %s feeds (%s) in

%s.' % \ + (pkg, mlib, "
".join(feed_archs), self.d.getVar('DEPLOY_DIR_RPM', True)) if not attempt_only:
- bb.error("List of available packages: " + "
".join(self.fullpkglist)) - bb.fatal(err_msg)

meta/lib/oe/package_manager.py +2 -0
+                            bb.error(err_msg)
+                            bb.fatal("This is often caused by an empty

package declared " \ + "in a recipe's
PACKAGES variable. (Empty packages are " \ +
"not constructed unless ALLOW_EMPTY_<pkg> = '1' is used.)")
bb.warn(err_msg)
else:
new_pkgs.append(new_pkg)

meta/lib/oe/package_manager.py +0 -0
@@ -855,11 +857,13 @@ class RpmPM(PackageManager):
                 default_archs = self.ml_prefix_list['default']
                 new_pkg = self._search_pkg_name_in_feeds(pkg,

default_archs) if not new_pkg:

meta/lib/oe/package_manager.py +2 -2
-                    err_msg = '%s not found in the feeds (%s).' % \
-                              (pkg, ' '.join(default_archs))
+                    err_msg = '%s not found in the feeds (%s) in %s.' % \
+                                  (pkg, " ".join(default_archs),

self.d.getVar('DEPLOY_DIR_RPM', True)) if not attempt_only:
- bb.error("List of available packages: " + "
".join(self.fullpkglist)) - bb.fatal(err_msg)

meta/lib/oe/package_manager.py +2 -0
+                        bb.error(err_msg)
+                        bb.fatal("This is often caused by an empty package
Quoted 5 lines

declared " \ + "in a recipe's PACKAGES
variable. (Empty packages are " \ + "not
constructed unless ALLOW_EMPTY_<pkg> = '1' is used.)") bb.warn(err_msg)
else:
new_pkgs.append(new_pkg)

Thanks for sorting this out - it's always bothered me a little bit every time I came across it (no doubt this came across in our discussion, I hope I wasn't too impertinent).

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre