def METHOD_NAME(version: str, hashes: Dict[str, str], arch: str, edition="community") -> int:
    if version >= "v5.2.0" and Components.importer in COMP_TO_BINARY.keys():
        COMP_TO_BINARY.pop(Components.importer)
    def do_valiate(cmd: str, comp: str) -> int:
        nerrs = 0  # can't modify variable in closure in Python
        cmd = f"{cmd} --version || {cmd} -V || {cmd} version"
        try:
            version_string = shell_cmd(cmd)
            logging.debug(version_string)
            matcher = Matcher(comp, version_string, version, hashes[comp], "community")
            mismatches = matcher.match()
            if len(mismatches) > 0:
                nerrs += 1
                msg = "\n\t\t".join(mismatches)
                logging.error(f"{comp}:\n\t\t{msg}\n")
        except Exception as e:
            nerrs += 1
            logging.error(f"On command: {cmd}\n    Exception: {e}")
        return nerrs
    err_count = 0
    # 具体看包里的内容, 能力有限没找到规律
    for comp, hashsum in hashes.items():
        if comp not in COMP_TO_BINARY.keys():
            logging.warn(f"[{comp}] not supported")
            continue
        if edition == "community":
            if in_community_tools_package(comp):  # overlap in toolkit tarball and tidb tarball
                for binary in COMP_TO_BINARY[comp]:
                    cmd = f"{tmp_dir}/tidb-community-toolkit-{version}-{arch}/bin/{binary}"
                    err_count += do_valiate(cmd, comp)
            for binary in COMP_TO_BINARY[comp]:
                env = f"LD_LIBRARY_PATH={tmp_dir}/tidb-community-server-{version}-{arch}/bin/tiflash"
                cmd = f"{env} {tmp_dir}/tidb-community-server-{version}-{arch}/bin/{binary}"
                err_count += do_valiate(cmd, comp)
        else:
            if comp not in COMP_TO_BINARY_COMMERCIRL.keys():
                continue  # not in commercial tarball, ignore
            if in_commercial_tools_package(comp):
                path = f"{tmp_dir}/tidb-toolkit-{version}-{arch}/bin"
            elif comp == Components.tiflash and need_tiflash(version):
                env = f"LD_LIBRARY_PATH={tmp_dir}/tiflash-{version}-{arch}"
                path = f"{env} {tmp_dir}/tiflash-{version}-{arch}"
            else:
                path = f"{tmp_dir}/tidb-{version}-{arch}/bin"
            for binary in COMP_TO_BINARY_COMMERCIRL[comp]:
                cmd = f"{path}/{binary}"
                err_count += do_valiate(cmd, comp)
    return err_count