mirror of
https://git.yoctoproject.org/poky
synced 2026-06-02 01:19:52 +00:00
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:
committed by
Richard Purdie
parent
a6450a951f
commit
4a75e83b29
@@ -1110,6 +1110,7 @@ PKGDESTWORK = "${WORKDIR}/pkgdata"
|
||||
|
||||
python emit_pkgdata() {
|
||||
from glob import glob
|
||||
import json
|
||||
|
||||
def write_if_exists(f, pkg, var):
|
||||
def encode(str):
|
||||
@@ -1173,22 +1174,20 @@ python emit_pkgdata() {
|
||||
workdir = d.getVar('WORKDIR', True)
|
||||
|
||||
for pkg in packages.split():
|
||||
items = {}
|
||||
for files_list in pkgfiles[pkg]:
|
||||
item_name = os.path.basename(files_list)
|
||||
item_path = os.path.dirname(files_list)
|
||||
if item_path not in items:
|
||||
items[item_path] = []
|
||||
items[item_path].append(item_name)
|
||||
subdata_file = pkgdatadir + "/runtime/%s" % pkg
|
||||
|
||||
pkgval = d.getVar('PKG_%s' % pkg, True)
|
||||
if pkgval is None:
|
||||
pkgval = pkg
|
||||
d.setVar('PKG_%s' % pkg, pkg)
|
||||
|
||||
d.setVar('FILES_INFO', str(items))
|
||||
pkgdestpkg = os.path.join(pkgdest, pkg)
|
||||
files = {}
|
||||
for f in pkgfiles[pkg]:
|
||||
relpth = os.path.relpath(f, pkgdestpkg)
|
||||
fstat = os.lstat(f)
|
||||
files[os.sep + relpth] = fstat.st_size
|
||||
d.setVar('FILES_INFO', json.dumps(files))
|
||||
|
||||
subdata_file = pkgdatadir + "/runtime/%s" % pkg
|
||||
sf = open(subdata_file, 'w')
|
||||
write_if_exists(sf, pkg, 'PN')
|
||||
write_if_exists(sf, pkg, 'PV')
|
||||
|
||||
Reference in New Issue
Block a user