[OE-core] [PATCH V2 1/2] oe-pkgdata-util: Refactor functions for consistency
Paul Eggleton
paul.eggleton at linux.intel.com
Mon Jan 22 20:12:12 UTC 2018
Hi Amanda,
On Friday, 19 January 2018 12:18:27 PM NZDT Amanda Brindle wrote:
> Refactor functions lookup_recipe and package_info to be consistent with
> list_pkg_files. Print the appropriate information as soon as it's found,
> rather than storing it in a mappings variable and wait to print after
> searching all packages.
>
> Signed-off-by: Amanda Brindle <amanda.r.brindle at intel.com>
> ---
> scripts/oe-pkgdata-util | 107 ++++++++++++++++++++++--------------------------
> 1 file changed, 48 insertions(+), 59 deletions(-)
>
> diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util
> index c6fba56..e4ccf30 100755
> --- a/scripts/oe-pkgdata-util
> +++ b/scripts/oe-pkgdata-util
> @@ -257,25 +257,22 @@ def lookup_recipe(args):
> for pkgitem in args.pkg:
> pkgs.extend(pkgitem.split())
>
> - mappings = defaultdict(list)
> for pkg in pkgs:
> - pkgfile = os.path.join(args.pkgdata_dir, 'runtime-reverse', pkg)
> - if os.path.exists(pkgfile):
> - with open(pkgfile, 'r') as f:
> + pkgdatafile = os.path.join(args.pkgdata_dir, 'runtime-reverse', pkg)
> + if os.path.exists(pkgdatafile):
> + with open(pkgdatafile, 'r') as f:
> + found = False
> for line in f:
> - fields = line.rstrip().split(': ')
> - if fields[0] == 'PN':
> - mappings[pkg].append(fields[1])
> + if line.startswith('PN'):
> + print("\t%s" % line.split(':', 1)[1].strip())
> + found = True
I don't think we want to do this. What if we started writing out some PN<something>
variable to the file? This will erroneously match it. We should split by : as the
previous code did and compare the actual field name, or at minimum add ':' to the
end of each check string. The same goes for the similar changes later on in the
patch.
Cheers,
Paul
--
Paul Eggleton
Intel Open Source Technology Centre
More information about the Openembedded-core
mailing list