classes/package: fix FILES_INFO serialisation in pkgdata

The FILES_INFO entry in each pkgdata file stores the list of files for
each package. Make the following improvements to how this is stored:
* Store paths as they would be seen on the target rather than
  erroneously including the full path to PKGDEST (which is specific to
  the build host the package was built on)
* For simplicity when loading the data, store complete paths for each
  entry instead of trying to break off the first part and use it as the
  dict key
* Record sizes for each file (as needed by Toaster)
* Serialise the value explicitly using json rather than just passing it
  through str().

Fixes [YOCTO #5443].

(From OE-Core rev: ca86603607a69a17cc5540d69de0e242b33382d3)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Paul Eggleton
2013-12-02 18:50:44 +00:00
committed by Richard Purdie
parent a6450a951f
commit 4a75e83b29
3 changed files with 21 additions and 45 deletions

View File

@@ -262,25 +262,20 @@ def find_path(args, usage, debug=False):
print('ERROR: Unable to find pkgdata directory %s' % pkgdata_dir)
sys.exit(1)
import ast
import json
import fnmatch
for root, dirs, files in os.walk(os.path.join(pkgdata_dir, 'runtime')):
for fn in files:
pkgsplitname = '/packages-split/%s' % fn
with open(os.path.join(root,fn)) as f:
for line in f:
if line.startswith('FILES_INFO:'):
val = line.split(':', 1)[1].strip().replace('\\\'', '\'')
dictval = ast.literal_eval(val)
for parent, dirlist in dictval.items():
idx = parent.find(pkgsplitname)
if idx > -1:
parent = parent[idx+len(pkgsplitname):]
for basename in dirlist:
fullpth = os.path.join(parent, basename)
if fnmatch.fnmatchcase(fullpth, targetpath):
print("%s: %s" % (fn, fullpth))
val = line.split(':', 1)[1].strip()
dictval = json.loads(val)
for fullpth in dictval.keys():
if fnmatch.fnmatchcase(fullpth, targetpath):
print("%s: %s" % (fn, fullpth))
break
def main():