cas | 4 ++--
cas.conf | 7 ++++---
casprint | 16 ++++++++++------
lib/cas/rpmutils.py | 12 +++++++-----
version | 2 +-
5 files changed, 24 insertions(+), 17 deletions(-)
New commits:
commit 0f8ae2fc50a228fbc562c0dba38a394699184314
Author: Adam Stokes <adam(a)conans.battleaxe>
Date: Wed Oct 22 12:19:23 2008 -0400
Reworked rpmutils library to return debug kernel results if asked Altered casprint to
cleanup after itself, we are going to continue storing all related information in the
debuginfo packages for now
diff --git a/cas b/cas
index 099ea6e..2172479 100755
--- a/cas
+++ b/cas
@@ -27,11 +27,11 @@ class CoreHandler(object):
def run(self):
if not os.path.isfile(self.filename):
- dprint("Unable to find file specified by -f FILENAME.", DPRINT)
+ print("Unable to find file %s" % (self.filename,))
sys.exit(1)
if self.tool.isCorefile(self.filename):
shutil.move(self.filename,
- os.path.join(self.dst,self.filename))
+ os.path.join(self.dst, self.filename))
return os.path.realpath(self.filename)
corepath = self.tool.extractCore(self.filename, self.dst)
if corepath:
diff --git a/cas.conf b/cas.conf
index 2e558a2..6de30b4 100644
--- a/cas.conf
+++ b/cas.conf
@@ -5,14 +5,15 @@
kernels=/mnt/kernels
# Database which houses all kernel found in $kernels
rpms=/var/db/cas/rpms.db
-# Database to house all kernel fingperint
# Define where to store necessary debug information
+# NOTE: This is more than likely going to be temporary storage
+# so you could essentially set this to /tmp if space permitted
debugs=/cores/debugs
# debug print on? (True/False)
dprint=True
# define work directory
workDirectory=/cores/processed
# database to house cas servers
-servers=/var/db/cas/casservers.db
+servers=/var/db/cas/servers.db
# define processing jobs db
-jobs=/var/db/cas/casjobs.db
+jobs=/var/db/cas/jobs.db
diff --git a/casprint b/casprint
index eca970b..bcfb0aa 100755
--- a/casprint
+++ b/casprint
@@ -10,6 +10,7 @@ from cas.db import Core
from cas.utilities import Utilities, CoreTool, dprint, sprint
from cas.rpmutils import Analyze, Tools
from subprocess import Popen, PIPE
+from shutil import rmtree
if sys.version_info[:2] < (2,4):
raise SystemExit("Python >= 2.4 required")
@@ -51,14 +52,17 @@ class CasDatabaseHandler(object):
count = count + 1
dst = os.path.join(DEBUGS, str(count))
rpmTool = Tools()
+ coreObj = Core()
+ sprint("(extracting) [%d/%d] %-100s" % (count, totalRpms,
os.path.basename(x)))
results = rpmTool.extract(x, dst)
- sprint("(extracted) [%d/%d] %-100s" % (count, totalRpms,
os.path.basename(x)))
for item in results:
vmlinux = item.strip()
stamper = CoreTool()
- timestamp = stamper.timestamp(vmlinux)
- self.debugList[x] = (vmlinux, timestamp)
- sprint("(timestamp) %-100s" %
(os.path.realpath(vmlinux),))
+ coreObj.debugKernel = os.path.normpath(vmlinux)
+ coreObj.timestamp = stamper.timestamp(coreObj.debugKernel)
+ self.debugList[x] = coreObj
+ sprint("(timestamp) %-100s" % (coreObj.debugKernel,))
+ rmtree(dst)
self.util.save(self.debugList, RPMS)
return
@@ -85,10 +89,10 @@ class CasprintApplication(object):
util.mkdir(DEBUGS)
if self.opts.buildDB:
- dprint("Building CAS DB instance.", DPRINT)
+ print("::: Building CAS DB instance. :::")
dbHandler = CasDatabaseHandler().run()
else:
- dprint("Please define -b switch to update the CAS database\n",
DPRINT)
+ print("Please define -b switch to update the CAS database.")
raise sys.exit(1)
if __name__=="__main__":
diff --git a/lib/cas/rpmutils.py b/lib/cas/rpmutils.py
index 5cecce4..abd7306 100644
--- a/lib/cas/rpmutils.py
+++ b/lib/cas/rpmutils.py
@@ -53,7 +53,7 @@ class Tools(object):
self.filter = filter
self.rpm2cpio = tool
self.cpio = "/bin/cpio"
- self.cpio_args = "-imud"
+ self.cpio_args = "-imudv"
self.filter_results = []
# change to destination directory
@@ -63,11 +63,13 @@ class Tools(object):
# pipe to handle extraction, e.g. rpm2cpio kernel.rpm | cpio -imud */vmlinux
p1 = Popen([self.rpm2cpio, self.rpm], stdout=PIPE)
- (out, err) = Popen([self.cpio,self.cpio_args,self.filter], stdin=p1.stdout,
- stdout=open(os.devnull, "w"),stderr=PIPE).communicate()
+ p2 = Popen([self.cpio,self.cpio_args,self.filter], stdin=p1.stdout,
+ stdout=PIPE,stderr=PIPE)
+ out, err = p2.communicate()
if return_results:
- for item in out.stderr.readlines():
- self.filter_results.append(os.path.join(self.dst,item))
+ tmp = err.split("\n")[:1]
+ for item in tmp:
+
self.filter_results.append(os.path.join(self.dst,os.path.normpath(item)))
return self.filter_results
return
diff --git a/version b/version
index 6b6bf85..5362fd9 100644
--- a/version
+++ b/version
@@ -1 +1 @@
-0.13 61
+0.13 63