summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-26 17:52:14 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-28 11:34:38 +0000
commitc679a3dd41db361212f8bb7c3d0227ff1b9d3011 (patch)
treee8439e397bdd4e53efdf035de3fc83a1d2edee7b /bitbake/lib
parentd01042eda955a855c7bd1a80a104f8cc2c6abf0c (diff)
downloadpoky-c679a3dd41db361212f8bb7c3d0227ff1b9d3011.tar.gz
bitbake: 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. (Bitbake rev: 48e903745db578d9b9b425a8d411c1369df0eb94) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py22
-rw-r--r--bitbake/lib/bb/fetch2/local.py1
2 files changed, 19 insertions, 4 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 11fe95b541..b18b406583 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -626,6 +626,9 @@ def verify_donestamp(ud, d, origud=None):
626 Returns True, if the donestamp exists and is valid, False otherwise. When 626 Returns True, if the donestamp exists and is valid, False otherwise. When
627 returning False, any existing done stamps are removed. 627 returning False, any existing done stamps are removed.
628 """ 628 """
629 if not ud.needdonestamp:
630 return True
631
629 if not os.path.exists(ud.donestamp): 632 if not os.path.exists(ud.donestamp):
630 return False 633 return False
631 634
@@ -684,6 +687,9 @@ def update_stamp(ud, d):
684 donestamp is file stamp indicating the whole fetching is done 687 donestamp is file stamp indicating the whole fetching is done
685 this function update the stamp after verifying the checksum 688 this function update the stamp after verifying the checksum
686 """ 689 """
690 if not ud.needdonestamp:
691 return
692
687 if os.path.exists(ud.donestamp): 693 if os.path.exists(ud.donestamp):
688 # Touch the done stamp file to show active use of the download 694 # Touch the done stamp file to show active use of the download
689 try: 695 try:
@@ -935,8 +941,9 @@ def try_mirror_url(fetch, origud, ud, ld, check = False):
935 if origud.mirrortarball and os.path.basename(ud.localpath) == os.path.basename(origud.mirrortarball) \ 941 if origud.mirrortarball and os.path.basename(ud.localpath) == os.path.basename(origud.mirrortarball) \
936 and os.path.basename(ud.localpath) != os.path.basename(origud.localpath): 942 and os.path.basename(ud.localpath) != os.path.basename(origud.localpath):
937 # Create donestamp in old format to avoid triggering a re-download 943 # Create donestamp in old format to avoid triggering a re-download
938 bb.utils.mkdirhier(os.path.dirname(ud.donestamp)) 944 if ud.donestamp:
939 open(ud.donestamp, 'w').close() 945 bb.utils.mkdirhier(os.path.dirname(ud.donestamp))
946 open(ud.donestamp, 'w').close()
940 dest = os.path.join(dldir, os.path.basename(ud.localpath)) 947 dest = os.path.join(dldir, os.path.basename(ud.localpath))
941 if not os.path.exists(dest): 948 if not os.path.exists(dest):
942 os.symlink(ud.localpath, dest) 949 os.symlink(ud.localpath, dest)
@@ -1119,6 +1126,7 @@ class FetchData(object):
1119 def __init__(self, url, d, localonly = False): 1126 def __init__(self, url, d, localonly = False):
1120 # localpath is the location of a downloaded result. If not set, the file is local. 1127 # localpath is the location of a downloaded result. If not set, the file is local.
1121 self.donestamp = None 1128 self.donestamp = None
1129 self.needdonestamp = True
1122 self.localfile = "" 1130 self.localfile = ""
1123 self.localpath = None 1131 self.localpath = None
1124 self.lockfile = None 1132 self.lockfile = None
@@ -1183,6 +1191,10 @@ class FetchData(object):
1183 self.localpath = self.method.localpath(self, d) 1191 self.localpath = self.method.localpath(self, d)
1184 1192
1185 dldir = d.getVar("DL_DIR", True) 1193 dldir = d.getVar("DL_DIR", True)
1194
1195 if not self.needdonestamp:
1196 return
1197
1186 # Note: .done and .lock files should always be in DL_DIR whereas localpath may not be. 1198 # Note: .done and .lock files should always be in DL_DIR whereas localpath may not be.
1187 if self.localpath and self.localpath.startswith(dldir): 1199 if self.localpath and self.localpath.startswith(dldir):
1188 basepath = self.localpath 1200 basepath = self.localpath
@@ -1533,7 +1545,8 @@ class Fetch(object):
1533 m = ud.method 1545 m = ud.method
1534 localpath = "" 1546 localpath = ""
1535 1547
1536 lf = bb.utils.lockfile(ud.lockfile) 1548 if ud.lockfile:
1549 lf = bb.utils.lockfile(ud.lockfile)
1537 1550
1538 try: 1551 try:
1539 self.d.setVar("BB_NO_NETWORK", network) 1552 self.d.setVar("BB_NO_NETWORK", network)
@@ -1599,7 +1612,8 @@ class Fetch(object):
1599 raise 1612 raise
1600 1613
1601 finally: 1614 finally:
1602 bb.utils.unlockfile(lf) 1615 if ud.lockfile:
1616 bb.utils.unlockfile(lf)
1603 1617
1604 def checkstatus(self, urls=None): 1618 def checkstatus(self, urls=None):
1605 """ 1619 """
diff --git a/bitbake/lib/bb/fetch2/local.py b/bitbake/lib/bb/fetch2/local.py
index 2d921f7e55..303a52b638 100644
--- a/bitbake/lib/bb/fetch2/local.py
+++ b/bitbake/lib/bb/fetch2/local.py
@@ -45,6 +45,7 @@ class Local(FetchMethod):
45 ud.decodedurl = urllib.unquote(ud.url.split("://")[1].split(";")[0]) 45 ud.decodedurl = urllib.unquote(ud.url.split("://")[1].split(";")[0])
46 ud.basename = os.path.basename(ud.decodedurl) 46 ud.basename = os.path.basename(ud.decodedurl)
47 ud.basepath = ud.decodedurl 47 ud.basepath = ud.decodedurl
48 ud.needdonestamp = False
48 return 49 return
49 50
50 def localpath(self, urldata, d): 51 def localpath(self, urldata, d):