21130996 pkg solver doesn't print error if pkg has two issues and one is not print-worthy
--- a/src/modules/client/pkg_solver.py Fri May 29 16:26:10 2015 -0700
+++ b/src/modules/client/pkg_solver.py Tue Jun 02 12:25:28 2015 -0700
@@ -2180,12 +2180,12 @@
"'{0}' dependency on {1} are "
"obsolete"), (dtype, fstr)))
else:
- sfmris = [
+ sfmris = frozenset([
fmri.get_fmri(anarchy=True,
include_build=False,
include_scheme=False)
for f in fmris
- ]
+ ])
raise DependencyException(
_TRIM_DEP_OBSOLETE,
(N_("All acceptable versions of "
@@ -2393,7 +2393,7 @@
already_seen.add(fmri)
if not verbose:
- # By default, omit packages from errors that were
+ # By default, omit packages from errors that were only
# rejected due to a newer version being installed, or
# because they didn't match user-specified input. It's
# tempting to omit _TRIM_REJECT here as well, but that
@@ -2402,14 +2402,22 @@
# is because a required dependency was rejected.
for reason_id, reason_t, fmris in \
self.__trim_dict[fmri]:
- if reason_id in (_TRIM_INSTALLED_NEWER,
+ if reason_id not in (_TRIM_INSTALLED_NEWER,
_TRIM_PROPOSED_PUB, _TRIM_PROPOSED_VER):
- omit.add(fmri)
- return
+ break
+ else:
+ omit.add(fmri)
+ return
ms = []
for reason_id, reason_t, fmris in sorted(
self.__trim_dict[fmri]):
+
+ if not verbose:
+ if reason_id in (_TRIM_INSTALLED_NEWER,
+ _TRIM_PROPOSED_PUB, _TRIM_PROPOSED_VER):
+ continue
+
if isinstance(reason_t, tuple):
reason = _(reason_t[0]).format(*reason_t[1])
else:
--- a/src/tests/cli/t_pkg_install.py Fri May 29 16:26:10 2015 -0700
+++ b/src/tests/cli/t_pkg_install.py Tue Jun 02 12:25:28 2015 -0700
@@ -2464,6 +2464,49 @@
self.pkg("verify -v")
+class TestPkgInstallUpdateSolverOutput(pkg5unittest.SingleDepotTestCase):
+ # Only start/stop the depot once (instead of for every test)
+ persistent_setup = True
+
+ octo10 = """
+ open [email protected],5.11-0
+ close
+ """
+
+ octo20 = """
+ open [email protected],5.11-0
+ close
+ """
+
+ incorp = """
+ open [email protected],5.11-0
+ add depend type=incorporate fmri=pkg:/[email protected]
+ close
+ """
+
+ def test_output_two_issues(self):
+ """ ^^^ hard to find a good name for this, it tests for bug
+ 21130996.
+ In case one pkg triggers two or more issues, one of which is not
+ considered print-worthy, we wouldn't print anything at all."""
+
+ self.pkgsend_bulk(self.rurl,
+ (self.incorp, self.octo10, self.octo20))
+ self.image_create(self.rurl)
+
+ self.pkg("install incorp octo@2")
+ self.pkg("install -v octo@1", exit=1)
+
+ # Check that the root cause for the issue is shown;
+ # the incorporation does not allow the older version.
+ self.assertTrue("[email protected]" in self.errout,
+ "Excluding incorporation not shown in solver error.")
+ # Check that the notice about a newer version already installed
+ # is ommited (it's not relevant).
+ self.assertFalse("[email protected]" in self.errout,
+ "Newer version should not be shown in solver error.")
+
+
class TestPkgInstallUpgrade(_TestHelper, pkg5unittest.SingleDepotTestCase):
# Only start/stop the depot once (instead of for every test)
persistent_setup = True