From 352f4c9960ad3e0e467c44fe256d4c837d3d330e Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Oct 22 2020 10:45:14 +0000 Subject: [PATCH 1/2] kojira: don't expire ignored tags with targets Fixes: https://pagure.io/koji/issue/2542 --- diff --git a/util/kojira b/util/kojira index 040fb60..0d9195b 100755 --- a/util/kojira +++ b/util/kojira @@ -780,10 +780,14 @@ class RepoManager(object): n_need = len(self.needed_tags) 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) - ]) + self.build_tags = set() + self.ignored_build_tags = set() + for t in self.session.getBuildTargets(): + if koji.util.multi_fnmatch(t['build_tag_name'], ignore): + self.ignored_build_tags.add(t['build_tag']) + else: + self.build_tags.add(t['build_tag']) + # index repos by tag tag_repos = {} for repo in to_list(self.repos.values()): @@ -846,7 +850,7 @@ class RepoManager(object): entry['taginfo']) del self.needed_tags[tag_id] for tag_id, repolist in tag_repos.items(): - if tag_id not in self.build_tags: + if tag_id not in self.build_tags and not in self.ignored_build_tags: # repos for these tags are no longer required for repo in repolist: if repo.ready(): From f49a272fd63af6aab32481a60b40934c4ba97dfa Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Oct 27 2020 12:35:41 +0000 Subject: [PATCH 2/2] remove instance variables --- diff --git a/util/kojira b/util/kojira index 0d9195b..443b039 100755 --- a/util/kojira +++ b/util/kojira @@ -780,20 +780,20 @@ class RepoManager(object): n_need = len(self.needed_tags) ignore = self.options.ignore_tags.split() - self.build_tags = set() - self.ignored_build_tags = set() + build_tags = set() + ignored_build_tags = set() for t in self.session.getBuildTargets(): if koji.util.multi_fnmatch(t['build_tag_name'], ignore): - self.ignored_build_tags.add(t['build_tag']) + ignored_build_tags.add(t['build_tag']) else: - self.build_tags.add(t['build_tag']) + build_tags.add(t['build_tag']) # index repos by tag tag_repos = {} for repo in to_list(self.repos.values()): tag_repos.setdefault(repo.tag_id, []).append(repo) - for tag_id in self.build_tags: + for tag_id in build_tags: covered = False for repo in tag_repos.get(tag_id, []): if repo.current: @@ -845,12 +845,12 @@ class RepoManager(object): # some cleanup for tag_id in list(self.needed_tags): entry = self.needed_tags.get(tag_id) - if tag_id not in self.build_tags: + if tag_id not in build_tags: self.logger.info("Tag %(name)s is no longer a build tag", entry['taginfo']) del self.needed_tags[tag_id] for tag_id, repolist in tag_repos.items(): - if tag_id not in self.build_tags and not in self.ignored_build_tags: + if tag_id not in build_tags and tag_id not in ignored_build_tags: # repos for these tags are no longer required for repo in repolist: if repo.ready():