MANIFEST.in | 1
Makefile | 5 -
cas | 26 ++++++
cas.conf | 6 +
cas.spec | 33 +++++---
lib/cas/grabcoretools.py | 186 -----------------------------------------------
lib/cas/util.py | 7 +
version | 1
8 files changed, 58 insertions(+), 207 deletions(-)
New commits:
commit a6774cb9567c1b0500e7ed5c939b6699299d8550
Author: Adam Stokes <ajs(a)redhat.com>
Date: Tue Jan 6 06:48:57 2009 -0500
- initial work to support 32bit crash on x86_64 systems
diff --git a/cas b/cas
index 2854f72..004d9a0 100755
--- a/cas
+++ b/cas
@@ -43,6 +43,14 @@ DEBUGLEVEL = config.get("settings","debugLevel")
SERVERS = config.get("settings", "servers")
SMTPHOST = config.get("settings", "mailServer")
+# Check for some advanced configurations
+# Test to see if we provide a 32bit crash binary
+# mainly used for x86_64 system who wish to analyze
+# 32bit cores.
+CRASH_32=None
+if config.has_option("advanced", "crash_32"):
+ CRASH_32=config.get("advanced", "crash_32")
+
class CoreHandler(object):
def __init__(self, filename, dst, logger):
self.filename = filename
@@ -174,6 +182,24 @@ class CasApplication(object):
# with processing the core on the current machine
currentMachineArch = Popen(["uname","-m"], stdout=PIPE,
stderr=PIPE)
currentMachineArch = currentMachineArch.stdout.read().strip()
+ # Check if we have installed crash 32bit on system
+ if debugKernelArch == "i686" and CRASH_32 is not None:
+ pass
+ # TODO: re-write crash output library to take into account
+ # 32bit crash on same system.
+ self.util.buildCrashFile(self.storagePath, corefile, debugKernel,
+ CRASH_32)
+ self.casLog.info("Current machine suitable for processing 32 bit core,
"\
+ "running crash.")
+ cmd = os.path.join(self.storagePath,"crash")
+ # DONE: capture any errors returned from crash when processing core.
+ cmdPipe = Popen([cmd], stdout=PIPE, stderr=PIPE)
+ cmdData = cmdPipe.communicate()
+ # pull status code to verify crash even ran to completeness
+ sts, out, err = (cmdPipe.returncode, cmdData[0].strip(),
+ cmdData[1].strip())
+ if sts:
+ self.casLog.debug("crash problem: err: %s, out: %s" % (err,
out))
if debugKernelArch != currentMachineArch:
# The machine running cas isn't capable of processing this core, lets
# attempt with Func. Assuming Func is installed and a server database
diff --git a/cas.conf b/cas.conf
index 5a49447..89af903 100644
--- a/cas.conf
+++ b/cas.conf
@@ -37,3 +37,9 @@ jobs=/var/db/cas/jobs.db
# Mail server, e.g.
mail.example.com
# Provides job results via email
mailServer=mail.example.com
+
+[advanced]
+# if running a x86_64 system and wish to analyze 32bit
+# cores, define the location of 32bit crash binary
+
+# crash_32=/usr/local/i386/bin/crash
diff --git a/lib/cas/util.py b/lib/cas/util.py
index 3ed4fff..cc4d834 100755
--- a/lib/cas/util.py
+++ b/lib/cas/util.py
@@ -141,7 +141,8 @@ class UtilBase(object):
return supportArch[k]
return False
- def buildCrashFile(self, dst, vmcore, debug, file_in="crash.in"):
+ def buildCrashFile(self, dst, vmcore, debug, file_in="crash.in",
+ crash_bin="/usr/bin/crash"):
""" build crash file with predefined debug
commands
"""
@@ -169,8 +170,8 @@ class UtilBase(object):
crashInputFH.close()
vmcorePath = os.path.join(dst, vmcore)
- crashCmd = "#!/bin/sh\ncrash %s %s -s < %s\n" % (vmcorePath, debug,
- crashInputPath)
+ crashCmd = "#!/bin/sh\n%s %s %s -s < %s\n" % (crash_bin, vmcorePath,
+ debug, crashInputPath)
crashExe = os.path.join(dst,"crash")
fh = open(crashExe,"w")
fh.write(crashCmd)
commit 2a4994f7f990983dcabdbeca07e14036b570f00c
Author: Adam Stokes <ajs(a)redhat.com>
Date: Mon Dec 29 08:20:07 2008 -0500
- remove uneeded python lib
- remove version as we rely on spec file for version info
- updated makefile
diff --git a/MANIFEST.in b/MANIFEST.in
index 4b3ea3a..ab1c592 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -3,4 +3,3 @@ include cas.1.gz
include cas-admin.1.gz
include LICENSE
include README
-include version
diff --git a/Makefile b/Makefile
index 8cd102e..412097c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
# cas Makefile
NAME = cas
-VERSION = $(shell echo `awk '{ print $$1 }' version`)
-RELEASE = $(shell echo `awk '{ print $$2 }' version`)
+VERSION = $(shell echo `awk '/^Version:/ {print $$2}' cas.spec`)
+RELEASE = $(shell echo `awk '/^Release:/ {gsub(/\%.*/,""); print $2}'
cas.spec`)
MANPAGE1 = $(PWD)/cas.1
MANPAGE2 = $(PWD)/cas-admin.1
SOURCE1 = version
@@ -21,7 +21,6 @@ tarball: clean
@mkdir /tmp/$(NAME)
@mv /tmp/$(NAME) /tmp/$(NAME)-$(VERSION)
@python setup.py sdist -d /tmp/$(NAME)-$(VERSION)
- @cp {$(SOURCE1),$(SOURCE2),$(SOURCE3),$(SOURCE4)} /tmp/$(NAME)-$(VERSION)
@mkdir $(PWD)/dist
@mv /tmp/$(NAME)-$(VERSION)/* $(PWD)/dist
@echo " "
diff --git a/cas.spec b/cas.spec
index 7a8c923..41b7542 100644
--- a/cas.spec
+++ b/cas.spec
@@ -1,27 +1,22 @@
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from
distutils.sysconfig import get_python_lib; print get_python_lib()")}
Name: cas
-Summary: Tool to analyze and configure core file environment.
-Source1: version
-Version: %(echo `awk '{print $1 }' %{SOURCE1}`)
-Release: %(echo `awk '{print $2 }' %{SOURCE1}`)%{?dist}
-Source0: %{name}-%{version}.tar.gz
-Source2: cas-admin.1.gz
-Source3: cas.1.gz
-Source4: cas.conf
-License: GPL
+Summary: Tool to analyze and configure core file environment
+Version: 0.13
+Release: 114%{?dist}
+Source0:
https://fedorahosted.org/releases/c/a/cas/%{name}-%{version}.tar.gz
+License: GPLv3+
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildArch: noarch
Url:
http://fedorahosted.org/cas
BuildRequires: python-devel
-Requires: python >= 2.4
Requires: crash
%description
-CAS provides a support engineer the ability to configure an environment for
-core analysis quickly. All the hassles of configuring architecture specific
-boxes, finding machines suitable for a particular core is now taken care of.
+CAS provides a user the ability to configure an environment for core analysis
+quickly. All the hassles of matching kernel versions and machine architecture
+types to core dumps are automatically detected and processed.
%prep
%setup -q
@@ -47,6 +42,18 @@ rm -rf ${RPM_BUILD_ROOT}
%doc LICENSE README PKG-INFO
%changelog
+* Mon Dec 29 2008 Adam Stokes <ajs at redhat dot com> - 0.13-114
+- changed license to gplv3 or later
+- removed source requirements as these are handled by python manifest
+- removed python requirement
+- updated description
+
+* Fri Dec 19 2008 Adam Stokes <ajs at redhat dot com> - 0.13-113
+- rpmlint verified
+- manually set version/release in spec
+- license tag fix
+- added full path to upstream source release
+
* Mon Dec 15 2008 Adam Stokes <ajs at redhat dot com> - 0.13-94
- no replace on config file
- cas now processes locally and remotely via func
diff --git a/lib/cas/grabcoretools.py b/lib/cas/grabcoretools.py
deleted file mode 100755
index cef0081..0000000
--- a/lib/cas/grabcoretools.py
+++ /dev/null
@@ -1,186 +0,0 @@
-#!/usr/bin/env python
-
-from ftplib import FTP
-from time import sleep, time
-import cPickle
-import cas.utilities
-import commands
-import logging
-import os
-import re
-import subprocess
-import sys
-
-build_sys={'i686' : 'core-i386.gsslab.rdu.redhat.com',
- 'x86_64' : 'megatron.gsslab.rdu.redhat.com',
- 'ia32e' : 'megatron.gsslab.rdu.redhat.com',
- 'ia64' : 'core-ia64.gsslab.rdu.redhat.com',
- 'ppc64' : 'core-ppc.gsslab.rdu.redhat.com'}
-
-class Grabcoretools(casui.cas.utilities.Utilities):
- ''' utilites for grabcore
- '''
- def getBacktrace(self,server,path,fname):
- ''' obtain initial backtrace from core
- requires expect package to be installed on system
- '''
- escPath=re.escape(path)
- crashCommands = ['bt -a','sys','sys -c',
- 'kmem -f', 'log', 'mod']
- cmd = '''#!/usr/bin/expect -f
-set timeout -1
-spawn %s
-match_max 100000
-''' % ('/'.join((path,fname)))
- for i in crashCommands:
- cmd +='''expect -re 'crash> '
-send -- '%s > %s\\/%s\\r'
-expect -exact '%s > %s\\/%s\\r'
-''' % (i,escPath,i.replace(' ',''),
- i,escPath,i.replace(' ',''))
- cmd +='''expect -re 'crash> '
-send -- 'quit\\r'
-expect -exact 'quit\\r'
-expect eof
-'''
- fd=open(path+'/expect-core','w')
- fd.write(cmd)
- fd.close()
- self._exec('ssh root@%s expect %s/expect-core' %
- (server, path))
- sleep(10)
- out = commands.getoutput('cat %s/{sys,bt-a,kmem-f,log,mod}' % (path,))
- return out
-
- def crash(self, workpath):
- ''' create crash wrapper
- This is accomplished by generating a list of files in
- workpath and building the wrapper based on vmlinux and
- the corefile.
- '''
- fd=open(os.path.join(workpath,'/crash'), 'w')
- dir_listing=self.dirList(workpath)
- vmlinux_list=[]
- for a in dir_listing:
- ftype = commands.getoutput('file -bi %s' % (a,))
- if self.filetype(ftype):
- vmlinux_list.append('%s' % (a))
- wrapper_txt='''#!/bin/bash
-crash %s
-''' \
- % (' '.join(vmlinux_list))
- fd.write(wrapper_txt)
- self.make_exe(os.path.join(workpath,'/crash'))
- fd.close()
- return
-
- def checkFingerprint(self, path):
- ''' captures fingerprint from core
- '''
- match='Linux\sversion.*\d{1,4}|#1\s.*20\d{1,2}'
- try:
- fd=open('%s' % (path))
- except IOError: return False
- fd.seek(0)
- b = fd.read(54000000)
- self.out = self.regexFindall(match, b)
- if not out:
- self.log(logging.ERROR, 'Unable to detect ' \
- 'fingerprint in %s' % (path,))
- return False
- return self.out
-
- def getFingerprint(self, db, txt):
- ''' return rpm->vmlinux for fingerprint
- '''
- self.flist=self.unpickleMe(db)
- self.out=[]
- for k, v in self.flist.iteritems():
- for i in v:
- for a, b in i.iteritems():
- if b == txt or txt in b:
- self.out.append(k)
- self.out.append(a)
- return self.out
- # If we get here we didnt find a fingerprint
- self.log(logging.ERROR, 'No matching fingerprint %s' % (txt,))
- return False
-
- def coreServer(self, vmname):
- ''' Map server for given core/vmlinux
- '''
- for k, v in build_sys.iteritems():
- for a in vmname:
- reg = self.regexFindall(r'.*%s.*' % (k,), a)
- if reg:
- return v
- return False
-
- def filetype(self, txt):
- ''' Determine if filetype is acceptable
- to process in work directory
- '''
- items = ['application/x-coredump',
- 'application/octet-stream',
- 'application/x-executable']
- for i in items:
- if i in txt and 'reports' not in txt:
- return True
- return False
-
- def isRHEL3(self, vmname):
- ''' Test version for RHEL3
- '''
- for i in vmname:
- if '2.4.21' in i: return True
- else: return False
-
- def extractDebug(self, vmname):
- ''' Extract debugging symbols from associated kernel rpms
- '''
- cmd = 'rpm2cpio %s | cpio -idv --quiet %s' % (vmname[0], vmname[1])
- print cmd
- self._exec([cmd])
- if self.isRHEL3(vmname):
- # FIXME: crazy ass regex search and replace to capture
- # proper rhel3 debuginfo package
- p = re.compile('(kernel-(smp|hugemem)-|kernel-)')
- begindebug = re.compile('(./boot/)')
- enddebug = re.compile('($)')
- a = p.sub('kernel-debuginfo-', vmname[0])
- b = begindebug.sub('./usr/lib/debug/boot/', vmname[1])
- c = enddebug.sub('.debug', b)
- self._exec(['rpm2cpio %s | cpio -idv --quiet %s'
- % (a, c)])
- return
-
- def getLoadedKernelModules(self, modfile):
- ''' list kernel modules based on `mod` output in crash
- '''
- self.mod = modfile
- if os.path.isfile(self.mod):
- fd = open(self.mod,'r').read()
- self.mod_list = fd.split('\n')[1:-1]
- self.mod_list_final = []
- for item in self.mod_list:
- self.mod_list_final.append(item.split()[1])
- return self.mod_list_final
-
- def getLoadedKernelModulesPath(self, modlist, fingerprint):
- ''' list full module paths
- '''
- self.fingerprint = fingerprint
- self.modlist = modlist
- self.search_path = '/'.join(self.fingerprint[1].split('/')[:-1])
- self.pattern = re.escape(self.search_path)
- self.module_path = []
- for module in self.modlist:
- cpio_grep = commands.getoutput('rpm2cpio %s|cpio -tv|grep %s.*%s' %
- (self.fingerprint[0],
- self.pattern,
- module))
- cpio_grep_split = cpio_grep.split('\n')[1:]
- for item in cpio_grep_split:
- self.module_path.append(item.split()[-1])
- return self.module_path
-
diff --git a/version b/version
deleted file mode 100644
index d13d5c2..0000000
--- a/version
+++ /dev/null
@@ -1 +0,0 @@
-0.13 112