| Submitter | Saul Wold |
|---|---|
| Date | June 27, 2012, 3:43 p.m. |
| Message ID | <d419bc8c4de78a3021183197b08ee7b864c6569d.1340811559.git.sgw@linux.intel.com> |
| Download | mbox | patch |
| Permalink | /patch/30729/ |
| State | New |
| Headers | show |
Comments
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 ? 2012-6-27 ??11:43?"Saul Wold" <sgw@linux.intel.com>??? > From: Lianhao Lu <lianhao.lu@intel.com> > > 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)))) > + > + d.setVar('IMAGE_FEATURES', ' '.join(list(remain_features))) > + > # If we don't do this we try and run the mapping hooks while parsing > which is slow > # bitbake should really provide something to let us know this... > if d.getVar('BB_WORKERCONTEXT', True) is not None: > diff --git a/meta/recipes-sato/images/core-image-sato-sdk.bbb/meta/recipes-sato/images/ > core-image-sato-sdk.bb > index eed1698..5bb9469 100644 > --- a/meta/recipes-sato/images/core-image-sato-sdk.bb > +++ b/meta/recipes-sato/images/core-image-sato-sdk.bb > @@ -8,6 +8,8 @@ form a standalone SDK." > IMAGE_FEATURES += "apps-console-core ${SATO_IMAGE_FEATURES} dev-pkgs > tools-sdk qt4-pkgs" > EXTRA_IMAGE_FEATURES += "tools-debug tools-profile tools-testapps > debug-tweaks" > > +SSHSERVER_IMAGE_FEATURES = "ssh-server-openssh" > + > LICENSE = "MIT" > > inherit core-image > -- > 1.7.7.6 > > > _______________________________________________ > Openembedded-core mailing list > Openembedded-core@lists.openembedded.org > http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core >
Patch
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)))) + + d.setVar('IMAGE_FEATURES', ' '.join(list(remain_features))) + # If we don't do this we try and run the mapping hooks while parsing which is slow # bitbake should really provide something to let us know this... if d.getVar('BB_WORKERCONTEXT', True) is not None: diff --git a/meta/recipes-sato/images/core-image-sato-sdk.bb b/meta/recipes-sato/images/core-image-sato-sdk.bb index eed1698..5bb9469 100644 --- a/meta/recipes-sato/images/core-image-sato-sdk.bb +++ b/meta/recipes-sato/images/core-image-sato-sdk.bb @@ -8,6 +8,8 @@ form a standalone SDK." IMAGE_FEATURES += "apps-console-core ${SATO_IMAGE_FEATURES} dev-pkgs tools-sdk qt4-pkgs" EXTRA_IMAGE_FEATURES += "tools-debug tools-profile tools-testapps debug-tweaks" +SSHSERVER_IMAGE_FEATURES = "ssh-server-openssh" + LICENSE = "MIT" inherit core-image