Blame SOURCES/BZ-1188960-API-missing-requires.patch

d2a170
commit 423f5ee15cb0184d6583b57429ba9cb5bd8cdd35
d2a170
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
d2a170
Date:   Wed Jun 24 17:05:59 2015 +0200
d2a170
d2a170
    Plugin API update: missing_requires, pretty_output_update and promptYN fix. BZ#1188960
d2a170
d2a170
diff --git a/output.py b/output.py
d2a170
index 091b58e..5a73f8e 100755
d2a170
--- a/output.py
d2a170
+++ b/output.py
d2a170
@@ -2795,6 +2795,13 @@ to exit.
d2a170
             if lastdbv.end_rpmdbversion != rpmdbv:
d2a170
                 self._rpmdb_warn_checks()
d2a170
 
d2a170
+    @staticmethod
d2a170
+    def pretty_output_restring(restring):
d2a170
+        for msg in restring:
d2a170
+            prefix = _('Error: %s')
d2a170
+            prefix2nd = (' ' * (utf8_width(prefix) - 2))
d2a170
+            yield (prefix, msg.replace('\n', '\n' + prefix2nd))
d2a170
+
d2a170
 
d2a170
 class DepSolveProgressCallBack:
d2a170
     """A class to provide text output callback functions for Dependency Solver callback."""
d2a170
diff --git a/utils.py b/utils.py
d2a170
index dbcd605..5ba320f 100755
d2a170
--- a/utils.py
d2a170
+++ b/utils.py
d2a170
@@ -393,10 +393,8 @@ class YumUtilBase(YumBaseCli):
d2a170
             return 0
d2a170
         elif result == 1:
d2a170
             # Fatal error
d2a170
-            for msg in resultmsgs:
d2a170
-                prefix = _('Error: %s')
d2a170
-                prefix2nd = (' ' * (utf8_width(prefix) - 2))
d2a170
-                self.logger.critical(prefix, msg.replace('\n', '\n' + prefix2nd))
d2a170
+            for prefix, msg in self.pretty_output_restring(resultmsgs):
d2a170
+                self.logger.critical(prefix, msg)
d2a170
             if not self.conf.skip_broken:
d2a170
                 self.verbose_logger.info(_(" You could try using --skip-broken to work around the problem"))
d2a170
             if not self._rpmdb_warn_checks(out=self.verbose_logger.info, warn=False):
d2a170
diff --git a/yum/depsolve.py b/yum/depsolve.py
d2a170
index 797826f..a1aeac3 100644
d2a170
--- a/yum/depsolve.py
d2a170
+++ b/yum/depsolve.py
d2a170
@@ -120,6 +120,7 @@ class Depsolve(object):
d2a170
 
d2a170
         self.installedFileRequires = None
d2a170
         self.installedUnresolvedFileRequires = None
d2a170
+        self._missing_requires = False
d2a170
 
d2a170
     def doTsSetup(self):
d2a170
         """Sets up the transaction set before it is used."""
d2a170
@@ -375,6 +376,7 @@ class Depsolve(object):
d2a170
         return self._prco_req_nfv2req(req[0], req[1], req[2])
d2a170
             
d2a170
     def _err_missing_requires(self, reqPo, reqTup):
d2a170
+        self._missing_requires = True
d2a170
         if hasattr(self.dsCallback, 'format_missing_requires'):
d2a170
             msg = self.dsCallback.format_missing_requires(reqPo, reqTup)
d2a170
             if msg is not None: # PK
d2a170
diff --git a/yum/plugins.py b/yum/plugins.py
d2a170
index f34ea19..7034da9 100644
d2a170
--- a/yum/plugins.py
d2a170
+++ b/yum/plugins.py
d2a170
@@ -63,7 +63,7 @@ from yum.i18n import utf8_width
d2a170
 # API, the major version number must be incremented and the minor version number
d2a170
 # reset to 0. If a change is made that doesn't break backwards compatibility,
d2a170
 # then the minor number must be incremented.
d2a170
-API_VERSION = '2.6'
d2a170
+API_VERSION = '2.7'
d2a170
 
d2a170
 class DeprecatedInt(int):
d2a170
     """A simple int subclass that is used to check when a deprecated
d2a170
@@ -416,18 +416,22 @@ class PluginConduit:
d2a170
         converted_level = logginglevels.logLevelFromErrorLevel(level)
d2a170
         self.logger.log(converted_level, msg)
d2a170
 
d2a170
-    def promptYN(self, msg):
d2a170
+    def promptYN(self, msg, prompt=None):
d2a170
         """Return a yes or no response, either from assumeyes already
d2a170
         being set, or from prompting the user.
d2a170
 
d2a170
-        :param msg: the message to prompt the user with
d2a170
+        :param msg: the message to show to the user
d2a170
+        :param prompt: the question to ask the user (optional); defaults to 'Is this ok [y/N]: '
d2a170
         :return: 1 if the response is yes, and 0 if the response is no
d2a170
         """
d2a170
         self.info(2, msg)
d2a170
+        if self._base.conf.assumeno:
d2a170
+            return False
d2a170
         if self._base.conf.assumeyes:
d2a170
-            return 1
d2a170
+            return True
d2a170
         else:
d2a170
-            return self._base.userconfirm()
d2a170
+            kwargs = {'prompt': prompt} if prompt else {}
d2a170
+            return bool(self._base.userconfirm(**kwargs))
d2a170
 
d2a170
     def getYumVersion(self):
d2a170
         """Return a string representing the current version of yum."""
d2a170
@@ -704,6 +708,14 @@ class DepsolvePluginConduit(MainPluginConduit):
d2a170
         self.resultcode = rescode
d2a170
         self.resultstring = restring
d2a170
 
d2a170
+    @property
d2a170
+    def missing_requires(self):
d2a170
+        """Boolean indicating if depsolving failed due to missing dependencies."""
d2a170
+        return self._base._missing_requires
d2a170
+
d2a170
+    def pretty_output_restring(self):
d2a170
+        return '\n'.join(prefix % msg for prefix, msg in self._base.pretty_output_restring(self.resultstring))
d2a170
+
d2a170
 class CompareProvidersPluginConduit(MainPluginConduit):
d2a170
     """Conduit to compare different providers of packages."""
d2a170
 
d2a170
diff --git a/yummain.py b/yummain.py
d2a170
index 0c7c535..32680a8 100755
d2a170
--- a/yummain.py
d2a170
+++ b/yummain.py
d2a170
@@ -248,10 +248,8 @@ def main(args):
d2a170
         return base.exit_code
d2a170
     elif result == 1:
d2a170
         # Fatal error
d2a170
-        for msg in resultmsgs:
d2a170
-            prefix = _('Error: %s')
d2a170
-            prefix2nd = (' ' * (utf8_width(prefix) - 2))
d2a170
-            logger.critical(prefix, msg.replace('\n', '\n' + prefix2nd))
d2a170
+        for prefix, msg in base.pretty_output_restring(resultmsgs):
d2a170
+            logger.critical(prefix, msg)
d2a170
         if base._depsolving_failed:
d2a170
             if not base.conf.skip_broken:
d2a170
                 verbose_logger.info(_(" You could try using --skip-broken to work around the problem"))
d2a170
commit 1c883b65432c288ad941a362a49c15a8e4fb74b9
d2a170
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
d2a170
Date:   Mon Jun 29 16:56:13 2015 +0200
d2a170
d2a170
    Add conduit.confList to plugin API
d2a170
d2a170
diff --git a/yum/plugins.py b/yum/plugins.py
d2a170
index 7034da9..6857626 100644
d2a170
--- a/yum/plugins.py
d2a170
+++ b/yum/plugins.py
d2a170
@@ -504,6 +504,17 @@ class PluginConduit:
d2a170
         """
d2a170
         return config.getOption(self._conf, section, opt, config.BoolOption(default))
d2a170
 
d2a170
+    def confList(self, section, opt, default=None):
d2a170
+        """Read a boolean value from the plugin's own configuration file
d2a170
+
d2a170
+        :param section: configuration file section to read
d2a170
+        :param opt: option name to read
d2a170
+        :param default: value to read if the option is missing
d2a170
+        :return: boolean option value read, or *default* if the option
d2a170
+            was missing or could not be parsed
d2a170
+        """
d2a170
+        return config.getOption(self._conf, section, opt, config.ListOption(default))
d2a170
+
d2a170
     def registerPackageName(self, name):
d2a170
         """Register the name of a package to use.
d2a170