cas-admin | 19 ++++++++++---------
cas.conf | 7 +++++--
doc/index.rst | 4 ++++
3 files changed, 19 insertions(+), 11 deletions(-)
New commits:
commit 3ac5745a0e08c3b9d7bb0b22c250352ae6e0c006
Author: adam stokes <astokes(a)fedoraproject.org>
Date: Thu May 13 11:58:39 2010 -0400
add flexibilty to posix regular expression syntax
diff --git a/cas-admin b/cas-admin
index 75c071d..cdc23a9 100755
--- a/cas-admin
+++ b/cas-admin
@@ -35,7 +35,7 @@ import optparse
import datetime
import paramiko
import tempfile
-from multiprocessing import Process, Queue, current_process, cpu_count
+from multiprocessing import Process, Queue, current_process, cpu_count, Lock
from caslib.core import casexecute, coreTimestamp
from caslib.util import Utility, genprint
@@ -68,11 +68,12 @@ util = Utility()
# Gather number of cpu's
PROCESSES = cpu_count()
-def queryWorker(input):
+def queryWorker(input, mutex):
""" worker function to process rpm debugs """
for rpm, dst in iter(input.get, 'STOP'):
session = Session()
rpm_IN_DB = session.query(RPM).filter_by(rpmPath=rpm).first()
+ session.close()
if not rpm_IN_DB:
# add RPM to database
session = Session()
@@ -94,7 +95,7 @@ def queryWorker(input):
session.add(timestamp_record)
# commit to database
session.commit()
- session.close()
+ session.close()
def queryLocalRpms():
""" query debug kernels located on the filesystem
@@ -104,22 +105,22 @@ def queryLocalRpms():
"""
# create Queues
task_queue = Queue()
- # Uses emacs regex -- see `man find`
- cmd = "find -L %s -iregex %s" % (settings["KERNELS"],
- settings["RPMFILTER"])
+ cmd = "find -L %s -regextype %s -iregex %s" % \
+ (settings["KERNELS"],
+ settings["REGEXTYPE"],
+ settings["RPMFILTER"])
results, err = casexecute(cmd, True)
dst = tempfile.mkdtemp(prefix='cas-')
for rpm in results.split():
- task_queue.put([rpm, dst])
+ task_queue.put((rpm, dst))
for i in range(PROCESSES):
- Process(target=queryWorker, args(task_queue).start()
+ Process(target=queryWorker, args=(task_queue, mutex)).start()
for i in range(PROCESSES):
task_queue.put('STOP')
# Cleanup extracted debugs
shutil.rmtree(dst)
- genprint("CAS Database generation complete.")
return
def queryServers():
diff --git a/cas.conf b/cas.conf
index ba5efd2..72a585f 100644
--- a/cas.conf
+++ b/cas.conf
@@ -22,9 +22,12 @@ sshkey=dss
# indefinately recursive
kernels=/mnt/kernels
-# Compose emacs regular expression for determining what
+# set -regextype see `man find`
+regexType=posix-extended
+
+# Compose -regextype regular expression for determining what
# kernel debug rpms you wish to search for
-rpmFilter=.*kerne.+-debuginfo-[0-9].*\.rpm
+rpmFilter=[^data].*kerne.+-debuginfo-[0-9].*\.rpm
# debug level (DEBUG, INFO)
debugLevel=DEBUG
diff --git a/doc/index.rst b/doc/index.rst
index 3b41ede..e906a15 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -60,6 +60,7 @@ each section and describe its meaning::
casuser=root
sshkey=dss
kernels=/mnt/kernels
+ regexType=posix-extended
rpmFilter=.*kerne.+-debuginfo-[0-9].*\.rpm
debugLevel=DEBUG
workDirectory=/cores/processed
@@ -80,6 +81,9 @@ each section and describe its meaning::
stored. This can range anywhere from an nfs mount, samba share, local disk or
any other type of media the cas server can access.
+``regexType``: (**Required**) Defines the regex syntax to use within ``find``. Doing a
+``man find`` and searching for regextype will give you the allowable syntaxess.
+
``rpmFilters``: (**Required**) This is a emacs based regular expression which is
essentially
passed to a find command to locate the various kernel-debuginfo packages defined
in ``kernels`` directive.
Show replies by date