Skip to content

Instantly share code, notes, and snippets.

@bartosh
Created September 22, 2015 14:56
Show Gist options
  • Save bartosh/772214f0678489e65ace to your computer and use it in GitHub Desktop.
Save bartosh/772214f0678489e65ace to your computer and use it in GitHub Desktop.
diff --git a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
index a9909b8..a19b4de 100644
--- a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
+++ b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
@@ -248,6 +248,11 @@ class LocalhostBEController(BuildEnvironmentController):
localdirname = os.path.join(self.be.sourcedir, self.getGitCloneDirectory(giturl, commit))
logger.debug("localhostbecontroller: giturl %s:%s checking out in current directory %s" % (giturl, commit, localdirname))
+ if re.match('^[a-fA-F0-9]+$', commit):
+ ref = commit
+ else:
+ ref = 'origin/%s' % commit
+
# make sure our directory is a git repository
if os.path.exists(localdirname):
localremotes = self._shellcmd("git remote -v", localdirname)
@@ -260,13 +265,13 @@ class LocalhostBEController(BuildEnvironmentController):
self._shellcmd("git remote remove origin", localdirname)
self._shellcmd("git remote add origin \"%s\"" % giturl, localdirname)
else:
- logger.debug("localhostbecontroller: cloning %s:%s in %s" % (giturl, commit, localdirname))
- self._shellcmd("git clone \"%s\" --single-branch --branch \"%s\" \"%s\"" % (giturl, commit, localdirname))
+ logger.debug("localhostbecontroller: cloning %s in %s" % (giturl, localdirname))
+ self._shellcmd('git clone "%s" "%s"' % (giturl, localdirname))
# 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 checkout \"%s\" && git rebase \"origin/%s\"" % (commit, commit) , localdirname)
+ 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")):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment