[yum-commits] Branch 'yum-3_2_X' - 3 commits - utils.py yummain.py yum/update_md.py

James Antill james at osuosl.org
Tue Aug 17 17:17:53 UTC 2010


 utils.py         |    9 +++++----
 yum/update_md.py |   20 +++++++++++++-------
 yummain.py       |    6 ++++--
 3 files changed, 22 insertions(+), 13 deletions(-)

New commits:
commit e177294f50944dfbf6b503eff15cedc2685b1415
Author: James Antill <james at and.org>
Date:   Mon Aug 16 17:42:48 2010 -0400

    If the lock owner has gone, don't wait for it.

diff --git a/utils.py b/utils.py
index 868e5cc..aad1b73 100644
--- a/utils.py
+++ b/utils.py
@@ -103,7 +103,7 @@ def get_process_info(pid):
 def show_lock_owner(pid, logger):
     ps = get_process_info(pid)
     if not ps:
-        return
+        return None
 
     # This yumBackend isn't very friendly, so...
     if ps['name'] == 'yumBackend.py':
@@ -121,6 +121,7 @@ def show_lock_owner(pid, logger):
                     (time.ctime(ps['start_time']), ago))
     logger.critical(_("    State  : %s, pid: %d") % (ps['state'], pid))
 
+    return ps
 
 
 class YumUtilBase(YumBaseCli):
diff --git a/yummain.py b/yummain.py
index 95c7462..2892c34 100755
--- a/yummain.py
+++ b/yummain.py
@@ -101,8 +101,10 @@ def main(args):
                 logger.critical(lockerr)
             if not base.conf.exit_on_lock:
                 logger.critical(_("Another app is currently holding the yum lock; waiting for it to exit..."))
-                show_lock_owner(e.pid, logger)
-                time.sleep(2)
+                tm = 0.1
+                if show_lock_owner(e.pid, logger):
+                    tm = 2
+                time.sleep(tm)
             else:
                 logger.critical(_("Another app is currently holding the yum lock; exiting as configured by exit_on_lock"))
                 return 1
commit abf78ea81fcf5d788fa2cbab656fbc7005dfa446
Author: Mads Kiilerich <mads at kiilerich.com>
Date:   Mon Aug 16 17:38:18 2010 -0400

    Really fix the race for lock owner exiting, BZ 588002.

diff --git a/utils.py b/utils.py
index 9335112..868e5cc 100644
--- a/utils.py
+++ b/utils.py
@@ -101,12 +101,12 @@ def get_process_info(pid):
     return ps
 
 def show_lock_owner(pid, logger):
-    if not pid:
+    ps = get_process_info(pid)
+    if not ps:
         return
 
-    ps = get_process_info(pid)
     # This yumBackend isn't very friendly, so...
-    if ps is not None and ps['name'] == 'yumBackend.py':
+    if ps['name'] == 'yumBackend.py':
         nmsg = _("  The other application is: PackageKit")
     else:
         nmsg = _("  The other application is: %s") % ps['name']
commit a791348d55fef603370d11c9e71ce74e50cda2a4
Author: James Antill <james at and.org>
Date:   Mon Aug 16 16:08:38 2010 -0400

    Don't print files section of updateinfo notices, by default.

diff --git a/yum/update_md.py b/yum/update_md.py
index 9f6ff99..3d05d19 100644
--- a/yum/update_md.py
+++ b/yum/update_md.py
@@ -74,7 +74,7 @@ class UpdateNotice(object):
     def __setitem__(self, item, val):
         self._md[item] = val
 
-    def __str__(self):
+    def text(self, skip_data=('files',)):
         head = """
 ===============================================================================
   %(title)s
@@ -91,7 +91,7 @@ class UpdateNotice(object):
 
         # Add our bugzilla references
         bzs = filter(lambda r: r['type'] == 'bugzilla', self._md['references'])
-        if len(bzs):
+        if len(bzs) and 'bugs' not in skip_data:
             buglist = "       Bugs :"
             for bz in bzs:
                 buglist += " %s%s\n\t    :" % (bz['id'], 'title' in bz
@@ -100,32 +100,35 @@ class UpdateNotice(object):
 
         # Add our CVE references
         cves = filter(lambda r: r['type'] == 'cve', self._md['references'])
-        if len(cves):
+        if len(cves) and 'cves' not in skip_data:
             cvelist = "       CVEs :"
             for cve in cves:
                 cvelist += " %s\n\t    :" % cve['id']
             head += cvelist[: - 1].rstrip() + '\n'
 
-        if self._md['summary']:
+        if self._md['summary'] and 'summary' not in skip_data:
             data = utf8_text_wrap(self._md['summary'], width=64,
                                   subsequent_indent=' ' * 12 + ': ')
             head += "    Summary : %s\n" % '\n'.join(data)
 
-        if self._md['description']:
+        if self._md['description'] and 'description' not in skip_data:
             desc = utf8_text_wrap(self._md['description'], width=64,
                                   subsequent_indent=' ' * 12 + ': ')
             head += "Description : %s\n" % '\n'.join(desc)
 
-        if self._md['solution']:
+        if self._md['solution'] and 'solution' not in skip_data:
             data = utf8_text_wrap(self._md['solution'], width=64,
                                   subsequent_indent=' ' * 12 + ': ')
             head += "   Solution : %s\n" % '\n'.join(data)
 
-        if self._md['rights']:
+        if self._md['rights'] and 'rights' not in skip_data:
             data = utf8_text_wrap(self._md['rights'], width=64,
                                   subsequent_indent=' ' * 12 + ': ')
             head += "     Rights : %s\n" % '\n'.join(data)
 
+        if 'files' in skip_data:
+            return head[:-1] # chop the last '\n'
+
         #  Get a list of arches we care about:
         #XXX ARCH CHANGE - what happens here if we set the arch - we need to
         # pass this in, perhaps
@@ -141,6 +144,9 @@ class UpdateNotice(object):
 
         return head
 
+    def __str__(self):
+        return to_utf8(self.text())
+
     def get_metadata(self):
         """ Return the metadata dict. """
         return self._md


More information about the Yum-commits mailing list