diff options
author | Ola x Nilsson <ola.x.nilsson@axis.com> | 2016-12-12 17:19:29 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-12-14 12:30:49 +0000 |
commit | d65886bb696365698111cd33fad577d5d12ce576 (patch) | |
tree | d80302a0de855b7733f65c259396b2c0c613cbab /scripts/oe-pkgdata-util | |
parent | c61b525e9190d1f6e18c3d7fc16736c075317b1d (diff) | |
download | poky-d65886bb696365698111cd33fad577d5d12ce576.tar.gz |
oe-pkgdata-util: Make read-value handle override variables
Some variables in pkgdata files have a package-name override. When
the bare variable can not be found, try with the override-variant.
PKGSIZE is one such variable, and already had special code to handle this.
Test included.
(From OE-Core rev: 6df99cda894033cba68bc6ab91e47f67e0d788a5)
Signed-off-by: Ola x Nilsson <ola.x.nilsson@axis.com>
Signed-off-by: Ross Burton <ross.burton@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 | 16 |
1 files changed, 8 insertions, 8 deletions
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): | |||
174 | logger.error("No packages specified") | 174 | logger.error("No packages specified") |
175 | sys.exit(1) | 175 | sys.exit(1) |
176 | 176 | ||
177 | def readvar(pkgdata_file, valuename): | 177 | def readvar(pkgdata_file, valuename, mappedpkg): |
178 | val = "" | 178 | val = "" |
179 | with open(pkgdata_file, 'r') as f: | 179 | with open(pkgdata_file, 'r') as f: |
180 | for line in f: | 180 | for line in f: |
181 | if line.startswith(valuename + ":"): | 181 | if (line.startswith(valuename + ":") or |
182 | line.startswith(valuename + "_" + mappedpkg + ":")): | ||
182 | val = line.split(': ', 1)[1].rstrip() | 183 | val = line.split(': ', 1)[1].rstrip() |
183 | return val | 184 | return val |
184 | 185 | ||
185 | logger.debug("read-value('%s', '%s' '%s'" % (args.pkgdata_dir, args.valuename, packages)) | 186 | logger.debug("read-value('%s', '%s' '%s')" % (args.pkgdata_dir, args.valuename, packages)) |
186 | for package in packages: | 187 | for package in packages: |
187 | pkg_split = package.split('_') | 188 | pkg_split = package.split('_') |
188 | pkg_name = pkg_split[0] | 189 | pkg_name = pkg_split[0] |
@@ -192,18 +193,17 @@ def read_value(args): | |||
192 | if os.path.exists(revlink): | 193 | if os.path.exists(revlink): |
193 | mappedpkg = os.path.basename(os.readlink(revlink)) | 194 | mappedpkg = os.path.basename(os.readlink(revlink)) |
194 | qvar = args.valuename | 195 | qvar = args.valuename |
196 | value = readvar(revlink, qvar, mappedpkg) | ||
195 | if qvar == "PKGSIZE": | 197 | if qvar == "PKGSIZE": |
196 | # append packagename | ||
197 | qvar = "%s_%s" % (args.valuename, mappedpkg) | ||
198 | # PKGSIZE is now in bytes, but we we want it in KB | 198 | # PKGSIZE is now in bytes, but we we want it in KB |
199 | pkgsize = (int(readvar(revlink, qvar)) + 1024 // 2) // 1024 | 199 | pkgsize = (int(value) + 1024 // 2) // 1024 |
200 | value = "%d" % pkgsize | 200 | value = "%d" % pkgsize |
201 | else: | ||
202 | value = readvar(revlink, qvar) | ||
203 | if args.prefix_name: | 201 | if args.prefix_name: |
204 | print('%s %s' % (pkg_name, value)) | 202 | print('%s %s' % (pkg_name, value)) |
205 | else: | 203 | else: |
206 | print(value) | 204 | print(value) |
205 | else: | ||
206 | logger.debug("revlink %s does not exist", revlink) | ||
207 | 207 | ||
208 | def lookup_pkglist(pkgs, pkgdata_dir, reverse): | 208 | def lookup_pkglist(pkgs, pkgdata_dir, reverse): |
209 | if reverse: | 209 | if reverse: |