[Notes] [Git][BuildStream/buildstream][willsalmon/defaultWorkspaces] Adding a little bit extra defaults so they work



Title: GitLab

Will Salmon pushed to branch willsalmon/defaultWorkspaces at BuildStream / buildstream

Commits:

2 changed files:

Changes:

  • buildstream/_stream.py
    ... ... @@ -462,8 +462,9 @@ class Stream():
    462 462
                                                   track_selection=PipelineSelection.REDIRECT)
    
    463 463
     
    
    464 464
             for target, directory in zip(elements, directories):
    
    465
    -            directory = os.path.abspath(directory)
    
    466
    -    
    
    465
    +            if not os.path.isabs(directory):
    
    466
    +                directory = os.path.abspath(os.path.join(self._context.workspacedir, directory))
    
    467
    +
    
    467 468
                 if not list(target.sources()):
    
    468 469
                     build_depends = [x.name for x in target.dependencies(Scope.BUILD, recurse=False)]
    
    469 470
                     if not build_depends:
    
    ... ... @@ -478,7 +479,7 @@ class Stream():
    478 479
                 workspace = workspaces.get_workspace(target._get_full_name())
    
    479 480
                 if workspace and not force:
    
    480 481
                     raise StreamError("Workspace '{}' is already defined at: {}"
    
    481
    -                              .format(target.name, workspace.get_absolute_path()))
    
    482
    +                                  .format(target.name, workspace.get_absolute_path()))
    
    482 483
     
    
    483 484
                 # If we're going to checkout, we need at least a fetch,
    
    484 485
                 # if we were asked to track first, we're going to fetch anyway.
    
    ... ... @@ -502,6 +503,7 @@ class Stream():
    502 503
                 try:
    
    503 504
                     os.makedirs(directory, exist_ok=True)
    
    504 505
                 except OSError as e:
    
    506
    +                 # should we try to make this more attomic?
    
    505 507
                     raise StreamError("Failed to create workspace directory: {}".format(e)) from e
    
    506 508
     
    
    507 509
                 workspaces.create_workspace(target._get_full_name(), directory)
    
    ... ... @@ -510,7 +512,6 @@ class Stream():
    510 512
                     with target.timed_activity("Staging sources to {}".format(directory)):
    
    511 513
                         target._open_workspace()
    
    512 514
     
    
    513
    -        ## should we try to make this more attomic?
    
    514 515
             workspaces.save_config()
    
    515 516
             self._message(MessageType.INFO, "Saved workspace configuration")
    
    516 517
     
    

  • tests/frontend/workspace.py
    ... ... @@ -184,7 +184,7 @@ def test_open_multi(cli, tmpdir, datafiles):
    184 184
     
    
    185 185
     @pytest.mark.datafiles(DATA_DIR)
    
    186 186
     def test_open_multi_with_directory(cli, tmpdir, datafiles):
    
    187
    -    workspace_object = WorkspaceCreater(cli, tmpdir, datafiles) 
    
    187
    +    workspace_object = WorkspaceCreater(cli, tmpdir, datafiles)
    
    188 188
     
    
    189 189
         results = workspace_object.create_workspace_elements(repo_kinds, False, repo_kinds)
    
    190 190
         os.makedirs(workspace_object.workspace_cmd, exist_ok=True)
    



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