summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/fetch2/git.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 3de83bed17..b733be9f38 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -322,16 +322,13 @@ class Git(FetchMethod):
322 def download(self, ud, d): 322 def download(self, ud, d):
323 """Fetch url""" 323 """Fetch url"""
324 324
325 no_clone = not os.path.exists(ud.clonedir)
326 need_update = no_clone or self.need_update(ud, d)
327
328 # A current clone is preferred to either tarball, a shallow tarball is 325 # A current clone is preferred to either tarball, a shallow tarball is
329 # preferred to an out of date clone, and a missing clone will use 326 # preferred to an out of date clone, and a missing clone will use
330 # either tarball. 327 # either tarball.
331 if ud.shallow and os.path.exists(ud.fullshallow) and need_update: 328 if ud.shallow and os.path.exists(ud.fullshallow) and self.need_update(ud, d):
332 ud.localpath = ud.fullshallow 329 ud.localpath = ud.fullshallow
333 return 330 return
334 elif os.path.exists(ud.fullmirror) and no_clone: 331 elif os.path.exists(ud.fullmirror) and not os.path.exists(ud.clonedir):
335 bb.utils.mkdirhier(ud.clonedir) 332 bb.utils.mkdirhier(ud.clonedir)
336 runfetchcmd("tar -xzf %s" % ud.fullmirror, d, workdir=ud.clonedir) 333 runfetchcmd("tar -xzf %s" % ud.fullmirror, d, workdir=ud.clonedir)
337 334
@@ -353,6 +350,8 @@ class Git(FetchMethod):
353 for name in ud.names: 350 for name in ud.names:
354 if not self._contains_ref(ud, d, name, ud.clonedir): 351 if not self._contains_ref(ud, d, name, ud.clonedir):
355 needupdate = True 352 needupdate = True
353 break
354
356 if needupdate: 355 if needupdate:
357 try: 356 try:
358 runfetchcmd("%s remote rm origin" % ud.basecmd, d, workdir=ud.clonedir) 357 runfetchcmd("%s remote rm origin" % ud.basecmd, d, workdir=ud.clonedir)
@@ -373,6 +372,7 @@ class Git(FetchMethod):
373 except OSError as exc: 372 except OSError as exc:
374 if exc.errno != errno.ENOENT: 373 if exc.errno != errno.ENOENT:
375 raise 374 raise
375
376 for name in ud.names: 376 for name in ud.names:
377 if not self._contains_ref(ud, d, name, ud.clonedir): 377 if not self._contains_ref(ud, d, name, ud.clonedir):
378 raise bb.fetch2.FetchError("Unable to find revision %s in branch %s even from upstream" % (ud.revisions[name], ud.branches[name])) 378 raise bb.fetch2.FetchError("Unable to find revision %s in branch %s even from upstream" % (ud.revisions[name], ud.branches[name]))
@@ -472,7 +472,7 @@ class Git(FetchMethod):
472 if os.path.exists(destdir): 472 if os.path.exists(destdir):
473 bb.utils.prunedir(destdir) 473 bb.utils.prunedir(destdir)
474 474
475 if ud.shallow and (not os.path.exists(ud.clonedir) or self.need_update(ud, d)): 475 if ud.shallow and self.need_update(ud, d):
476 bb.utils.mkdirhier(destdir) 476 bb.utils.mkdirhier(destdir)
477 runfetchcmd("tar -xzf %s" % ud.fullshallow, d, workdir=destdir) 477 runfetchcmd("tar -xzf %s" % ud.fullshallow, d, workdir=destdir)
478 else: 478 else: