[yum-git] Branch 'yum-3_2_X' - 3 commits - cli.py yum/sqlitesack.py

James Antill james at linux.duke.edu
Sat Jul 19 02:12:05 UTC 2008


 cli.py            |    2 +-
 yum/sqlitesack.py |   15 ++++++++++-----
 2 files changed, 11 insertions(+), 6 deletions(-)

New commits:
commit be409e6004176075c5a6d8738fb7da994b619f82
Author: James Antill <james at and.org>
Date:   Fri Jul 18 22:10:49 2008 -0400

    Don't do SQL escaping combined on each SQL field

diff --git a/yum/sqlitesack.py b/yum/sqlitesack.py
index 8ebc11f..c1fdc23 100644
--- a/yum/sqlitesack.py
+++ b/yum/sqlitesack.py
@@ -1027,13 +1027,16 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
                 pat_sqls = []
                 pat_data = []
                 for pattern in patterns:
+                    done = False
                     for field in ['name', 'sql_nameArch', 'sql_nameVerRelArch',
                                   'sql_nameVer', 'sql_nameVerRel',
                                   'sql_envra', 'sql_nevra']:
                         if ignore_case:
-                            (pattern, esc) = self._sql_esc(pattern)
-                            pattern = pattern.replace("*", "%")
-                            pattern = pattern.replace("?", "_")
+                            if not done:
+                                done = True
+                                (pattern, esc) = self._sql_esc(pattern)
+                                pattern = pattern.replace("*", "%")
+                                pattern = pattern.replace("?", "_")
                             pat_sqls.append("%s LIKE ?%s" % (field, esc))
                         else:
                             pat_sqls.append("%s GLOB ?" % field)
commit 7c379426cf2724c34a402c8a4f7845a9ac69b48b
Author: James Antill <james at and.org>
Date:   Fri Jul 18 22:09:41 2008 -0400

    Make error reporting work with python-2.4.z, dito. SQL escaping.

diff --git a/yum/sqlitesack.py b/yum/sqlitesack.py
index 15e916b..8ebc11f 100644
--- a/yum/sqlitesack.py
+++ b/yum/sqlitesack.py
@@ -41,7 +41,9 @@ def catchSqliteException(func):
         try:
             return func(*args, **kwargs)
         except sqlutils.sqlite.Error, e:
-            raise Errors.RepoError, str(e.message)
+            if hasattr(e, "message"):
+                raise Errors.RepoError, str(e.message)
+            raise Errors.RepoError, str(e)
 
     newFunc.__name__ = func.__name__
     newFunc.__doc__ = func.__doc__
@@ -458,7 +460,7 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
         """ Apply SQLite escaping, if needed. Returns pattern and esc. """
         esc = ''
         if "_" in pattern or "%" in pattern:
-            esc = " ESCAPE '!'"
+            esc = ' ESCAPE "!"'
             pattern = pattern.replace("!", "!!")
             pattern = pattern.replace("%", "!%")
             pattern = pattern.replace("_", "!_")
commit 5dea0d2e29c21ee357a924eef5c9bcb32f282b28
Author: James Antill <james at and.org>
Date:   Thu Jul 17 10:34:12 2008 -0400

    Tweak provides warning message to be quiet on anything with a * in it

diff --git a/cli.py b/cli.py
index b5e95cf..4d84b74 100644
--- a/cli.py
+++ b/cli.py
@@ -727,7 +727,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         
         if len(matching) == 0:
             for arg in args:
-                if len(arg) and arg[0] == '*':
+                if '*' in arg:
                     continue
                 self.logger.warning(_('Warning: 3.0.x versions of yum would erronously match against filenames.\n You can use "%s*/%s%s" and/or "%s*bin/%s%s" to get that behaviour'),
                                     self.term.MODE['bold'], arg,



More information about the Yum-cvs-commits mailing list