Will Salmon pushed to branch willsalmon/trackWarning at BuildStream / buildstream
Commits:
-
34015a26
by Tristan Maat at 2018-07-30T12:19:45Z
-
ae47a72b
by Tristan Van Berkom at 2018-07-30T13:11:34Z
-
695c0cb0
by Phil Dawson at 2018-07-30T16:07:36Z
-
fcb87b0a
by Phil Dawson at 2018-07-30T16:53:37Z
-
74076dc2
by William Salmon at 2018-08-01T08:21:02Z
5 changed files:
- HACKING.rst
- buildstream/_pipeline.py
- buildstream/plugins/sources/git.py
- doc/source/advanced-features/junction-elements.rst
- tests/sources/git.py
Changes:
| ... | ... | @@ -23,6 +23,11 @@ a reasonable timeframe for identifying these. |
| 23 | 23 |
|
| 24 | 24 |
Patch submissions
|
| 25 | 25 |
-----------------
|
| 26 |
+If you want to submit a patch, do ask for developer permissions on our
|
|
| 27 |
+IRC channel first (GitLab's button also works, but you may need to
|
|
| 28 |
+shout about it - we often overlook this) - for CI reasons, it's much
|
|
| 29 |
+easier if patches are in branches of the main repository.
|
|
| 30 |
+ |
|
| 26 | 31 |
Branches must be submitted as merge requests in gitlab. If the branch
|
| 27 | 32 |
fixes an issue or is related to any issues, these issues must be mentioned
|
| 28 | 33 |
in the merge request or preferably the commit messages themselves.
|
| ... | ... | @@ -385,7 +385,14 @@ class Pipeline(): |
| 385 | 385 |
detail = "Exact versions are missing for the following elements\n" + \
|
| 386 | 386 |
"Try tracking these elements first with `bst track`\n\n"
|
| 387 | 387 |
for element in inconsistent:
|
| 388 |
- detail += " " + element._get_full_name() + "\n"
|
|
| 388 |
+ detail += " " + element._get_full_name()
|
|
| 389 |
+ for source in element.sources():
|
|
| 390 |
+ if not source._get_consistency() and not source.get_ref():
|
|
| 391 |
+ if hasattr(source, 'tracking') and source.tracking is None:
|
|
| 392 |
+ detail += ": Is missing ref and track, please add a branch to track or a ref.\n"
|
|
| 393 |
+ detail += "\n"
|
|
| 394 |
+ |
|
| 395 |
+
|
|
| 389 | 396 |
raise PipelineError("Inconsistent pipeline", detail=detail, reason="inconsistent-pipeline")
|
| 390 | 397 |
|
| 391 | 398 |
# cleanup()
|
| ... | ... | @@ -363,6 +363,12 @@ class GitSource(Source): |
| 363 | 363 |
|
| 364 | 364 |
# If self.tracking is not specified it's not an error, just silently return
|
| 365 | 365 |
if not self.tracking:
|
| 366 |
+ # Is there a better way to check if a ref is given.
|
|
| 367 |
+ if self.mirror.ref is None:
|
|
| 368 |
+ detail = 'Without a tracking branch ref can not be updated but with out ' + \
|
|
| 369 |
+ 'a ref then build can not fetch the repo and bst build will fail'
|
|
| 370 |
+ raise SourceError("{}: No track or ref".format(self),
|
|
| 371 |
+ detail=detail, reason="track-attempt-no-track")
|
|
| 366 | 372 |
return None
|
| 367 | 373 |
|
| 368 | 374 |
with self.timed_activity("Tracking {} from {}"
|
| ... | ... | @@ -34,6 +34,7 @@ The below bst file describes an element which depends on the hello.bst element |
| 34 | 34 |
from the autotools example:
|
| 35 | 35 |
|
| 36 | 36 |
.. literalinclude:: ../../examples/junctions/elements/callHello.bst
|
| 37 |
+ :language: yaml
|
|
| 37 | 38 |
|
| 38 | 39 |
This element consists of a script which calls hello.bst's hello command.
|
| 39 | 40 |
|
| ... | ... | @@ -359,3 +359,44 @@ def test_submodule_track_ignore_inconsistent(cli, tmpdir, datafiles): |
| 359 | 359 |
|
| 360 | 360 |
# Assert that we are just fine without it, and emit a warning to the user.
|
| 361 | 361 |
assert "Ignoring inconsistent submodule" in result.stderr
|
| 362 |
+ |
|
| 363 |
+ |
|
| 364 |
+@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
|
|
| 365 |
+@pytest.mark.datafiles(os.path.join(DATA_DIR, 'template'))
|
|
| 366 |
+def test_submodule_track_no_ref_or_track(cli, tmpdir, datafiles):
|
|
| 367 |
+ project = os.path.join(datafiles.dirname, datafiles.basename)
|
|
| 368 |
+ |
|
| 369 |
+ # Create the repo from 'repofiles' subdir
|
|
| 370 |
+ repo = create_repo('git', str(tmpdir))
|
|
| 371 |
+ ref = repo.create(os.path.join(project, 'repofiles'))
|
|
| 372 |
+ |
|
| 373 |
+ # Write out our test target
|
|
| 374 |
+ gitsource = repo.source_config(ref=None)
|
|
| 375 |
+ gitsource.pop('track')
|
|
| 376 |
+ element = {
|
|
| 377 |
+ 'kind': 'import',
|
|
| 378 |
+ 'sources': [
|
|
| 379 |
+ gitsource
|
|
| 380 |
+ ]
|
|
| 381 |
+ }
|
|
| 382 |
+ |
|
| 383 |
+ _yaml.dump(element, os.path.join(project, 'target.bst'))
|
|
| 384 |
+ |
|
| 385 |
+ # Track will encounter an inconsistent submodule without any ref
|
|
| 386 |
+ result = cli.run(project=project, args=['track', 'target.bst'])
|
|
| 387 |
+ result.assert_main_error(ErrorDomain.STREAM, None)
|
|
| 388 |
+ result.assert_task_error(ErrorDomain.SOURCE, 'track-attempt-no-track')
|
|
| 389 |
+ |
|
| 390 |
+ # Assert that we are just fine without it, and emit a warning to the user.
|
|
| 391 |
+ assert "FAILURE git source at" in result.stderr
|
|
| 392 |
+ assert "Without a tracking branch ref can not be updated but with out a ref " + \
|
|
| 393 |
+ "then build can not fetch the repo and bst build will fail" in result.stderr
|
|
| 394 |
+ |
|
| 395 |
+ # Track will encounter an inconsistent submodule without any ref
|
|
| 396 |
+ result = cli.run(project=project, args=['build', 'target.bst'])
|
|
| 397 |
+ result.assert_main_error(ErrorDomain.PIPELINE, 'inconsistent-pipeline')
|
|
| 398 |
+ result.assert_task_error(None, None)
|
|
| 399 |
+ |
|
| 400 |
+ # Assert that we are just fine without it, and emit a warning to the user.
|
|
| 401 |
+ assert "Exact versions are missing for the following elements" in result.stderr
|
|
| 402 |
+ assert ": Is missing ref and track, please add a branch to track or a ref." in result.stderr
|
