diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-09-26 14:32:13 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-09-26 15:02:25 +0100 |
commit | 9eacffe137278b6d72672b41f98dfced9ee80036 (patch) | |
tree | a7eeed52e5bc7034f7b2e70568ab3620f7cb8cf4 /meta | |
parent | 42e8c8056719326b68b1602e0699eba00a924d2b (diff) | |
download | poky-9eacffe137278b6d72672b41f98dfced9ee80036.tar.gz |
sstate: Remove master manifest usage
This was added to allow detection of duplicate files being installed by sstate.
There is a much simpler way, just check if the file already exists. This
effectively uses the kernel VFS as the cache which is much more efficient.
This resolves a significant performance bottleneck (lock contention on a
single file) when running builds that are just being generated from sstate
cache files.
(From OE-Core rev: 603daf343ad3f18c8adb799e3625ae2a18d94f56)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/sstate.bbclass | 31 |
1 files changed, 3 insertions, 28 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass index 0037ce5638..6878e1a936 100644 --- a/meta/classes/sstate.bbclass +++ b/meta/classes/sstate.bbclass | |||
@@ -3,7 +3,6 @@ SSTATE_VERSION = "2" | |||
3 | SSTATE_MANIFESTS ?= "${TMPDIR}/sstate-control" | 3 | SSTATE_MANIFESTS ?= "${TMPDIR}/sstate-control" |
4 | SSTATE_MANFILEBASE = "${SSTATE_MANIFESTS}/manifest-${SSTATE_MANMACH}-" | 4 | SSTATE_MANFILEBASE = "${SSTATE_MANIFESTS}/manifest-${SSTATE_MANMACH}-" |
5 | SSTATE_MANFILEPREFIX = "${SSTATE_MANFILEBASE}${PN}" | 5 | SSTATE_MANFILEPREFIX = "${SSTATE_MANFILEBASE}${PN}" |
6 | SSTATE_MASTERMANIFEST = "${SSTATE_MANIFESTS}/master.list" | ||
7 | 6 | ||
8 | def generate_sstatefn(spec, hash, d): | 7 | def generate_sstatefn(spec, hash, d): |
9 | if not hash: | 8 | if not hash: |
@@ -142,17 +141,11 @@ def sstate_install(ss, d): | |||
142 | dstdir = dstdir + "/" | 141 | dstdir = dstdir + "/" |
143 | shareddirs.append(dstdir) | 142 | shareddirs.append(dstdir) |
144 | 143 | ||
145 | # Check the file list for conflicts against the master manifest | 144 | # Check the file list for conflicts against files which already exist |
146 | mastermanifest = d.getVar("SSTATE_MASTERMANIFEST", True) | ||
147 | whitelist = (d.getVar("SSTATE_DUPWHITELIST", True) or "").split() | 145 | whitelist = (d.getVar("SSTATE_DUPWHITELIST", True) or "").split() |
148 | lock = bb.utils.lockfile(mastermanifest + ".lock") | ||
149 | if not os.path.exists(mastermanifest): | ||
150 | open(mastermanifest, "w").close() | ||
151 | fileslist = [line.strip() for line in open(mastermanifest)] | ||
152 | bb.utils.unlockfile(lock) | ||
153 | match = [] | 146 | match = [] |
154 | for f in sharedfiles: | 147 | for f in sharedfiles: |
155 | if f in fileslist: | 148 | if os.path.exists(f): |
156 | realmatch = True | 149 | realmatch = True |
157 | for w in whitelist: | 150 | for w in whitelist: |
158 | if f.startswith(w): | 151 | if f.startswith(w): |
@@ -163,14 +156,10 @@ def sstate_install(ss, d): | |||
163 | if match: | 156 | if match: |
164 | bb.warn("The recipe is trying to install files into a shared area when those files already exist. Those files are:\n %s" % "\n ".join(match)) | 157 | bb.warn("The recipe is trying to install files into a shared area when those files already exist. Those files are:\n %s" % "\n ".join(match)) |
165 | 158 | ||
166 | # Write out the manifest and add to the task's manifest file | 159 | # Write out the manifest |
167 | lock = bb.utils.lockfile(mastermanifest + ".lock") | ||
168 | mf = open(mastermanifest, "a") | ||
169 | f = open(manifest, "w") | 160 | f = open(manifest, "w") |
170 | for file in sharedfiles: | 161 | for file in sharedfiles: |
171 | mf.write(file + "\n") | ||
172 | f.write(file + "\n") | 162 | f.write(file + "\n") |
173 | bb.utils.unlockfile(lock) | ||
174 | 163 | ||
175 | # We want to ensure that directories appear at the end of the manifest | 164 | # We want to ensure that directories appear at the end of the manifest |
176 | # so that when we test to see if they should be deleted any contents | 165 | # so that when we test to see if they should be deleted any contents |
@@ -301,20 +290,6 @@ def sstate_clean_manifest(manifest, d): | |||
301 | except OSError: | 290 | except OSError: |
302 | pass | 291 | pass |
303 | 292 | ||
304 | # Remove the entries from the master manifest | ||
305 | mastermanifest = d.getVar("SSTATE_MASTERMANIFEST", True) | ||
306 | lock = bb.utils.lockfile(mastermanifest + ".lock") | ||
307 | if not os.path.exists(mastermanifest): | ||
308 | open(mastermanifest, "w").close() | ||
309 | mf = open(mastermanifest + ".new", "w") | ||
310 | for line in open(mastermanifest, "r"): | ||
311 | if not line or line in entries: | ||
312 | continue | ||
313 | mf.write(line) | ||
314 | mf.close() | ||
315 | os.rename(mastermanifest + ".new", mastermanifest) | ||
316 | bb.utils.unlockfile(lock) | ||
317 | |||
318 | oe.path.remove(manifest) | 293 | oe.path.remove(manifest) |
319 | 294 | ||
320 | def sstate_clean(ss, d): | 295 | def sstate_clean(ss, d): |