diff --git a/chb/app/CHVersion.py b/chb/app/CHVersion.py index ad754b54..bead9dee 100644 --- a/chb/app/CHVersion.py +++ b/chb/app/CHVersion.py @@ -1 +1,3 @@ -chbversion: str = "0.3.0-20260122" +chbversion: str = "0.3.0-20260125" + +minimum_required_chb_version = "0.6.0_20260122" diff --git a/chb/cmdline/commandutil.py b/chb/cmdline/commandutil.py index d8dbc09c..4ebd392c 100644 --- a/chb/cmdline/commandutil.py +++ b/chb/cmdline/commandutil.py @@ -62,6 +62,8 @@ from chb.app.Callgraph import CallgraphNode +from chb.app.CHVersion import minimum_required_chb_version + from chb.arm.ARMAccess import ARMAccess from chb.arm.ARMAssembly import ARMAssembly @@ -458,9 +460,18 @@ def analyzecmd(args: argparse.Namespace) -> NoReturn: exit(0) if skip_if_metrics and UF.has_analysis_results(path, xfile): - # we have what we need - print_status_update("Skip analysis of " + xname) - exit(0) + chbversion = UF.get_resultmetrics_chb_version(path, xfile) + if chbversion >= minimum_required_chb_version: + # we have what we need + print_status_update("Skip analysis of " + xname + " (version: " + chbversion + ")") + exit(0) + else: + print_status_update( + "Analysis results found are out of date with current version. " + + "Minimum required version: " + + minimum_required_chb_version + + ". Version found: " + + chbversion) try: userhints = prepare_executable( diff --git a/chb/util/fileutil.py b/chb/util/fileutil.py index 7a5c8819..4b7e71fb 100644 --- a/chb/util/fileutil.py +++ b/chb/util/fileutil.py @@ -843,6 +843,14 @@ def get_resultmetrics_xheader(path: str, xfile: str) -> ET.Element: return get_chb_xheader(filename) +def get_resultmetrics_chb_version(path: str, xfile: str) -> str: + xheader = get_resultmetrics_xheader(path, xfile) + xversion = xheader.get("chb-version") + if xversion is None: + raise CHBError("chb-version attribute missing from metrics header") + return xversion + + def get_resultdata_filename(path: str, xfile: str) -> str: fdir = get_results_dir(path, xfile) return get_chb_filename(fdir, xfile, "data.xml")