[Notes] [Git][BuildStream/buildstream][chandan/fix-git-version-mac] 5 commits: filter.py: don't recurse when staging dependencies



Title: GitLab

Chandan Singh pushed to branch chandan/fix-git-version-mac at BuildStream / buildstream

Commits:

6 changed files:

Changes:

  • buildstream/plugins/elements/filter.py
    ... ... @@ -47,6 +47,8 @@ from buildstream import Element, ElementError, Scope
    47 47
     class FilterElement(Element):
    
    48 48
         # pylint: disable=attribute-defined-outside-init
    
    49 49
     
    
    50
    +    BST_ARTIFACT_VERSION = 1
    
    51
    +
    
    50 52
         # The filter element's output is its dependencies, so
    
    51 53
         # we must rebuild if the dependencies change even when
    
    52 54
         # not in strict build plans.
    
    ... ... @@ -102,7 +104,7 @@ class FilterElement(Element):
    102 104
     
    
    103 105
         def assemble(self, sandbox):
    
    104 106
             with self.timed_activity("Staging artifact", silent_nested=True):
    
    105
    -            for dep in self.dependencies(Scope.BUILD):
    
    107
    +            for dep in self.dependencies(Scope.BUILD, recurse=False):
    
    106 108
                     dep.stage_artifact(sandbox, include=self.include,
    
    107 109
                                        exclude=self.exclude, orphans=self.include_orphans)
    
    108 110
             return ""
    

  • tests/elements/filter.py
    ... ... @@ -464,3 +464,23 @@ def test_filter_track_multi_exclude(datafiles, cli, tmpdir):
    464 464
         assert "ref" not in new_input["sources"][0]
    
    465 465
         new_input2 = _yaml.load(input2_file)
    
    466 466
         assert new_input2["sources"][0]["ref"] == ref
    
    467
    +
    
    468
    +
    
    469
    +@pytest.mark.datafiles(os.path.join(DATA_DIR, 'basic'))
    
    470
    +def test_filter_include_with_indirect_deps(datafiles, cli, tmpdir):
    
    471
    +    project = os.path.join(datafiles.dirname, datafiles.basename)
    
    472
    +    result = cli.run(project=project, args=[
    
    473
    +        'build', 'output-include-with-indirect-deps.bst'])
    
    474
    +    result.assert_success()
    
    475
    +
    
    476
    +    checkout = os.path.join(tmpdir.dirname, tmpdir.basename, 'checkout')
    
    477
    +    result = cli.run(project=project, args=[
    
    478
    +        'artifact', 'checkout', 'output-include-with-indirect-deps.bst', '--directory', checkout])
    
    479
    +    result.assert_success()
    
    480
    +
    
    481
    +    # direct dependencies should be staged and filtered
    
    482
    +    assert os.path.exists(os.path.join(checkout, "baz"))
    
    483
    +
    
    484
    +    # indirect dependencies shouldn't be staged and filtered
    
    485
    +    assert not os.path.exists(os.path.join(checkout, "foo"))
    
    486
    +    assert not os.path.exists(os.path.join(checkout, "bar"))

  • tests/elements/filter/basic/elements/input-with-deps.bst
    1
    +kind: import
    
    2
    +
    
    3
    +depends:
    
    4
    +- filename: input.bst
    
    5
    +
    
    6
    +sources:
    
    7
    +- kind: local
    
    8
    +  path: files
    
    9
    +
    
    10
    +public:
    
    11
    +  bst:
    
    12
    +    split-rules:
    
    13
    +      baz:
    
    14
    +      - /baz

  • tests/elements/filter/basic/elements/output-include-with-indirect-deps.bst
    1
    +kind: filter
    
    2
    +
    
    3
    +depends:
    
    4
    +- filename: input-with-deps.bst
    
    5
    +  type: build

  • tests/testutils/site.py
    ... ... @@ -18,7 +18,7 @@ try:
    18 18
         utils.get_host_tool('git')
    
    19 19
         HAVE_GIT = True
    
    20 20
         out = str(subprocess.check_output(['git', '--version']), "utf-8")
    
    21
    -    version = tuple(int(x) for x in out.split(' ', 2)[2].split('.'))
    
    21
    +    version = tuple(int(x) for x in out.split(' ')[2].split('.'))
    
    22 22
         HAVE_OLD_GIT = version < (1, 8, 5)
    
    23 23
     except ProgramNotFoundError:
    
    24 24
         HAVE_GIT = False
    

  • tox.ini
    ... ... @@ -88,5 +88,5 @@ whitelist_externals =
    88 88
     commands =
    
    89 89
         python3 setup.py --command-packages=click_man.commands man_pages
    
    90 90
     deps =
    
    91
    -    click-man
    
    91
    +    click-man >= 0.3.0
    
    92 92
         -rrequirements/requirements.txt



  • [Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]