diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-02-26 17:52:14 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-02-28 11:33:58 +0000 |
commit | 48e903745db578d9b9b425a8d411c1369df0eb94 (patch) | |
tree | be46bb5ed02c9dd46db7a71bccb7bd5623aa6b19 /lib/bb/fetch2/__init__.py | |
parent | 81158071508cc68c39db7d501370872f44d335cc (diff) | |
download | openembedded-core-contrib-48e903745db578d9b9b425a8d411c1369df0eb94.tar.gz |
fetch2: Skip lockfiles and donestamps for local files
For local files, there are no races with downloads, we don't need ".done"
stamps and we don't need lockfiles.
This considerably cleans up DL_DIR and all the pointless ".done" files
as well as removes stalls over local files with the same name.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/fetch2/__init__.py')
-rw-r--r-- | lib/bb/fetch2/__init__.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py index 11fe95b541..b18b406583 100644 --- a/lib/bb/fetch2/__init__.py +++ b/lib/bb/fetch2/__init__.py @@ -626,6 +626,9 @@ def verify_donestamp(ud, d, origud=None): Returns True, if the donestamp exists and is valid, False otherwise. When returning False, any existing done stamps are removed. """ + if not ud.needdonestamp: + return True + if not os.path.exists(ud.donestamp): return False @@ -684,6 +687,9 @@ def update_stamp(ud, d): donestamp is file stamp indicating the whole fetching is done this function update the stamp after verifying the checksum """ + if not ud.needdonestamp: + return + if os.path.exists(ud.donestamp): # Touch the done stamp file to show active use of the download try: @@ -935,8 +941,9 @@ def try_mirror_url(fetch, origud, ud, ld, check = False): if origud.mirrortarball and os.path.basename(ud.localpath) == os.path.basename(origud.mirrortarball) \ and os.path.basename(ud.localpath) != os.path.basename(origud.localpath): # Create donestamp in old format to avoid triggering a re-download - bb.utils.mkdirhier(os.path.dirname(ud.donestamp)) - open(ud.donestamp, 'w').close() + if ud.donestamp: + bb.utils.mkdirhier(os.path.dirname(ud.donestamp)) + open(ud.donestamp, 'w').close() dest = os.path.join(dldir, os.path.basename(ud.localpath)) if not os.path.exists(dest): os.symlink(ud.localpath, dest) @@ -1119,6 +1126,7 @@ class FetchData(object): def __init__(self, url, d, localonly = False): # localpath is the location of a downloaded result. If not set, the file is local. self.donestamp = None + self.needdonestamp = True self.localfile = "" self.localpath = None self.lockfile = None @@ -1183,6 +1191,10 @@ class FetchData(object): self.localpath = self.method.localpath(self, d) dldir = d.getVar("DL_DIR", True) + + if not self.needdonestamp: + return + # Note: .done and .lock files should always be in DL_DIR whereas localpath may not be. if self.localpath and self.localpath.startswith(dldir): basepath = self.localpath @@ -1533,7 +1545,8 @@ class Fetch(object): m = ud.method localpath = "" - lf = bb.utils.lockfile(ud.lockfile) + if ud.lockfile: + lf = bb.utils.lockfile(ud.lockfile) try: self.d.setVar("BB_NO_NETWORK", network) @@ -1599,7 +1612,8 @@ class Fetch(object): raise finally: - bb.utils.unlockfile(lf) + if ud.lockfile: + bb.utils.unlockfile(lf) def checkstatus(self, urls=None): """ |