mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 12:29:55 +00:00
fetch2: Correct the clean() mechanism for the fetcher2 code
This create a clean() method in each of the fetcher modules and correctly cleans the .done stamp file and lock files Signed-off-by: Saul Wold <sgw@linux.intel.com>
This commit is contained in:
committed by
Richard Purdie
parent
f1bbea4ab0
commit
14dea89521
@@ -491,6 +491,7 @@ class FetchData(object):
|
||||
"""
|
||||
def __init__(self, url, d):
|
||||
# localpath is the location of a downloaded result. If not set, the file is local.
|
||||
self.donestamp = None
|
||||
self.localfile = ""
|
||||
self.localpath = None
|
||||
self.lockfile = None
|
||||
@@ -717,6 +718,12 @@ class FetchMethod(object):
|
||||
|
||||
return
|
||||
|
||||
def clean(self, urldata, d):
|
||||
"""
|
||||
Clean any existing full or partial download
|
||||
"""
|
||||
bb.utils.remove(urldata.localpath)
|
||||
|
||||
def try_premirror(self, url, urldata, d):
|
||||
"""
|
||||
Should premirrors be used?
|
||||
@@ -958,6 +965,33 @@ class Fetch(object):
|
||||
if ud.lockfile:
|
||||
bb.utils.unlockfile(lf)
|
||||
|
||||
def clean(self, urls = []):
|
||||
"""
|
||||
Clean files that the fetcher gets or places
|
||||
"""
|
||||
|
||||
if len(urls) == 0:
|
||||
urls = self.urls
|
||||
|
||||
for url in urls:
|
||||
if url not in self.ud:
|
||||
self.ud[url] = FetchData(url, d)
|
||||
ud = self.ud[url]
|
||||
ud.setup_localpath(self.d)
|
||||
|
||||
if not ud.localfile or self.localpath is None:
|
||||
continue
|
||||
|
||||
if ud.lockfile:
|
||||
lf = bb.utils.lockfile(ud.lockfile)
|
||||
|
||||
ud.method.clean(ud, self.d)
|
||||
if ud.donestamp:
|
||||
bb.utils.remove(ud.donestamp)
|
||||
|
||||
if ud.lockfile:
|
||||
bb.utils.unlockfile(lf)
|
||||
|
||||
from . import cvs
|
||||
from . import git
|
||||
from . import local
|
||||
|
||||
Reference in New Issue
Block a user