Example #1
0
def test_load():
    contents = """
gitlab:
  url: http://gitlab.example.com
repos:
  - src: foo
    url: [email protected]:foo.git
    branch: next

  - src: master
    url: [email protected]:master.git
    copy:
      - src: top.cmake
        dest: CMakeLists.txt
"""
    manifest = tsrc.manifest.Manifest()
    manifest.load(contents)
    assert manifest.gitlab["url"] == "http://gitlab.example.com"
    assert manifest.repos == [
        tsrc.Repo(src="foo", url="[email protected]:foo.git", branch="next"),
        tsrc.Repo(src="master", url="[email protected]:master.git", branch="master")
    ]
    assert manifest.copyfiles == [
        (os.path.join("master", "top.cmake"), "CMakeLists.txt")
    ]
Example #2
0
def read_remote_manifest(workspace_path, git_server):
    tsrc.git.run_git(workspace_path, "clone", git_server.manifest_url)
    manifest_yml = workspace_path.joinpath("manifest", "manifest.yml")
    assert manifest_yml.exists()
    manifest = tsrc.manifest.Manifest()
    manifest.load(manifest_yml.text())
    return manifest
Example #3
0
 def load_manifest(self):
     manifest_yml_path = self.manifest_clone_path.joinpath("manifest.yml")
     if not manifest_yml_path.exists():
         message = "No manifest found in {}. Did you run `tsrc init` ?"
         raise tsrc.Error(message.format(manifest_yml_path))
     manifest = tsrc.manifest.Manifest()
     manifest.load(manifest_yml_path.text())
     return manifest
Example #4
0
def test_git_server_change_manifest_branch(workspace_path, git_server):
    git_server.add_repo("foo")
    git_server.change_manifest_branch("devel")
    git_server.add_repo("bar")

    tsrc.git.run_git(workspace_path, "clone", git_server.manifest_url,
                     "--branch", "devel")
    manifest_yml = workspace_path.joinpath("manifest", "manifest.yml")
    manifest = tsrc.manifest.Manifest()
    manifest.load(manifest_yml.text())

    assert len(manifest.repos) == 2
Example #5
0
def test_find():
    contents = """
repos:
  - src: foo
    url: [email protected]:proj_one/foo

  - src: bar
    url: [email protected]:proj_two/bar
"""
    manifest = tsrc.manifest.Manifest()
    manifest.load(contents)
    assert manifest.get_url("foo") == "[email protected]:proj_one/foo"
    assert manifest.get_url("bar") == "[email protected]:proj_two/bar"
    with pytest.raises(tsrc.manifest.RepoNotFound) as e:
        manifest.get_url("no/such")
        assert "no/such" in e.value.message
Example #6
0
def test_load():
    contents = """
gitlab:
  url: http://gitlab.example.com
repos:
  - src: foo
    url: [email protected]:foo.git
    branch: next

  - src: master
    url: [email protected]:master.git
    fixed_ref: v0.1
    copy:
      - src: top.cmake
        dest: CMakeLists.txt
      - src: .clang-format
"""
    manifest = tsrc.manifest.Manifest()
    parsed = ruamel.yaml.safe_load(contents)
    manifest.load(parsed)
    assert manifest.gitlab["url"] == "http://gitlab.example.com"
    assert manifest.repos == [
        tsrc.Repo(
            url="[email protected]:foo.git",
            src="foo",
            branch="next",
            fixed_ref=None,
        ),
        tsrc.Repo(url="[email protected]:master.git",
                  src="master",
                  branch="master",
                  fixed_ref="v0.1"),
    ]
    assert manifest.copyfiles == [
        (os.path.join("master", "top.cmake"), "CMakeLists.txt"),
        (os.path.join("master", ".clang-format"), ".clang-format"),
    ]