From 16740d951cd253a0f1297487b842ac97ef9322cd Mon Sep 17 00:00:00 2001 From: Holger Freyther Date: Mon, 26 May 2008 16:05:14 +0200 Subject: [PATCH] [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. --- lib/bb/fetch/git.py | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/lib/bb/fetch/git.py b/lib/bb/fetch/git.py index b256fd0..774bd1a 100644 --- a/lib/bb/fetch/git.py +++ b/lib/bb/fetch/git.py @@ -157,6 +157,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": @@ -177,6 +181,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 -- 1.5.4.3