blob: 1c00055fde05cdbf69249f507cabe5a3b1eccc83 [file] [log] [blame]
Jackie Huangd2b0c292020-05-30 15:23:16 +08001#
2## Copyright (C) 2019 Wind River Systems, Inc.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16IMAGE_LIST = "${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.pkglist"
17
18ROOTFS_POSTPROCESS_COMMAND_append = " write_image_list;"
19
20python write_image_list () {
21 from oe.rootfs import image_list_installed_packages
22
23 deploy_dir = d.getVar('IMGDEPLOYDIR')
24 link_name = d.getVar('IMAGE_LINK_NAME')
25 image_list_file = d.getVar('IMAGE_LIST')
26
27 pkg_dict = image_list_installed_packages(d)
28 output = []
29 for pkg in sorted(pkg_dict):
30 output.append(pkg_dict[pkg]["filename"])
31 output_str = '\n'.join(output) + '\n'
32
33 with open(image_list_file, 'w+') as image_pkglist:
34 image_pkglist.write(output_str)
35
36 if os.path.exists(image_list_file):
37 pkglist_link = deploy_dir + "/" + link_name + ".pkglist"
38 if os.path.lexists(pkglist_link):
39 os.remove(pkglist_link)
40 os.symlink(os.path.basename(image_list_file), pkglist_link)
41}