bitbake: bb.fetch2.git: reuse basecmd attribute
The basecmd is initialized in urldata_init; there's no need redoing that work. (Bitbake rev: f8df6f746fb2e27f029a5449cee6c891b1f36f4f) Signed-off-by: Olof Johansson <olof.johansson@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
498de04737
commit
52ef6c210c
|
@ -152,7 +152,7 @@ class Git(FetchMethod):
|
||||||
return True
|
return True
|
||||||
os.chdir(ud.clonedir)
|
os.chdir(ud.clonedir)
|
||||||
for name in ud.names:
|
for name in ud.names:
|
||||||
if not self._contains_ref(ud.revisions[name], ud.branches[name], d):
|
if not self._contains_ref(ud, d, name):
|
||||||
return True
|
return True
|
||||||
if ud.write_tarballs and not os.path.exists(ud.fullmirror):
|
if ud.write_tarballs and not os.path.exists(ud.fullmirror):
|
||||||
return True
|
return True
|
||||||
|
@ -199,7 +199,7 @@ class Git(FetchMethod):
|
||||||
# Update the checkout if needed
|
# Update the checkout if needed
|
||||||
needupdate = False
|
needupdate = False
|
||||||
for name in ud.names:
|
for name in ud.names:
|
||||||
if not self._contains_ref(ud.revisions[name], ud.branches[name], d):
|
if not self._contains_ref(ud, d, name):
|
||||||
needupdate = True
|
needupdate = True
|
||||||
if needupdate:
|
if needupdate:
|
||||||
try:
|
try:
|
||||||
|
@ -217,7 +217,7 @@ class Git(FetchMethod):
|
||||||
ud.repochanged = True
|
ud.repochanged = True
|
||||||
os.chdir(ud.clonedir)
|
os.chdir(ud.clonedir)
|
||||||
for name in ud.names:
|
for name in ud.names:
|
||||||
if not self._contains_ref(ud.revisions[name], ud.branches[name], d):
|
if not self._contains_ref(ud, d, name):
|
||||||
raise bb.fetch2.FetchError("Unable to find revision %s in branch %s even from upstream" % (ud.revisions[name], ud.branches[name]))
|
raise bb.fetch2.FetchError("Unable to find revision %s in branch %s even from upstream" % (ud.revisions[name], ud.branches[name]))
|
||||||
|
|
||||||
def build_mirror_data(self, ud, d):
|
def build_mirror_data(self, ud, d):
|
||||||
|
@ -287,9 +287,9 @@ class Git(FetchMethod):
|
||||||
def supports_srcrev(self):
|
def supports_srcrev(self):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _contains_ref(self, tag, branch, d):
|
def _contains_ref(self, ud, d, name):
|
||||||
basecmd = data.getVar("FETCHCMD_git", d, True) or "git"
|
cmd = "%s branch --contains %s --list %s 2> /dev/null | wc -l" % (
|
||||||
cmd = "%s branch --contains %s --list %s 2> /dev/null | wc -l" % (basecmd, tag, branch)
|
ud.basecmd, ud.revisions[name], ud.branches[name])
|
||||||
try:
|
try:
|
||||||
output = runfetchcmd(cmd, d, quiet=True)
|
output = runfetchcmd(cmd, d, quiet=True)
|
||||||
except bb.fetch2.FetchError:
|
except bb.fetch2.FetchError:
|
||||||
|
@ -313,9 +313,8 @@ class Git(FetchMethod):
|
||||||
else:
|
else:
|
||||||
username = ""
|
username = ""
|
||||||
|
|
||||||
basecmd = data.getVar("FETCHCMD_git", d, True) or "git"
|
|
||||||
cmd = "%s ls-remote %s://%s%s%s %s" % \
|
cmd = "%s ls-remote %s://%s%s%s %s" % \
|
||||||
(basecmd, ud.proto, username, ud.host, ud.path, ud.unresolvedrev[name])
|
(ud.basecmd, ud.proto, username, ud.host, ud.path, ud.unresolvedrev[name])
|
||||||
if ud.proto.lower() != 'file':
|
if ud.proto.lower() != 'file':
|
||||||
bb.fetch2.check_network_access(d, cmd)
|
bb.fetch2.check_network_access(d, cmd)
|
||||||
output = runfetchcmd(cmd, d, True)
|
output = runfetchcmd(cmd, d, True)
|
||||||
|
|
Loading…
Reference in New Issue