Patchwork sysvinit: fix install hook.

login
register
mail settings
Submitter Jacob Kjaergaard
Date July 10, 2013, 12:21 p.m.
Message ID <1373458869-16597-1-git-send-email-jabk@prevas.dk>
Download mbox | patch
Permalink /patch/258036/
State Rejected
Delegated to: Esben Haabendal
Headers show

Comments

Jacob Kjaergaard - July 10, 2013, 12:21 p.m.
From: Jacob Kjaergaard <jacob.kjaergaard@prevas.dk>

previously init.d scripts should be installed prior to
sysvinit do_install[postfunc] call. that could result in
a race depending on implementation += or =+ in the
individual recipes. That was error-prone!

Now add sysvinit install as task after install before split
to overcome this problem.
---
 classes/sysvinit.oeclass |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
Esben Haabendal - Aug. 7, 2013, 8:18 a.m.
<jabk@prevas.dk> writes:

> From: Jacob Kjaergaard <jacob.kjaergaard@prevas.dk>
>
> previously init.d scripts should be installed prior to
> sysvinit do_install[postfunc] call. that could result in
> a race depending on implementation += or =+ in the
> individual recipes. That was error-prone!

I agree, but...

> Now add sysvinit install as task after install before split
> to overcome this problem.

That is not without its own problems too.  Other tasks depending on
do_install (added with 'after install') is likely broken with this
change.  And as such, this is not backwards compatible.

Further, I would like to have the underlying problem addressed instead.

And that is that the current postfunc/prefunc mechanism is not
sufficient.  Instead of just using a dumb varflag, I would like to
introduce a new language feature: 'addfunc', which should work something
like addtask and addhook, so that dependencies to other funcs can be
specified explicitly.  Of-course, such a change is also not backwards
compatible, so it will have to wait until OE-lite core 4.

Going down a path to explosion of the number of tasks does not seem that
attractive.

/Esben


> ---
>  classes/sysvinit.oeclass |    7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/classes/sysvinit.oeclass b/classes/sysvinit.oeclass
> index c48987a..c4f449f 100644
> --- a/classes/sysvinit.oeclass
> +++ b/classes/sysvinit.oeclass
> @@ -11,8 +11,8 @@ RDEPENDS_${PN}:>USE_sysvinit = " ${RDEPENDS_SYSVINIT}"
>  
>  CLASS_FLAGS += "sysvinit"
>  
> -do_install[postfuncs] += "do_install_sysvinit"
> -python do_install_sysvinit () {
> +addtask do_install_sysvinit after do_install before do_split
> +def do_install_sysvinit(d):
>      import os
>  
>      path = d.get("D")
> @@ -64,4 +64,5 @@ python do_install_sysvinit () {
>          if os.path.exists(dst):
>              os.remove(dst)
>          os.symlink(src, dst)
> -}
> +
> +

Patch

diff --git a/classes/sysvinit.oeclass b/classes/sysvinit.oeclass
index c48987a..c4f449f 100644
--- a/classes/sysvinit.oeclass
+++ b/classes/sysvinit.oeclass
@@ -11,8 +11,8 @@  RDEPENDS_${PN}:>USE_sysvinit = " ${RDEPENDS_SYSVINIT}"
 
 CLASS_FLAGS += "sysvinit"
 
-do_install[postfuncs] += "do_install_sysvinit"
-python do_install_sysvinit () {
+addtask do_install_sysvinit after do_install before do_split
+def do_install_sysvinit(d):
     import os
 
     path = d.get("D")
@@ -64,4 +64,5 @@  python do_install_sysvinit () {
         if os.path.exists(dst):
             os.remove(dst)
         os.symlink(src, dst)
-}
+
+