Patchwork [meta-oe,meta-systemd] systemd.bbclass: add option to disable automatic RRECOMMENDS pkg-systemd_base -> pkg-systemd

login
register
mail settings
Submitter Martin Jansa
Date Aug. 16, 2012, 2:07 p.m.
Message ID <1345126066-1406-1-git-send-email-Martin.Jansa@gmail.com>
Download mbox | patch
Permalink /patch/34715/
State Accepted
Commit e008cc8688504687b1e3a62a149a78d3da1375e7
Headers show

Comments

Martin Jansa - Aug. 16, 2012, 2:07 p.m.
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 meta-systemd/classes/systemd.bbclass |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
Andreas Müller - Aug. 16, 2012, 2:53 p.m.
On Thu, Aug 16, 2012 at 4:07 PM, Martin Jansa <martin.jansa@gmail.com> wrote:
> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
> ---
>  meta-systemd/classes/systemd.bbclass |   16 ++++++++++------
>  1 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/meta-systemd/classes/systemd.bbclass b/meta-systemd/classes/systemd.bbclass
> index 4036f91..96d7f8f 100644
> --- a/meta-systemd/classes/systemd.bbclass
> +++ b/meta-systemd/classes/systemd.bbclass
> @@ -2,6 +2,8 @@ DEPENDS_append = " systemd-systemctl-native"
>
>  SYSTEMD_AUTO_ENABLE ??= "enable"
>
> +SYSTEMD_AUTO_RRECOMMENDS ??= "enable"
> +
>  systemd_postinst() {
>  OPTS=""
>
> @@ -208,12 +210,14 @@ python populate_packages_prepend () {
>          if len(rdepends_arr) == 0 and pkg_systemd != '${PN}' and not pkg_systemd_base in rdepends:
>              rdepends = '%s %s' % (rdepends, pkg_systemd_base)
>          d.setVar('RDEPENDS_' + pkg_systemd, rdepends)
> -        # RRECOMMENDS_${pkg_systemd_base} += pkg_systemd systemd
> -        rrecommends = d.getVar('RRECOMMENDS_' + pkg_systemd_base, 1) or ""
> -        # not rrecommending myself AND avoid double entries
> -        if pkg_systemd != pkg_systemd_base and not pkg_systemd in rrecommends.split():
> -            rrecommends = '%s %s' % (rrecommends, pkg_systemd)
> -        d.setVar('RRECOMMENDS_' + pkg_systemd_base, rrecommends)
> +        auto_rrecommends = d.getVar('SYSTEMD_AUTO_RRECOMMENDS', 1) or 'enable'
> +        if auto_rrecommends == 'enable':
> +            # RRECOMMENDS_${pkg_systemd_base} += pkg_systemd systemd
> +            rrecommends = d.getVar('RRECOMMENDS_' + pkg_systemd_base, 1) or ""
> +            # not rrecommending myself AND avoid double entries
> +            if pkg_systemd != pkg_systemd_base and not pkg_systemd in rrecommends.split():
> +                rrecommends = '%s %s' % (rrecommends, pkg_systemd)
> +            d.setVar('RRECOMMENDS_' + pkg_systemd_base, rrecommends)
>
>      # run all modifications once when creating package
>      if os.path.exists('${D}'):
> --
> 1.7.8.6
>
>
Although I don't have this use case - I like this one. Off topic: We
should think of documentation for the systemd variables...

Acked-by: Andreas Müller <schnitzeltony@googlemail.com>

Patch

diff --git a/meta-systemd/classes/systemd.bbclass b/meta-systemd/classes/systemd.bbclass
index 4036f91..96d7f8f 100644
--- a/meta-systemd/classes/systemd.bbclass
+++ b/meta-systemd/classes/systemd.bbclass
@@ -2,6 +2,8 @@  DEPENDS_append = " systemd-systemctl-native"
 
 SYSTEMD_AUTO_ENABLE ??= "enable"
 
+SYSTEMD_AUTO_RRECOMMENDS ??= "enable"
+
 systemd_postinst() {
 OPTS=""
 
@@ -208,12 +210,14 @@  python populate_packages_prepend () {
         if len(rdepends_arr) == 0 and pkg_systemd != '${PN}' and not pkg_systemd_base in rdepends:
             rdepends = '%s %s' % (rdepends, pkg_systemd_base)
         d.setVar('RDEPENDS_' + pkg_systemd, rdepends)
-        # RRECOMMENDS_${pkg_systemd_base} += pkg_systemd systemd
-        rrecommends = d.getVar('RRECOMMENDS_' + pkg_systemd_base, 1) or ""
-        # not rrecommending myself AND avoid double entries
-        if pkg_systemd != pkg_systemd_base and not pkg_systemd in rrecommends.split():
-            rrecommends = '%s %s' % (rrecommends, pkg_systemd)
-        d.setVar('RRECOMMENDS_' + pkg_systemd_base, rrecommends)
+        auto_rrecommends = d.getVar('SYSTEMD_AUTO_RRECOMMENDS', 1) or 'enable'
+        if auto_rrecommends == 'enable':
+            # RRECOMMENDS_${pkg_systemd_base} += pkg_systemd systemd
+            rrecommends = d.getVar('RRECOMMENDS_' + pkg_systemd_base, 1) or ""
+            # not rrecommending myself AND avoid double entries
+            if pkg_systemd != pkg_systemd_base and not pkg_systemd in rrecommends.split():
+                rrecommends = '%s %s' % (rrecommends, pkg_systemd)
+            d.setVar('RRECOMMENDS_' + pkg_systemd_base, rrecommends)
 
     # run all modifications once when creating package
     if os.path.exists('${D}'):