From 48c02f188784d65bd501a907e572e041ed61dc15 Mon Sep 17 00:00:00 2001 From: Daniel Narvaez Date: Thu, 29 Nov 2012 22:14:39 +0000 Subject: Use the new git module in build --- (limited to 'devbot') diff --git a/devbot/build.py b/devbot/build.py index 9c616aa..e958078 100644 --- a/devbot/build.py +++ b/devbot/build.py @@ -8,6 +8,7 @@ import time from devbot import command from devbot import config from devbot import environ +from devbot import git from devbot import state from devbot import utils @@ -86,39 +87,13 @@ def _unlink_libtool_files(): os.path.walk(config.lib_dir, func, None) -def _is_detached_head(): - return subprocess.call(["git", "symbolic-ref", "-q", "HEAD"], - stdout=utils.devnull, - stderr=subprocess.STDOUT) != 0 - -def _pull_git_module(module): - module_dir = module.get_source_dir() - - if os.path.exists(os.path.join(module_dir, ".git")): - os.chdir(module_dir) - - command.run(["git", "remote", "set-url", "origin", module.repo]) - - if _is_detached_head(): - command.run(["git", "remote", "update", "origin"], retry=10) - command.run(["git", "checkout", module.branch]) - else: - command.run(["git", "checkout", module.branch]) - command.run(["git", "pull"], retry=10) - else: - os.chdir(config.get_source_dir()) - - command.run(["git", "clone", "--progress", module.repo, module.name], - retry=10) - - os.chdir(module_dir) - command.run(["git", "checkout", module.branch]) - def _pull_module(module): print "\n=== Pulling %s ===\n" % module.name try: - _pull_git_module(module) + git_module = git.Module(config.get_source_dir(), module.name, + module.repo, module.tag) + git_module.update() except subprocess.CalledProcessError: return False diff --git a/devbot/config.py b/devbot/config.py index 513fe10..0f76644 100644 --- a/devbot/config.py +++ b/devbot/config.py @@ -33,6 +33,7 @@ class Module: self.name = info["name"] self.repo = info["repo"] self.branch = info.get("branch", "master") + self.tag = info.get("tag", None) self.auto_install = info.get("auto-install", False) self.options = info.get("options", []) -- cgit v0.9.1