diff options
author | Martin Jansa <martin.jansa@gmail.com> | 2013-08-15 18:04:35 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-08-16 11:44:16 +0100 |
commit | 855b3252d968e7bb93b4b318b7a26336dd8ea375 (patch) | |
tree | 96844e624521099806b340e18d79628b0c70eaad /scripts/oe-pkgdata-util | |
parent | 23575b4fdbeafcbd688d169775e6ca9aa51515b7 (diff) | |
download | poky-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>
Diffstat (limited to 'scripts/oe-pkgdata-util')
-rwxr-xr-x | scripts/oe-pkgdata-util | 59 |
1 files changed, 55 insertions, 4 deletions
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 | ||
28 | import sys | 31 | import sys |
@@ -32,7 +35,8 @@ import fnmatch | |||
32 | import re | 35 | import re |
33 | 36 | ||
34 | def usage(): | 37 | def 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 | ||
158 | def 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 |
157 | debug = False | 206 | debug = False |
@@ -173,6 +222,8 @@ if len(args) < 1: | |||
173 | 222 | ||
174 | if args[0] == "glob": | 223 | if args[0] == "glob": |
175 | glob(args[1:]) | 224 | glob(args[1:]) |
225 | elif args[0] == "read-value": | ||
226 | read_value(args[1:]) | ||
176 | else: | 227 | else: |
177 | usage() | 228 | usage() |
178 | sys.exit(1) | 229 | sys.exit(1) |