diff --git a/backend/run/copr-change-storage b/backend/run/copr-change-storage index 01139c4ad..21573ddb3 100755 --- a/backend/run/copr-change-storage +++ b/backend/run/copr-change-storage @@ -51,6 +51,31 @@ def get_arg_parser(): return parser +def is_valid_build_directory(name): + """ + See the `copr-backend-resultdir-cleaner`. We may want to share the code + between them. + """ + if name in ["repodata", "devel"]: + return False + + if name.startswith("repodata.old") or name.startswith(".repodata."): + return False + + if name in ["tmp", "cache", "appdata"]: + return False + + parts = name.split("-") + if len(parts) <= 1: + return False + + number = parts[0] + if len(number) != 8 or any(not c.isdigit() for c in number): + return False + + return True + + def main(): """ The main function @@ -98,6 +123,10 @@ def main(): if not os.path.isdir(resultdir): continue + if not is_valid_build_directory(builddir): + log.info("Skipping: %s", resultdir) + continue + full_name = "{0}/{1}".format(owner, subproject) result = storage.init_project(full_name, chroot) if not result: