rpms/yum/devel yum-big-head.patch,1.2,1.3 yum.spec,1.207,1.208

Seth Vidal (skvidal) fedora-extras-commits at redhat.com
Fri Apr 11 17:53:12 UTC 2008


Author: skvidal

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

Modified Files:
	yum-big-head.patch yum.spec 
Log Message:
new big head patch with gaftonmode and fixes for randomly converting tuples



yum-big-head.patch:

Index: yum-big-head.patch
===================================================================
RCS file: /cvs/extras/rpms/yum/devel/yum-big-head.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- yum-big-head.patch	10 Apr 2008 18:08:15 -0000	1.2
+++ yum-big-head.patch	11 Apr 2008 17:52:43 -0000	1.3
@@ -1,7 +1,29 @@
+diff --git a/callback.py b/callback.py
+index e147b05..4d75a08 100644
+--- a/callback.py
++++ b/callback.py
+@@ -24,7 +24,7 @@ import sys
+ import logging
+ from yum.constants import *
+ 
+-from yum.i18n import _
++import yum.i18n
+ 
+ class RPMInstallCallback:
+ 
 diff --git a/cli.py b/cli.py
-index 741fcc7..125b09c 100644
+index 741fcc7..f4c044f 100644
 --- a/cli.py
 +++ b/cli.py
+@@ -40,7 +40,7 @@ import rpmUtils.arch
+ from rpmUtils.arch import isMultiLibArch
+ import rpmUtils.miscutils
+ from yum.packages import parsePackages, YumLocalPackage
+-from yum.i18n import _
++import yum.i18n
+ from yum.rpmtrans import RPMTransaction
+ import signal
+ import yumcommands
 @@ -381,7 +381,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
          tt_st = time.time()            
          self.verbose_logger.log(yum.logginglevels.INFO_2,
@@ -12,15 +34,22 @@
              
          
 diff --git a/output.py b/output.py
-index 532a06e..697c456 100644
+index 532a06e..4d835a8 100644
 --- a/output.py
 +++ b/output.py
-@@ -29,7 +29,7 @@ import re # For YumTerm
+@@ -23,13 +23,13 @@ import logging
+ import types
+ import gettext
+ import rpm
+-from yum.i18n import _
++import yum.i18n
+ 
+ import re # For YumTerm
  
  from urlgrabber.progress import TextMeter
  from urlgrabber.grabber import URLGrabError
 -from yum.misc import sortPkgObj, prco_tuple_to_string
-+from yum.misc import sortPkgObj, prco_tuple_to_string, to_str, to_unicode
++from yum.misc import sortPkgObj, prco_tuple_to_string, to_str, to_unicode_maybe
  from rpmUtils.miscutils import checkSignals
  from yum.constants import *
  
@@ -33,15 +62,21 @@
          keylen = len(key)
          cols = self.term.columns
          nxt = ' ' * (keylen - 2) + ': '
-@@ -755,7 +755,10 @@ class YumCliRPMCallBack(RPMBaseCallback):
+@@ -747,7 +747,7 @@ class YumCliRPMCallBack(RPMBaseCallback):
+             fmt = self._makefmt(percent, ts_current, ts_total)
+             msg = fmt % (process, pkgname)
+             if msg != self.lastmsg:
+-                sys.stdout.write(msg)
++                sys.stdout.write(to_unicode_maybe(msg))
+                 sys.stdout.flush()
+                 self.lastmsg = msg
+             if te_current == te_total:
+@@ -755,7 +755,7 @@ class YumCliRPMCallBack(RPMBaseCallback):
  
      def scriptout(self, package, msgs):
          if msgs:
 -            sys.stdout.write(msgs)
-+            if not sys.stdout.isatty():
-+                sys.stdout.write(to_unicode(msgs))
-+            else:
-+                sys.stdout.write(msgs)
++            sys.stdout.write(to_unicode_maybe(msgs))
              sys.stdout.flush()
  
      def _makefmt(self, percent, ts_current, ts_total, progress = True):
@@ -7243,11 +7278,43 @@
 +#, python-format
 +msgid "Error opening rpm %s - error %s"
 +msgstr "Greška pri otvaranju rpm-a %s - greška %s"
+diff --git a/utils.py b/utils.py
+index 9f5f4a1..82534cf 100644
+--- a/utils.py
++++ b/utils.py
+@@ -18,7 +18,7 @@ import time
+ 
+ import yum
+ from cli import *
+-from yum.i18n import _
++import yum.i18n
+ 
+ 
+ import yum.plugins as plugins
 diff --git a/yum/__init__.py b/yum/__init__.py
-index 270f79f..efd5a40 100644
+index 270f79f..bef88cb 100644
 --- a/yum/__init__.py
 +++ b/yum/__init__.py
-@@ -759,11 +759,19 @@ class YumBase(depsolve.Depsolve):
+@@ -63,7 +63,7 @@ warnings.simplefilter("ignore", Errors.YumFutureDeprecationWarning)
+ from packages import parsePackages, YumAvailablePackage, YumLocalPackage, YumInstalledPackage
+ from constants import *
+ from yum.rpmtrans import RPMTransaction,SimpleCliCallBack
+-from yum.i18n import _
++import yum.i18n
+ from misc import to_unicode
+ 
+ import string
+@@ -176,6 +176,9 @@ class YumBase(depsolve.Depsolve):
+                     startupconf.pluginconfpath,disabled_plugins)
+ 
+         self._conf = config.readMainConfig(startupconf)
++        if self._conf.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):
      def runTransaction(self, cb):
          """takes an rpm callback object, performs the transaction"""
  
@@ -7268,11 +7335,72 @@
              raise Errors.YumBaseError, errstring
  
          if not self.conf.keepcache:
+diff --git a/yum/config.py b/yum/config.py
+index ea7c158..fecdfe3 100644
+--- a/yum/config.py
++++ b/yum/config.py
+@@ -570,6 +570,7 @@ class StartupConf(BaseConfig):
+     plugins = BoolOption(False)
+     pluginpath = ListOption(['/usr/share/yum-plugins', '/usr/lib/yum-plugins'])
+     pluginconfpath = ListOption(['/etc/yum/pluginconf.d'])
++    gaftonmode = BoolOption(False)
+ 
+ class YumConf(StartupConf):
+     '''
+diff --git a/yum/depsolve.py b/yum/depsolve.py
+index 8a707bd..2012a40 100644
+--- a/yum/depsolve.py
++++ b/yum/depsolve.py
+@@ -35,7 +35,7 @@ from constants import *
+ import packages
+ import logginglevels
+ import Errors
+-from i18n import _
++import i18n
+ import warnings
+ warnings.simplefilter("ignore", Errors.YumFutureDeprecationWarning)
+ from operator import itemgetter
+diff --git a/yum/i18n.py b/yum/i18n.py
+index f735edd..84c4882 100644
+--- a/yum/i18n.py
++++ b/yum/i18n.py
+@@ -13,6 +13,12 @@
+ # along with this program; if not, write to the Free Software
+ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ 
++def dummy_wrapper(str):
++    '''
++    Dummy Translation wrapper, just returning the same string.
++    '''
++    return str
++
+ try: 
+     '''
+     Setup the yum translation domain and make _() translation wrapper
+@@ -21,15 +27,11 @@ try:
+     '''
+     import gettext
+     t = gettext.translation('yum')
+-    _ =  t.ugettext
++    t.install(unicode=True)
+ except:
+     '''
+     Something went wrong so we make a dummy _() wrapper there is just
+     returning the same text
+     '''
+-    def _(str):
+-        '''
+-        Dummy Translation wrapper, just returning the same string.
+-        '''
+-        return str
+-
++    import __builtin__
++    __builtin__.__dict__['_'] = dummy_wrapper
 diff --git a/yum/misc.py b/yum/misc.py
-index 44f85d4..c164e87 100644
+index 44f85d4..bc3186f 100644
 --- a/yum/misc.py
 +++ b/yum/misc.py
-@@ -20,11 +20,22 @@ import gpgme
+@@ -20,11 +20,27 @@ import gpgme
  
  from Errors import MiscError
  
@@ -7289,6 +7417,11 @@
 +    store = _share_data_store
 +    if isinstance(value, unicode):
 +        store = _share_data_store_u
++    # hahahah, of course the above means that:
++    #   hash(('a', 'b')) == hash((u'a', u'b'))
++    # ...which we have in deptuples, so just screw sharing those atm.
++    if type(value) == type(tuple):
++        return value
 +    return store.setdefault(value, value)
 +
 +def unshare_data():
@@ -7297,19 +7430,48 @@
  
  _re_compiled_glob_match = None
  def re_glob(s):
-@@ -522,4 +533,12 @@ def to_unicode(obj, encoding='utf-8'):
-             obj = unicode(obj, encoding)
-     return obj
- 
+@@ -515,11 +531,26 @@ def find_ts_remaining(timestamp, yumlibpath='/var/lib/yum'):
+     
+     return to_complete_items
+     
+-def to_unicode(obj, encoding='utf-8'):
++def to_unicode(obj, encoding='utf-8', errors='strict'):
+     ''' convert a 'str' to 'unicode' '''
+     if isinstance(obj, basestring):
+         if not isinstance(obj, unicode):
+-            obj = unicode(obj, encoding)
++            obj = unicode(obj, encoding, errors)
++    return obj
++
++def to_unicode_maybe(obj, encoding='utf-8', errors='replace'):
++    ''' Don't ask don't tell, only use when you must '''
++    try:
++        return to_unicode(obj, encoding, errors)
++    except UnicodeEncodeError:
++        return obj
++
 +def to_str(obj):
 +    """ Convert something to a string, if it isn't one. """
 +    # NOTE: unicode counts as a string just fine. We just want objects to call
 +    # their __str__ methods.
 +    if not isinstance(obj, basestring):
 +        obj = str(obj)
-+    return obj
-+
+     return obj
+ 
          
+diff --git a/yum/plugins.py b/yum/plugins.py
+index 0a7f57a..99c2740 100644
+--- a/yum/plugins.py
++++ b/yum/plugins.py
+@@ -31,7 +31,7 @@ import Errors
+ from parser import ConfigPreProcessor
+ 
+ from textwrap import fill
+-from i18n import _
++import i18n
+ 
+ import fnmatch
+ 
 diff --git a/yum/rpmsack.py b/yum/rpmsack.py
 index c6bcbc0..8f47bab 100644
 --- a/yum/rpmsack.py
@@ -7334,6 +7496,19 @@
              r_e = r_v = r_r = None
  
          deptup = (name, misc.share_data(flags),
+diff --git a/yum/rpmtrans.py b/yum/rpmtrans.py
+index d16af96..2fb51a2 100644
+--- a/yum/rpmtrans.py
++++ b/yum/rpmtrans.py
+@@ -24,7 +24,7 @@ import logging
+ import types
+ import sys
+ from yum.constants import *
+-from i18n import _
++import i18n
+ 
+ 
+ class NoOutputCallBack:
 diff --git a/yum/sqlitesack.py b/yum/sqlitesack.py
 index be34cdc..dfc5932 100644
 --- a/yum/sqlitesack.py
@@ -7347,3 +7522,36 @@
  
      @catchSqliteException
      def close(self):
+diff --git a/yumcommands.py b/yumcommands.py
+index 0afcf66..9dce44f 100644
+--- a/yumcommands.py
++++ b/yumcommands.py
+@@ -23,7 +23,7 @@ import os
+ import cli
+ from yum import logginglevels
+ import yum.Errors
+-from yum.i18n import _
++import yum.i18n
+ 
+ import operator
+ 
+diff --git a/yummain.py b/yummain.py
+index 8fc518d..281fc91 100755
+--- a/yummain.py
++++ b/yummain.py
+@@ -27,13 +27,13 @@ import time # test purposes only
+ from yum import Errors
+ from yum import plugins
+ from yum import logginglevels
+-from yum.i18n import _ 
++import yum.i18n
+ import cli
+ 
+ 
+ def main(args):
+     """This does all the real work"""
+-    if not sys.stdout.isatty():
++    if True: # not sys.stdout.isatty():
+         import codecs
+         sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout)
+ 


Index: yum.spec
===================================================================
RCS file: /cvs/extras/rpms/yum/devel/yum.spec,v
retrieving revision 1.207
retrieving revision 1.208
diff -u -r1.207 -r1.208
--- yum.spec	10 Apr 2008 20:36:28 -0000	1.207
+++ yum.spec	11 Apr 2008 17:52:43 -0000	1.208
@@ -3,7 +3,7 @@
 Summary: RPM installer/updater
 Name: yum
 Version: 3.2.14
-Release: 5%{?dist}
+Release: 6%{?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