buildhistory: Fix package output files for SDKs

Currently, installed packages are listed for images in image-info.txt, but
not for SDKs in sdk-info.txt. Add TOOLCHAIN_HOST_TASK and
TOOLCHAIN_TARGET_TASK to the output variables in sdk-info.txt.

Moreover, package output files for the SDK host are empty because
PKGDATA_DIR defaults to the target directory. Fix this bug and create a new
variable called PKGDATA_DIR_SDK which stores the correct path for the SDK
host package data.

(From OE-Core rev: af7b5c664649d2c0d1b23eb1d553080b9d2a7864)

Signed-off-by: Andres Beltran <abeltran@linux.microsoft.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
(cherry picked from commit 82e6172c1df378dff4e503aa878501c08937b5bb)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Andres Beltran 2021-10-05 00:34:15 +00:00 committed by Richard Purdie
parent be011b75c0
commit 6c3a8ae1f9
5 changed files with 20 additions and 8 deletions

View File

@ -442,11 +442,16 @@ def buildhistory_list_installed(d, rootfs_type="image"):
else:
pkgs = sdk_list_installed_packages(d, rootfs_type == "sdk_target")
if rootfs_type == "sdk_host":
pkgdata_dir = d.getVar('PKGDATA_DIR_SDK')
else:
pkgdata_dir = d.getVar('PKGDATA_DIR')
for output_type, output_file in process_list:
output_file_full = os.path.join(d.getVar('WORKDIR'), output_file)
with open(output_file_full, 'w') as output:
output.write(format_pkg_list(pkgs, output_type, d.getVar('PKGDATA_DIR')))
output.write(format_pkg_list(pkgs, output_type, pkgdata_dir))
python buildhistory_list_installed_image() {
buildhistory_list_installed(d)
@ -496,13 +501,19 @@ buildhistory_get_installed() {
echo "}" >> $1/depends.dot
rm $1/depends.tmp
# Set correct pkgdatadir
pkgdatadir=${PKGDATA_DIR}
if [ "$2" == "sdk" ] && [ "$3" == "host" ]; then
pkgdatadir="${PKGDATA_DIR_SDK}"
fi
# Produce installed package sizes list
oe-pkgdata-util -p ${PKGDATA_DIR} read-value "PKGSIZE" -n -f $pkgcache > $1/installed-package-sizes.tmp
oe-pkgdata-util -p $pkgdatadir read-value "PKGSIZE" -n -f $pkgcache > $1/installed-package-sizes.tmp
cat $1/installed-package-sizes.tmp | awk '{print $2 "\tKiB\t" $1}' | sort -n -r > $1/installed-package-sizes.txt
rm $1/installed-package-sizes.tmp
# Produce package info: runtime_name, buildtime_name, recipe, version, size
oe-pkgdata-util -p ${PKGDATA_DIR} read-value "PACKAGE,PN,PV,PKGSIZE" -n -f $pkgcache > $1/installed-package-info.tmp
oe-pkgdata-util -p $pkgdatadir read-value "PACKAGE,PN,PV,PKGSIZE" -n -f $pkgcache > $1/installed-package-info.tmp
cat $1/installed-package-info.tmp | sort -n -r -k 5 > $1/installed-package-info.txt
rm $1/installed-package-info.tmp
@ -542,7 +553,7 @@ buildhistory_get_sdk_installed() {
return
fi
buildhistory_get_installed ${BUILDHISTORY_DIR_SDK}/$1 sdk
buildhistory_get_installed ${BUILDHISTORY_DIR_SDK}/$1 sdk $1
}
buildhistory_get_sdk_installed_host() {
@ -773,7 +784,7 @@ def buildhistory_get_imagevars(d):
def buildhistory_get_sdkvars(d):
if d.getVar('BB_WORKERCONTEXT') != '1':
return ""
sdkvars = "DISTRO DISTRO_VERSION SDK_NAME SDK_VERSION SDKMACHINE SDKIMAGE_FEATURES BAD_RECOMMENDATIONS NO_RECOMMENDATIONS PACKAGE_EXCLUDE"
sdkvars = "DISTRO DISTRO_VERSION SDK_NAME SDK_VERSION SDKMACHINE SDKIMAGE_FEATURES TOOLCHAIN_HOST_TASK TOOLCHAIN_TARGET_TASK BAD_RECOMMENDATIONS NO_RECOMMENDATIONS PACKAGE_EXCLUDE"
if d.getVar('BB_CURRENTTASK') == 'populate_sdk_ext':
# Extensible SDK uses some additional variables
sdkvars += " SDK_LOCAL_CONF_WHITELIST SDK_LOCAL_CONF_BLACKLIST SDK_INHERIT_BLACKLIST SDK_UPDATE_URL SDK_EXT_TYPE SDK_RECRDEP_TASKS SDK_INCLUDE_PKGDATA SDK_INCLUDE_TOOLCHAIN"

View File

@ -169,7 +169,7 @@ USE_NLS = "${SDKUSE_NLS}"
# and not any particular tune that is enabled.
TARGET_ARCH[vardepsexclude] = "TUNE_ARCH"
PKGDATA_DIR = "${TMPDIR}/pkgdata/${SDK_SYS}"
PKGDATA_DIR = "${PKGDATA_DIR_SDK}"
# If MLPREFIX is set by multilib code, shlibs
# points to the wrong place so force it
SHLIBSDIRS = "${PKGDATA_DIR}/nativesdk-shlibs2"

View File

@ -31,7 +31,7 @@ PACKAGE_ARCHS = "${SDK_PACKAGE_ARCHS}"
DEPENDS:append = " chrpath-replacement-native"
EXTRANATIVEPATH += "chrpath-native"
PKGDATA_DIR = "${TMPDIR}/pkgdata/${SDK_SYS}"
PKGDATA_DIR = "${PKGDATA_DIR_SDK}"
HOST_ARCH = "${SDK_ARCH}"
HOST_VENDOR = "${SDK_VENDOR}"

View File

@ -415,6 +415,7 @@ DEPLOY_DIR_IMAGE ?= "${DEPLOY_DIR}/images/${MACHINE}"
DEPLOY_DIR_TOOLS = "${DEPLOY_DIR}/tools"
PKGDATA_DIR = "${TMPDIR}/pkgdata/${MACHINE}"
PKGDATA_DIR_SDK = "${TMPDIR}/pkgdata/${SDK_SYS}"
##################################################################
# SDK variables.

View File

@ -321,7 +321,7 @@ class PackageManager(object, metaclass=ABCMeta):
# TODO don't have sdk here but have a property on the superclass
# (and respect in install_complementary)
if sdk:
pkgdatadir = self.d.expand("${TMPDIR}/pkgdata/${SDK_SYS}")
pkgdatadir = self.d.getVar("PKGDATA_DIR_SDK")
else:
pkgdatadir = self.d.getVar("PKGDATA_DIR")