diff options
| author | Urs Fässler <urs.fassler@bbv.ch> | 2018-10-03 12:04:06 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-10-04 23:00:24 +0100 |
| commit | 073c62cb56f3cd45d9ae28e0fcfc522be7480d4f (patch) | |
| tree | bdf29dc059354d13face1b7c769ab2095385cc81 | |
| parent | 6d9de01c181066326365ff743c4c4cb5707db1e2 (diff) | |
| download | poky-073c62cb56f3cd45d9ae28e0fcfc522be7480d4f.tar.gz | |
bitbake: fetch2/git: improve readability of method need_update
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 <urs.fassler@bbv.ch>
Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | bitbake/lib/bb/fetch2/git.py | 13 |
1 files changed, 9 insertions, 4 deletions
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): | |||
| 299 | return ud.clonedir | 299 | return ud.clonedir |
| 300 | 300 | ||
| 301 | def need_update(self, ud, d): | 301 | def need_update(self, ud, d): |
| 302 | return self.clonedir_need_update(ud, d) or self.shallow_tarball_need_update(ud) or self.tarball_need_update(ud) | ||
| 303 | |||
| 304 | def clonedir_need_update(self, ud, d): | ||
| 302 | if not os.path.exists(ud.clonedir): | 305 | if not os.path.exists(ud.clonedir): |
| 303 | return True | 306 | return True |
| 304 | for name in ud.names: | 307 | for name in ud.names: |
| 305 | if not self._contains_ref(ud, d, name, ud.clonedir): | 308 | if not self._contains_ref(ud, d, name, ud.clonedir): |
| 306 | return True | 309 | return True |
| 307 | if ud.shallow and ud.write_shallow_tarballs and not os.path.exists(ud.fullshallow): | ||
| 308 | return True | ||
| 309 | if ud.write_tarballs and not os.path.exists(ud.fullmirror): | ||
| 310 | return True | ||
| 311 | return False | 310 | return False |
| 312 | 311 | ||
| 312 | def shallow_tarball_need_update(self, ud): | ||
| 313 | return ud.shallow and ud.write_shallow_tarballs and not os.path.exists(ud.fullshallow) | ||
| 314 | |||
| 315 | def tarball_need_update(self, ud): | ||
| 316 | return ud.write_tarballs and not os.path.exists(ud.fullmirror) | ||
| 317 | |||
| 313 | def try_premirror(self, ud, d): | 318 | def try_premirror(self, ud, d): |
| 314 | # If we don't do this, updating an existing checkout with only premirrors | 319 | # If we don't do this, updating an existing checkout with only premirrors |
| 315 | # is not possible | 320 | # is not possible |
