Skip to content

Commit

Permalink
backend: skip invalid build directories
Browse files Browse the repository at this point in the history
  • Loading branch information
FrostyX committed Dec 1, 2024
1 parent c06a8ef commit f69d158
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions backend/run/copr-change-storage
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit f69d158

Please sign in to comment.