All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Patches and discussions about the oe-core layer
	<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH V3 2/3] image/core-image: Handle conflicting IMAGE_FEATURES.
Date: Mon, 02 Jul 2012 09:55:41 +0100	[thread overview]
Message-ID: <1341219341.23146.183.camel@ted> (raw)
In-Reply-To: <13ed4eabf4dfcb28267d045fc30e402a3484e95d.1340600710.git.lianhao.lu@intel.com>

On Mon, 2012-06-25 at 13:15 +0800, Lianhao Lu wrote:
> IMAGE_FEATURES such as 'ssh-server-dropbear' and 'ssh-server-openssh'
> can't be both enabled. User can use the following variables to define
> the relationship of image features:
> 
> IMAGE_FEATURES_REPLACES_foo = "bar" means including image feature "foo"
> would replace the image feature "bar".
> 
> IMAGE_FEATURES_CONFLICTS_foo = "bar" means including both image features
> "foo" and "bar" would cause an parsing error.
> 
> Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
> ---
>  meta/classes/core-image.bbclass                 |   11 ++++++++++-
>  meta/classes/image.bbclass                      |   17 +++++++++++++++++
>  meta/recipes-sato/images/core-image-sato-sdk.bb |    2 ++
>  3 files changed, 29 insertions(+), 1 deletions(-)
> 
> diff --git a/meta/classes/core-image.bbclass b/meta/classes/core-image.bbclass
> index 25f5c5a..6b207d7 100644
> --- a/meta/classes/core-image.bbclass
> +++ b/meta/classes/core-image.bbclass
> @@ -47,6 +47,14 @@ PACKAGE_GROUP_ssh-server-openssh = "task-core-ssh-openssh"
>  PACKAGE_GROUP_package-management = "${ROOTFS_PKGMANAGE}"
>  PACKAGE_GROUP_qt4-pkgs = "task-core-qt-demos"
>  
> +
> +# IMAGE_FEAETURES_REPLACES_foo = 'bar1 bar2'
> +# Including image feature foo would replace the image features bar1 and bar2
> +IMAGE_FEATURES_REPLACES_ssh-server-openssh = "ssh-server-dropbear"
> +
> +# IMAGE_FEATURES_CONFLICTS_foo = 'bar1 bar2'
> +# An error exception would be raised if both image features foo and bar1(or bar2) are included
> +
>  CORE_IMAGE_BASE_INSTALL = '\
>      task-core-boot \
>      task-base-extended \
> @@ -60,7 +68,8 @@ IMAGE_INSTALL ?= "${CORE_IMAGE_BASE_INSTALL}"
>  
>  X11_IMAGE_FEATURES  = "x11-base apps-x11-core package-management"
>  ENHANCED_IMAGE_FEATURES = "${X11_IMAGE_FEATURES} apps-x11-games apps-x11-pimlico package-management"
> -SATO_IMAGE_FEATURES = "${ENHANCED_IMAGE_FEATURES} x11-sato ssh-server-dropbear"
> +SSHSERVER_IMAGE_FEATURES ??= "ssh-server-dropbear"
> +SATO_IMAGE_FEATURES = "${ENHANCED_IMAGE_FEATURES} x11-sato ${SSHSERVER_IMAGE_FEATURES}"
>  
>  inherit image
>  
> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> index 0772363..6fac974 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -87,6 +87,23 @@ python () {
>          deps += " %s:do_populate_sysroot" % dep
>      d.setVarFlag('do_rootfs', 'depends', deps)
>  
> +    #process IMAGE_FEATURES, we must do this before runtime_mapping_rename
> +    #Check for replaces image features
> +    features = set(oe.data.typed_value('IMAGE_FEATURES', d))
> +    remain_features = features.copy()
> +    for feature in features:
> +        replaces = set((d.getVar("IMAGE_FEATURES_REPLACES_%s" % feature, True) or "").split())
> +        remain_features -= replaces
> +
> +    #Check for conflict image features
> +    for feature in remain_features:
> +        conflicts = set((d.getVar("IMAGE_FEATURES_CONFLICTS_%s" % feature, True) or "").split())
> +        temp = conflicts & remain_features
> +        if temp:
> +            raise bb.parse.SkipPackage("%s contains conflicting IMAGE_FEATURES %s %s" % (d.getVar('PN', True), feature, ' '.join(list(temp))))


I'm not sure that SkipPackage is the right error here. This will simply
make the image target "disappear" when in this case we really want to
raise a "proper" error?


Cheers,

Richard




  reply	other threads:[~2012-07-02  9:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-25  5:15 [PATCH V3 0/3] misc IMAGE_FEATURE fixings Lianhao Lu
2012-06-25  5:15 ` [PATCH V3 1/3] classes/image: Allow openssh empty passwords login Lianhao Lu
2012-06-25  5:15 ` [PATCH V3 2/3] image/core-image: Handle conflicting IMAGE_FEATURES Lianhao Lu
2012-07-02  8:55   ` Richard Purdie [this message]
2012-07-02 11:10     ` Lu, Lianhao
2012-07-02 13:45       ` Richard Purdie
2012-06-25  5:15 ` [PATCH V3 3/3] task-core-tools-debug: Added openssh-sftp-server Lianhao Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1341219341.23146.183.camel@ted \
    --to=richard.purdie@linuxfoundation.org \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.