Added clean mock cache

This commit is contained in:
Alexey Berezhok
2025-12-04 23:18:15 +03:00
parent f2136260c9
commit 482a586b6e
5 changed files with 43 additions and 0 deletions

View File

@@ -321,4 +321,10 @@ class MockManager
@db.after_fork
end
def self.clean_mock
cmd_args = %Q(/usr/bin/mock --scrub-all-chroots)
cmd = Runner.new(cmd_args)
cmd.run_clean
end
end

View File

@@ -54,3 +54,8 @@ end
def get_rpms_list(directory)
Dir.glob(File.join(directory, "**", "*.rpm")).reject { |f| File.directory?(f) || f =~ /repodata\// }.map { |f| f.delete_prefix(directory + "/") }
end
def get_dirs_in_mock_cache(dir_path)
Dir.glob(File.join(dir_path, "*")).select { |f| File.directory?(f) }.map{ |f| File.basename(f) }
end