diff --git a/module_build_service/builder.py b/module_build_service/builder.py index 57f9758a..e2b29148 100644 --- a/module_build_service/builder.py +++ b/module_build_service/builder.py @@ -523,6 +523,14 @@ chmod 644 %buildroot/%_rpmconfigdir/macros.d/macros.modules log.info("%r adding deps on %r" % (self, dependencies)) self._koji_add_many_tag_inheritance(self.module_build_tag, dependencies) + def _get_tagged_nvrs(self, tag): + """ + Returns set of NVR strings tagged in tag `tag`. + """ + tagged = self.koji_session.listTagged(tag) + tagged_nvrs = set(build["nvr"] for build in tagged) + return tagged_nvrs + def buildroot_add_artifacts(self, artifacts, install=False): """ :param artifacts - list of artifacts to add to buildroot @@ -533,8 +541,7 @@ chmod 644 %buildroot/%_rpmconfigdir/macros.d/macros.modules log.info("%r adding artifacts %r" % (self, artifacts)) build_tag = self._get_tag(self.module_build_tag)['id'] - tagged = self.koji_session.listTagged(self.module_build_tag['name']) - tagged_nvrs = [build["nvr"] for build in tagged] + tagged_nvrs = self._get_tagged_nvrs(self.module_build_tag['name']) for nvr in artifacts: if nvr in tagged_nvrs: @@ -554,8 +561,7 @@ chmod 644 %buildroot/%_rpmconfigdir/macros.d/macros.modules def tag_artifacts(self, artifacts): dest_tag = self._get_tag(self.module_tag)['id'] - tagged = self.koji_session.listTagged(self.module_tag['name']) - tagged_nvrs = [build["nvr"] for build in tagged] + tagged_nvrs = self._get_tagged_nvrs(self.module_tag['name']) for nvr in artifacts: if nvr in tagged_nvrs: diff --git a/module_build_service/scheduler/handlers/components.py b/module_build_service/scheduler/handlers/components.py index c0a1026f..52665043 100644 --- a/module_build_service/scheduler/handlers/components.py +++ b/module_build_service/scheduler/handlers/components.py @@ -105,7 +105,11 @@ def _finalize(config, session, msg, state): log.debug("%r" % built_components_in_batch) install = bool(component_build.package == 'module-build-macros') builder.buildroot_add_artifacts(built_components_in_batch, install=install) - builder.tag_artifacts(built_components_in_batch) + + # Do not tag packages which belong to -build tag to final tag. + if not install: + builder.tag_artifacts(built_components_in_batch) + session.commit() elif (any([c.state != koji.BUILD_STATES['BUILDING'] for c in unbuilt_components_in_batch])): diff --git a/tests/test_build/test_build.py b/tests/test_build/test_build.py index 27c359d6..43652eb4 100644 --- a/tests/test_build/test_build.py +++ b/tests/test_build/test_build.py @@ -136,6 +136,7 @@ class TestModuleBuilder(GenericBuilder): def buildroot_add_artifacts(self, artifacts, install=False): if TestModuleBuilder.on_buildroot_add_artifacts_cb: TestModuleBuilder.on_buildroot_add_artifacts_cb(self, artifacts, install) + self._send_repo_done() def buildroot_add_repos(self, dependencies): pass @@ -143,7 +144,6 @@ class TestModuleBuilder(GenericBuilder): def tag_artifacts(self, artifacts): if TestModuleBuilder.on_tag_artifacts_cb: TestModuleBuilder.on_tag_artifacts_cb(self, artifacts) - self._send_repo_done() @property def module_build_tag(self): @@ -254,7 +254,6 @@ class TestBuild(unittest.TestCase): # Check that components are tagged after the batch is built. tag_groups = [] - tag_groups.append([u'module-build-macros-0.1-1.module_fc4ed5f7.src.rpm-1-1']) tag_groups.append([u'perl-Tangerine?#f25-1-1', u'perl-List-Compare?#f25-1-1']) tag_groups.append([u'tangerine?#f25-1-1'])