summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jansa <martin.jansa@gmail.com>2013-08-15 18:04:35 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-08-16 11:44:16 +0100
commit855b3252d968e7bb93b4b318b7a26336dd8ea375 (patch)
tree96844e624521099806b340e18d79628b0c70eaad
parent23575b4fdbeafcbd688d169775e6ca9aa51515b7 (diff)
downloadpoky-855b3252d968e7bb93b4b318b7a26336dd8ea375.tar.gz
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>
-rw-r--r--meta/classes/buildhistory.bbclass12
-rw-r--r--meta/classes/package_rpm.bbclass2
-rw-r--r--meta/classes/populate_sdk_deb.bbclass6
-rw-r--r--meta/classes/populate_sdk_ipk.bbclass6
-rw-r--r--meta/classes/populate_sdk_rpm.bbclass2
-rwxr-xr-xscripts/oe-pkgdata-util59
-rwxr-xr-xscripts/opkg-query-helper.py2
7 files changed, 72 insertions, 17 deletions
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index 1c49831978..b2e5cc50e8 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -337,12 +337,14 @@ buildhistory_get_installed() {
337 337
338 # Produce installed package sizes list 338 # Produce installed package sizes list
339 printf "" > $1/installed-package-sizes.tmp 339 printf "" > $1/installed-package-sizes.tmp
340 cat $pkgcache | while read pkg pkgfile 340 cat $pkgcache | while read pkg pkgfile pkgarch
341 do 341 do
342 if [ -f $pkgfile ] ; then 342 for vendor in ${TARGET_VENDOR} ${MULTILIB_VENDORS} ; do
343 pkgsize=`du -k $pkgfile | head -n1 | awk '{ print $1 }'` 343 size=`oe-pkgdata-util read-value ${TMPDIR}/pkgdata $vendor-${TARGET_OS} "PKGSIZE" ${pkg}_${pkgarch}`
344 echo $pkgsize $pkg >> $1/installed-package-sizes.tmp 344 if [ "$size" != "" ] ; then
345 fi 345 echo "$size $pkg" >> $1/installed-package-sizes.tmp
346 fi
347 done
346 done 348 done
347 cat $1/installed-package-sizes.tmp | sort -n -r | awk '{print $1 "\tKiB " $2}' > $1/installed-package-sizes.txt 349 cat $1/installed-package-sizes.tmp | sort -n -r | awk '{print $1 "\tKiB " $2}' > $1/installed-package-sizes.txt
348 rm $1/installed-package-sizes.tmp 350 rm $1/installed-package-sizes.tmp
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index 324d83f751..53377a4e7f 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -127,6 +127,8 @@ translate_smart_to_oe() {
127 #echo "$pkg -> $new_pkg" >&2 127 #echo "$pkg -> $new_pkg" >&2
128 if [ "$arg1" = "arch" ]; then 128 if [ "$arg1" = "arch" ]; then
129 echo $new_pkg $new_arch $other 129 echo $new_pkg $new_arch $other
130 elif [ "$arg1" = "file" ]; then
131 echo $new_pkg $other $new_arch
130 else 132 else
131 echo $new_pkg $other 133 echo $new_pkg $other
132 fi 134 fi
diff --git a/meta/classes/populate_sdk_deb.bbclass b/meta/classes/populate_sdk_deb.bbclass
index 3e123ac561..ec116ab187 100644
--- a/meta/classes/populate_sdk_deb.bbclass
+++ b/meta/classes/populate_sdk_deb.bbclass
@@ -75,13 +75,13 @@ list_installed_packages() {
75 # Here we want the PACKAGE_ARCH not the deb architecture 75 # Here we want the PACKAGE_ARCH not the deb architecture
76 ${DPKG_QUERY_COMMAND} -W -f='${Package} ${PackageArch}\n' 76 ${DPKG_QUERY_COMMAND} -W -f='${Package} ${PackageArch}\n'
77 elif [ "$1" = "file" ] ; then 77 elif [ "$1" = "file" ] ; then
78 ${DPKG_QUERY_COMMAND} -W -f='${Package} ${Package}_${Version}_${Architecture}.deb\n' | while read pkg pkgfile 78 ${DPKG_QUERY_COMMAND} -W -f='${Package} ${Package}_${Version}_${Architecture}.deb ${PackageArch}\n' | while read pkg pkgfile pkgarch
79 do 79 do
80 fullpath=`find ${DEPLOY_DIR_DEB} -name "$pkgfile" || true` 80 fullpath=`find ${DEPLOY_DIR_DEB} -name "$pkgfile" || true`
81 if [ "$fullpath" = "" ] ; then 81 if [ "$fullpath" = "" ] ; then
82 echo "$pkg $pkgfile" 82 echo "$pkg $pkgfile $pkgarch"
83 else 83 else
84 echo "$pkg $fullpath" 84 echo "$pkg $fullpath $pkgarch"
85 fi 85 fi
86 done 86 done
87 else 87 else
diff --git a/meta/classes/populate_sdk_ipk.bbclass b/meta/classes/populate_sdk_ipk.bbclass
index 4e14d9a3a6..04c71af42e 100644
--- a/meta/classes/populate_sdk_ipk.bbclass
+++ b/meta/classes/populate_sdk_ipk.bbclass
@@ -61,13 +61,13 @@ list_installed_packages() {
61 if [ "$1" = "arch" ] ; then 61 if [ "$1" = "arch" ] ; then
62 opkg-cl ${OPKG_ARGS} status | opkg-query-helper.py -a 62 opkg-cl ${OPKG_ARGS} status | opkg-query-helper.py -a
63 elif [ "$1" = "file" ] ; then 63 elif [ "$1" = "file" ] ; then
64 opkg-cl ${OPKG_ARGS} status | opkg-query-helper.py -f | while read pkg pkgfile 64 opkg-cl ${OPKG_ARGS} status | opkg-query-helper.py -f | while read pkg pkgfile pkgarch
65 do 65 do
66 fullpath=`find ${DEPLOY_DIR_IPK} -name "$pkgfile" || true` 66 fullpath=`find ${DEPLOY_DIR_IPK} -name "$pkgfile" || true`
67 if [ "$fullpath" = "" ] ; then 67 if [ "$fullpath" = "" ] ; then
68 echo "$pkg $pkgfile" 68 echo "$pkg $pkgfile $pkgarch"
69 else 69 else
70 echo "$pkg $fullpath" 70 echo "$pkg $fullpath $pkgarch"
71 fi 71 fi
72 done 72 done
73 else 73 else
diff --git a/meta/classes/populate_sdk_rpm.bbclass b/meta/classes/populate_sdk_rpm.bbclass
index 219cd185ce..dd5f39a100 100644
--- a/meta/classes/populate_sdk_rpm.bbclass
+++ b/meta/classes/populate_sdk_rpm.bbclass
@@ -161,7 +161,7 @@ list_installed_packages() {
161 if [ "$1" = "arch" ]; then 161 if [ "$1" = "arch" ]; then
162 ${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{ARCH}\n]" | translate_smart_to_oe arch 162 ${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{ARCH}\n]" | translate_smart_to_oe arch
163 elif [ "$1" = "file" ]; then 163 elif [ "$1" = "file" ]; then
164 ${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{ARCH} %{PACKAGEORIGIN}\n]" | translate_smart_to_oe 164 ${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{ARCH} %{PACKAGEORIGIN}\n]" | translate_smart_to_oe file
165 else 165 else
166 ${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{ARCH}\n]" | translate_smart_to_oe 166 ${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{ARCH}\n]" | translate_smart_to_oe
167 fi 167 fi
diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util
index 629b2d5c84..c63f87d7e6 100755
--- a/scripts/oe-pkgdata-util
+++ b/scripts/oe-pkgdata-util
@@ -20,9 +20,12 @@
20# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21# 21#
22# 22#
23# Currently only has one function - mapping of packages to their dev/dbg/doc/locale etc. 23# Currently only has two functions:
24# counterparts ("glob" command). Could be extended in future to perform other useful querying 24# 1) glob - mapping of packages to their dev/dbg/doc/locale etc. counterparts.
25# functions on the pkgdata though. 25# 2) read-value - mapping of packagenames to their location in
26# pkgdata and then returns value of selected variable (e.g. PKGSIZE)
27# Could be extended in future to perform other useful querying functions on the
28# pkgdata though.
26# 29#
27 30
28import sys 31import sys
@@ -32,7 +35,8 @@ import fnmatch
32import re 35import re
33 36
34def usage(): 37def usage():
35 print("syntax: pkgdata-util glob [-d] <pkgdatadir> <vendor-os> <pkglist> \"<globs>\""); 38 print("syntax: oe-pkgdata-util glob [-d] <pkgdatadir> <vendor-os> <pkglist> \"<globs>\"\n \
39 read-value [-d] <pkgdatadir> <vendor-os> <value-name> \"<package-name>_<package_architecture>\"");
36 40
37 41
38 42
@@ -151,7 +155,52 @@ def glob(args):
151 155
152 print("\n".join(mappedpkgs)) 156 print("\n".join(mappedpkgs))
153 157
158def read_value(args):
159 if len(args) < 4:
160 usage()
161 sys.exit(1)
162
163 pkgdata_dir = args[0]
164 target_suffix = args[1]
165 var = args[2]
166 packages = args[3].split()
154 167
168 if target_suffix.startswith("-"):
169 target_suffix = target_suffix[1:]
170
171 def readvar(pkgdata_file, var):
172 val = ""
173 with open(pkgdata_file, 'r') as f:
174 for line in f:
175 if line.startswith(var + ":"):
176 val = line.split(': ')[1].rstrip()
177 return val
178
179 if debug:
180 print "read-value('%s', '%s', '%s' '%s'" % (pkgdata_dir, target_suffix, var, packages)
181 for package in packages:
182 pkg_split = package.split('_')
183 pkg_name = pkg_split[0]
184 pkg_arch = '_'.join(pkg_split[1:])
185 if debug:
186 print "package: name: '%s', arch: '%s'" % (pkg_name, pkg_arch)
187 multimach_target_sys = "%s-%s" % (pkg_arch, target_suffix)
188 revlink = os.path.join(pkgdata_dir, multimach_target_sys, "runtime-reverse", pkg_name)
189 if debug:
190 print(revlink)
191 if not os.path.exists(revlink):
192 # [YOCTO #4227] try to drop -gnueabi from TARGET_OS
193 multimach_target_sys = '-'.join(multimach_target_sys.split('-')[:-1])
194 revlink = os.path.join(pkgdata_dir, multimach_target_sys, "runtime-reverse", pkg_name)
195 if debug:
196 print(revlink)
197 if os.path.exists(revlink):
198 mappedpkg = os.path.basename(os.readlink(revlink))
199 qvar = var
200 if qvar == "PKGSIZE":
201 # append packagename
202 qvar = "%s_%s" % (var, mappedpkg)
203 print(readvar(revlink, qvar))
155 204
156# Too lazy to use getopt 205# Too lazy to use getopt
157debug = False 206debug = False
@@ -173,6 +222,8 @@ if len(args) < 1:
173 222
174if args[0] == "glob": 223if args[0] == "glob":
175 glob(args[1:]) 224 glob(args[1:])
225elif args[0] == "read-value":
226 read_value(args[1:])
176else: 227else:
177 usage() 228 usage()
178 sys.exit(1) 229 sys.exit(1)
diff --git a/scripts/opkg-query-helper.py b/scripts/opkg-query-helper.py
index b52284b325..fa6c44fa8b 100755
--- a/scripts/opkg-query-helper.py
+++ b/scripts/opkg-query-helper.py
@@ -59,7 +59,7 @@ for line in fileinput.input(args):
59 ver = line.split(": ")[1] 59 ver = line.split(": ")[1]
60 elif line.startswith("Architecture:"): 60 elif line.startswith("Architecture:"):
61 arch = line.split(": ")[1] 61 arch = line.split(": ")[1]
62 print("%s %s_%s_%s.ipk" % (pkg,pkg,ver,arch)) 62 print("%s %s_%s_%s.ipk %s" % (pkg,pkg,ver,arch,arch))
63 else: 63 else:
64 if line.startswith("Depends:"): 64 if line.startswith("Depends:"):
65 depval = line.split(": ")[1] 65 depval = line.split(": ")[1]