Merge branch 'chandan/upgrade-ruamel' into 'master'

Bump minimum version requirement for ruamel.yaml

Closes #1265

See merge request BuildStream/buildstream!2028
diff --git a/requirements/requirements.in b/requirements/requirements.in
index ca38d71..f62623f 100644
--- a/requirements/requirements.in
+++ b/requirements/requirements.in
@@ -4,7 +4,7 @@
 pluginbase
 protobuf >= 3.6
 psutil
-ruamel.yaml >= 0.16
+ruamel.yaml >= 0.16.7
 ruamel.yaml.clib >= 0.1.2
 setuptools
 pyroaring
diff --git a/tests/frontend/source-track/comments.bst b/tests/frontend/source-track/comments.bst
new file mode 100644
index 0000000..887c37b
--- /dev/null
+++ b/tests/frontend/source-track/comments.bst
@@ -0,0 +1,13 @@
+kind: manual
+
+config:
+  build-commands:
+    (<):
+    # This is a multi-line comment.
+    # It should have no effect and should be ignored safely.
+    - |
+      true
+
+sources:
+- kind: remote
+  url: project-root:/files/apples
diff --git a/tests/frontend/track.py b/tests/frontend/track.py
index ba569d2..51768f0 100644
--- a/tests/frontend/track.py
+++ b/tests/frontend/track.py
@@ -396,3 +396,26 @@
     track2_mtime = os.path.getmtime(path_to_target)
 
     assert track1_mtime == track2_mtime
+
+
+# Regression test for https://gitlab.com/BuildStream/buildstream/-/issues/1265.
+# Ensure that we can successfully track a `.bst` file that has comments inside
+# one of our YAML directives (like list append, prepend etc).
+@pytest.mark.datafiles(os.path.join(TOP_DIR, "source-track"))
+def test_track_with_comments(cli, datafiles):
+    project = str(datafiles)
+    generate_project(project, {"aliases": {"project-root": "file:///" + project}})
+
+    target = "comments.bst"
+
+    # Assert that it needs to be tracked
+    assert cli.get_element_state(project, target) == "no reference"
+
+    # Track and fetch the sources
+    result = cli.run(project=project, args=["source", "track", target])
+    result.assert_success()
+    result = cli.run(project=project, args=["source", "fetch", target])
+    result.assert_success()
+
+    # Assert that the sources are cached
+    assert cli.get_element_state(project, target) == "buildable"