[bitbake-devel] [PATCH 3/9] fetch2/git: only use relevant checks for shallow tarball unpack
Urs Fässler
urs.fassler at bbv.ch
Mon Jul 23 15:42:53 UTC 2018
Some checks in need_update do not make sense in the unpack step. The
relevant checks for the unpack check are extracted into
__has_up_to_date_clonedir which is used in the unpack step.
Signed-off-by: Urs Fässler <urs.fassler at bbv.ch>
Signed-off-by: Pascal Bach <pascal.bach at siemens.com>
---
lib/bb/fetch2/git.py | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index 612aac43..3364bbf9 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -299,17 +299,22 @@ class Git(FetchMethod):
return ud.clonedir
def need_update(self, ud, d):
- if not os.path.exists(ud.clonedir):
+ if not self.__has_up_to_date_clonedir(ud, d):
return True
- for name in ud.names:
- if not self._contains_ref(ud, d, name, ud.clonedir):
- return True
if ud.shallow and ud.write_shallow_tarballs and not os.path.exists(ud.fullshallow):
return True
if ud.write_tarballs and not os.path.exists(ud.fullmirror):
return True
return False
+ def __has_up_to_date_clonedir(self, ud, d):
+ if not os.path.exists(ud.clonedir):
+ return False
+ for name in ud.names:
+ if not self._contains_ref(ud, d, name, ud.clonedir):
+ return False
+ return True
+
def try_premirror(self, ud, d):
# If we don't do this, updating an existing checkout with only premirrors
# is not possible
@@ -472,7 +477,7 @@ class Git(FetchMethod):
if os.path.exists(destdir):
bb.utils.prunedir(destdir)
- if ud.shallow and self.need_update(ud, d):
+ if ud.shallow and not self.__has_up_to_date_clonedir(ud, d):
bb.utils.mkdirhier(destdir)
runfetchcmd("tar -xzf %s" % ud.fullshallow, d, workdir=destdir)
else:
--
2.18.0
More information about the bitbake-devel
mailing list