From 073c62cb56f3cd45d9ae28e0fcfc522be7480d4f Mon Sep 17 00:00:00 2001 From: Urs Fässler Date: Wed, 3 Oct 2018 12:04:06 +0000 Subject: bitbake: fetch2/git: improve readability of method need_update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To improve the readability we extract the different scenarios of why the clonedir needs an update. (Bitbake rev: 9038e029f4f0ab413727de76c74248cbb3cdc9ea) Signed-off-by: Urs Fässler Signed-off-by: Pascal Bach Signed-off-by: Richard Purdie --- bitbake/lib/bb/fetch2/git.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'bitbake/lib/bb/fetch2') diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index 35da14d71b..e46ea4893b 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py @@ -299,17 +299,22 @@ class Git(FetchMethod): return ud.clonedir def need_update(self, ud, d): + return self.clonedir_need_update(ud, d) or self.shallow_tarball_need_update(ud) or self.tarball_need_update(ud) + + def clonedir_need_update(self, ud, d): if not os.path.exists(ud.clonedir): 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 shallow_tarball_need_update(self, ud): + return ud.shallow and ud.write_shallow_tarballs and not os.path.exists(ud.fullshallow) + + def tarball_need_update(self, ud): + return ud.write_tarballs and not os.path.exists(ud.fullmirror) + def try_premirror(self, ud, d): # If we don't do this, updating an existing checkout with only premirrors # is not possible -- cgit v1.2.3-54-g00ecf