1# Copyright (C) 2021, Rockchip Electronics Co., Ltd 2# Released under the MIT license (see COPYING.MIT for the terms) 3 4python () { 5 from bb.fetch2 import git 6 from bb.fetch2 import Fetch 7 from bb.fetch2 import runfetchcmd 8 import shlex 9 10 git = git.Git() 11 bb.fetch2.get_srcrev(d) 12 fetcher = Fetch(d.getVar('SRC_URI').split(), d) 13 urldata = fetcher.ud 14 for u in urldata: 15 if not urldata[u].method.supports_srcrev(): 16 continue 17 18 ud = urldata[u] 19 if ud.proto.lower() != 'file' or ud.type != 'git': 20 continue 21 22 if not os.path.exists(ud.clonedir): 23 continue 24 25 repourl = git._get_repo_url(ud) 26 27 # Try an early full fetching 28 fetch_cmd = "LANG=C %s fetch %s" % (ud.basecmd, shlex.quote(repourl)) 29 try: 30 runfetchcmd(fetch_cmd, d, workdir=ud.clonedir) 31 except bb.fetch2.FetchError: 32 # Ignoring errors 33 return 34} 35