[Notes] [Git][BuildStream/buildstream][valentindavid/fix_included_junction_track] Fix tracking of junctions used in project.conf.



Title: GitLab

Valentin David pushed to branch valentindavid/fix_included_junction_track at BuildStream / buildstream

Commits:

2 changed files:

Changes:

  • buildstream/_stream.py
    ... ... @@ -273,7 +273,8 @@ class Stream():
    273 273
                            except_targets=except_targets,
    
    274 274
                            track_except_targets=except_targets,
    
    275 275
                            track_cross_junctions=cross_junctions,
    
    276
    -                       fetch_subprojects=True)
    
    276
    +                       fetch_subprojects=True,
    
    277
    +                       only_track=True)
    
    277 278
     
    
    278 279
             track_queue = TrackQueue(self._scheduler)
    
    279 280
             self._add_queue(track_queue, track=True)
    
    ... ... @@ -833,6 +834,7 @@ class Stream():
    833 834
         #    use_artifact_config (bool): Whether to initialize artifacts with the config
    
    834 835
         #    artifact_remote_url (bool): A remote url for initializing the artifacts
    
    835 836
         #    fetch_subprojects (bool): Whether to fetch subprojects while loading
    
    837
    +    #    only_track (bool): Whether it should only calculate tracking
    
    836 838
         #
    
    837 839
         # Returns:
    
    838 840
         #    (list of Element): The primary element selection
    
    ... ... @@ -847,7 +849,8 @@ class Stream():
    847 849
                   use_artifact_config=False,
    
    848 850
                   artifact_remote_url=None,
    
    849 851
                   fetch_subprojects=False,
    
    850
    -              dynamic_plan=False):
    
    852
    +              dynamic_plan=False,
    
    853
    +              only_track=False):
    
    851 854
     
    
    852 855
             # Load rewritable if we have any tracking selection to make
    
    853 856
             rewritable = False
    
    ... ... @@ -905,6 +908,10 @@ class Stream():
    905 908
             for element in track_selected:
    
    906 909
                 element._schedule_tracking()
    
    907 910
     
    
    911
    +        if only_track:
    
    912
    +            self._pipeline.resolve_elements(track_selected)
    
    913
    +            return [], track_selected
    
    914
    +
    
    908 915
             # ArtifactCache.setup_remotes expects all projects to be fully loaded
    
    909 916
             for project in self._context.get_projects():
    
    910 917
                 project.ensure_fully_loaded()
    

  • tests/frontend/track.py
    ... ... @@ -612,3 +612,25 @@ def test_track_include_junction(cli, tmpdir, datafiles, ref_storage, kind):
    612 612
             # Assert that we are now buildable because the source is
    
    613 613
             # now cached.
    
    614 614
             assert cli.get_element_state(project, element_name) == 'buildable'
    
    615
    +
    
    616
    +
    
    617
    +@pytest.mark.datafiles(DATA_DIR)
    
    618
    +@pytest.mark.parametrize("ref_storage", [('inline'), ('project.refs')])
    
    619
    +@pytest.mark.parametrize("kind", [(kind) for kind in ALL_REPO_KINDS])
    
    620
    +def test_track_junction_included(cli, tmpdir, datafiles, ref_storage, kind):
    
    621
    +    project = os.path.join(datafiles.dirname, datafiles.basename)
    
    622
    +    element_path = os.path.join(project, 'elements')
    
    623
    +    subproject_path = os.path.join(project, 'files', 'sub-project')
    
    624
    +    sub_element_path = os.path.join(subproject_path, 'elements')
    
    625
    +    junction_path = os.path.join(element_path, 'junction.bst')
    
    626
    +
    
    627
    +    configure_project(project, {
    
    628
    +        'ref-storage': ref_storage,
    
    629
    +        '(@)': ['junction.bst:test.yml']
    
    630
    +    })
    
    631
    +
    
    632
    +    generate_junction(str(tmpdir.join('junction_repo')),
    
    633
    +                      subproject_path, junction_path, store_ref=False)
    
    634
    +
    
    635
    +    result = cli.run(project=project, args=['track', 'junction.bst'])
    
    636
    +    result.assert_success()



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