improve virtual package management
v2 cover improve virtual package management
This patch series improves virtual package management by:
- using make control functions in dependency check.
- adding a tutorial to the user manual.
Changes v1 -> v2:
- rebased on master.
- replaced 'infrastructure' by 'management' as this mechanism does not (yet?)
provide a "$(eval $(virtual-package))" helper
- converted code examples to plain sections (suggested by Yann E. Morin).
Best regards,
ELB
Eric Le Bihan (2):
packages: improve dependency check in virtual packages.
manual: add virtual package tutorial.
docs/manual/adding-packages-virtual.txt | 99 ++++++++++++++++++++++++++++++ docs/manual/adding-packages.txt | 2 + package/luainterpreter/luainterpreter.mk | 6 ++ package/opengl/libegl/libegl.mk | 7 +-- package/opengl/libgles/libgles.mk | 7 +-- package/opengl/libopenmax/libopenmax.mk | 7 +-- package/opengl/libopenvg/libopenvg.mk | 7 +-- package/powervr/powervr.mk | 7 +-- 8 files changed, 122 insertions(+), 20 deletions(-) create mode 100644 docs/manual/adding-packages-virtual.txt
Signature · 1 line
1.7.9.5
PATCH v2 1/2 packages: improve dependency check in virtual packages.
The current version of dependency check for virtual package <foo> defines FOO_CONFIGURE_CMDS to print an error message if the dependencies are not met.
This patch updates all the virtual packages to use the GNU Make control function $(error text...) instead.
This makes the error happen at the beginning of the build, with a clearer message.
--- package/luainterpreter/luainterpreter.mk | 6 ++++++ package/opengl/libegl/libegl.mk | 7 +++---- package/opengl/libgles/libgles.mk | 7 +++---- package/opengl/libopenmax/libopenmax.mk | 7 +++---- package/opengl/libopenvg/libopenvg.mk | 7 +++---- package/powervr/powervr.mk | 7 +++---- 6 files changed, 21 insertions(+), 20 deletions(-)
package/luainterpreter/luainterpreter.mk +6 -0
@@ -9,4 +9,10 @@ LUAINTERPRETER_DEPENDENCIES = $(call qstrip,$(BR2_PACKAGE_PROVIDES_LUA_INTERPRET LUAINTERPRETER_ABIVER = $(call qstrip,$(BR2_PACKAGE_LUAINTERPRETER_ABI_VERSION)) +ifeq ($(BR2_PACKAGE_HAS_LUA_INTERPRETER),y) +ifeq ($(LUAINTERPRETER_DEPENDENCIES),) +$(error No lua interpreter implementation selected. Configuration error.) +endif +endif + $(eval $(generic-package))
package/opengl/libegl/libegl.mk +3 -4
@@ -7,11 +7,10 @@ LIBEGL_SOURCE = LIBEGL_DEPENDENCIES = $(call qstrip,$(BR2_PACKAGE_PROVIDES_OPENGL_EGL)) +ifeq ($(BR2_PACKAGE_HAS_OPENGL_EGL),y) ifeq ($(LIBEGL_DEPENDENCIES),) -define LIBEGL_CONFIGURE_CMDS - echo "No libEGL implementation selected. Configuration error." - exit 1 -endef +$(error No libEGL implementation selected. Configuration error.) +endif endif $(eval $(generic-package))
package/opengl/libgles/libgles.mk +3 -4
@@ -7,11 +7,10 @@ LIBGLES_SOURCE = LIBGLES_DEPENDENCIES = $(call qstrip,$(BR2_PACKAGE_PROVIDES_OPENGL_ES)) +ifeq ($(BR2_PACKAGE_HAS_OPENGL_ES),y) ifeq ($(LIBGLES_DEPENDENCIES),) -define LIBGLES_CONFIGURE_CMDS - echo "No libGLES implementation selected. Configuration error." - exit 1 -endef +$(error No libGLES implementation selected. Configuration error.) +endif endif $(eval $(generic-package))
package/opengl/libopenmax/libopenmax.mk +3 -4
@@ -7,11 +7,10 @@ LIBOPENMAX_SOURCE = LIBOPENMAX_DEPENDENCIES = $(call qstrip,$(BR2_PACKAGE_PROVIDES_OPENMAX)) +ifeq ($(BR2_PACKAGE_HAS_OPENMAX),y) ifeq ($(LIBOPENMAX_DEPENDENCIES),) -define LIBOPENMAX_CONFIGURE_CMDS - echo "No libopenmax implementation selected. Configuration error." - exit 1 -endef +$(error No libopenmax implementation selected. Configuration error.) +endif endif $(eval $(generic-package))
package/opengl/libopenvg/libopenvg.mk +3 -4
@@ -7,11 +7,10 @@ LIBOPENVG_SOURCE = LIBOPENVG_DEPENDENCIES = $(call qstrip,$(BR2_PACKAGE_PROVIDES_OPENVG)) +ifeq ($(BR2_PACKAGE_HAS_OPENVG),y) ifeq ($(LIBOPENVG_DEPENDENCIES),) -define LIBOPENVG_CONFIGURE_CMDS - echo "No libOpenVG implementation selected. Configuration error." - exit 1 -endef +$(error No libOpenVG implementation selected. Configuration error.) +endif endif $(eval $(generic-package))
package/powervr/powervr.mk +3 -4
@@ -7,11 +7,10 @@ POWERVR_SOURCE = POWERVR_DEPENDENCIES = $(call qstrip,$(BR2_PACKAGE_PROVIDES_POWERVR)) +ifeq ($(BR2_PACKAGE_HAS_POWERVR),y) ifeq ($(POWERVR_DEPENDENCIES),) -define POWERVR_CONFIGURE_CMDS - echo "No PowerVR implementation selected. Configuration error." - exit 1 -endef +$(error No PowerVR implementation selected. Configuration error.) +endif endif $(eval $(generic-package))
--
1.7.9.5
PATCH v2 1/2 packages: improve dependency check in virtual packages.
Quoted 4 lines · Eric Le Bihan
The current version of dependency check for virtual package <foo> defines
FOO_CONFIGURE_CMDSto print an error message if the dependencies are not met.
Quoted 8 lines
This patch updates all the virtual packages to use the GNU Make control function $(error text...) instead.
This makes the error happen at the beginning of the build, with a clearer message.
Signed-off-by Eric Le Bihan <[email protected]>Reviewed-by "Yann E. MORIN" <[email protected]>
Regards,
Signature · 1 line
Samuel
PATCH v2 1/2 packages: improve dependency check in virtual packages.
In reply to Eric Le BihanQuoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Eric" == Eric Le Bihan <[email protected]> writes:
The current version of dependency check for virtual package <foo> defines
FOO_CONFIGURE_CMDSto print an error message if the dependencies are not met.
Quoted 8 lines
This patch updates all the virtual packages to use the GNU Make control function $(error text...) instead.
This makes the error happen at the beginning of the build, with a clearer message.
Signed-off-by Eric Le Bihan <[email protected]>Reviewed-by "Yann E. MORIN" <[email protected]>
Committed to next, thanks.
Signature · 1 line
Bye, Peter Korsgaard
PATCH v2 1/2 packages: improve dependency check in virtual packages.
In reply to Eric Le BihanEric, All,
On 2014-02-25 16:45 +0100, Eric Le Bihan spake thusly:
Quoted 9 lines
The current version of dependency check for virtual package <foo> defines
FOO_CONFIGURE_CMDSto print an error message if the dependencies are not met.This patch updates all the virtual packages to use the GNU Make control function $(error text...) instead.
This makes the error happen at the beginning of the build, with a clearer message.
You missed two virtual packages in this change:
- jpeg
- cryptodev
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v2 2/2 manual: add virtual package tutorial.
In reply to Eric Le BihanThe manual now features a new section with instructions about how to add a virtual package.
--- docs/manual/adding-packages-virtual.txt | 99 +++++++++++++++++++++++++++++++ docs/manual/adding-packages.txt | 2 + 2 files changed, 101 insertions(+) create mode 100644 docs/manual/adding-packages-virtual.txt
docs/manual/adding-packages-virtual.txt new file +99 -0
@@ -0,0 +1,99 @@ +// -*- mode:doc; -*- +// vim: set syntax=asciidoc: + +[[virtual-package-tutorial]] + +Virtual package tutorial +~~~~~~~~~~~~~~~~~~~~~~~~ + +In Buildroot, a virtual package is a package whose functionalities are +provided by one or more packages, referred to as 'providers'. The virtual +package management is an extensible mechanism allowing the user to choose +the provider used in the rootfs. + +For example, 'OpenGL ES' is an API for 2D and 3D graphics on embedded systems. +The implementation of this API is different for the 'Allwinner Tech Sunxi' and +the 'Texas Instruments OMAP35xx' plaftorms. So +libgles+ will be a virtual +package and +sunxi-mali+ and +ti-gfx+ will be the providers. + +In the following example, we will explain how to add a new virtual package +('something-virtual') and a provider for it ('some-provider'). + +First, let's create the virtual package. + +Virtual package +Config.in+ file +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The +Config.in+ file of virtual package 'something-virtual' should contain: + +--------------------------- +01: config BR2_PACKAGE_HAS_SOMETHING_VIRTUAL +02: bool +03: +04: config BR2_PACKAGE_PROVIDES_SOMETHING_VIRTUAL +05: depends on BR2_PACKAGE_HAS_SOMETHING_VIRTUAL +06: string +--------------------------- + +In this file, we declare two options, +BR2_PACKAGE_HAS_SOMETHING_VIRTUAL+ and ++BR2_PACKAGE_PROVIDES_SOMETHING_VIRTUAL+, whose values will be used by the +providers. + +Virtual package +*.mk+ file +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The Makefile +package/something-virtual/something-virtual.mk+ should contain: + +--------------------------- +01: ################################################################################ +02: # +03: # something-virtual +04: # +05: ################################################################################ +06: +07: SOMETHING_VIRTUAL_SOURCE = +08: SOMETHING_VIRTUAL_DEPENDENCIES = $(call qstrip,$(BR2_PACKAGE_PROVIDES_SOMETHING_VIRTUAL)) +09: +10: ifeq ($(BR2_PACKAGE_HAS_SOMETHING_VIRTUAL),y) +11: ifeq ($(SOMETHING_VIRTUAL_DEPENDENCIES),) +12: $(error No something-virtual implementation selected. Configuration error.) +13: endif +14: endif +15: +16: $(eval $(generic-package)) +--------------------------- + +The Makefile is quite small as it will only check if a provider for the +virtual package has been selected. + +When adding a package as a provider, only the +Config.in+ file requires some +modifications. The +*.mk+ file should follow the Buildroot infrastructure with +no change at all. + +Provider +Config.in+ file +^^^^^^^^^^^^^^^^^^^^^^^^^ + +The +Config.in+ file of the package 'some-provider', which provides the +functionalities of 'something-virtual', should contain: + +--------------------------- +01: config BR2_PACKAGE_SOME_PROVIDER +02: bool "some-provider" +03: select BR2_PACKAGE_HAS_SOMETHING_VIRTUAL +04: help +05: This is a comment that explains what some-provider is. +06: +07: http://foosoftware.org/some-provider/ +08: +09: if BR2_PACKAGE_SOME_PROVIDER +10: config BR2_PACKAGE_PROVIDES_SOMETHING_VIRTUAL +11: default "some-provider" +12: endif +--------------------------- + +On line 3, we select +BR2_PACKAGE_HAS_SOMETHING_VIRTUAL+, and on line 11, we +set the value of +BR2_PACKAGE_PROVIDES_SOMETHING_VIRTUAL+ to the name of the +provider, but only if it is selected. + +Of course, do not forget to add the proper build and runtime dependencies for +this package!
docs/manual/adding-packages.txt +2 -0
@@ -22,6 +22,8 @@ include::adding-packages-python.txt[] include::adding-packages-luarocks.txt[] +include::adding-packages-virtual.txt[] + include::adding-packages-hooks.txt[] include::adding-packages-gettext.txt[]
Signature · 1 line
1.7.9.5
PATCH v2 2/2 manual: add virtual package tutorial.
Hi Eric,
On Tue, Feb 25, 2014 at 4:45 PM, Eric Le Bihan
<[email protected]> wrote:
[...]
docs/manual/adding-packages-virtual.txt line 78
Quoted 7 lines
docs/manual/adding-packages-virtual.txt new file +7
-0+ +Provider +Config.in+ file +^^^^^^^^^^^^^^^^^^^^^^^^^ + +The +Config.in+ file of the package 'some-provider', which provides the +functionalities of 'something-virtual', should contain: +
No word about the provider's *.mk file which does not need any change?
Quoted 26 lines
+---------------------------
+01: configBR2_PACKAGE_SOME_PROVIDER+02: bool "some-provider" +03: select BR2_PACKAGE_HAS_SOMETHING_VIRTUAL +04: help+05: This is a comment that explains what some-provider is.
+06:
+07: http://foosoftware.org/some-provider/
+08:
+09: ifBR2_PACKAGE_SOME_PROVIDER
+10: configBR2_PACKAGE_PROVIDES_SOMETHING_VIRTUAL
+11: default "some-provider"
+12: endif
+---------------------------docs/manual/adding-packages-virtual.txt new file +7
-0+ +On line 3, we select +BR2_PACKAGE_HAS_SOMETHING_VIRTUAL+, and on line 11, we +set the value of +BR2_PACKAGE_PROVIDES_SOMETHING_VIRTUAL+ to the name of the +provider, but only if it is selected. + +Of course, do not forget to add the proper build and runtime dependencies for +this package!docs/manual/adding-packages.txt +0
-0
docs/manual/adding-packages.txt include::adding-packages-python.txt[]
Quoted 9 lines
docs/manual/adding-packages.txt +2
-1@@ -22,6 +22,8 @@ include::adding-packages-python.txt[] include::adding-packages-luarocks.txt[] +include::adding-packages-virtual.txt[] + include::adding-packages-hooks.txt[] include::adding-packages-gettext.txt[] --
Otherwise, it looks good! :)
Regards,
Signature · 1 line
Samuel
PATCH v2 2/2 manual: add virtual package tutorial.
Hi!
Quoted 5 lines · Samuel Martin
Hi Eric,
On Tue, Feb 25, 2014 at 4:45 PM, Eric Le Bihan
<[email protected]> wrote:
[...]
Quoted 9 lines
docs/manual/adding-packages-virtual.txt line 78
Quoted 7 lines
docs/manual/adding-packages-virtual.txt new file +7
-0+ +Provider +Config.in+ file +^^^^^^^^^^^^^^^^^^^^^^^^^ + +The +Config.in+ file of the package 'some-provider', which provides the +functionalities of 'something-virtual', should contain: +No word about the provider's *.mk file which does not need any change?
I added a line about it, but when I converted the example to plain section, I have not noticed that the line stayed above the targeted section ("D'Oh"^5)... Will fix.
Thanks for your reviews!
Best regards,
ELB
PATCH v2 2/2 manual: add virtual package tutorial.
In reply to Eric Le BihanEric, All,
On 2014-02-25 16:45 +0100, Eric Le Bihan spake thusly:
Quoted 4 lines
The manual now features a new section with instructions about how to add a virtual package.
Signed-off-by Eric Le Bihan <[email protected]>
Same comment as Samuel.
Otherwise, I agree with Arnout: we will soon have a virtual-package infrastructure (see my recent RFC series), and virtual packages are not something we expect to be added very often.
I know I pushed you to repost an updated version of that patch, so we could get it in for 2014.02, but in restrospect, Arnout is right: we can well wait post-release to aply it. My apologies.
Anyway, this patch is rather good, and will need only minor changes (ie. removals) to the .mk section once we have the virtual-package infra.
Thank you for your work on this! :-)
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'