Revert "Revert "oran-shell-release: release image for F""
[pti/rtp.git] / meta-starlingx / meta-stx-distro / classes / stx-image-list.bbclass
1 #
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
16 IMAGE_LIST = "${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.pkglist"
17
18 ROOTFS_POSTPROCESS_COMMAND_append = " write_image_list;"
19
20 python 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 }