[Piuparts-commits] [SCM] piuparts git repository branch, master, updated. 0.51
David Steele
dsteele at gmail.com
Wed May 15 10:09:37 UTC 2013
The following commit has been merged in the master branch:
commit 45eccb50c328d68e579249cee93dcafcc8fcfaf9
Author: David Steele <dsteele at gmail.com>
Date: Fri Mar 22 20:40:36 2013 -0400
detect_well_known_errors - Restore recheck and recheck-failed options.
Conflicts:
master-bin/detect_well_known_errors
diff --git a/master-bin/detect_well_known_errors b/master-bin/detect_well_known_errors
index a42b11e..2984664 100755
--- a/master-bin/detect_well_known_errors
+++ b/master-bin/detect_well_known_errors
@@ -24,6 +24,7 @@ import time
import re
import subprocess
from collections import namedtuple
+import argparse
CONFIG_FILE = "/etc/piuparts/piuparts.conf"
DISTRO_CONFIG_FILE = "/etc/piuparts/distros.conf"
@@ -251,16 +252,18 @@ def section_path( logpath ):
def mtime( path ):
return os.path.getmtime(path)
-def clean_cache_files( logdict, cachedict, skipnewer=False ):
+def clean_cache_files( logdict, cachedict, recheck=False, recheck_failed=False,
+ skipnewer=False ):
"""Delete files in cachedict if the corresponding logdict file is missing
or newer"""
count = 0
for pkgspec in cachedict:
if pkgspec not in logdict \
- or (mtime(logdict[pkgspec]) > mtime(cachedict[pkgspec])
- and not skipnewer) \
- or get_where(logdict[pkgspec]) != get_where(cachedict[pkgspec]):
+ or (mtime(logdict[pkgspec])>mtime(cachedict[pkgspec]) and not skipnewer)\
+ or get_where(logdict[pkgspec]) != get_where(cachedict[pkgspec])\
+ or recheck\
+ or (recheck_failed and not get_where(cachedict[pkgspec]) in ['pass']):
try:
os.remove(cachedict[pkgspec])
@@ -365,7 +368,8 @@ def update_html( section, logdict, problem_list, failures, config, pkgsdb ):
logdict,
PKG_ERROR_TPL, UNKNOWN_TPL, pkgsdb )
-def process_section( section, config, problem_list, pkgsdb=None ):
+def process_section( section, config, problem_list,
+ recheck=False, recheck_failed=False, pkgsdb=None ):
""" Update .bug and .kpr files for logs in this section """
sectiondir = os.path.join( config['master-directory'], section )
@@ -379,8 +383,8 @@ def process_section( section, config, problem_list, pkgsdb=None ):
(logdict, kprdict, bugdict) = [ get_file_dict(workdirs, x ) \
for x in [LOG_EXT, KPR_EXT, BUG_EXT] ]
- del_cnt = clean_cache_files( logdict, kprdict )
- clean_cache_files( logdict, bugdict, True )
+ del_cnt = clean_cache_files( logdict, kprdict, recheck, recheck_failed )
+ clean_cache_files( logdict, bugdict, skipnewer=True )
(kprdict, bugdict) = [get_file_dict(workdirs,x) for x in [KPR_EXT, BUG_EXT]]
@@ -417,14 +421,15 @@ def process_section( section, config, problem_list, pkgsdb=None ):
return( del_cnt, add_cnt, failures )
-def detect_well_known_errors( config, problem_list ):
+def detect_well_known_errors( config, problem_list, recheck, recheck_failed ):
for section in config['sections'].split(" "):
print time.strftime( "%a %b %2d %H:%M:%S %Z %Y", time.localtime() )
print "%s:" % section
( del_cnt, add_cnt, failures ) = \
- process_section( section, config, problem_list )
+ process_section( section, config, problem_list,
+ recheck, recheck_failed )
print "parsed logfiles: %d removed, %d added" % (del_cnt, add_cnt)
@@ -444,9 +449,28 @@ def create_problem_list( pdir ):
if __name__ == '__main__':
+ parser = argparse.ArgumentParser(
+ description="Detect/process well known errors to html",
+ epilog="""
+This script processes all log files against defined "known_problem" files,
+caching the problems found, by package, into ".kpr" files. The cached data
+is summarized into html ".tpl" files in <html_dir>/<section>, which are then
+incorporated by piuparts-report into the final web reports.
+""" )
+
+ parser.add_argument( '--recheck', dest='recheck', action='store_true',
+ help="recheck all log files (delete cache)" )
+
+ parser.add_argument( '--recheck-failed', dest='recheck_failed',
+ action='store_true',
+ help="recheck failed log files (delete cache)" )
+
+ args = parser.parse_args()
+
conf = WKE_Config()
conf.read( CONFIG_FILE )
problem_list = create_problem_list( conf['known-problem-directory'] )
- detect_well_known_errors( conf, problem_list )
+ detect_well_known_errors( conf, problem_list, args.recheck,
+ args.recheck_failed )
--
piuparts git repository
More information about the Piuparts-commits
mailing list