[yum-commits] Branch 'yum-3_2_X' - 4 commits - utils.py yum/config.py yum/history.py yum/sqlitesack.py yum/yumRepo.py

James Antill james at osuosl.org
Mon May 24 14:30:35 UTC 2010


 utils.py          |   13 +++++++++++++
 yum/config.py     |    2 +-
 yum/history.py    |    2 +-
 yum/sqlitesack.py |    9 +++++++++
 yum/yumRepo.py    |    2 +-
 5 files changed, 25 insertions(+), 3 deletions(-)

New commits:
commit d75aed77b1bb5c866d564b99116d84561cb09ee1
Author: James Antill <james at and.org>
Date:   Fri May 21 10:37:48 2010 -0400

    Fix blank line at end of all scriptlet output.

diff --git a/yum/history.py b/yum/history.py
index d5a167e..bfb0b45 100644
--- a/yum/history.py
+++ b/yum/history.py
@@ -507,7 +507,7 @@ class YumHistory:
         cur = self._get_cursor()
         if cur is None:
             return # Should never happen, due to above
-        for error in msg.split('\n'):
+        for error in msg.splitlines():
             error = to_unicode(error)
             executeSQL(cur,
                        """INSERT INTO trans_script_stdout
commit de891005978c2923c8bd7c5c8a5decc421bd0e4a
Author: James Antill <james at and.org>
Date:   Fri May 21 12:40:41 2010 -0400

    Add --setopt to YumUtilBase commands.

diff --git a/utils.py b/utils.py
index 0445b88..1bb4569 100644
--- a/utils.py
+++ b/utils.py
@@ -166,6 +166,14 @@ class YumUtilBase(YumBaseCli):
     def doUtilConfigSetup(self,args = sys.argv[1:],pluginsTypes=(plugins.TYPE_CORE,)):
         # Parse only command line options that affect basic yum setup
         opts = self._parser.firstParse(args)
+
+        # go through all the setopts and set the global ones
+        self._parseSetOpts(opts.setopts)
+
+        if self.main_setopts:
+            for opt in self.main_setopts.items:
+                setattr(opts, opt, getattr(self.main_setopts, opt))
+
         # Just print out the version if that's what the user wanted
         if opts.version:
             self._printUtilVersion()
@@ -193,6 +201,11 @@ class YumUtilBase(YumBaseCli):
                 pc.enabled_plugins = self._parser._splitArg(opts.enableplugins)
             self.conf
 
+            # now set  all the non-first-start opts from main from our setopts
+            if self.main_setopts:
+                for opt in self.main_setopts.items:
+                    setattr(self.conf, opt, getattr(self.main_setopts, opt))
+
         except Errors.ConfigError, e:
             self.logger.critical(_('Config Error: %s'), e)
             sys.exit(1)
commit c3d3cc73ef8145d840b0b3d82f8dc3a5618bb582
Author: James Antill <james at and.org>
Date:   Fri May 21 11:42:07 2010 -0400

    Dump False and 0 as their values, and not the empty string.

diff --git a/yum/config.py b/yum/config.py
index 3610b91..949751a 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -752,7 +752,7 @@ class YumConf(StartupConf):
             if isinstance(getattr(self, attr), types.MethodType):
                 continue
             res = getattr(self, attr)
-            if not res:
+            if not res and type(res) not in (type(False), type(0)):
                 res = ''
             if type(res) == types.ListType:
                 res = ',\n   '.join(res)
diff --git a/yum/yumRepo.py b/yum/yumRepo.py
index 7c3a4d7..3a695d8 100644
--- a/yum/yumRepo.py
+++ b/yum/yumRepo.py
@@ -385,7 +385,7 @@ class YumRepository(Repository, config.RepoConf):
             if isinstance(getattr(self, attr), types.MethodType):
                 continue
             res = getattr(self, attr)
-            if not res:
+            if not res and type(res) not in (type(False), type(0)):
                 res = ''
             if type(res) == types.ListType:
                 res = ',\n   '.join(res)
commit 718c84edfcd7c9b46007388f1f4435e51b3d8ba8
Author: James Antill <james at and.org>
Date:   Thu May 20 16:31:09 2010 -0400

    Fix adding pkgExcluders after a package has been loaded. versionlock, at least

diff --git a/yum/sqlitesack.py b/yum/sqlitesack.py
index 84607c6..92b98ce 100644
--- a/yum/sqlitesack.py
+++ b/yum/sqlitesack.py
@@ -710,9 +710,13 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
         if excluderid is not None:
             self._pkgExcludeIds[excluderid] = len(self._pkgExcluder)
 
+        self._exclude_whitelist = set()
+        self._pkgobjlist_dirty  = True
+
     def _packageByKey(self, repo, pkgKey, exclude=True):
         """ Lookup a pkg by it's pkgKey, if we don't have it load it """
         # Speed hack, so we don't load the pkg. if the pkgKey is dead.
+        assert exclude
         if exclude and self._pkgKeyExcluded(repo, pkgKey):
             return None
 
@@ -733,10 +737,14 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
             self._pkgtup2pkgs.setdefault(po.pkgtup, []).append(po)
             pkgkeys = self._pkgname2pkgkeys[repo].setdefault(data['name'], [])
             pkgkeys.append(pkgKey)
+        elif exclude and self._pkgExcluded(self._key2pkg[repo][pkgKey]):
+            self._delPackageRK(repo, pkgKey)
+            return None
         return self._key2pkg[repo][pkgKey]
         
     def _packageByKeyData(self, repo, pkgKey, data, exclude=True):
         """ Like _packageByKey() but we already have the data for .pc() """
+        assert exclude
         if exclude and self._pkgExcludedRKD(repo, pkgKey, data):
             return None
         if repo not in self._key2pkg:
@@ -1622,6 +1630,7 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
 
         for (repo, x) in self._yieldSQLDataList(repoid, patterns, fields,
                                                 ignore_case):
+            # Can't use: _sql_pkgKey2po because we change repos.
             po = self._packageByKeyData(repo, x['pkgKey'], x)
             if po is None:
                 continue


More information about the Yum-commits mailing list