classes/buildhistory: record size of installed package not compressed archive
* usually it's more important to know how much space will each package take on target device then size of compressed package * example for libewebkit0 with 4 different architectures, interesting that om_gta02 .ipk is bigger but it's smaller when installed before: MACHINE DEFAULTTUNE SIZE (.ipk file) om_gta04 cortexa8t-neon 15996 KiB libewebkit0 qemux86_64 x86-64 16992 KiB libewebkit0 spitz xscale 16148 KiB libewebkit0 om_gta02 arm920t 16260 KiB libewebkit0 after: MACHINE DEFAULTTUNE SIZE (installed) om_gta04 cortexa8t-neon 60544 KiB libewebkit0 qemux86_64 x86-64 63720 KiB libewebkit0 spitz xscale 60588 KiB libewebkit0 om_gta02 arm920t 56268 KiB libewebkit0 (From OE-Core rev: 85e4a77138381a6086d5ebd3a28cb5a94bc26a19) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
23575b4fdb
commit
855b3252d9
|
@ -337,12 +337,14 @@ buildhistory_get_installed() {
|
||||||
|
|
||||||
# Produce installed package sizes list
|
# Produce installed package sizes list
|
||||||
printf "" > $1/installed-package-sizes.tmp
|
printf "" > $1/installed-package-sizes.tmp
|
||||||
cat $pkgcache | while read pkg pkgfile
|
cat $pkgcache | while read pkg pkgfile pkgarch
|
||||||
do
|
do
|
||||||
if [ -f $pkgfile ] ; then
|
for vendor in ${TARGET_VENDOR} ${MULTILIB_VENDORS} ; do
|
||||||
pkgsize=`du -k $pkgfile | head -n1 | awk '{ print $1 }'`
|
size=`oe-pkgdata-util read-value ${TMPDIR}/pkgdata $vendor-${TARGET_OS} "PKGSIZE" ${pkg}_${pkgarch}`
|
||||||
echo $pkgsize $pkg >> $1/installed-package-sizes.tmp
|
if [ "$size" != "" ] ; then
|
||||||
fi
|
echo "$size $pkg" >> $1/installed-package-sizes.tmp
|
||||||
|
fi
|
||||||
|
done
|
||||||
done
|
done
|
||||||
cat $1/installed-package-sizes.tmp | sort -n -r | awk '{print $1 "\tKiB " $2}' > $1/installed-package-sizes.txt
|
cat $1/installed-package-sizes.tmp | sort -n -r | awk '{print $1 "\tKiB " $2}' > $1/installed-package-sizes.txt
|
||||||
rm $1/installed-package-sizes.tmp
|
rm $1/installed-package-sizes.tmp
|
||||||
|
|
|
@ -127,6 +127,8 @@ translate_smart_to_oe() {
|
||||||
#echo "$pkg -> $new_pkg" >&2
|
#echo "$pkg -> $new_pkg" >&2
|
||||||
if [ "$arg1" = "arch" ]; then
|
if [ "$arg1" = "arch" ]; then
|
||||||
echo $new_pkg $new_arch $other
|
echo $new_pkg $new_arch $other
|
||||||
|
elif [ "$arg1" = "file" ]; then
|
||||||
|
echo $new_pkg $other $new_arch
|
||||||
else
|
else
|
||||||
echo $new_pkg $other
|
echo $new_pkg $other
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -75,13 +75,13 @@ list_installed_packages() {
|
||||||
# Here we want the PACKAGE_ARCH not the deb architecture
|
# Here we want the PACKAGE_ARCH not the deb architecture
|
||||||
${DPKG_QUERY_COMMAND} -W -f='${Package} ${PackageArch}\n'
|
${DPKG_QUERY_COMMAND} -W -f='${Package} ${PackageArch}\n'
|
||||||
elif [ "$1" = "file" ] ; then
|
elif [ "$1" = "file" ] ; then
|
||||||
${DPKG_QUERY_COMMAND} -W -f='${Package} ${Package}_${Version}_${Architecture}.deb\n' | while read pkg pkgfile
|
${DPKG_QUERY_COMMAND} -W -f='${Package} ${Package}_${Version}_${Architecture}.deb ${PackageArch}\n' | while read pkg pkgfile pkgarch
|
||||||
do
|
do
|
||||||
fullpath=`find ${DEPLOY_DIR_DEB} -name "$pkgfile" || true`
|
fullpath=`find ${DEPLOY_DIR_DEB} -name "$pkgfile" || true`
|
||||||
if [ "$fullpath" = "" ] ; then
|
if [ "$fullpath" = "" ] ; then
|
||||||
echo "$pkg $pkgfile"
|
echo "$pkg $pkgfile $pkgarch"
|
||||||
else
|
else
|
||||||
echo "$pkg $fullpath"
|
echo "$pkg $fullpath $pkgarch"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
|
|
|
@ -61,13 +61,13 @@ list_installed_packages() {
|
||||||
if [ "$1" = "arch" ] ; then
|
if [ "$1" = "arch" ] ; then
|
||||||
opkg-cl ${OPKG_ARGS} status | opkg-query-helper.py -a
|
opkg-cl ${OPKG_ARGS} status | opkg-query-helper.py -a
|
||||||
elif [ "$1" = "file" ] ; then
|
elif [ "$1" = "file" ] ; then
|
||||||
opkg-cl ${OPKG_ARGS} status | opkg-query-helper.py -f | while read pkg pkgfile
|
opkg-cl ${OPKG_ARGS} status | opkg-query-helper.py -f | while read pkg pkgfile pkgarch
|
||||||
do
|
do
|
||||||
fullpath=`find ${DEPLOY_DIR_IPK} -name "$pkgfile" || true`
|
fullpath=`find ${DEPLOY_DIR_IPK} -name "$pkgfile" || true`
|
||||||
if [ "$fullpath" = "" ] ; then
|
if [ "$fullpath" = "" ] ; then
|
||||||
echo "$pkg $pkgfile"
|
echo "$pkg $pkgfile $pkgarch"
|
||||||
else
|
else
|
||||||
echo "$pkg $fullpath"
|
echo "$pkg $fullpath $pkgarch"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
|
|
|
@ -161,7 +161,7 @@ list_installed_packages() {
|
||||||
if [ "$1" = "arch" ]; then
|
if [ "$1" = "arch" ]; then
|
||||||
${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{ARCH}\n]" | translate_smart_to_oe arch
|
${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{ARCH}\n]" | translate_smart_to_oe arch
|
||||||
elif [ "$1" = "file" ]; then
|
elif [ "$1" = "file" ]; then
|
||||||
${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{ARCH} %{PACKAGEORIGIN}\n]" | translate_smart_to_oe
|
${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{ARCH} %{PACKAGEORIGIN}\n]" | translate_smart_to_oe file
|
||||||
else
|
else
|
||||||
${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{ARCH}\n]" | translate_smart_to_oe
|
${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{ARCH}\n]" | translate_smart_to_oe
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -20,9 +20,12 @@
|
||||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Currently only has one function - mapping of packages to their dev/dbg/doc/locale etc.
|
# Currently only has two functions:
|
||||||
# counterparts ("glob" command). Could be extended in future to perform other useful querying
|
# 1) glob - mapping of packages to their dev/dbg/doc/locale etc. counterparts.
|
||||||
# functions on the pkgdata though.
|
# 2) read-value - mapping of packagenames to their location in
|
||||||
|
# pkgdata and then returns value of selected variable (e.g. PKGSIZE)
|
||||||
|
# Could be extended in future to perform other useful querying functions on the
|
||||||
|
# pkgdata though.
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
@ -32,7 +35,8 @@ import fnmatch
|
||||||
import re
|
import re
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print("syntax: pkgdata-util glob [-d] <pkgdatadir> <vendor-os> <pkglist> \"<globs>\"");
|
print("syntax: oe-pkgdata-util glob [-d] <pkgdatadir> <vendor-os> <pkglist> \"<globs>\"\n \
|
||||||
|
read-value [-d] <pkgdatadir> <vendor-os> <value-name> \"<package-name>_<package_architecture>\"");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -151,7 +155,52 @@ def glob(args):
|
||||||
|
|
||||||
print("\n".join(mappedpkgs))
|
print("\n".join(mappedpkgs))
|
||||||
|
|
||||||
|
def read_value(args):
|
||||||
|
if len(args) < 4:
|
||||||
|
usage()
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
pkgdata_dir = args[0]
|
||||||
|
target_suffix = args[1]
|
||||||
|
var = args[2]
|
||||||
|
packages = args[3].split()
|
||||||
|
|
||||||
|
if target_suffix.startswith("-"):
|
||||||
|
target_suffix = target_suffix[1:]
|
||||||
|
|
||||||
|
def readvar(pkgdata_file, var):
|
||||||
|
val = ""
|
||||||
|
with open(pkgdata_file, 'r') as f:
|
||||||
|
for line in f:
|
||||||
|
if line.startswith(var + ":"):
|
||||||
|
val = line.split(': ')[1].rstrip()
|
||||||
|
return val
|
||||||
|
|
||||||
|
if debug:
|
||||||
|
print "read-value('%s', '%s', '%s' '%s'" % (pkgdata_dir, target_suffix, var, packages)
|
||||||
|
for package in packages:
|
||||||
|
pkg_split = package.split('_')
|
||||||
|
pkg_name = pkg_split[0]
|
||||||
|
pkg_arch = '_'.join(pkg_split[1:])
|
||||||
|
if debug:
|
||||||
|
print "package: name: '%s', arch: '%s'" % (pkg_name, pkg_arch)
|
||||||
|
multimach_target_sys = "%s-%s" % (pkg_arch, target_suffix)
|
||||||
|
revlink = os.path.join(pkgdata_dir, multimach_target_sys, "runtime-reverse", pkg_name)
|
||||||
|
if debug:
|
||||||
|
print(revlink)
|
||||||
|
if not os.path.exists(revlink):
|
||||||
|
# [YOCTO #4227] try to drop -gnueabi from TARGET_OS
|
||||||
|
multimach_target_sys = '-'.join(multimach_target_sys.split('-')[:-1])
|
||||||
|
revlink = os.path.join(pkgdata_dir, multimach_target_sys, "runtime-reverse", pkg_name)
|
||||||
|
if debug:
|
||||||
|
print(revlink)
|
||||||
|
if os.path.exists(revlink):
|
||||||
|
mappedpkg = os.path.basename(os.readlink(revlink))
|
||||||
|
qvar = var
|
||||||
|
if qvar == "PKGSIZE":
|
||||||
|
# append packagename
|
||||||
|
qvar = "%s_%s" % (var, mappedpkg)
|
||||||
|
print(readvar(revlink, qvar))
|
||||||
|
|
||||||
# Too lazy to use getopt
|
# Too lazy to use getopt
|
||||||
debug = False
|
debug = False
|
||||||
|
@ -173,6 +222,8 @@ if len(args) < 1:
|
||||||
|
|
||||||
if args[0] == "glob":
|
if args[0] == "glob":
|
||||||
glob(args[1:])
|
glob(args[1:])
|
||||||
|
elif args[0] == "read-value":
|
||||||
|
read_value(args[1:])
|
||||||
else:
|
else:
|
||||||
usage()
|
usage()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
|
@ -59,7 +59,7 @@ for line in fileinput.input(args):
|
||||||
ver = line.split(": ")[1]
|
ver = line.split(": ")[1]
|
||||||
elif line.startswith("Architecture:"):
|
elif line.startswith("Architecture:"):
|
||||||
arch = line.split(": ")[1]
|
arch = line.split(": ")[1]
|
||||||
print("%s %s_%s_%s.ipk" % (pkg,pkg,ver,arch))
|
print("%s %s_%s_%s.ipk %s" % (pkg,pkg,ver,arch,arch))
|
||||||
else:
|
else:
|
||||||
if line.startswith("Depends:"):
|
if line.startswith("Depends:"):
|
||||||
depval = line.split(": ")[1]
|
depval = line.split(": ")[1]
|
||||||
|
|
Loading…
Reference in New Issue