X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=meta-stx%2Fclasses%2Fstx-image-list.bbclass;fp=meta-stx%2Fclasses%2Fstx-image-list.bbclass;h=1c00055fde05cdbf69249f507cabe5a3b1eccc83;hb=d2b0c29d821e2a683dd486e75c460f5be8923a1a;hp=0000000000000000000000000000000000000000;hpb=09a8904eac19fe2f2d95a2de311e1db2a9256860;p=pti%2Frtp.git diff --git a/meta-stx/classes/stx-image-list.bbclass b/meta-stx/classes/stx-image-list.bbclass new file mode 100644 index 0000000..1c00055 --- /dev/null +++ b/meta-stx/classes/stx-image-list.bbclass @@ -0,0 +1,41 @@ +# +## Copyright (C) 2019 Wind River Systems, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +IMAGE_LIST = "${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.pkglist" + +ROOTFS_POSTPROCESS_COMMAND_append = " write_image_list;" + +python write_image_list () { + from oe.rootfs import image_list_installed_packages + + deploy_dir = d.getVar('IMGDEPLOYDIR') + link_name = d.getVar('IMAGE_LINK_NAME') + image_list_file = d.getVar('IMAGE_LIST') + + pkg_dict = image_list_installed_packages(d) + output = [] + for pkg in sorted(pkg_dict): + output.append(pkg_dict[pkg]["filename"]) + output_str = '\n'.join(output) + '\n' + + with open(image_list_file, 'w+') as image_pkglist: + image_pkglist.write(output_str) + + if os.path.exists(image_list_file): + pkglist_link = deploy_dir + "/" + link_name + ".pkglist" + if os.path.lexists(pkglist_link): + os.remove(pkglist_link) + os.symlink(os.path.basename(image_list_file), pkglist_link) +}