rpms/yum/devel yum-big-head.patch,1.3,1.4 yum.spec,1.208,1.209

Seth Vidal (skvidal) fedora-extras-commits at redhat.com
Mon Apr 14 17:09:19 UTC 2008


Author: skvidal

Update of /cvs/extras/rpms/yum/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv9816

Modified Files:
	yum-big-head.patch yum.spec 
Log Message:
more fixes from Jantill and Timlau for all sorta of the unicode/translation
insanity



yum-big-head.patch:

View full diff with command:
/usr/bin/cvs -f diff  -kk -u -N -r 1.3 -r 1.4 yum-big-head.patch
Index: yum-big-head.patch
===================================================================
RCS file: /cvs/extras/rpms/yum/devel/yum-big-head.patch,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- yum-big-head.patch	11 Apr 2008 17:52:43 -0000	1.3
+++ yum-big-head.patch	14 Apr 2008 17:08:45 -0000	1.4
@@ -1,3 +1,15 @@
+diff --git a/Makefile b/Makefile
+index 48b7333..f9e8d76 100644
+--- a/Makefile
++++ b/Makefile
+@@ -46,6 +46,7 @@ doccheck:
+ 
+ test:
+ 	@nosetests -i ".*test" test
++	@test/check-po-yes-no.py
+ 
+ check: test
+ 
 diff --git a/callback.py b/callback.py
 index e147b05..4d75a08 100644
 --- a/callback.py
@@ -12,10 +24,10 @@
  class RPMInstallCallback:
  
 diff --git a/cli.py b/cli.py
-index 741fcc7..f4c044f 100644
+index 741fcc7..0454c9a 100644
 --- a/cli.py
 +++ b/cli.py
-@@ -40,7 +40,7 @@ import rpmUtils.arch
+@@ -40,11 +40,13 @@ import rpmUtils.arch
  from rpmUtils.arch import isMultiLibArch
  import rpmUtils.miscutils
  from yum.packages import parsePackages, YumLocalPackage
@@ -24,7 +36,13 @@
  from yum.rpmtrans import RPMTransaction
  import signal
  import yumcommands
-@@ -381,7 +381,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+ 
++from yum.misc import to_unicode
++
+ def sigquit(signum, frame):
+     """ SIGQUIT handler for the yum cli. """
+     print >> sys.stderr, "Quit signal sent - exiting immediately"
+@@ -381,7 +383,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          tt_st = time.time()            
          self.verbose_logger.log(yum.logginglevels.INFO_2,
              _('Running Transaction Test'))
@@ -33,8 +51,68 @@
              self.tsInfo.probFilterFlags.append(rpm.RPMPROB_FILTER_DISKSPACE)
              
          
+@@ -682,6 +684,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+             
+         searchlist = ['name', 'summary', 'description', 'url']
+         dups = self.conf.showdupesfromrepos
++        args = map(to_unicode, args)
+         matching = self.searchGenerator(searchlist, args,
+                                         showdups=dups, keys=True)
+         
+@@ -896,11 +899,11 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
+ 
+     def usage(self):
+         ''' Print out command line usage '''
+-        self.optparser.print_help()
++        sys.stdout.write(self.optparser.format_help())
+ 
+     def shellUsage(self):
+         ''' Print out the shell usage '''
+-        self.optparser.print_usage()
++        sys.stdout.write(self.optparser.get_usage())
+     
+     def _installable(self, pkg, ematch=False):
+ 
+@@ -1088,6 +1091,10 @@ class YumOptionParser(OptionParser):
+             root = '/'
+         return root
+ 
++    def _wrapOptParseUsage(self, opt, value, parser, *args, **kwargs):
++        self.base.usage()
++        self.exit()
++
+     def _addYumBasicOptions(self):
+         def repo_optcb(optobj, opt, value, parser):
+             '''Callback for the enablerepo and disablerepo option. 
+@@ -1098,7 +1105,16 @@ class YumOptionParser(OptionParser):
+             dest = eval('parser.values.%s' % optobj.dest)
+             dest.append((opt, value))
+ 
+-        
++
++        # Note that we can't use the default action="help" because of the
++        # fact that print_help() unconditionally does .encode() ... which is
++        # bad on unicode input.
++        self.conflict_handler = "resolve"
++        self.add_option("-h", "--help", action="callback",
++                        callback=self._wrapOptParseUsage, 
++                help=_("show this help message and exit"))
++        self.conflict_handler = "error"
++
+         self.add_option("-t", "--tolerant", action="store_true",
+                 help=_("be tolerant of errors"))
+         self.add_option("-C", dest="cacheonly", action="store_true",
+@@ -1119,7 +1135,7 @@ class YumOptionParser(OptionParser):
+         self.add_option("-q", "--quiet", dest="quiet", action="store_true",
+                         help=_("quiet operation"))
+         self.add_option("-v", "--verbose", dest="verbose", action="store_true",
+-                        help="verbose operation")
++                        help=_("verbose operation"))
+         self.add_option("-y", dest="assumeyes", action="store_true",
+                 help=_("answer yes for all questions"))
+         self.add_option("--version", action="store_true", 
 diff --git a/output.py b/output.py
-index 532a06e..4d835a8 100644
+index 532a06e..3ef850d 100644
 --- a/output.py
 +++ b/output.py
 @@ -23,13 +23,13 @@ import logging
@@ -62,7 +140,29 @@
          keylen = len(key)
          cols = self.term.columns
          nxt = ' ' * (keylen - 2) + ': '
-@@ -747,7 +747,7 @@ class YumCliRPMCallBack(RPMBaseCallback):
+@@ -266,7 +266,7 @@ class YumOutput:
+         return ret
+     
+     def fmtSection(self, name, fill='='):
+-        name = str(name)
++        name = to_str(name)
+         cols = self.term.columns - 2
+         name_len = len(name)
+         if name_len >= (cols - 4):
+@@ -349,9 +349,11 @@ class YumOutput:
+ 
+         while True:
+             try:
+-                choice = raw_input(_('Is this ok [y/N]: ').encode("utf-8"))
++                choice = raw_input(_('Is this ok [y/N]: '))
+             except UnicodeEncodeError:
+                 raise
++            except UnicodeDecodeError:
++                raise
+             except:
+                 choice = ''
+             choice = choice.lower()
+@@ -747,7 +749,7 @@ class YumCliRPMCallBack(RPMBaseCallback):
              fmt = self._makefmt(percent, ts_current, ts_total)
              msg = fmt % (process, pkgname)
              if msg != self.lastmsg:
@@ -71,7 +171,7 @@
                  sys.stdout.flush()
                  self.lastmsg = msg
              if te_current == te_total:
-@@ -755,7 +755,7 @@ class YumCliRPMCallBack(RPMBaseCallback):
+@@ -755,7 +757,7 @@ class YumCliRPMCallBack(RPMBaseCallback):
  
      def scriptout(self, package, msgs):
          if msgs:
@@ -3339,86 +3439,1319 @@
  msgid "Import of key(s) didn't help, wrong key(s)?"
  msgstr "L'import de la (des) clé(s) n'a pas résolu le problème, mauvaise(s) clé(s) ?"
  
--#: ../yum/__init__.py:2693
-+#: ../yum/__init__.py:2727
- msgid "Unable to find a suitable mirror."
- msgstr "Impossible de trouver un miroir adapté."
+-#: ../yum/__init__.py:2693
++#: ../yum/__init__.py:2727
+ msgid "Unable to find a suitable mirror."
+ msgstr "Impossible de trouver un miroir adapté."
+ 
+-#: ../yum/__init__.py:2695
++#: ../yum/__init__.py:2729
+ msgid "Errors were encountered while downloading packages."
+ msgstr "Des erreurs ont été rencontrée durant le téléchargement des paquetages."
+ 
+-#: ../yum/__init__.py:2760
++#: ../yum/__init__.py:2794
+ msgid "Test Transaction Errors: "
+ msgstr "Erreurs de la transaction de test : "
+ 
+ #. Mostly copied from YumOutput._outKeyValFill()
+-#: ../yum/plugins.py:195
++#: ../yum/plugins.py:197
+ msgid "Loaded plugins: "
+ msgstr "Modules complémentaires chargés : "
+ 
+-#: ../yum/plugins.py:206
++#: ../yum/plugins.py:208
+ #, python-format
+ msgid "No plugin match for: %s"
+ msgstr "Aucun plugin correspondant pour : %s"
+ 
+-#: ../yum/plugins.py:219
++#: ../yum/plugins.py:221
+ #, python-format
[...1641 lines suppressed...]
  import yum.plugins as plugins
 diff --git a/yum/__init__.py b/yum/__init__.py
-index 270f79f..bef88cb 100644
+index 270f79f..7bf6ff3 100644
 --- a/yum/__init__.py
 +++ b/yum/__init__.py
 @@ -63,7 +63,7 @@ warnings.simplefilter("ignore", Errors.YumFutureDeprecationWarning)
@@ -7304,17 +8929,18 @@
  from misc import to_unicode
  
  import string
-@@ -176,6 +176,9 @@ class YumBase(depsolve.Depsolve):
-                     startupconf.pluginconfpath,disabled_plugins)
+@@ -162,7 +162,9 @@ class YumBase(depsolve.Depsolve):
+             fn = '/etc/yum.conf'
  
-         self._conf = config.readMainConfig(startupconf)
-+        if self._conf.gaftonmode:
+         startupconf = config.readStartupConfig(fn, root)
+-
++        if startupconf.gaftonmode:
 +            import __builtin__
 +            __builtin__.__dict__['_'] = i18n.dummy_wrapper
- 
-         # run the postconfig plugin hook
-         self.plugins.run('postconfig')
-@@ -759,11 +762,19 @@ class YumBase(depsolve.Depsolve):
+         
+         if debuglevel != None:
+             startupconf.debuglevel = debuglevel
+@@ -759,11 +761,19 @@ class YumBase(depsolve.Depsolve):
      def runTransaction(self, cb):
          """takes an rpm callback object, performs the transaction"""
  
@@ -7335,6 +8961,15 @@
              raise Errors.YumBaseError, errstring
  
          if not self.conf.keepcache:
+@@ -2619,7 +2629,7 @@ class YumBase(depsolve.Depsolve):
+                 rawkey = urlgrabber.urlread(keyurl, limit=9999)
+             except urlgrabber.grabber.URLGrabError, e:
+                 raise Errors.YumBaseError(_('GPG key retrieval failed: ') +
+-                                          str(e))
++                                          unicode(e))
+ 
+             # Parse the key
+             try:
 diff --git a/yum/config.py b/yum/config.py
 index ea7c158..fecdfe3 100644
 --- a/yum/config.py
@@ -7397,10 +9032,10 @@
 +    import __builtin__
 +    __builtin__.__dict__['_'] = dummy_wrapper
 diff --git a/yum/misc.py b/yum/misc.py
-index 44f85d4..bc3186f 100644
+index 44f85d4..a7090c9 100644
 --- a/yum/misc.py
 +++ b/yum/misc.py
-@@ -20,11 +20,27 @@ import gpgme
+@@ -20,11 +20,29 @@ import gpgme
  
  from Errors import MiscError
  
@@ -7425,12 +9060,14 @@
 +    return store.setdefault(value, value)
 +
 +def unshare_data():
++    global _share_data_store
++    global _share_data_store_u
 +    _share_data_store   = {}
 +    _share_data_store_u = {}
  
  _re_compiled_glob_match = None
  def re_glob(s):
-@@ -515,11 +531,26 @@ def find_ts_remaining(timestamp, yumlibpath='/var/lib/yum'):
+@@ -515,11 +533,26 @@ def find_ts_remaining(timestamp, yumlibpath='/var/lib/yum'):
      
      return to_complete_items
      
@@ -7473,9 +9110,18 @@
  import fnmatch
  
 diff --git a/yum/rpmsack.py b/yum/rpmsack.py
-index c6bcbc0..8f47bab 100644
+index c6bcbc0..aa5f445 100644
 --- a/yum/rpmsack.py
 +++ b/yum/rpmsack.py
+@@ -28,7 +28,7 @@ from packageSack import PackageSackBase
+ import fnmatch
+ import re
+ 
+-from misc import to_unicode
++from misc import to_unicode_maybe
+ 
+ class RPMInstalledPackage(YumInstalledPackage):
+ 
 @@ -123,7 +123,7 @@ class RPMDBPackageSack(PackageSackBase):
          self._simple_pkgtup_list = []
          self._get_pro_cache = {}
@@ -7485,6 +9131,24 @@
          self._cache = {
              'provides' : { },
              'requires' : { },
+@@ -255,7 +255,7 @@ class RPMDBPackageSack(PackageSackBase):
+ 
+     @staticmethod
+     def _compile_patterns(patterns):
+-        if patterns is None:
++        if not patterns:
+             return None
+         ret = []
+         for pat in patterns:
+@@ -298,7 +298,7 @@ class RPMDBPackageSack(PackageSackBase):
+         count = 0
+         for s in searchstrings:
+             for field in fields:
+-                value = to_unicode(hdr[field])
++                value = to_unicode_maybe(hdr[field])
+                 if value and value.lower().find(s) != -1:
+                     count += 1
+                     break
 @@ -514,7 +514,9 @@ class RPMDBPackageSack(PackageSackBase):
          # would this ever be a ListType?
          elif type(version) in (types.TupleType, types.ListType):
@@ -7536,10 +9200,10 @@
  import operator
  
 diff --git a/yummain.py b/yummain.py
-index 8fc518d..281fc91 100755
+index 8fc518d..9421d02 100755
 --- a/yummain.py
 +++ b/yummain.py
-@@ -27,13 +27,13 @@ import time # test purposes only
+@@ -27,15 +27,27 @@ import time # test purposes only
  from yum import Errors
  from yum import plugins
  from yum import logginglevels
@@ -7551,7 +9215,62 @@
  def main(args):
      """This does all the real work"""
 -    if not sys.stdout.isatty():
++
++    # This test needs to be before locale.getpreferredencoding() as that
++    # does setlocale(LC_CTYPE, "")
++    try:
++        locale.setlocale(locale.LC_ALL, '')
++    except locale.Error, e:
++        # default to C locale if we get a failure.
++        print >> sys.stderr, 'Failed to set locale, defaulting to C'
++        os.environ['LC_ALL'] = 'C'
++        locale.setlocale(locale.LC_ALL, 'C')
++        
 +    if True: # not sys.stdout.isatty():
          import codecs
          sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout)
++        sys.stdout.errors = 'replace'
  
+     def exUserCancel():
+         logger.critical(_('\n\nExiting on user cancel'))
+@@ -60,7 +72,7 @@ def main(args):
+         return 1
+ 
+     def exFatal(e):
+-        logger.critical('\n\n%s', str(e))
++        logger.critical('\n\n%s', unicode(e))
+         if unlock(): return 200
+         return 1
+ 
+@@ -75,13 +87,6 @@ def main(args):
+     logger = logging.getLogger("yum.main")
+     verbose_logger = logging.getLogger("yum.verbose.main")
+ 
+-    try:
+-        locale.setlocale(locale.LC_ALL, '')
+-    except locale.Error, e:
+-        # default to C locale if we get a failure.
+-        print >> sys.stderr, 'Failed to set locale, defaulting to C'
+-        locale.setlocale(locale.LC_ALL, 'C')
+-        
+     # our core object for the cli
+     base = cli.YumBaseCli()
+ 
+@@ -113,7 +118,7 @@ def main(args):
+         return exPluginExit(e)
+     except Errors.YumBaseError, e:
+         result = 1
+-        resultmsgs = [str(e)]
++        resultmsgs = [unicode(e)]
+     except KeyboardInterrupt:
+         return exUserCancel()
+     except IOError, e:
+@@ -154,7 +159,7 @@ def main(args):
+         return exPluginExit(e)
+     except Errors.YumBaseError, e:
+         result = 1
+-        resultmsgs = [str(e)]
++        resultmsgs = [unicode(e)]
+     except KeyboardInterrupt:
+         return exUserCancel()
+     except IOError, e:


Index: yum.spec
===================================================================
RCS file: /cvs/extras/rpms/yum/devel/yum.spec,v
retrieving revision 1.208
retrieving revision 1.209
diff -u -r1.208 -r1.209
--- yum.spec	11 Apr 2008 17:52:43 -0000	1.208
+++ yum.spec	14 Apr 2008 17:08:45 -0000	1.209
@@ -3,7 +3,7 @@
 Summary: RPM installer/updater
 Name: yum
 Version: 3.2.14
-Release: 6%{?dist}
+Release: 7%{?dist}
 License: GPLv2+
 Group: System Environment/Base
 Source0: http://linux.duke.edu/projects/yum/download/3.2/%{name}-%{version}.tar.gz




More information about the fedora-extras-commits mailing list