poky/scripts/opkg-query-helper.py
Martin Jansa 855b3252d9 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>
2013-08-16 11:44:16 +01:00

77 lines
2.4 KiB
Python
Executable File

#!/usr/bin/env python
# OpenEmbedded opkg query helper utility
#
# Written by: Paul Eggleton <paul.eggleton@linux.intel.com>
#
# Copyright 2012 Intel Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
#
import sys
import fileinput
import re
archmode = False
filemode = False
args = []
for arg in sys.argv[1:]:
if arg == '-a':
archmode = True
elif arg == '-f':
filemode = True
else:
args.append(arg)
# Regex for removing version specs after dependency items
verregex = re.compile(' \([=<>]* [^ )]*\)')
pkg = ""
ver = ""
for line in fileinput.input(args):
line = line.rstrip()
if ': ' in line:
if line.startswith("Package:"):
pkg = line.split(": ")[1]
ver = ""
else:
if archmode:
if line.startswith("Architecture:"):
arch = line.split(": ")[1]
print("%s %s" % (pkg,arch))
elif filemode:
if line.startswith("Version:"):
ver = line.split(": ")[1]
elif line.startswith("Architecture:"):
arch = line.split(": ")[1]
print("%s %s_%s_%s.ipk %s" % (pkg,pkg,ver,arch,arch))
else:
if line.startswith("Depends:"):
depval = line.split(": ")[1]
deps = depval.split(", ")
for dep in deps:
dep = verregex.sub('', dep)
print("%s|%s" % (pkg,dep))
elif line.startswith("Recommends:"):
recval = line.split(": ")[1]
recs = recval.split(", ")
for rec in recs:
rec = verregex.sub('', rec)
print("%s|%s [REC]" % (pkg, rec))