summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/fetch2/git.py23
1 files changed, 16 insertions, 7 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 2d1d2cabd5..fa41b078f1 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -292,11 +292,21 @@ class Git(FetchMethod):
292 def clonedir_need_update(self, ud, d): 292 def clonedir_need_update(self, ud, d):
293 if not os.path.exists(ud.clonedir): 293 if not os.path.exists(ud.clonedir):
294 return True 294 return True
295 if ud.shallow and ud.write_shallow_tarballs and self.clonedir_need_shallow_revs(ud, d):
296 return True
295 for name in ud.names: 297 for name in ud.names:
296 if not self._contains_ref(ud, d, name, ud.clonedir): 298 if not self._contains_ref(ud, d, name, ud.clonedir):
297 return True 299 return True
298 return False 300 return False
299 301
302 def clonedir_need_shallow_revs(self, ud, d):
303 for rev in ud.shallow_revs:
304 try:
305 runfetchcmd('%s rev-parse -q --verify %s' % (ud.basecmd, rev), d, quiet=True, workdir=ud.clonedir)
306 except bb.fetch2.FetchError:
307 return rev
308 return None
309
300 def shallow_tarball_need_update(self, ud): 310 def shallow_tarball_need_update(self, ud):
301 return ud.shallow and ud.write_shallow_tarballs and not os.path.exists(ud.fullshallow) 311 return ud.shallow and ud.write_shallow_tarballs and not os.path.exists(ud.fullshallow)
302 312
@@ -339,13 +349,7 @@ class Git(FetchMethod):
339 runfetchcmd(clone_cmd, d, log=progresshandler) 349 runfetchcmd(clone_cmd, d, log=progresshandler)
340 350
341 # Update the checkout if needed 351 # Update the checkout if needed
342 needupdate = False 352 if self.clonedir_need_update(ud, d):
343 for name in ud.names:
344 if not self._contains_ref(ud, d, name, ud.clonedir):
345 needupdate = True
346 break
347
348 if needupdate:
349 output = runfetchcmd("%s remote" % ud.basecmd, d, quiet=True, workdir=ud.clonedir) 353 output = runfetchcmd("%s remote" % ud.basecmd, d, quiet=True, workdir=ud.clonedir)
350 if "origin" in output: 354 if "origin" in output:
351 runfetchcmd("%s remote rm origin" % ud.basecmd, d, workdir=ud.clonedir) 355 runfetchcmd("%s remote rm origin" % ud.basecmd, d, workdir=ud.clonedir)
@@ -369,6 +373,11 @@ class Git(FetchMethod):
369 if not self._contains_ref(ud, d, name, ud.clonedir): 373 if not self._contains_ref(ud, d, name, ud.clonedir):
370 raise bb.fetch2.FetchError("Unable to find revision %s in branch %s even from upstream" % (ud.revisions[name], ud.branches[name])) 374 raise bb.fetch2.FetchError("Unable to find revision %s in branch %s even from upstream" % (ud.revisions[name], ud.branches[name]))
371 375
376 if ud.shallow and ud.write_shallow_tarballs:
377 missing_rev = self.clonedir_need_shallow_revs(ud, d)
378 if missing_rev:
379 raise bb.fetch2.FetchError("Unable to find revision %s even from upstream" % missing_rev)
380
372 def build_mirror_data(self, ud, d): 381 def build_mirror_data(self, ud, d):
373 if ud.shallow and ud.write_shallow_tarballs: 382 if ud.shallow and ud.write_shallow_tarballs:
374 if not os.path.exists(ud.fullshallow): 383 if not os.path.exists(ud.fullshallow):