[Notes] [Git][BuildStream/buildstream][bst-1.2] 2 commits: Ensure `--deps=none` option works for `bst checkout`



Title: GitLab

Tristan Van Berkom pushed to branch bst-1.2 at BuildStream / buildstream

Commits:

4 changed files:

Changes:

  • buildstream/element.py
    ... ... @@ -434,7 +434,7 @@ class Element(Plugin):
    434 434
                                                     visited=visited, recursed=True)
    
    435 435
     
    
    436 436
             # Yeild self only at the end, after anything needed has been traversed
    
    437
    -        if should_yield and (recurse or recursed) and (scope == Scope.ALL or scope == Scope.RUN):
    
    437
    +        if should_yield and (recurse or recursed) and scope != Scope.BUILD:
    
    438 438
                 yield self
    
    439 439
     
    
    440 440
         def search(self, scope, name):
    
    ... ... @@ -1289,17 +1289,21 @@ class Element(Plugin):
    1289 1289
                     if scope == Scope.BUILD:
    
    1290 1290
                         self.stage(sandbox)
    
    1291 1291
                     elif scope == Scope.RUN:
    
    1292
    -                    # Stage deps in the sandbox root
    
    1293 1292
                         if deps == 'run':
    
    1294
    -                        with self.timed_activity("Staging dependencies", silent_nested=True):
    
    1295
    -                            self.stage_dependency_artifacts(sandbox, scope)
    
    1296
    -
    
    1297
    -                        # Run any integration commands provided by the dependencies
    
    1298
    -                        # once they are all staged and ready
    
    1299
    -                        if integrate:
    
    1300
    -                            with self.timed_activity("Integrating sandbox"):
    
    1301
    -                                for dep in self.dependencies(scope):
    
    1302
    -                                    dep.integrate(sandbox)
    
    1293
    +                        dependency_scope = Scope.RUN
    
    1294
    +                    else:
    
    1295
    +                        dependency_scope = None
    
    1296
    +
    
    1297
    +                    # Stage deps in the sandbox root
    
    1298
    +                    with self.timed_activity("Staging dependencies", silent_nested=True):
    
    1299
    +                        self.stage_dependency_artifacts(sandbox, dependency_scope)
    
    1300
    +
    
    1301
    +                    # Run any integration commands provided by the dependencies
    
    1302
    +                    # once they are all staged and ready
    
    1303
    +                    if integrate:
    
    1304
    +                        with self.timed_activity("Integrating sandbox"):
    
    1305
    +                            for dep in self.dependencies(dependency_scope):
    
    1306
    +                                dep.integrate(sandbox)
    
    1303 1307
     
    
    1304 1308
                 yield sandbox
    
    1305 1309
     
    

  • tests/frontend/buildcheckout.py
    ... ... @@ -65,9 +65,10 @@ def test_build_checkout(datafiles, cli, strict, hardlinks):
    65 65
     def test_build_checkout_deps(datafiles, cli, deps):
    
    66 66
         project = os.path.join(datafiles.dirname, datafiles.basename)
    
    67 67
         checkout = os.path.join(cli.directory, 'checkout')
    
    68
    +    element_name = "checkout-deps.bst"
    
    68 69
     
    
    69 70
         # First build it
    
    70
    -    result = cli.run(project=project, args=['build', 'target.bst'])
    
    71
    +    result = cli.run(project=project, args=['build', element_name])
    
    71 72
         result.assert_success()
    
    72 73
     
    
    73 74
         # Assert that after a successful build, the builddir is empty
    
    ... ... @@ -76,20 +77,15 @@ def test_build_checkout_deps(datafiles, cli, deps):
    76 77
         assert not os.listdir(builddir)
    
    77 78
     
    
    78 79
         # Now check it out
    
    79
    -    result = cli.run(project=project, args=['checkout', 'target.bst', '--deps', deps, checkout])
    
    80
    +    result = cli.run(project=project, args=['checkout', element_name, '--deps', deps, checkout])
    
    80 81
         result.assert_success()
    
    81 82
     
    
    82
    -    # Check that the executable hello file is found in the checkout
    
    83
    -    filename = os.path.join(checkout, 'usr', 'bin', 'hello')
    
    84
    -
    
    85
    -    if deps == "run":
    
    86
    -        assert os.path.exists(filename)
    
    87
    -    else:
    
    88
    -        assert not os.path.exists(filename)
    
    89
    -
    
    90
    -    # Check that the executable hello file is found in the checkout
    
    91
    -    filename = os.path.join(checkout, 'usr', 'include', 'pony.h')
    
    83
    +    # Verify output of this element
    
    84
    +    filename = os.path.join(checkout, 'etc', 'buildstream', 'config')
    
    85
    +    assert os.path.exists(filename)
    
    92 86
     
    
    87
    +    # Verify output of this element's runtime dependencies
    
    88
    +    filename = os.path.join(checkout, 'usr', 'bin', 'hello')
    
    93 89
         if deps == "run":
    
    94 90
             assert os.path.exists(filename)
    
    95 91
         else:
    

  • tests/frontend/project/elements/checkout-deps.bst
    1
    +kind: import
    
    2
    +description: It is important for this element to have both build and runtime dependencies
    
    3
    +sources:
    
    4
    +- kind: local
    
    5
    +  path: files/etc-files
    
    6
    +depends:
    
    7
    +- filename: import-dev.bst
    
    8
    +  type: build
    
    9
    +- filename: import-bin.bst
    
    10
    +  type: runtime

  • tests/frontend/project/files/etc-files/etc/buildstream/config
    1
    +config



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