summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/fetch2/git.py10
-rw-r--r--bitbake/lib/bb/fetch2/hg.py10
2 files changed, 12 insertions, 8 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 40658ff94c..4a32a31e40 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -181,8 +181,6 @@ class Git(FetchMethod):
181 def download(self, ud, d): 181 def download(self, ud, d):
182 """Fetch url""" 182 """Fetch url"""
183 183
184 ud.repochanged = not os.path.exists(ud.fullmirror)
185
186 # If the checkout doesn't exist and the mirror tarball does, extract it 184 # If the checkout doesn't exist and the mirror tarball does, extract it
187 if not os.path.exists(ud.clonedir) and os.path.exists(ud.fullmirror): 185 if not os.path.exists(ud.clonedir) and os.path.exists(ud.fullmirror):
188 bb.utils.mkdirhier(ud.clonedir) 186 bb.utils.mkdirhier(ud.clonedir)
@@ -220,7 +218,11 @@ class Git(FetchMethod):
220 runfetchcmd(fetch_cmd, d) 218 runfetchcmd(fetch_cmd, d)
221 runfetchcmd("%s prune-packed" % ud.basecmd, d) 219 runfetchcmd("%s prune-packed" % ud.basecmd, d)
222 runfetchcmd("%s pack-redundant --all | xargs -r rm" % ud.basecmd, d) 220 runfetchcmd("%s pack-redundant --all | xargs -r rm" % ud.basecmd, d)
223 ud.repochanged = True 221 try:
222 os.unlink(ud.fullmirror)
223 except OSError as exc:
224 if exc.errno != errno.ENOENT:
225 raise
224 os.chdir(ud.clonedir) 226 os.chdir(ud.clonedir)
225 for name in ud.names: 227 for name in ud.names:
226 if not self._contains_ref(ud, d, name): 228 if not self._contains_ref(ud, d, name):
@@ -228,7 +230,7 @@ class Git(FetchMethod):
228 230
229 def build_mirror_data(self, ud, d): 231 def build_mirror_data(self, ud, d):
230 # Generate a mirror tarball if needed 232 # Generate a mirror tarball if needed
231 if ud.write_tarballs and (ud.repochanged or not os.path.exists(ud.fullmirror)): 233 if ud.write_tarballs and not os.path.exists(ud.fullmirror):
232 # it's possible that this symlink points to read-only filesystem with PREMIRROR 234 # it's possible that this symlink points to read-only filesystem with PREMIRROR
233 if os.path.islink(ud.fullmirror): 235 if os.path.islink(ud.fullmirror):
234 os.unlink(ud.fullmirror) 236 os.unlink(ud.fullmirror)
diff --git a/bitbake/lib/bb/fetch2/hg.py b/bitbake/lib/bb/fetch2/hg.py
index d978630bac..bbb4ed95dc 100644
--- a/bitbake/lib/bb/fetch2/hg.py
+++ b/bitbake/lib/bb/fetch2/hg.py
@@ -163,8 +163,6 @@ class Hg(FetchMethod):
163 def download(self, ud, d): 163 def download(self, ud, d):
164 """Fetch url""" 164 """Fetch url"""
165 165
166 ud.repochanged = not os.path.exists(ud.fullmirror)
167
168 logger.debug(2, "Fetch: checking for module directory '" + ud.moddir + "'") 166 logger.debug(2, "Fetch: checking for module directory '" + ud.moddir + "'")
169 167
170 # If the checkout doesn't exist and the mirror tarball does, extract it 168 # If the checkout doesn't exist and the mirror tarball does, extract it
@@ -189,7 +187,11 @@ class Hg(FetchMethod):
189 logger.debug(1, "Running %s", pullcmd) 187 logger.debug(1, "Running %s", pullcmd)
190 bb.fetch2.check_network_access(d, pullcmd, ud.url) 188 bb.fetch2.check_network_access(d, pullcmd, ud.url)
191 runfetchcmd(pullcmd, d) 189 runfetchcmd(pullcmd, d)
192 ud.repochanged = True 190 try:
191 os.unlink(ud.fullmirror)
192 except OSError as exc:
193 if exc.errno != errno.ENOENT:
194 raise
193 195
194 # No source found, clone it. 196 # No source found, clone it.
195 if not os.path.exists(ud.moddir): 197 if not os.path.exists(ud.moddir):
@@ -238,7 +240,7 @@ class Hg(FetchMethod):
238 240
239 def build_mirror_data(self, ud, d): 241 def build_mirror_data(self, ud, d):
240 # Generate a mirror tarball if needed 242 # Generate a mirror tarball if needed
241 if ud.write_tarballs == "1" and (ud.repochanged or not os.path.exists(ud.fullmirror)): 243 if ud.write_tarballs == "1" and not os.path.exists(ud.fullmirror):
242 # it's possible that this symlink points to read-only filesystem with PREMIRROR 244 # it's possible that this symlink points to read-only filesystem with PREMIRROR
243 if os.path.islink(ud.fullmirror): 245 if os.path.islink(ud.fullmirror):
244 os.unlink(ud.fullmirror) 246 os.unlink(ud.fullmirror)