Update unit test script to use GitPython library
Resolves openbmc/openbmc#382
Change-Id: I4283b36a8d5ab8ec0ff486af127fcc4c61dd6753
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/scripts/unit-test.py b/scripts/unit-test.py
index b1ea3fa..7b5e9c4 100755
--- a/scripts/unit-test.py
+++ b/scripts/unit-test.py
@@ -7,6 +7,7 @@
prior to executing its unit tests.
"""
+from git import Repo
from urlparse import urljoin
from subprocess import check_call, call
import os
@@ -36,8 +37,9 @@
pkg Name of the package to clone
"""
pkg_repo = urljoin('https://gerrit.openbmc-project.xyz/openbmc/', pkg)
- os.chdir(WORKSPACE)
- check_call_cmd(WORKSPACE, 'git', 'clone', pkg_repo)
+ os.mkdir(os.path.join(WORKSPACE, pkg))
+ printline(os.path.join(WORKSPACE, pkg), "> git clone", pkg_repo, "./")
+ return Repo.clone_from(pkg_repo, os.path.join(WORKSPACE, pkg))
def get_deps(configure_ac):
@@ -94,12 +96,13 @@
if dep_installed.get(dep_pkg) is None:
# Dependency package not installed
dep_installed[dep_pkg] = False
- clone_pkg(dep_pkg)
+ dep_repo = clone_pkg(dep_pkg)
# Determine this dependency package's
# dependencies and install them before
# returning to install this package
dep_pkgdir = os.path.join(WORKSPACE, dep_pkg)
- dep_installed = build_depends(dep_pkg, dep_pkgdir,
+ dep_installed = build_depends(dep_pkg,
+ dep_repo.working_dir,
dep_installed)
else:
# Dependency package known and installed