mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 12:29:55 +00:00
bitbake: Sync git fetcher with changes upstream
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
+15
-10
@@ -37,9 +37,12 @@ class Git(Fetch):
|
|||||||
|
|
||||||
def localpath(self, url, ud, d):
|
def localpath(self, url, ud, d):
|
||||||
|
|
||||||
ud.proto = "rsync"
|
|
||||||
if 'protocol' in ud.parm:
|
if 'protocol' in ud.parm:
|
||||||
ud.proto = ud.parm['protocol']
|
ud.proto = ud.parm['protocol']
|
||||||
|
elif not ud.host:
|
||||||
|
ud.proto = 'file'
|
||||||
|
else:
|
||||||
|
ud.proto = "rsync"
|
||||||
|
|
||||||
ud.branch = ud.parm.get("branch", "master")
|
ud.branch = ud.parm.get("branch", "master")
|
||||||
|
|
||||||
@@ -49,10 +52,7 @@ class Git(Fetch):
|
|||||||
elif tag:
|
elif tag:
|
||||||
ud.tag = tag
|
ud.tag = tag
|
||||||
|
|
||||||
if not ud.tag:
|
if not ud.tag or ud.tag == "master":
|
||||||
ud.tag = self.latest_revision(url, ud, d)
|
|
||||||
|
|
||||||
if ud.tag == "master":
|
|
||||||
ud.tag = self.latest_revision(url, ud, d)
|
ud.tag = self.latest_revision(url, ud, d)
|
||||||
|
|
||||||
ud.localfile = data.expand('git_%s%s_%s.tar.gz' % (ud.host, ud.path.replace('/', '.'), ud.tag), d)
|
ud.localfile = data.expand('git_%s%s_%s.tar.gz' % (ud.host, ud.path.replace('/', '.'), ud.tag), d)
|
||||||
@@ -90,11 +90,12 @@ class Git(Fetch):
|
|||||||
|
|
||||||
os.chdir(repodir)
|
os.chdir(repodir)
|
||||||
# Remove all but the .git directory
|
# Remove all but the .git directory
|
||||||
runfetchcmd("rm * -Rf", d)
|
if not self._contains_ref(ud.tag, d):
|
||||||
runfetchcmd("git fetch %s://%s%s%s %s" % (ud.proto, username, ud.host, ud.path, ud.branch), d)
|
runfetchcmd("rm * -Rf", d)
|
||||||
runfetchcmd("git fetch --tags %s://%s%s%s" % (ud.proto, username, ud.host, ud.path), d)
|
runfetchcmd("git fetch %s://%s%s%s %s" % (ud.proto, username, ud.host, ud.path, ud.branch), d)
|
||||||
runfetchcmd("git prune-packed", d)
|
runfetchcmd("git fetch --tags %s://%s%s%s" % (ud.proto, username, ud.host, ud.path), d)
|
||||||
runfetchcmd("git pack-redundant --all | xargs -r rm", d)
|
runfetchcmd("git prune-packed", d)
|
||||||
|
runfetchcmd("git pack-redundant --all | xargs -r rm", d)
|
||||||
|
|
||||||
os.chdir(repodir)
|
os.chdir(repodir)
|
||||||
mirror_tarballs = data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True)
|
mirror_tarballs = data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True)
|
||||||
@@ -120,6 +121,10 @@ class Git(Fetch):
|
|||||||
def suppports_srcrev(self):
|
def suppports_srcrev(self):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def _contains_ref(self, tag, d):
|
||||||
|
output = runfetchcmd("git log --pretty=oneline -n 1 %s -- 2> /dev/null | wc -l" % tag, d, quiet=True)
|
||||||
|
return output.split()[0] != "0"
|
||||||
|
|
||||||
def _revision_key(self, url, ud, d):
|
def _revision_key(self, url, ud, d):
|
||||||
"""
|
"""
|
||||||
Return a unique key for the url
|
Return a unique key for the url
|
||||||
|
|||||||
Reference in New Issue
Block a user