improve virtual package management
v3 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 v2 -> v3:
- rebased on master.
- removed already converted packages (lua, libegl, ...).
- converted cryptodev and jpeg (reported by Yann E. Morin).
- fixed comments on virtual package provider *.mk not being in the correct section of tutorial (reported by S. Martin).
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 (3):
manual: add virtual package tutorial.
cryptodev: convert to new virtual package management.
jpeg: convert to new virtual package management.
docs/manual/adding-packages-virtual.txt | 97 +++++++++++++++++++++++++++++++ docs/manual/adding-packages.txt | 2 + package/cryptodev/Config.in | 3 + package/cryptodev/cryptodev.mk | 7 +-- package/jpeg/Config.in | 3 + package/jpeg/jpeg.mk | 7 +-- 6 files changed, 111 insertions(+), 8 deletions(-) create mode 100644 docs/manual/adding-packages-virtual.txt
Signature · 1 line
1.7.9.5
PATCH v3 1/3 manual: add virtual package tutorial.
The manual now features a new section with instructions about how to add a virtual package.
--- docs/manual/adding-packages-virtual.txt | 97 +++++++++++++++++++++++++++++++ docs/manual/adding-packages.txt | 2 + 2 files changed, 99 insertions(+) create mode 100644 docs/manual/adding-packages-virtual.txt
docs/manual/adding-packages-virtual.txt new file +97 -0
@@ -0,0 +1,97 @@ +// -*- 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 infrastructure 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'). + +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. + +Provider +Config.in+ file +^^^^^^^^^^^^^^^^^^^^^^^^^ + +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. + +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
@@ -24,6 +24,8 @@ include::adding-packages-luarocks.txt[] include::adding-packages-perl.txt[] +include::adding-packages-virtual.txt[] + include::adding-packages-hooks.txt[] include::adding-packages-gettext.txt[]
Signature · 1 line
1.7.9.5
PATCH v3 2/3 cryptodev: convert to new virtual package management.
In reply to Eric Le BihanThe dependency check in 'cryptodev' has been updated to match the new virtual package management.
Since this package is implemented via a choice rather than the usual separate-package providers, BR2_PACKAGE_HAS_CRYPTODEV is always defined when the 'cryptodev' package is selected.
--- package/cryptodev/Config.in | 3 +++ package/cryptodev/cryptodev.mk | 7 +++---- 2 files changed, 6 insertions(+), 4 deletions(-)
package/cryptodev/Config.in +3 -0
@@ -37,6 +37,9 @@ config BR2_PACKAGE_OCF_LINUX endchoice +config BR2_PACKAGE_HAS_CRYPTODEV + def_bool y + config BR2_PACKAGE_PROVIDES_CRYPTODEV string default "cryptodev-linux" if BR2_PACKAGE_CRYPTODEV_LINUX
package/cryptodev/cryptodev.mk +3 -4
@@ -7,11 +7,10 @@ CRYPTODEV_SOURCE = CRYPTODEV_DEPENDENCIES = $(call qstrip,$(BR2_PACKAGE_PROVIDES_CRYPTODEV)) +ifeq ($(BR2_PACKAGE_HAS_CRYPTODEV),y) ifeq ($(CRYPTODEV_DEPENDENCIES),) -define CRYPTODEV_CONFIGURE_CMDS - echo "No CRYPTODEV implementation defined. Configuration error" - exit 1 -endef +$(error No CRYPTODEV implementation defined. Configuration error.) +endif endif $(eval $(generic-package))
Signature · 1 line
1.7.9.5
PATCH v3 3/3 jpeg: convert to new virtual package management.
In reply to Eric Le BihanThe dependency check in 'jpeg' has been updated to match the new virtual package management.
Since this package is implemented via a choice rather than the usual separate-package providers, BR2_PACKAGE_HAS_JPEG is always defined when the 'jpeg' package is selected.
--- package/jpeg/Config.in | 3 +++ package/jpeg/jpeg.mk | 7 +++---- 2 files changed, 6 insertions(+), 4 deletions(-)
package/jpeg/Config.in +3 -0
@@ -30,6 +30,9 @@ config BR2_PACKAGE_JPEG_TURBO endchoice +config BR2_PACKAGE_HAS_JPEG + def_bool y + config BR2_PACKAGE_PROVIDES_JPEG string default "libjpeg" if BR2_PACKAGE_LIBJPEG
package/jpeg/jpeg.mk +3 -4
@@ -7,11 +7,10 @@ JPEG_SOURCE = JPEG_DEPENDENCIES = $(call qstrip,$(BR2_PACKAGE_PROVIDES_JPEG)) +ifeq ($(BR2_PACKAGE_HAS_JPEG),y) ifeq ($(JPEG_DEPENDENCIES),) -define JPEG_CONFIGURE_CMDS - echo "No JPEG implementation defined. Configuration error" - exit 1 -endef +$(error No JPEG implementation defined. Configuration error.) +endif endif $(eval $(generic-package))
Signature · 1 line
1.7.9.5
v3 cover improve virtual package management
In reply to Eric Le BihanEric, All,
On 2014-03-07 14:22 +0100, Eric Le Bihan spake thusly:
Quoted 4 lines
This patch series improves virtual package management by:
- using make control functions in dependency check.
- adding a tutorial to the user manual.
I've already integrated most of this in my virtual-package branch, which has already been posted to the list (at least twice) in the recent past.
So, unless the maintainer-of-the-day disagrees, I think it is better to rather wait for the virtual-package infra to get in.
Which can be sped up by giving some tested-by, reviewed-by or acked-by tags to the already-posted patches. ;-)
Thanks 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. | '------------------------------^-------^------------------^--------------------'
v3 cover improve virtual package management
Hi!
Quoted 10 lines · Yann E. MORIN
Eric, All,
On 2014-03-07 14:22 +0100, Eric Le Bihan spake thusly:
Quoted 4 lines
This patch series improves virtual package management by:
- using make control functions in dependency check.
- adding a tutorial to the user manual.I've already integrated most of this in my virtual-package branch, which has already been posted to the list (at least twice) in the recent past.
I had not properly reviewed your patches... Sorry for the noise.
Quoted 2 lines
So, unless the maintainer-of-the-day disagrees, I think it is better to rather wait for the virtual-package infra to get in.
Of course!
Quoted 2 lines
Which can be sped up by giving some tested-by, reviewed-by or acked-by tags to the already-posted patches. ;-)
I'll give them a shot.
Best regards,
ELB