Loading buildstream/element.py +25 −5 Original line number Diff line number Diff line Loading @@ -2510,9 +2510,29 @@ class Element(Plugin): exclude = [] # Ignore domains that dont apply to this element # include = [domain for domain in include if domain in element_domains] exclude = [domain for domain in exclude if domain in element_domains] # - In the case of the filter element, we can explicitly # declare in domains we want to include/exclude. unfound_domains = [] include_domains = [] for domain in include: if domain not in element_domains: unfound_domains.append(domain) else: include_domains.append(domain) exclude_domains = [] for domain in exclude: if domain not in element_domains: unfound_domains.append(domain) else: exclude_domains.append(domain) # Print a warning to the user if we have unfound domains if unfound_domains: warning_detail = "Split-domains: {} not provided by '{}'.\n" \ "Known split domains: {}".format(unfound_domains, self.name, element_domains) self.warn("Split domains: {} not found.".format(unfound_domains), detail=warning_detail) # FIXME: Instead of listing the paths in an extracted artifact, # we should be using a manifest loaded from the artifact Loading @@ -2531,9 +2551,9 @@ class Element(Plugin): for domain in element_domains: if self.__splits[domain].match(filename): claimed_file = True if domain in include: if domain in include_domains: include_file = True if domain in exclude: if domain in exclude_domains: exclude_file = True if orphans and not claimed_file: Loading tests/elements/filter.py +10 −0 Original line number Diff line number Diff line Loading @@ -484,3 +484,13 @@ def test_filter_include_with_indirect_deps(datafiles, cli, tmpdir): # indirect dependencies shouldn't be staged and filtered assert not os.path.exists(os.path.join(checkout, "foo")) assert not os.path.exists(os.path.join(checkout, "bar")) @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_warning_for_nonexistent_domain(datafiles, cli, tmpdir): project = os.path.join(datafiles.dirname, datafiles.basename) result = cli.run(project=project, args=['build', 'output-include-nonexistent-domain.bst']) result.assert_success() warning_str = "WARNING Split domains: ['barry'] not found." assert warning_str in result.stderr tests/elements/filter/basic/elements/output-include-nonexistent-domain.bst 0 → 100644 +8 −0 Original line number Diff line number Diff line kind: filter depends: - filename: input.bst type: build config: include: - foo - barry Loading
buildstream/element.py +25 −5 Original line number Diff line number Diff line Loading @@ -2510,9 +2510,29 @@ class Element(Plugin): exclude = [] # Ignore domains that dont apply to this element # include = [domain for domain in include if domain in element_domains] exclude = [domain for domain in exclude if domain in element_domains] # - In the case of the filter element, we can explicitly # declare in domains we want to include/exclude. unfound_domains = [] include_domains = [] for domain in include: if domain not in element_domains: unfound_domains.append(domain) else: include_domains.append(domain) exclude_domains = [] for domain in exclude: if domain not in element_domains: unfound_domains.append(domain) else: exclude_domains.append(domain) # Print a warning to the user if we have unfound domains if unfound_domains: warning_detail = "Split-domains: {} not provided by '{}'.\n" \ "Known split domains: {}".format(unfound_domains, self.name, element_domains) self.warn("Split domains: {} not found.".format(unfound_domains), detail=warning_detail) # FIXME: Instead of listing the paths in an extracted artifact, # we should be using a manifest loaded from the artifact Loading @@ -2531,9 +2551,9 @@ class Element(Plugin): for domain in element_domains: if self.__splits[domain].match(filename): claimed_file = True if domain in include: if domain in include_domains: include_file = True if domain in exclude: if domain in exclude_domains: exclude_file = True if orphans and not claimed_file: Loading
tests/elements/filter.py +10 −0 Original line number Diff line number Diff line Loading @@ -484,3 +484,13 @@ def test_filter_include_with_indirect_deps(datafiles, cli, tmpdir): # indirect dependencies shouldn't be staged and filtered assert not os.path.exists(os.path.join(checkout, "foo")) assert not os.path.exists(os.path.join(checkout, "bar")) @pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic')) def test_warning_for_nonexistent_domain(datafiles, cli, tmpdir): project = os.path.join(datafiles.dirname, datafiles.basename) result = cli.run(project=project, args=['build', 'output-include-nonexistent-domain.bst']) result.assert_success() warning_str = "WARNING Split domains: ['barry'] not found." assert warning_str in result.stderr
tests/elements/filter/basic/elements/output-include-nonexistent-domain.bst 0 → 100644 +8 −0 Original line number Diff line number Diff line kind: filter depends: - filename: input.bst type: build config: include: - foo - barry