[OE-core] [RFC][PATCH 1/2] packagedata: show error when there are multiple pkgdata directories

Martin Jansa martin.jansa at gmail.com
Thu Apr 4 15:39:30 UTC 2013


On Wed, Apr 03, 2013 at 12:14:33PM +0200, Martin Jansa wrote:
> * when PACKAGE_ARCH is changed e.g. from MACHINE_ARCH to TUNE_PKGARCH
>   get_subpkgedata_fn is still reading old MACHINE_ARCH directory instead of newer with TUNE_PKGARCH

This is too strict in some cases, e.g.:

ERROR: More then one pkgdata dir found for pkg 'opkg-collateral'
(
'/OE/shr-core/tmp-eglibc/pkgdata/cortexa8-vfp-neon-oe-linux-gnueabi/runtime/opkg-collateral',
'/OE/shr-core/tmp-eglibc/pkgdata/armv5te-oe-linux-gnueabi/runtime/opkg-collateral'),
returning first

Why do we need to look in all pkgdatadirs? Why not just PACKAGE_ARCH?

> ---
>  meta/lib/oe/packagedata.py | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/lib/oe/packagedata.py b/meta/lib/oe/packagedata.py
> index 62fd718..2533700 100644
> --- a/meta/lib/oe/packagedata.py
> +++ b/meta/lib/oe/packagedata.py
> @@ -34,11 +34,18 @@ def get_subpkgedata_fn(pkg, d):
>      dirs = all_pkgdatadirs(d)
>  
>      pkgdata = d.expand('${TMPDIR}/pkgdata/')
> +    found = None
>      for dir in dirs:
>          fn = pkgdata + dir + pkg
>          if os.path.exists(fn):
> -            return fn
> -    return d.expand('${PKGDATA_DIR}/runtime/%s' % pkg)
> +	    if found:
> +                bb.error("More then one pkgdata dir found for pkg '%s' ('%s', '%s'), returning first" % (pkg, found, fn))
> +                continue
> +            found = fn
> +    if found:
> +        return found
> +    else:
> +        return d.expand('${PKGDATA_DIR}/runtime/%s' % pkg)
>  
>  def has_subpkgdata(pkg, d):
>      return os.access(get_subpkgedata_fn(pkg, d), os.R_OK)
> @@ -68,6 +75,7 @@ def read_subpkgdata_dict(pkg, d):
>      return ret
>  
>  def _pkgmap(d):
> +    import bb
>      """Return a dictionary mapping package to recipe name."""
>  
>      target_os = d.getVar("TARGET_OS", True)
> @@ -85,6 +93,7 @@ def _pkgmap(d):
>              continue
>  
>          for pn in filter(lambda f: not os.path.isdir(os.path.join(pkgdatadir, f)), files):
> +            bb.warn("Trying path '%s'" % os.path.join(pkgdatadir, pn))
>              try:
>                  pkgdata = read_pkgdatafile(os.path.join(pkgdatadir, pn))
>              except OSError:
> -- 
> 1.8.1.5
> 

-- 
Martin 'JaMa' Jansa     jabber: Martin.Jansa at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20130404/bdc7d242/attachment-0002.sig>


More information about the Openembedded-core mailing list