summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2012-07-24 12:37:01 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-07-28 09:20:53 +0100
commit2045338ab4eda5dfab79c21fea3c4fc7b9732ec9 (patch)
treecd2482b53d2751e4cff3f1eff21b2c13cb6b4fea
parent10b5ea77b1e7c64d4ff37c6c348bf1a6d28ce54d (diff)
downloadpoky-2045338ab4eda5dfab79c21fea3c4fc7b9732ec9.tar.gz
sstate: Add a two character subdirectory to the sstate directory layout
Currently all sstate files are placed into one directory. This does not scale and causes a variety of filesystem issues. This patch adds a two character subdirectory to the layout (based on the first two characters of the hash) so that files can be split into several directories. This should help performance of sstate in most cases. (From OE-Core rev: 5d45c7b025f6635b2232d7bf92b7c1aba350396b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/sstate.bbclass27
1 files changed, 15 insertions, 12 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 570b371daa..d00779adeb 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -4,16 +4,21 @@ SSTATE_MANIFESTS ?= "${TMPDIR}/sstate-control"
4SSTATE_MANFILEBASE = "${SSTATE_MANIFESTS}/manifest-${SSTATE_MANMACH}-" 4SSTATE_MANFILEBASE = "${SSTATE_MANIFESTS}/manifest-${SSTATE_MANMACH}-"
5SSTATE_MANFILEPREFIX = "${SSTATE_MANFILEBASE}${PN}" 5SSTATE_MANFILEPREFIX = "${SSTATE_MANFILEBASE}${PN}"
6 6
7def generate_sstatefn(spec, hash, d):
8 if not hash:
9 hash = "INVALID"
10 return hash[:2] + "/" + spec + hash
7 11
8SSTATE_PKGARCH = "${PACKAGE_ARCH}" 12SSTATE_PKGARCH = "${PACKAGE_ARCH}"
9SSTATE_PKGSPEC = "sstate-${PN}-${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}-${PV}-${PR}-${SSTATE_PKGARCH}-${SSTATE_VERSION}-" 13SSTATE_PKGSPEC = "sstate-${PN}-${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}-${PV}-${PR}-${SSTATE_PKGARCH}-${SSTATE_VERSION}-"
10SSTATE_PKGNAME = "${SSTATE_PKGSPEC}${BB_TASKHASH}" 14SSTATE_PKGNAME = "${@generate_sstatefn(d.getVar('SSTATE_PKGSPEC', True), d.getVar('BB_TASKHASH', True), d)}"
11SSTATE_PKG = "${SSTATE_DIR}/${SSTATE_PKGNAME}" 15SSTATE_PKG = "${SSTATE_DIR}/${SSTATE_PKGNAME}"
16SSTATE_PATHSPEC = "${SSTATE_DIR}/*/${SSTATE_PKGSPEC}"
12 17
13SSTATE_SCAN_FILES ?= "*.la *-config *_config" 18SSTATE_SCAN_FILES ?= "*.la *-config *_config"
14SSTATE_SCAN_CMD ?= 'find ${SSTATE_BUILDDIR} \( -name "${@"\" -o -name \"".join(d.getVar("SSTATE_SCAN_FILES", True).split())}" \) -type f' 19SSTATE_SCAN_CMD ?= 'find ${SSTATE_BUILDDIR} \( -name "${@"\" -o -name \"".join(d.getVar("SSTATE_SCAN_FILES", True).split())}" \) -type f'
15 20
16BB_HASHFILENAME = "${SSTATE_PKGNAME}" 21BB_HASHFILENAME = "${SSTATE_PKGSPEC}"
17 22
18SSTATE_MANMACH ?= "${SSTATE_PKGARCH}" 23SSTATE_MANMACH ?= "${SSTATE_PKGARCH}"
19 24
@@ -158,10 +163,11 @@ def sstate_installpkg(ss, d):
158 oe.path.remove(dir) 163 oe.path.remove(dir)
159 164
160 sstateinst = d.expand("${WORKDIR}/sstate-install-%s/" % ss['name']) 165 sstateinst = d.expand("${WORKDIR}/sstate-install-%s/" % ss['name'])
166 sstatefetch = d.getVar('SSTATE_PKGNAME', True) + '_' + ss['name'] + ".tgz"
161 sstatepkg = d.getVar('SSTATE_PKG', True) + '_' + ss['name'] + ".tgz" 167 sstatepkg = d.getVar('SSTATE_PKG', True) + '_' + ss['name'] + ".tgz"
162 168
163 if not os.path.exists(sstatepkg): 169 if not os.path.exists(sstatepkg):
164 pstaging_fetch(sstatepkg, d) 170 pstaging_fetch(sstatefetch, sstatepkg, d)
165 171
166 if not os.path.isfile(sstatepkg): 172 if not os.path.isfile(sstatepkg):
167 bb.note("Staging package %s does not exist" % sstatepkg) 173 bb.note("Staging package %s does not exist" % sstatepkg)
@@ -223,8 +229,7 @@ def sstate_installpkg(ss, d):
223def sstate_clean_cachefile(ss, d): 229def sstate_clean_cachefile(ss, d):
224 import oe.path 230 import oe.path
225 231
226 sstatepkgdir = d.getVar('SSTATE_DIR', True) 232 sstatepkgfile = d.getVar('SSTATE_PATHSPEC', True) + "*_" + ss['name'] + ".tgz*"
227 sstatepkgfile = sstatepkgdir + '/' + d.getVar('SSTATE_PKGSPEC', True) + "*_" + ss['name'] + ".tgz*"
228 bb.note("Removing %s" % sstatepkgfile) 233 bb.note("Removing %s" % sstatepkgfile)
229 oe.path.remove(sstatepkgfile) 234 oe.path.remove(sstatepkgfile)
230 235
@@ -417,7 +422,7 @@ def sstate_package(ss, d):
417 422
418 return 423 return
419 424
420def pstaging_fetch(sstatepkg, d): 425def pstaging_fetch(sstatefetch, sstatepkg, d):
421 import bb.fetch2 426 import bb.fetch2
422 427
423 # Only try and fetch if the user has configured a mirror 428 # Only try and fetch if the user has configured a mirror
@@ -430,7 +435,7 @@ def pstaging_fetch(sstatepkg, d):
430 bb.data.update_data(localdata) 435 bb.data.update_data(localdata)
431 436
432 dldir = localdata.expand("${SSTATE_DIR}") 437 dldir = localdata.expand("${SSTATE_DIR}")
433 srcuri = "file://" + os.path.basename(sstatepkg) 438 srcuri = "file://" + sstatefetch
434 439
435 bb.mkdirhier(dldir) 440 bb.mkdirhier(dldir)
436 441
@@ -519,8 +524,7 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d):
519 } 524 }
520 525
521 for task in range(len(sq_fn)): 526 for task in range(len(sq_fn)):
522 sstatefile = d.expand("${SSTATE_DIR}/" + sq_hashfn[task] + "_" + mapping[sq_task[task]] + ".tgz") 527 sstatefile = d.expand("${SSTATE_DIR}/" + generate_sstatefn(sq_hashfn[task], sq_hash[task], d) + "_" + mapping[sq_task[task]] + ".tgz")
523 sstatefile = sstatefile.replace("${BB_TASKHASH}", sq_hash[task])
524 if os.path.exists(sstatefile): 528 if os.path.exists(sstatefile):
525 bb.debug(2, "SState: Found valid sstate file %s" % sstatefile) 529 bb.debug(2, "SState: Found valid sstate file %s" % sstatefile)
526 ret.append(task) 530 ret.append(task)
@@ -544,10 +548,9 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d):
544 if task in ret: 548 if task in ret:
545 continue 549 continue
546 550
547 sstatefile = d.expand("${SSTATE_DIR}/" + sq_hashfn[task] + "_" + mapping[sq_task[task]] + ".tgz") 551 sstatefile = d.expand(generate_sstatefn(sq_hashfn[task], sq_hash[task], d) + "_" + mapping[sq_task[task]] + ".tgz")
548 sstatefile = sstatefile.replace("${BB_TASKHASH}", sq_hash[task])
549 552
550 srcuri = "file://" + os.path.basename(sstatefile) 553 srcuri = "file://" + sstatefile
551 localdata.setVar('SRC_URI', srcuri) 554 localdata.setVar('SRC_URI', srcuri)
552 bb.debug(2, "SState: Attempting to fetch %s" % srcuri) 555 bb.debug(2, "SState: Attempting to fetch %s" % srcuri)
553 556