[5/9] update-rcd.bbclass: handle both sysvinit and systemd features being present

Submitted by Ross Burton on March 11, 2013, 8:07 p.m.

Details

Message ID f7ba9c2b1c0d7d520300c6c3b38f5d5e0172ad51.1363031776.git.ross.burton@intel.com
State New
Headers show

Commit Message

Ross Burton March 11, 2013, 8:07 p.m.
Run the helper if the sysvinit feature is present, or if the systemd feature is
present but the systemd class hasn't been inherited.  We want to run in the
latter case as systemd has sysvinit compatibility, but we don't want to always
so that pure systemd images don't have redundent sysvinit files.

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 meta/classes/update-rc.d.bbclass                          |    9 ++++++---
 meta/recipes-core/packagegroups/packagegroup-core-boot.bb |    4 ++--
 2 files changed, 8 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/meta/classes/update-rc.d.bbclass b/meta/classes/update-rc.d.bbclass
index 65bf022..06b91c1 100644
--- a/meta/classes/update-rc.d.bbclass
+++ b/meta/classes/update-rc.d.bbclass
@@ -75,9 +75,12 @@  python populate_packages_updatercd () {
         postrm += d.getVar('updatercd_postrm', True)
         d.setVar('pkg_postrm_%s' % pkg, postrm)
 
-    # If the systemd class has also been inherited, then don't do anything as
-    # the systemd units will override anything created by update-rc.d.
-    if not d.getVar("SYSTEMD_BBCLASS_ENABLED", True):
+    # Run if the sysvinit feature is present, or if the systemd feature is present
+    # but the systemd class hasn't been inherited.  We want to run in the latter case
+    # as systemd has sysvinit compatibility, but we don't want to always so that
+    # pure systemd images don't have redundent sysvinit files.
+    if "sysvinit" in d.getVar("DISTRO_FEATURES").split() or \
+       ("systemd" in d.getVar("DISTRO_FEATURES").split() and not d.getVar("SYSTEMD_BBCLASS_ENABLED", True)):
         pkgs = d.getVar('INITSCRIPT_PACKAGES', True)
         if pkgs == None:
             pkgs = d.getVar('UPDATERCPN', True)
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-boot.bb b/meta/recipes-core/packagegroups/packagegroup-core-boot.bb
index b9183a8..e73b46e 100644
--- a/meta/recipes-core/packagegroups/packagegroup-core-boot.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-core-boot.bb
@@ -27,7 +27,7 @@  RCONFLICTS_${PN} = "task-core-boot"
 VIRTUAL-RUNTIME_dev_manager ?= "udev"
 VIRTUAL-RUNTIME_login_manager ?= "tinylogin"
 VIRTUAL-RUNTIME_init_manager ?= "${DISTRO_FEATURES_INITMAN}"
-VIRTUAL-RUNTIME_initscripts ?= "${@base_contains('DISTRO_FEATURES', 'sysvinit', 'initscripts', '',d)}"
+VIRTUAL-RUNTIME_initscripts ?= "${@base_contains('DISTRO_FEATURES_INITMAN', 'sysvinit', 'initscripts', '',d)}"
 VIRTUAL-RUNTIME_keymaps ?= "keymaps"
 
 RDEPENDS_${PN} = "\
@@ -42,7 +42,7 @@  RDEPENDS_${PN} = "\
     ${VIRTUAL-RUNTIME_login_manager} \
     ${VIRTUAL-RUNTIME_init_manager} \
     ${VIRTUAL-RUNTIME_initscripts} \
-    ${@base_contains('DISTRO_FEATURES', 'systemd', 'systemd-compat-units', '',d)} \
+    ${@base_contains('DISTRO_FEATURES_INITMAN', 'systemd', 'systemd-compat-units', '',d)} \
     ${VIRTUAL-RUNTIME_dev_manager} \
     ${VIRTUAL-RUNTIME_update-alternatives} \
     ${MACHINE_ESSENTIAL_EXTRA_RDEPENDS}"

Comments

Martin Jansa March 12, 2013, 7:12 a.m.
On Mon, Mar 11, 2013 at 01:07:35PM -0700, Ross Burton wrote:
> Run the helper if the sysvinit feature is present, or if the systemd feature is
> present but the systemd class hasn't been inherited.  We want to run in the
> latter case as systemd has sysvinit compatibility, but we don't want to always
> so that pure systemd images don't have redundent sysvinit files.
> 
> Signed-off-by: Ross Burton <ross.burton@intel.com>
> ---
>  meta/classes/update-rc.d.bbclass                          |    9 ++++++---
>  meta/recipes-core/packagegroups/packagegroup-core-boot.bb |    4 ++--
>  2 files changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/meta/classes/update-rc.d.bbclass b/meta/classes/update-rc.d.bbclass
> index 65bf022..06b91c1 100644
> --- a/meta/classes/update-rc.d.bbclass
> +++ b/meta/classes/update-rc.d.bbclass
> @@ -75,9 +75,12 @@ python populate_packages_updatercd () {
>          postrm += d.getVar('updatercd_postrm', True)
>          d.setVar('pkg_postrm_%s' % pkg, postrm)
>  
> -    # If the systemd class has also been inherited, then don't do anything as
> -    # the systemd units will override anything created by update-rc.d.
> -    if not d.getVar("SYSTEMD_BBCLASS_ENABLED", True):
> +    # Run if the sysvinit feature is present, or if the systemd feature is present
> +    # but the systemd class hasn't been inherited.  We want to run in the latter case
> +    # as systemd has sysvinit compatibility, but we don't want to always so that
> +    # pure systemd images don't have redundent sysvinit files.
> +    if "sysvinit" in d.getVar("DISTRO_FEATURES").split() or \
> +       ("systemd" in d.getVar("DISTRO_FEATURES").split() and not d.getVar("SYSTEMD_BBCLASS_ENABLED", True)):
>          pkgs = d.getVar('INITSCRIPT_PACKAGES', True)
>          if pkgs == None:
>              pkgs = d.getVar('UPDATERCPN', True)
> diff --git a/meta/recipes-core/packagegroups/packagegroup-core-boot.bb b/meta/recipes-core/packagegroups/packagegroup-core-boot.bb
> index b9183a8..e73b46e 100644
> --- a/meta/recipes-core/packagegroups/packagegroup-core-boot.bb
> +++ b/meta/recipes-core/packagegroups/packagegroup-core-boot.bb
> @@ -27,7 +27,7 @@ RCONFLICTS_${PN} = "task-core-boot"
>  VIRTUAL-RUNTIME_dev_manager ?= "udev"
>  VIRTUAL-RUNTIME_login_manager ?= "tinylogin"
>  VIRTUAL-RUNTIME_init_manager ?= "${DISTRO_FEATURES_INITMAN}"
> -VIRTUAL-RUNTIME_initscripts ?= "${@base_contains('DISTRO_FEATURES', 'sysvinit', 'initscripts', '',d)}"
> +VIRTUAL-RUNTIME_initscripts ?= "${@base_contains('DISTRO_FEATURES_INITMAN', 'sysvinit', 'initscripts', '',d)}"
>  VIRTUAL-RUNTIME_keymaps ?= "keymaps"
>  
>  RDEPENDS_${PN} = "\
> @@ -42,7 +42,7 @@ RDEPENDS_${PN} = "\
>      ${VIRTUAL-RUNTIME_login_manager} \
>      ${VIRTUAL-RUNTIME_init_manager} \
>      ${VIRTUAL-RUNTIME_initscripts} \
> -    ${@base_contains('DISTRO_FEATURES', 'systemd', 'systemd-compat-units', '',d)} \
> +    ${@base_contains('DISTRO_FEATURES_INITMAN', 'systemd', 'systemd-compat-units', '',d)} \

Why these 2 changes? I don't see any explanation in commit message.

>      ${VIRTUAL-RUNTIME_dev_manager} \
>      ${VIRTUAL-RUNTIME_update-alternatives} \
>      ${MACHINE_ESSENTIAL_EXTRA_RDEPENDS}"
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core