<p>is that possible to have a virtual/ssh-server mechanism, provide either openssh or dropbear would server this dependency, quite similiar with what gentoo linux handle this, instead of override foo with bar</p>
<div class="gmail_quote">在 2012-6-27 下午11:43,&quot;Saul Wold&quot; &lt;<a href="mailto:sgw@linux.intel.com">sgw@linux.intel.com</a>&gt;写道:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
From: Lianhao Lu &lt;<a href="mailto:lianhao.lu@intel.com">lianhao.lu@intel.com</a>&gt;<br>
<br>
IMAGE_FEATURES such as &#39;ssh-server-dropbear&#39; and &#39;ssh-server-openssh&#39;<br>
can&#39;t be both enabled. User can use the following variables to define<br>
the relationship of image features:<br>
<br>
IMAGE_FEATURES_REPLACES_foo = &quot;bar&quot; means including image feature &quot;foo&quot;<br>
would replace the image feature &quot;bar&quot;.<br>
<br>
IMAGE_FEATURES_CONFLICTS_foo = &quot;bar&quot; means including both image features<br>
&quot;foo&quot; and &quot;bar&quot; would cause an parsing error.<br>
<br>
Signed-off-by: Lianhao Lu &lt;<a href="mailto:lianhao.lu@intel.com">lianhao.lu@intel.com</a>&gt;<br>
---<br>
 meta/classes/core-image.bbclass                 |   11 ++++++++++-<br>
 meta/classes/image.bbclass                      |   17 +++++++++++++++++<br>
 meta/recipes-sato/images/<a href="http://core-image-sato-sdk.bb" target="_blank">core-image-sato-sdk.bb</a> |    2 ++<br>
 3 files changed, 29 insertions(+), 1 deletions(-)<br>
<br>
diff --git a/meta/classes/core-image.bbclass b/meta/classes/core-image.bbclass<br>
index 25f5c5a..6b207d7 100644<br>
--- a/meta/classes/core-image.bbclass<br>
+++ b/meta/classes/core-image.bbclass<br>
@@ -47,6 +47,14 @@ PACKAGE_GROUP_ssh-server-openssh = &quot;task-core-ssh-openssh&quot;<br>
 PACKAGE_GROUP_package-management = &quot;${ROOTFS_PKGMANAGE}&quot;<br>
 PACKAGE_GROUP_qt4-pkgs = &quot;task-core-qt-demos&quot;<br>
<br>
+<br>
+# IMAGE_FEAETURES_REPLACES_foo = &#39;bar1 bar2&#39;<br>
+# Including image feature foo would replace the image features bar1 and bar2<br>
+IMAGE_FEATURES_REPLACES_ssh-server-openssh = &quot;ssh-server-dropbear&quot;<br>
+<br>
+# IMAGE_FEATURES_CONFLICTS_foo = &#39;bar1 bar2&#39;<br>
+# An error exception would be raised if both image features foo and bar1(or bar2) are included<br>
+<br>
 CORE_IMAGE_BASE_INSTALL = &#39;\<br>
     task-core-boot \<br>
     task-base-extended \<br>
@@ -60,7 +68,8 @@ IMAGE_INSTALL ?= &quot;${CORE_IMAGE_BASE_INSTALL}&quot;<br>
<br>
 X11_IMAGE_FEATURES  = &quot;x11-base apps-x11-core package-management&quot;<br>
 ENHANCED_IMAGE_FEATURES = &quot;${X11_IMAGE_FEATURES} apps-x11-games apps-x11-pimlico package-management&quot;<br>
-SATO_IMAGE_FEATURES = &quot;${ENHANCED_IMAGE_FEATURES} x11-sato ssh-server-dropbear&quot;<br>
+SSHSERVER_IMAGE_FEATURES ??= &quot;ssh-server-dropbear&quot;<br>
+SATO_IMAGE_FEATURES = &quot;${ENHANCED_IMAGE_FEATURES} x11-sato ${SSHSERVER_IMAGE_FEATURES}&quot;<br>
<br>
 inherit image<br>
<br>
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass<br>
index 0772363..6fac974 100644<br>
--- a/meta/classes/image.bbclass<br>
+++ b/meta/classes/image.bbclass<br>
@@ -87,6 +87,23 @@ python () {<br>
         deps += &quot; %s:do_populate_sysroot&quot; % dep<br>
     d.setVarFlag(&#39;do_rootfs&#39;, &#39;depends&#39;, deps)<br>
<br>
+    #process IMAGE_FEATURES, we must do this before runtime_mapping_rename<br>
+    #Check for replaces image features<br>
+    features = set(oe.data.typed_value(&#39;IMAGE_FEATURES&#39;, d))<br>
+    remain_features = features.copy()<br>
+    for feature in features:<br>
+        replaces = set((d.getVar(&quot;IMAGE_FEATURES_REPLACES_%s&quot; % feature, True) or &quot;&quot;).split())<br>
+        remain_features -= replaces<br>
+<br>
+    #Check for conflict image features<br>
+    for feature in remain_features:<br>
+        conflicts = set((d.getVar(&quot;IMAGE_FEATURES_CONFLICTS_%s&quot; % feature, True) or &quot;&quot;).split())<br>
+        temp = conflicts &amp; remain_features<br>
+        if temp:<br>
+            raise bb.parse.SkipPackage(&quot;%s contains conflicting IMAGE_FEATURES %s %s&quot; % (d.getVar(&#39;PN&#39;, True), feature, &#39; &#39;.join(list(temp))))<br>
+<br>
+    d.setVar(&#39;IMAGE_FEATURES&#39;, &#39; &#39;.join(list(remain_features)))<br>
+<br>
     # If we don&#39;t do this we try and run the mapping hooks while parsing which is slow<br>
     # bitbake should really provide something to let us know this...<br>
     if d.getVar(&#39;BB_WORKERCONTEXT&#39;, True) is not None:<br>
diff --git a/meta/recipes-sato/images/<a href="http://core-image-sato-sdk.bb" target="_blank">core-image-sato-sdk.bb</a> b/meta/recipes-sato/images/<a href="http://core-image-sato-sdk.bb" target="_blank">core-image-sato-sdk.bb</a><br>

index eed1698..5bb9469 100644<br>
--- a/meta/recipes-sato/images/<a href="http://core-image-sato-sdk.bb" target="_blank">core-image-sato-sdk.bb</a><br>
+++ b/meta/recipes-sato/images/<a href="http://core-image-sato-sdk.bb" target="_blank">core-image-sato-sdk.bb</a><br>
@@ -8,6 +8,8 @@ form a standalone SDK.&quot;<br>
 IMAGE_FEATURES += &quot;apps-console-core ${SATO_IMAGE_FEATURES} dev-pkgs tools-sdk qt4-pkgs&quot;<br>
 EXTRA_IMAGE_FEATURES += &quot;tools-debug tools-profile tools-testapps debug-tweaks&quot;<br>
<br>
+SSHSERVER_IMAGE_FEATURES = &quot;ssh-server-openssh&quot;<br>
+<br>
 LICENSE = &quot;MIT&quot;<br>
<br>
 inherit core-image<br>
--<br>
1.7.7.6<br>
<br>
<br>
_______________________________________________<br>
Openembedded-core mailing list<br>
<a href="mailto:Openembedded-core@lists.openembedded.org">Openembedded-core@lists.openembedded.org</a><br>
<a href="http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core" target="_blank">http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core</a><br>
</blockquote></div>