]> code.ossystems Code Review - openembedded-core.git/commitdiff
bitbake/git: define a forcefetch method
authorJoshua Lock <josh@linux.intel.com>
Fri, 27 Aug 2010 13:06:18 +0000 (14:06 +0100)
committerJoshua Lock <josh@linux.intel.com>
Wed, 1 Sep 2010 10:14:41 +0000 (11:14 +0100)
The git fetcher should force a fetch if the required tag is not present in
the local clone, or if the fullclone parameter is set.

Signed-off-by: Joshua Lock <josh@linux.intel.com>
bitbake/lib/bb/fetch/git.py

index 9cd538854f79d05b91516121e5098cbcbbdc5a9c..b6126cbe9169bb79f02c58f252679cbe7aa500b5 100644 (file)
@@ -85,6 +85,11 @@ class Git(Fetch):
 
         return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
 
+    def forcefetch(self, url, ud, d):
+        if not self._contains_ref(ud.tag, d) or 'fullclone' in ud.parm:
+            return True
+        return False
+
     def go(self, loc, ud, d):
         """Fetch url"""
 
@@ -108,8 +113,8 @@ class Git(Fetch):
                 runfetchcmd("%s clone -n %s://%s%s%s %s" % (ud.basecmd, ud.proto, username, ud.host, ud.path, ud.clonedir), d)
 
         os.chdir(ud.clonedir)
-        # Remove all but the .git directory
         if not self._contains_ref(ud.tag, d) or 'fullclone' in ud.parm:
+            # Remove all but the .git directory
             runfetchcmd("rm * -Rf", d)
             runfetchcmd("%s fetch %s://%s%s%s %s" % (ud.basecmd, ud.proto, username, ud.host, ud.path, ud.branch), d)
             runfetchcmd("%s fetch --tags %s://%s%s%s" % (ud.basecmd, ud.proto, username, ud.host, ud.path), d)