[yum-commits] Branch 'yum-3_2_X' - 4 commits - output.py yum/config.py yum/misc.py yum/rpmsack.py

James Antill james at osuosl.org
Tue Jul 12 16:30:12 UTC 2011


 output.py      |    1 +
 yum/config.py  |    2 +-
 yum/misc.py    |   10 ++++++----
 yum/rpmsack.py |   19 +++++++++++++++----
 4 files changed, 23 insertions(+), 9 deletions(-)

New commits:
commit 396e34c3341fb8874d47e525598e4fca810dddb6
Author: Zdeněk Pavlas <zpavlas at redhat.com>
Date:   Tue Jul 12 10:15:22 2011 +0200

    Fix a (likely) typo in writeRawRepoFile()
    
    Fixes a traceback when enabling/disabling repositories in the desktop.

diff --git a/yum/config.py b/yum/config.py
index d09511f..cb7ed57 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -1069,7 +1069,7 @@ def writeRawRepoFile(repo,only=None):
         #  If the value is the same, but just interpreted ... when we don't want
         # to keep the interpreted values.
         if (name in ini[section_id] and
-            ovalue == varReplace(ini[section_id][name], yumvar)):
+            ovalue == varReplace(ini[section_id][name], repo.yumvar)):
             ovalue = ini[section_id][name]
 
         if name not in cfgOptions and option.default == value:
commit fce611847370974d131ec50a4eb689ae462c20c0
Author: Zdeněk Pavlas <zpavlas at redhat.com>
Date:   Mon Jul 11 10:33:48 2011 +0200

    Do not output '\r' unless to a tty. BZ 720088

diff --git a/output.py b/output.py
index b6aa277..94cbc64 100755
--- a/output.py
+++ b/output.py
@@ -2366,6 +2366,7 @@ class YumCliRPMCallBack(RPMBaseCallback):
         
         if self.output and (sys.stdout.isatty() or te_current == te_total):
             (fmt, wid1, wid2) = self._makefmt(percent, ts_current, ts_total,
+                                              progress=sys.stdout.isatty(),
                                               pkgname=pkgname, wid1=wid1)
             msg = fmt % (utf8_width_fill(process, wid1, wid1),
                          utf8_width_fill(pkgname, wid2, wid2))
commit 90e2e5f357585d77846d3373c87b869fb21c5401
Author: James Antill <james at and.org>
Date:   Fri Jul 8 14:56:27 2011 -0400

    Override the umask settings for mkdir() too. Second part of BZ 719467.

diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index ed9cabf..9717912 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -48,6 +48,17 @@ def _open_no_umask(*args):
 
     return ret
 
+def _makedirs_no_umask(*args):
+    """ Annoying people like to set umask's for root, which screws everything
+        up for user readable stuff. """
+    oumask = os.umask(022)
+    try:
+        ret = os.makedirs(*args)
+    finally:
+        os.umask(oumask)
+
+    return ret
+
 def _iopen(*args):
     """ IOError wrapper BS for open, stupid exceptions. """
     try:
@@ -1088,7 +1099,7 @@ class RPMDBPackageSack(PackageSackBase):
                 return
 
             try:
-                os.makedirs(self._cachedir)
+                _makedirs_no_umask(self._cachedir)
             except (IOError, OSError), e:
                 return
 
@@ -1562,7 +1573,7 @@ class RPMDBAdditionalData(object):
         self._packages = {} # pkgid = dir
         if not os.path.exists(self.conf.db_path):
             try:
-                os.makedirs(self.conf.db_path)
+                _makedirs_no_umask(self.conf.db_path)
             except (IOError, OSError), e:
                 # some sort of useful thing here? A warning?
                 return
@@ -1708,7 +1719,7 @@ class RPMDBAdditionalDataPackage(object):
     def _write(self, attr, value):
         # check for self._conf.writable before going on?
         if not os.path.exists(self._mydir):
-            os.makedirs(self._mydir)
+            _makedirs_no_umask(self._mydir)
 
         attr = _sanitize(attr)
         if attr in self._read_cached_data:
commit aa71cd50d42c6416a0dbc334a9df63e3b233fdcb
Author: James Antill <james at and.org>
Date:   Thu Jul 7 10:49:50 2011 -0400

     Ignore EACCES on yumdb stat calls, which shouldn't happen. But ignore is nicer
    than traceback. BZ 719467

diff --git a/yum/misc.py b/yum/misc.py
index 2f6ddfe..37c572b 100644
--- a/yum/misc.py
+++ b/yum/misc.py
@@ -940,14 +940,16 @@ def unlink_f(filename):
         if e.errno != errno.ENOENT:
             raise
 
-def stat_f(filename):
+def stat_f(filename, ignore_EACCES=False):
     """ Call os.stat(), but don't die if the file isn't there. Returns None. """
     try:
         return os.stat(filename)
     except OSError, e:
-        if e.errno not in (errno.ENOENT, errno.ENOTDIR):
-            raise
-        return None
+        if e.errno in (errno.ENOENT, errno.ENOTDIR):
+            return None
+        if ignore_EACCES and e.errno == errno.EACCES:
+            return None
+        raise
 
 def _getloginuid():
     """ Get the audit-uid/login-uid, if available. None is returned if there
diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index e289a7a..ed9cabf 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -1753,7 +1753,7 @@ class RPMDBAdditionalDataPackage(object):
         if attr.endswith('.tmp'):
             raise AttributeError, "%s has no attribute %s" % (self, attr)
 
-        info = misc.stat_f(fn)
+        info = misc.stat_f(fn, ignore_EACCES=True)
         if info is None:
             raise AttributeError, "%s has no attribute %s" % (self, attr)
 


More information about the Yum-commits mailing list