]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
[git] Do not run git-rev-list everytime to increase the speed
authorHolger Hans Peter Freyther <zecke@selfish.org>
Sun, 12 Oct 2008 22:14:10 +0000 (22:14 +0000)
committerHolger Hans Peter Freyther <zecke@selfish.org>
Sun, 12 Oct 2008 22:14:10 +0000 (22:14 +0000)
    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

index ff4b7dcdbb58c8d8ee321e6dd7668c0b0f8dd673..3a2fa5ab78f9a82111eb145ee1bb4989885d12b2 100644 (file)
@@ -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