[yum-commits] 2 commits - yum-debug-dump.py
James Antill
james at osuosl.org
Fri Jan 30 15:34:51 UTC 2009
yum-debug-dump.py | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
New commits:
commit 339df99249060682e90689d200b0fdf39ab26cca
Author: James Antill <james at and.org>
Date: Fri Jan 30 10:34:44 2009 -0500
Allow filenames to yum-debug-dump, make default filename "unique"
diff --git a/yum-debug-dump.py b/yum-debug-dump.py
index f306354..874c369 100644
--- a/yum-debug-dump.py
+++ b/yum-debug-dump.py
@@ -18,6 +18,7 @@
import os
import subprocess
import sys
+import time
import yum
from yum import Errors
from yum.misc import getCacheDir
@@ -136,12 +137,16 @@ class YumDebugDump(yum.YumBase):
"""create debug txt file and compress it, place it at yum_debug_dump.txt.gz
unless fn is specified"""
if not fn:
- fn = 'yum_debug_dump.txt.gz'
+ now = time.strftime("%Y-%m-%d_%T", time.localtime(time.time()))
+ fn = 'yum_debug_dump-%s-%s.txt.gz' % (os.uname()[1], now)
if not fn.startswith('/'):
fn = '%s/%s' % (os.getcwd(), fn)
- fo = gzip.GzipFile(fn, 'w')
+ if fn.endswith('.gz'):
+ fo = gzip.GzipFile(fn, 'w')
+ else:
+ fo = open(fn, 'w')
msg = "yum-debug-dump version %s\n" % self.file_version
fo.write(msg)
@@ -171,7 +176,10 @@ def main():
# make sure the repos know about it, too
my.repos.setCache(0)
- fn = my.create_debug_file()
+ filename = None
+ if len(sys.argv) > 1:
+ filename = sys.argv[1]
+ fn = my.create_debug_file(fn=filename)
print "Output written to: %s" % fn
if __name__ == "__main__":
commit 7991494a4925b2ca82c82be6fb10b8a2397635bf
Author: James Antill <james at and.org>
Date: Fri Jan 30 10:19:48 2009 -0500
Fix copy and paste typos.
diff --git a/yum-debug-dump.py b/yum-debug-dump.py
index 65e706c..f306354 100644
--- a/yum-debug-dump.py
+++ b/yum-debug-dump.py
@@ -20,6 +20,7 @@ import subprocess
import sys
import yum
from yum import Errors
+from yum.misc import getCacheDir
from rpmUtils import miscutils
import gzip
import rpm
@@ -161,7 +162,7 @@ def main():
if my.conf.uid != 0:
cachedir = getCacheDir()
if cachedir is None:
- self.logger.error("Error: Could not make cachedir, exiting")
+ my.logger.error("Error: Could not make cachedir, exiting")
sys.exit(50)
my.repos.setCacheDir(cachedir)
More information about the Yum-commits
mailing list