diff --git a/botbot/botbot.py b/botbot/botbot.py index a28a85c..470801b 100755 --- a/botbot/botbot.py +++ b/botbot/botbot.py @@ -70,17 +70,18 @@ def run_file_check(args, outpath): all_file_checks = checks.ALLCHECKS + schecks.ALLSCHECKS chkr.register(*all_file_checks) - # Set up default options - opt = { - 'shared': args.shared if hasattr(args, 'shared') else True, - 'link': args.follow_symlinks if hasattr(args, 'follow_symlinks') else False, - 'verbose': args.verbose if hasattr(args, 'verbose') else False, - 'force': args.force if hasattr(args, 'force') else False, - 'me': args.me if hasattr(args, 'me') else False + # Get the options + opts = { + 'shared': args.shared, + 'link': args.follow_symlinks, + 'verbose': args.verbose, + 'cached': args.cached, + 'force': args.force_recheck, + 'me': args.me } # Run the checker! - chkr.check_all(path, **opt) + chkr.check_all(path, **opts) def run_env_check(args, outpath): # Import relevant environment checks diff --git a/botbot/checker.py b/botbot/checker.py index a1fd020..cfe68f5 100644 --- a/botbot/checker.py +++ b/botbot/checker.py @@ -124,7 +124,7 @@ def check_all(self, path, shared=False, link=False, # Munge that path boys! path = os.path.expanduser(path) path = os.path.abspath(path) - self.path = path + self.path = py.path.local(path) # If no cached tree exists, (or if we explicitly want to build # a new one) build one if we need one @@ -139,6 +139,9 @@ def check_all(self, path, shared=False, link=False, self.db.store_file_problems(self.checked) + else: + self.checked = self.db.get_cached_results(self.path.strpath) + # Record stats and write the report. We out! self.status['time'] = time.time() - starttime self.reporter.write_report(fmt, shared) diff --git a/botbot/checkinfo.py b/botbot/checkinfo.py index 57e704c..17d02f3 100644 --- a/botbot/checkinfo.py +++ b/botbot/checkinfo.py @@ -16,13 +16,20 @@ def _is_important(path): class CheckResult(): """Holds the result of a check""" - def __init__(self, path, lastcheck=time.time(), probstr=None): - self.path = path + def __init__(self, path, lastcheck=time.time(), problems=None, md5sum=None): + if isinstance(path, str): + self.path = py.path.local(path) + elif isinstance(path, py.path.local): + self.path = path + self.lastcheck = lastcheck - if probstr: - self.decode_probstr(probstr) - else: - self.problems = set() + + self.problems = set() + if problems: + if isinstance(problems, str): + self.decode_probstr(problems) + + self.md5sum = md5sum def add_problem(self, probstr): """Add a problem to this file""" diff --git a/botbot/sqlcache.py b/botbot/sqlcache.py index 24e662e..385a52e 100644 --- a/botbot/sqlcache.py +++ b/botbot/sqlcache.py @@ -86,7 +86,7 @@ def get_cached_results(self, path, uid=None): return [ ci.CheckResult( - dict(res) + **dict(res) ) for res in cached ]