From 50c28bb41d57a5447c56a251486f20ba8e55b7a7 Mon Sep 17 00:00:00 2001 From: Mike McLean Date: Feb 20 2018 14:43:55 +0000 Subject: PR#695: blacklist tags for kojira Merges #695 https://pagure.io/koji/pull-request/695 Fixes: #694 https://pagure.io/koji/issue/694 Give kojira a blacklist of targets that it shouldn't bother with --- diff --git a/tests/test_kojira/test_repo_manager.py b/tests/test_kojira/test_repo_manager.py index bd48d23..09b5bf1 100644 --- a/tests/test_kojira/test_repo_manager.py +++ b/tests/test_kojira/test_repo_manager.py @@ -132,9 +132,9 @@ class RepoManagerTest(unittest.TestCase): def test_check_needed(self): self.session.getBuildTargets.return_value = [ - {'build_tag': 1}, - {'build_tag': 2}, - {'build_tag': 3}, + {'build_tag': 1, 'build_tag_name': 'tag 1'}, + {'build_tag': 2, 'build_tag_name': 'tag 2'}, + {'build_tag': 3, 'build_tag_name': 'tag 3'}, ] # make two repo entries repo1 = mock.MagicMock() diff --git a/util/kojira b/util/kojira index c1db9ed..3cdeb43 100755 --- a/util/kojira +++ b/util/kojira @@ -556,8 +556,11 @@ class RepoManager(object): """Determine which tags currently need regeneration""" n_need = len(self.needed_tags) - self.build_tags = set( - [t['build_tag']for t in self.session.getBuildTargets()]) + ignore = self.options.ignore_tags.split() + self.build_tags = set([ + t['build_tag'] for t in self.session.getBuildTargets() + if not koji.util.multi_fnmatch(t['build_tag_name'], ignore) + ]) #index repos by tag tag_repos = {} for repo in self.repos.values(): @@ -811,6 +814,7 @@ def get_options(): defaults = {'with_src': False, 'debuginfo_tags': '', 'source_tags': '', + 'ignore_tags': '', 'verbose': False, 'debug': False, 'ignore_stray_repos': False, @@ -847,7 +851,8 @@ def get_options(): 'max_delete_processes', 'max_repo_tasks_maven', 'delete_batch_size', 'dist_repo_lifetime', 'sleeptime') str_opts = ('topdir', 'server', 'user', 'password', 'logfile', 'principal', 'keytab', 'krbservice', - 'cert', 'ca', 'serverca', 'debuginfo_tags', 'source_tags') # FIXME: remove ca here + 'cert', 'ca', 'serverca', 'debuginfo_tags', + 'source_tags', 'ignore_tags') # FIXME: remove ca here bool_opts = ('with_src','verbose','debug','ignore_stray_repos', 'offline_retry', 'krb_rdns', 'krb_canon_host', 'no_ssl_verify') for name in config.options(section): diff --git a/util/kojira.conf b/util/kojira.conf index fc8f4c0..6cf509e 100644 --- a/util/kojira.conf +++ b/util/kojira.conf @@ -48,3 +48,6 @@ with_src=no ;turn on debugging statements in the log ;debug = false + +; ignored repositories according to glob. Multiple masks separated by space. +; ignore_tags =