From: Holger Hans Peter Freyther Date: Sun, 12 Oct 2008 22:14:10 +0000 (+0000) Subject: [git] Do not run git-rev-list everytime to increase the speed X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f6ec708818097f5ea9b23f3dea9fff6779844567;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git [git] Do not run git-rev-list everytime to increase the speed Cache the result of git-rev-list for a repo and hash. This speeds up do_package of the linux kernel tremendously. --- diff --git a/lib/bb/fetch/git.py b/lib/bb/fetch/git.py index ff4b7dcdbb5..3a2fa5ab78f 100644 --- a/lib/bb/fetch/git.py +++ b/lib/bb/fetch/git.py @@ -148,6 +148,10 @@ class Git(Fetch): gitsrcname = '%s%s' % (ud.host, ud.path.replace('/', '.')) repodir = os.path.join(data.expand('${GITDIR}', d), gitsrcname) + key = "GIT_CACHED_REVISION-%s-%s" % (gitsrcname, ud.tag) + if bb.data.getVar(key, d): + return bb.data.getVar(key, d) + # Runtime warning on wrongly configured sources if ud.tag == "1": @@ -168,6 +172,8 @@ class Git(Fetch): output = runfetchcmd("git rev-list %s -- 2> /dev/null | wc -l" % ud.tag, d, quiet=True) os.chdir(cwd) - return "%s+%s" % (output.split()[0], ud.tag) + sortable_revision = "%s+%s" % (output.split()[0], ud.tag) + bb.data.setVar(key, sortable_revision, d) + return sortable_revision