summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--meta/lib/oeqa/selftest/pkgdata.py2
-rwxr-xr-xscripts/oe-pkgdata-util16
2 files changed, 10 insertions, 8 deletions
diff --git a/meta/lib/oeqa/selftest/pkgdata.py b/meta/lib/oeqa/selftest/pkgdata.py
index 5a63f89ff2..adfe346879 100644
--- a/meta/lib/oeqa/selftest/pkgdata.py
+++ b/meta/lib/oeqa/selftest/pkgdata.py
@@ -41,6 +41,8 @@ class OePkgdataUtilTests(oeSelfTest):
def test_read_value(self):
result = runCmd('oe-pkgdata-util read-value PN libz1')
self.assertEqual(result.output, 'zlib')
+ result = runCmd('oe-pkgdata-util read-value PKG libz1')
+ self.assertEqual(result.output, 'libz1')
result = runCmd('oe-pkgdata-util read-value PKGSIZE bash')
pkgsize = int(result.output.strip())
self.assertGreater(pkgsize, 1, "Size should be greater than 1. %s" % result.output)
diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util
index dbffd6a36b..fe41f41fa3 100755
--- a/scripts/oe-pkgdata-util
+++ b/scripts/oe-pkgdata-util
@@ -174,15 +174,16 @@ def read_value(args):
logger.error("No packages specified")
sys.exit(1)
- def readvar(pkgdata_file, valuename):
+ def readvar(pkgdata_file, valuename, mappedpkg):
val = ""
with open(pkgdata_file, 'r') as f:
for line in f:
- if line.startswith(valuename + ":"):
+ if (line.startswith(valuename + ":") or
+ line.startswith(valuename + "_" + mappedpkg + ":")):
val = line.split(': ', 1)[1].rstrip()
return val
- logger.debug("read-value('%s', '%s' '%s'" % (args.pkgdata_dir, args.valuename, packages))
+ logger.debug("read-value('%s', '%s' '%s')" % (args.pkgdata_dir, args.valuename, packages))
for package in packages:
pkg_split = package.split('_')
pkg_name = pkg_split[0]
@@ -192,18 +193,17 @@ def read_value(args):
if os.path.exists(revlink):
mappedpkg = os.path.basename(os.readlink(revlink))
qvar = args.valuename
+ value = readvar(revlink, qvar, mappedpkg)
if qvar == "PKGSIZE":
- # append packagename
- qvar = "%s_%s" % (args.valuename, mappedpkg)
# PKGSIZE is now in bytes, but we we want it in KB
- pkgsize = (int(readvar(revlink, qvar)) + 1024 // 2) // 1024
+ pkgsize = (int(value) + 1024 // 2) // 1024
value = "%d" % pkgsize
- else:
- value = readvar(revlink, qvar)
if args.prefix_name:
print('%s %s' % (pkg_name, value))
else:
print(value)
+ else:
+ logger.debug("revlink %s does not exist", revlink)
def lookup_pkglist(pkgs, pkgdata_dir, reverse):
if reverse: