From 45efe171e6510d06217d83bc28e0f4b9d85fe4ba Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Tue, 10 Jun 2014 15:51:09 +0300 Subject: [PATCH] bootstrap: add manifest subclass Move add_project() functionality from gbp back to the test data repo. This functionality is only used here so it makes sense to maintain it here, too. Signed-off-by: Markus Lehtonen --- bootstrap.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/bootstrap.py b/bootstrap.py index ec6c321..08506be 100755 --- a/bootstrap.py +++ b/bootstrap.py @@ -48,6 +48,20 @@ class GitError(Exception): pass +class TestDataRepoManifest(RepoManifest): + """Test repo manifest""" + def add_project(self, name, branches): + """Add new project to the manifest""" + prj_e = self._doc.createElement('project') + prj_e.setAttribute('name', name) + for branch, revision in branches.iteritems(): + br_e = self._doc.createElement('branch') + br_e.setAttribute('name', branch) + br_e.setAttribute('revision', revision) + prj_e.appendChild(br_e) + self._doc.firstChild.appendChild(prj_e) + + def run_cmd(cmd, opts=None, capture_stdout=False, capture_stderr=False): """Run command""" args = [cmd] + opts if opts else [cmd] @@ -206,7 +220,7 @@ def main(argv=None): if args.update_branches != 'no': force = True if args.update_branches == 'force' else False update_from_remote('origin', force=force) - test_manifest = RepoManifest() + test_manifest = TestDataRepoManifest() for pkg, pkgconf in TEST_PKGS.iteritems(): if 'export_branches' in pkgconf: update_testrepo_manifest(test_manifest, pkg, -- 2.34.1