Message ID | 20170801225224.16899-11-arnout@mind.be |
---|---|
State | Accepted |
Headers | show |
Hello, On Wed, 2 Aug 2017 00:52:20 +0200, Arnout Vandecappelle (Essensium/Mind) wrote: > diff --git a/package/skeleton-common/Config.in b/package/skeleton-common/Config.in > index 5675e873cf..e18d6d0ff0 100644 > --- a/package/skeleton-common/Config.in > +++ b/package/skeleton-common/Config.in > @@ -1,6 +1,17 @@ > config BR2_PACKAGE_SKELETON_COMMON > bool > + > +# skeleton-common is normally a dependency of another skeleton. > +# BR2_PACKAGE_SKELETON_COMMON_ONLY can be selected if skeleton-common > +# is the only provider of the skeleton. > +config BR2_PACKAGE_SKELETON_COMMON_ONLY > + bool > + select BR2_PACKAGE_SKELETON_COMMON > select BR2_PACKAGE_HAS_SKELETON I was not really happy with this BR2_PACKAGE_SKELETON_COMMON_ONLY solution, where skeleton-common is sometimes a provider of the skeleton virtual package, sometimes not. It feels a bit hackish. So I've replaced that with what I believe is a simpler and cleaner solution, even if it requires a little bit more code: I've added a skeleton-none package. At the point of this commit, it is completely identical to skeleton-sysv and skeleton-systemd: it does nothing but depend on skeleton-common. But this way, we have a clean situation where the skeleton virtual package has four providers: skeleton-none, skeleton-sysv, skeleton-systemd and skeleton-custom. All of skeleton-none, skeleton-sysv and skeleton-systemd depend on skeleton-common. > +endif > diff --git a/package/skeleton-common/skeleton-common.mk b/package/skeleton-common/skeleton-common.mk > index bf75077a85..e9b87c3fd3 100644 > --- a/package/skeleton-common/skeleton-common.mk > +++ b/package/skeleton-common/skeleton-common.mk > @@ -11,8 +11,6 @@ > SKELETON_COMMON_ADD_TOOLCHAIN_DEPENDENCY = NO > SKELETON_COMMON_ADD_SKELETON_DEPENDENCY = NO > > -SKELETON_COMMON_PROVIDES = skeleton Removing this was correct when skeleton-common was *not* a provider of skeleton (i.e when skeleton-common is a dependency of skeleton-sysv or skeleton-systemd). But it should have been kept in the BR2_PACKAGE_SKELETON_COMMON_ONLY, because in this case, skeleton-common was directly a provider of the skeleton virtual package. But thanks to the addition of a skeleton-none package, skeleton-common is really never a provider of skeleton, and therefore removing this line unconditionally becomes correct. Hopefully I haven't messed up my change introducing skeleton-none :-) > config BR2_ROOTFS_SKELETON_DEFAULT > bool "default target skeleton" > - select BR2_PACKAGE_SKELETON_COMMON > + select BR2_PACKAGE_SKELETON_SYSV if BR2_INIT_SYSV > + select BR2_PACKAGE_SKELETON_SYSV if BR2_INIT_BUSYBOX > + select BR2_PACKAGE_SKELETON_SYSTEMD if BR2_INIT_SYSTEMD > + select BR2_PACKAGE_SKELETON_COMMON_ONLY if BR2_INIT_NONE So this last line is now: select BR2_PACKAGE_SKELETON_NONE if BR2_INIT_NONE Thanks! Thomas
diff --git a/package/Config.in b/package/Config.in index 7d22b47f5c..8e0717cd90 100644 --- a/package/Config.in +++ b/package/Config.in @@ -4,6 +4,8 @@ menu "Target packages" source "package/skeleton/Config.in" source "package/skeleton-common/Config.in" source "package/skeleton-custom/Config.in" + source "package/skeleton-systemd/Config.in" + source "package/skeleton-sysv/Config.in" menu "Audio and video applications" source "package/alsa-utils/Config.in" diff --git a/package/skeleton-common/Config.in b/package/skeleton-common/Config.in index 5675e873cf..e18d6d0ff0 100644 --- a/package/skeleton-common/Config.in +++ b/package/skeleton-common/Config.in @@ -1,6 +1,17 @@ config BR2_PACKAGE_SKELETON_COMMON bool + +# skeleton-common is normally a dependency of another skeleton. +# BR2_PACKAGE_SKELETON_COMMON_ONLY can be selected if skeleton-common +# is the only provider of the skeleton. +config BR2_PACKAGE_SKELETON_COMMON_ONLY + bool + select BR2_PACKAGE_SKELETON_COMMON select BR2_PACKAGE_HAS_SKELETON +if BR2_PACKAGE_SKELETON_COMMON_ONLY + config BR2_PACKAGE_PROVIDES_SKELETON - default "skeleton-common" if BR2_PACKAGE_SKELETON_COMMON + default "skeleton-common" + +endif diff --git a/package/skeleton-common/skeleton-common.mk b/package/skeleton-common/skeleton-common.mk index bf75077a85..e9b87c3fd3 100644 --- a/package/skeleton-common/skeleton-common.mk +++ b/package/skeleton-common/skeleton-common.mk @@ -11,8 +11,6 @@ SKELETON_COMMON_ADD_TOOLCHAIN_DEPENDENCY = NO SKELETON_COMMON_ADD_SKELETON_DEPENDENCY = NO -SKELETON_COMMON_PROVIDES = skeleton - # The skeleton also handles the merged /usr case in the sysroot SKELETON_COMMON_INSTALL_STAGING = YES diff --git a/package/skeleton-systemd/Config.in b/package/skeleton-systemd/Config.in new file mode 100644 index 0000000000..c507264598 --- /dev/null +++ b/package/skeleton-systemd/Config.in @@ -0,0 +1,7 @@ +config BR2_PACKAGE_SKELETON_SYSTEMD + bool + select BR2_PACKAGE_HAS_SKELETON + select BR2_PACKAGE_SKELETON_COMMON + +config BR2_PACKAGE_PROVIDES_SKELETON + default "skeleton-systemd" if BR2_PACKAGE_SKELETON_SYSTEMD diff --git a/package/skeleton-systemd/skeleton-systemd.mk b/package/skeleton-systemd/skeleton-systemd.mk new file mode 100644 index 0000000000..cec6359007 --- /dev/null +++ b/package/skeleton-systemd/skeleton-systemd.mk @@ -0,0 +1,18 @@ +################################################################################ +# +# skeleton-systemd +# +################################################################################ + +# The skeleton can't depend on the toolchain, since all packages depends on the +# skeleton and the toolchain is a target package, as is skeleton. +# Hence, skeleton would depends on the toolchain and the toolchain would depend +# on skeleton. +SKELETON_SYSTEMD_ADD_TOOLCHAIN_DEPENDENCY = NO +SKELETON_SYSTEMD_ADD_SKELETON_DEPENDENCY = NO + +SKELETON_SYSTEMD_DEPENDENCIES = skeleton-common + +SKELETON_SYSTEMD_PROVIDES = skeleton + +$(eval $(generic-package)) diff --git a/package/skeleton-sysv/Config.in b/package/skeleton-sysv/Config.in new file mode 100644 index 0000000000..2f6dbd9673 --- /dev/null +++ b/package/skeleton-sysv/Config.in @@ -0,0 +1,7 @@ +config BR2_PACKAGE_SKELETON_SYSV + bool + select BR2_PACKAGE_HAS_SKELETON + select BR2_PACKAGE_SKELETON_COMMON + +config BR2_PACKAGE_PROVIDES_SKELETON + default "skeleton-sysv" if BR2_PACKAGE_SKELETON_SYSV diff --git a/package/skeleton-sysv/skeleton-sysv.mk b/package/skeleton-sysv/skeleton-sysv.mk new file mode 100644 index 0000000000..b0c2b6bac1 --- /dev/null +++ b/package/skeleton-sysv/skeleton-sysv.mk @@ -0,0 +1,18 @@ +################################################################################ +# +# skeleton-sysv +# +################################################################################ + +# The skeleton can't depend on the toolchain, since all packages depends on the +# skeleton and the toolchain is a target package, as is skeleton. +# Hence, skeleton would depends on the toolchain and the toolchain would depend +# on skeleton. +SKELETON_SYSV_ADD_TOOLCHAIN_DEPENDENCY = NO +SKELETON_SYSV_ADD_SKELETON_DEPENDENCY = NO + +SKELETON_SYSV_DEPENDENCIES = skeleton-common + +SKELETON_SYSV_PROVIDES = skeleton + +$(eval $(generic-package)) diff --git a/system/Config.in b/system/Config.in index 8c3f903bdc..6d2d10269e 100644 --- a/system/Config.in +++ b/system/Config.in @@ -1,15 +1,18 @@ menu "System configuration" # Note: usually, it is not possible to select a provider of a virtual -# package. But here we have an exception: there are only two providers -# and they only get selected each by separate entries in this choice. -# So this is a safe situation. +# package. But here we have an exception: there are only three providers +# and they only get selected by separate entries in this choice and +# under different, exclusive conditions. So this is a safe situation. choice prompt "Root FS skeleton" config BR2_ROOTFS_SKELETON_DEFAULT bool "default target skeleton" - select BR2_PACKAGE_SKELETON_COMMON + select BR2_PACKAGE_SKELETON_SYSV if BR2_INIT_SYSV + select BR2_PACKAGE_SKELETON_SYSV if BR2_INIT_BUSYBOX + select BR2_PACKAGE_SKELETON_SYSTEMD if BR2_INIT_SYSTEMD + select BR2_PACKAGE_SKELETON_COMMON_ONLY if BR2_INIT_NONE help Use default target skeleton