[yum-commits] Branch 'yum-3_2_X' - 2 commits - yum/history.py yum/sqlitesack.py

James Antill james at osuosl.org
Mon Sep 28 18:08:42 UTC 2009


 yum/history.py    |    9 +++++++--
 yum/sqlitesack.py |   14 ++++++++++++++
 2 files changed, 21 insertions(+), 2 deletions(-)

New commits:
commit 502c1126df77e742edb417f787bd68071566c793
Author: James Antill <james at and.org>
Date:   Mon Sep 28 11:53:42 2009 -0400

    to_unicode all text going into the history DB, that might need it, BZ 525843

diff --git a/yum/history.py b/yum/history.py
index 482587e..644c2fc 100644
--- a/yum/history.py
+++ b/yum/history.py
@@ -27,6 +27,7 @@ import yum.misc
 import yum.constants
 from yum.constants import *
 from yum.packages import YumInstalledPackage, YumAvailablePackage, PackageObject
+from yum.i18n import to_unicode
 
 _history_dir = '/var/lib/yum/history'
 
@@ -245,8 +246,10 @@ class YumHistory:
             if checksum == sql_checksum:
                 return sql_pkgtupid
         
+        (n,a,e,v,r) = pkgtup
+        (n,a,e,v,r) = (to_unicode(n),to_unicode(a),
+                       to_unicode(e),to_unicode(v),to_unicode(r))
         if checksum is not None:
-            (n,a,e,v,r) = pkgtup
             res = executeSQL(cur,
                              """INSERT INTO pkgtups
                                 (name, arch, epoch, version, release, checksum)
@@ -256,7 +259,7 @@ class YumHistory:
             res = executeSQL(cur,
                              """INSERT INTO pkgtups
                                 (name, arch, epoch, version, release)
-                                VALUES (?, ?, ?, ?, ?)""", pkgtup)
+                                VALUES (?, ?, ?, ?, ?)""", (n,a,e,v,r))
         return cur.lastrowid
     def _apkg2pid(self, po):
         csum = po.returnIdSum()
@@ -346,6 +349,7 @@ class YumHistory:
     def _log_errors(self, errors):
         cur = self._get_cursor()
         for error in errors:
+            error = to_unicode(error)
             executeSQL(cur,
                        """INSERT INTO trans_error
                           (tid, msg) VALUES (?, ?)""", (self._tid, error))
@@ -358,6 +362,7 @@ class YumHistory:
 
         cur = self._get_cursor()
         for error in msg.split('\n'):
+            error = to_unicode(error)
             executeSQL(cur,
                        """INSERT INTO trans_script_stdout
                           (tid, line) VALUES (?, ?)""", (self._tid, error))
commit db2fe752319a130f230232f2ad5c470ab4e33939
Author: James Antill <james at and.org>
Date:   Sat Sep 26 01:01:23 2009 -0400

    Make a specical codepath for /path/to/* searches

diff --git a/yum/sqlitesack.py b/yum/sqlitesack.py
index 9bfcd93..ce2988f 100644
--- a/yum/sqlitesack.py
+++ b/yum/sqlitesack.py
@@ -911,6 +911,20 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
             dirname_check = "dirname GLOB ? and filenames LIKE ? %s and " % esc
             sql_params.append(dirname)
             sql_params.append('%' + pattern + '%')
+        elif filename == '*':
+            # We only care about matching on dirname...
+            for (rep,cache) in self.filelistsdb.items():
+                if rep in self._all_excludes:
+                    continue
+
+                cur = cache.cursor()
+                sql_params.append(dirname)
+                executeSQL(cur, """SELECT pkgKey FROM filelist
+                                   WHERE dirname %s ?""" % (querytype,),
+                           sql_params)
+                self._sql_pkgKey2po(rep, cur, pkgs)
+
+            return misc.unique(pkgs)
 
         for (rep,cache) in self.filelistsdb.items():
             if rep in self._all_excludes:


More information about the Yum-commits mailing list