All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fetch2: Improve lock/done stamp file paths for local files
@ 2013-02-14 21:38 Richard Purdie
  0 siblings, 0 replies; only message in thread
From: Richard Purdie @ 2013-02-14 21:38 UTC (permalink / raw)
  To: bitbake-devel

Currently stamps end up at the top level of DL_DIR even if the files
themselves are in a directory structure. This patch preserves path
components allowing the top level directory to be less populated
which is an advantage for large sstate caches.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 3f5de99..90c894f 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -756,6 +756,7 @@ class FetchData(object):
         self.lockfile = None
         self.mirrortarball = None
         self.basename = None
+        self.basepath = None
         (self.type, self.host, self.path, self.user, self.pswd, self.parm) = decodeurl(data.expand(url, d))
         self.date = self.getSRCDate(d)
         self.url = url
@@ -812,8 +813,14 @@ class FetchData(object):
         elif self.localfile:
             self.localpath = self.method.localpath(self.url, self, d)
 
-        # Note: These files should always be in DL_DIR whereas localpath may not be.
-        basepath = d.expand("${DL_DIR}/%s" % os.path.basename(self.localpath or self.basename))
+        dldir = d.getVar("DL_DIR", True)
+        # 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
+        elif self.localpath:
+            basepath = dldir + os.sep + os.path.basename(self.localpath)
+        else:
+            basepath = dldir + os.sep + (self.basepath or self.basename)
         self.donestamp = basepath + '.done'
         self.lockfile = basepath + '.lock'
 





^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-02-14 21:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-14 21:38 [PATCH] fetch2: Improve lock/done stamp file paths for local files Richard Purdie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.