diff options
author | Saul Wold <sgw@linux.intel.com> | 2011-02-09 14:30:29 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-02-10 23:49:25 +0000 |
commit | 14dea89521c0c648e8e543388096a6dcd6d4f2e0 (patch) | |
tree | ddb73f19d8eeaa659905968ee1de28b9750b5628 /bitbake/lib/bb/fetch2/__init__.py | |
parent | f1bbea4ab0c41cf93cd1a2d0d4d05a4ad06a0728 (diff) | |
download | poky-14dea89521c0c648e8e543388096a6dcd6d4f2e0.tar.gz |
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>
Diffstat (limited to 'bitbake/lib/bb/fetch2/__init__.py')
-rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 34 |
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 | |||
961 | from . import cvs | 995 | from . import cvs |
962 | from . import git | 996 | from . import git |
963 | from . import local | 997 | from . import local |