diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-08-11 16:45:02 +1200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-08-17 10:35:40 +0100 |
commit | 7df442c340ba8eaaad7d512ed4130a87a25328f5 (patch) | |
tree | 9781a8f18e4162623daa5cc7f4b4368368300852 /meta/lib/oe/copy_buildsystem.py | |
parent | 37b81968bb74b2ea06c317fce68deb9739dba666 (diff) | |
download | poky-7df442c340ba8eaaad7d512ed4130a87a25328f5.tar.gz |
lib/oe/copy_buildsystem: fix merging sstate directories for eSDK
When we don't have uninative enabled there's more merging to be done in
the default configuration (SDK_EXT_TYPE = "full" which by default means
SDK_INCLUDE_TOOLCHAIN = "1") and there are likely files that already
exist in the sstate feed we're assembling, so we need to take care to
merge the directory contents rather than just moving the directories
over. Additionally we now only run this if uninative genuinely isn't
enabled (i.e. NATIVELSBSTRING is different to the fixed value of
"universal".)
In the process of fixing this I discovered an unusual behaviour in
os.rename() - when we're merging these feeds we're dealing with
hard-linked sstate artifacts, and whilst os.rename() is supposed to
silently overwrite an existing destination (permissions allowing), if
you have the source and destination as hardlinks to the same file then
the os.rename() call will just silently fail. As a result the code now
just checks if the destination exists and deletes the source if so
(since we know it will be the same file, we don't need to check in this
case.)
(From OE-Core rev: 2b5b920c6b4f4d5c243192aa75beff402fd704d3)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/copy_buildsystem.py')
-rw-r--r-- | meta/lib/oe/copy_buildsystem.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/meta/lib/oe/copy_buildsystem.py b/meta/lib/oe/copy_buildsystem.py index 4d3faf6681..3d5a746586 100644 --- a/meta/lib/oe/copy_buildsystem.py +++ b/meta/lib/oe/copy_buildsystem.py | |||
@@ -201,21 +201,25 @@ def merge_lockedsigs(copy_tasks, lockedsigs_main, lockedsigs_extra, merged_outpu | |||
201 | write_sigs_file(merged_output, arch_order, merged) | 201 | write_sigs_file(merged_output, arch_order, merged) |
202 | 202 | ||
203 | def create_locked_sstate_cache(lockedsigs, input_sstate_cache, output_sstate_cache, d, fixedlsbstring="", filterfile=None): | 203 | def create_locked_sstate_cache(lockedsigs, input_sstate_cache, output_sstate_cache, d, fixedlsbstring="", filterfile=None): |
204 | import shutil | ||
204 | bb.note('Generating sstate-cache...') | 205 | bb.note('Generating sstate-cache...') |
205 | 206 | ||
206 | nativelsbstring = d.getVar('NATIVELSBSTRING', True) | 207 | nativelsbstring = d.getVar('NATIVELSBSTRING', True) |
207 | bb.process.run("gen-lockedsig-cache %s %s %s %s %s" % (lockedsigs, input_sstate_cache, output_sstate_cache, nativelsbstring, filterfile or '')) | 208 | bb.process.run("gen-lockedsig-cache %s %s %s %s %s" % (lockedsigs, input_sstate_cache, output_sstate_cache, nativelsbstring, filterfile or '')) |
208 | if fixedlsbstring: | 209 | if fixedlsbstring and nativelsbstring != fixedlsbstring: |
209 | nativedir = output_sstate_cache + '/' + nativelsbstring | 210 | nativedir = output_sstate_cache + '/' + nativelsbstring |
210 | if os.path.isdir(nativedir): | 211 | if os.path.isdir(nativedir): |
211 | destdir = os.path.join(output_sstate_cache, fixedlsbstring) | 212 | destdir = os.path.join(output_sstate_cache, fixedlsbstring) |
212 | bb.utils.mkdirhier(destdir) | 213 | for root, _, files in os.walk(nativedir): |
213 | 214 | for fn in files: | |
214 | dirlist = os.listdir(nativedir) | 215 | src = os.path.join(root, fn) |
215 | for i in dirlist: | 216 | dest = os.path.join(destdir, os.path.relpath(src, nativedir)) |
216 | src = os.path.join(nativedir, i) | 217 | if os.path.exists(dest): |
217 | dest = os.path.join(destdir, i) | 218 | # Already exists, and it'll be the same file, so just delete it |
218 | os.rename(src, dest) | 219 | os.unlink(src) |
220 | else: | ||
221 | bb.utils.mkdirhier(os.path.dirname(dest)) | ||
222 | shutil.move(src, dest) | ||
219 | 223 | ||
220 | def check_sstate_task_list(d, targets, filteroutfile, cmdprefix='', cwd=None, logfile=None): | 224 | def check_sstate_task_list(d, targets, filteroutfile, cmdprefix='', cwd=None, logfile=None): |
221 | import subprocess | 225 | import subprocess |