summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/fetch2/__init__.py')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index ef9d75f3fe..1ec42717ff 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -491,6 +491,7 @@ class FetchData(object):
491 """ 491 """
492 def __init__(self, url, d): 492 def __init__(self, url, d):
493 # localpath is the location of a downloaded result. If not set, the file is local. 493 # localpath is the location of a downloaded result. If not set, the file is local.
494 self.donestamp = None
494 self.localfile = "" 495 self.localfile = ""
495 self.localpath = None 496 self.localpath = None
496 self.lockfile = None 497 self.lockfile = None
@@ -717,6 +718,12 @@ class FetchMethod(object):
717 718
718 return 719 return
719 720
721 def clean(self, urldata, d):
722 """
723 Clean any existing full or partial download
724 """
725 bb.utils.remove(urldata.localpath)
726
720 def try_premirror(self, url, urldata, d): 727 def try_premirror(self, url, urldata, d):
721 """ 728 """
722 Should premirrors be used? 729 Should premirrors be used?
@@ -958,6 +965,33 @@ class Fetch(object):
958 if ud.lockfile: 965 if ud.lockfile:
959 bb.utils.unlockfile(lf) 966 bb.utils.unlockfile(lf)
960 967
968 def clean(self, urls = []):
969 """
970 Clean files that the fetcher gets or places
971 """
972
973 if len(urls) == 0:
974 urls = self.urls
975
976 for url in urls:
977 if url not in self.ud:
978 self.ud[url] = FetchData(url, d)
979 ud = self.ud[url]
980 ud.setup_localpath(self.d)
981
982 if not ud.localfile or self.localpath is None:
983 continue
984
985 if ud.lockfile:
986 lf = bb.utils.lockfile(ud.lockfile)
987
988 ud.method.clean(ud, self.d)
989 if ud.donestamp:
990 bb.utils.remove(ud.donestamp)
991
992 if ud.lockfile:
993 bb.utils.unlockfile(lf)
994
961from . import cvs 995from . import cvs
962from . import git 996from . import git
963from . import local 997from . import local