[Toaster] [PATCH 3/6] toaster: fix bug in resetting git repository

Ed Bartosh ed.bartosh at linux.intel.com
Wed Sep 23 09:52:03 PDT 2015


git reset --hard should be given either commit id or
origin/<ref name> to work properly. Without this fix git will
complain that origin/<commit id> does not exist.

[YOCTO #7505]

Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
---
 bitbake/lib/toaster/bldcontrol/localhostbecontroller.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
index 42be4af..0c34957 100644
--- a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
+++ b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
@@ -266,7 +266,8 @@ class LocalhostBEController(BuildEnvironmentController):
             # branch magic name "HEAD" will inhibit checkout
             if commit != "HEAD":
                 logger.debug("localhostbecontroller: checking out commit %s to %s " % (commit, localdirname))
-                self._shellcmd('git fetch --all && git reset --hard "origin/%s"' % commit, localdirname)
+                ref = commit if re.match('^[a-fA-F0-9]+$', commit) else 'origin/%s' % commit
+                self._shellcmd('git fetch --all && git reset --hard "%s"' % ref, localdirname)
 
             # take the localdirname as poky dir if we can find the oe-init-build-env
             if self.pokydirname is None and os.path.exists(os.path.join(localdirname, "oe-init-build-env")):
-- 
2.1.4



More information about the toaster mailing list