def need_update(self, ud, d): if Git.need_update(self, ud, d): return True try: # Check for the nugget dropped by the download operation known_srcrevs = runfetchcmd("%s config --get-all bitbake.srcrev" % \ (ud.basecmd), d, workdir=ud.clonedir) if ud.revisions[ud.names[0]] in known_srcrevs.split(): return False except bb.fetch2.FetchError: pass need_update_list = [] def need_update_submodule(ud, url, module, modpath, workdir, d): url += ";bareclone=1;nobranch=1" try: newfetch = Fetch([url], d, cache=False) new_ud = newfetch.ud[url] if new_ud.method.need_update(new_ud, d): need_update_list.append(modpath) except Exception as e: logger.error('gitsm: submodule update check failed: %s %s' % (type(e).__name__, str(e))) need_update_result = True # If we're using a shallow mirror tarball it needs to be unpacked # temporarily so that we can examine the .gitmodules file if ud.shallow and os.path.exists( ud.fullshallow) and not os.path.exists(ud.clonedir): tmpdir = tempfile.mkdtemp(dir=d.getVar("DL_DIR")) runfetchcmd("tar -xzf %s" % ud.fullshallow, d, workdir=tmpdir) self.process_submodules(ud, tmpdir, need_update_submodule, d) shutil.rmtree(tmpdir) else: self.process_submodules(ud, ud.clonedir, need_update_submodule, d) if len(need_update_list) == 0: # We already have the required commits of all submodules. Drop # a nugget so we don't need to check again. runfetchcmd("%s config --add bitbake.srcrev %s" % \ (ud.basecmd, ud.revisions[ud.names[0]]), d, workdir=ud.clonedir) if len(need_update_list) > 0: logger.debug( 1, 'gitsm: Submodules requiring update: %s' % (' '.join(need_update_list))) return True return False
def need_update(self, ud, d): main_repo_needs_update = Git.need_update(self, ud, d) # First check that the main repository has enough history fetched. If it doesn't, then we don't # even have the .gitmodules and gitlinks for the submodules to attempt asking whether the # submodules' histories are recent enough. if main_repo_needs_update: return True # Now check that the submodule histories are new enough. The git-submodule command doesn't have # any clean interface for doing this aside from just attempting the checkout (with network # fetched disabled). return not self.update_submodules(ud, d)
def need_update(self, ud, d): main_repo_needs_update = Git.need_update(self, ud, d) # First check that the main repository has enough history fetched. If it doesn't, then we don't # even have the .gitmodules and gitlinks for the submodules to attempt asking whether the # submodules' histories are recent enough. if main_repo_needs_update: return True # Now check that the submodule histories are new enough. The git-submodule command doesn't have # any clean interface for doing this aside from just attempting the checkout (with network # fetched disabled). return not self.update_submodules(ud, d)
def need_update(self, ud, d): if Git.need_update(self, ud, d): return True try: # Check for the nugget dropped by the download operation known_srcrevs = runfetchcmd("%s config --get-all bitbake.srcrev" % \ (ud.basecmd), d, workdir=ud.clonedir) if ud.revisions[ud.names[0]] not in known_srcrevs.split(): return True except bb.fetch2.FetchError: # No srcrev nuggets, so this is new and needs to be updated return True return False
def need_update(self, ud, d): if Git.need_update(self, ud, d): return True try: # Check for the nugget dropped by the download operation known_srcrevs = runfetchcmd("%s config --get-all bitbake.srcrev" % \ (ud.basecmd), d, workdir=ud.clonedir) if ud.revisions[ud.names[0]] not in known_srcrevs.split(): return True except bb.fetch2.FetchError: # No srcrev nuggets, so this is new and needs to be updated return True return False
def need_update(self, ud, d): if Git.need_update(self, ud, d): return True need_update_list = [] def need_update_submodule(ud, url, module, modpath, workdir, d): url += ";bareclone=1;nobranch=1" try: newfetch = Fetch([url], d, cache=False) new_ud = newfetch.ud[url] if new_ud.method.need_update(new_ud, d): need_update_list.append(modpath) except Exception as e: logger.error('gitsm: submodule update check failed: %s %s' % (type(e).__name__, str(e))) need_update_result = True # If we're using a shallow mirror tarball it needs to be unpacked # temporarily so that we can examine the .gitmodules file if ud.shallow and os.path.exists( ud.fullshallow) and not os.path.exists(ud.clonedir): tmpdir = tempfile.mkdtemp(dir=d.getVar("DL_DIR")) runfetchcmd("tar -xzf %s" % ud.fullshallow, d, workdir=tmpdir) self.process_submodules(ud, tmpdir, need_update_submodule, d) shutil.rmtree(tmpdir) else: self.process_submodules(ud, ud.clonedir, need_update_submodule, d) if need_update_list: logger.debug('gitsm: Submodules requiring update: %s' % (' '.join(need_update_list))) return True return False