diff options
author | Elliot Smith <elliot.smith@intel.com> | 2015-09-21 19:42:35 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-09-23 22:44:55 +0100 |
commit | 15b482b16b2340edc6f59a9c9e1d7f38bda9b6c2 (patch) | |
tree | 4aed90fdcc4b5a959a71464b12c2ef8c78c9cdff /bitbake/lib/bb/ui/buildinfohelper.py | |
parent | 767fe69fd045e9d1c0b9da4ae605b6f55f10e11e (diff) | |
download | poky-15b482b16b2340edc6f59a9c9e1d7f38bda9b6c2.tar.gz |
bitbake: toaster: Add fake entry to Target_File for filesystem root
The files-in-image.txt file is produced by bitbake after an
image is created, listing all the files in the image.
However, this list doesn't include the root directory ('/').
buildinfohelper.py then tries to construct the filesystem
tree from this file, assuming that every directory apart from
the root directory (which is special-cased) can be assigned
a parent. But because the root directory isn't listed in
files-in-image.txt, an object for the root directory is never
created.
The direct subdirectories of the root ('./bin', './usr' etc.)
then can't be assigned a parent directory, as the object
representing the root directory doesn't exist. This
results in a Target_File lookup error and causes the
directory listing page to fail.
Fix this by creating a fake entry for the root directory
in the Target_File table, so that the direct subdirectories
of / can be assigned a parent. Note that it doesn't matter
that the root is faked, as its properties are never shown
in the directory structure tree.
[YOCTO #8280]
(Bitbake rev: a4015768183e5a3fa39a6c2b4dea0088ca182d80)
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: brian avery <avery.brian@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui/buildinfohelper.py')
-rw-r--r-- | bitbake/lib/bb/ui/buildinfohelper.py | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py index e5f1e09978..5098448c97 100644 --- a/bitbake/lib/bb/ui/buildinfohelper.py +++ b/bitbake/lib/bb/ui/buildinfohelper.py | |||
@@ -338,26 +338,29 @@ class ORMWrapper(object): | |||
338 | files = filedata['files'] | 338 | files = filedata['files'] |
339 | syms = filedata['syms'] | 339 | syms = filedata['syms'] |
340 | 340 | ||
341 | # we insert directories, ordered by name depth | 341 | # always create the root directory as a special case; |
342 | # note that this is never displayed, so the owner, group, | ||
343 | # size, permission are irrelevant | ||
344 | tf_obj = Target_File.objects.create(target = target_obj, | ||
345 | path = '/', | ||
346 | size = 0, | ||
347 | owner = '', | ||
348 | group = '', | ||
349 | permission = '', | ||
350 | inodetype = Target_File.ITYPE_DIRECTORY) | ||
351 | tf_obj.save() | ||
352 | |||
353 | # insert directories, ordered by name depth | ||
342 | for d in sorted(dirs, key=lambda x:len(x[-1].split("/"))): | 354 | for d in sorted(dirs, key=lambda x:len(x[-1].split("/"))): |
343 | (user, group, size) = d[1:4] | 355 | (user, group, size) = d[1:4] |
344 | permission = d[0][1:] | 356 | permission = d[0][1:] |
345 | path = d[4].lstrip(".") | 357 | path = d[4].lstrip(".") |
358 | |||
359 | # we already created the root directory, so ignore any | ||
360 | # entry for it | ||
346 | if len(path) == 0: | 361 | if len(path) == 0: |
347 | # we create the root directory as a special case | ||
348 | path = "/" | ||
349 | tf_obj = Target_File.objects.create( | ||
350 | target = target_obj, | ||
351 | path = path, | ||
352 | size = size, | ||
353 | inodetype = Target_File.ITYPE_DIRECTORY, | ||
354 | permission = permission, | ||
355 | owner = user, | ||
356 | group = group, | ||
357 | ) | ||
358 | tf_obj.directory = tf_obj | ||
359 | tf_obj.save() | ||
360 | continue | 362 | continue |
363 | |||
361 | parent_path = "/".join(path.split("/")[:len(path.split("/")) - 1]) | 364 | parent_path = "/".join(path.split("/")[:len(path.split("/")) - 1]) |
362 | if len(parent_path) == 0: | 365 | if len(parent_path) == 0: |
363 | parent_path = "/" | 366 | parent_path = "/" |