I need to generate some kind of manifest, based on the contents of the recipe. This file needs to be deployed to the image as well.
To generate a file, I have seen in many bbclasses that python code functions are used in a similar way such as:
python do_create_manifest () {
[...]
filename = d.expand("${D}${LOC}/${MANIFEST_NAME}")
[...]
with open (filename,'w') as manifest_file:
json.dump(manifest_dict, manifest_file, indent=True)
os.chmod(filename, 0o644)
}
The file is created after adding the task dependency, however when such file is packaged, the host-user-contaminated warning arises in the file.
Despite I have seen in many recipes the use of:
chown -R root:root ${D}${...}/${...}
This fails, as chown needs to be run by root, and bitbake is ran by current user:
Log data follows:
| DEBUG: Executing shell function do_uncontaminate
| chown: changing ownership of '/mnt/thud/build-r0w/[...]/manifest.json': Operation not permitted
| WARNING: exit code 1 from a shell command.
Note: I know this would prevent the warning from appearing, but not solving the problem.
INSANE_SKIP_${PN} = "host-user-contaminated"
You don't specify where this file gets created, what path filename
contains, but from the error I suspect you create it directly under ${D}
somewhere.
If you instead create the manifest file under e.g. ${B}
, and then during the regular do_install
you install it using e.g. install -Dm0644 ${B}/my_manifest ${D}/dest/path/my_manifest
the ownership issue will be taken care of as with any other file that a recipe installs.
Just make sure that the do_create_manifest task is run before do_install.