Patchwork [2/6] kernel.bbclass: use symlinks for modutils files

login
register
mail settings
Submitter Martin Jansa
Date March 23, 2012, 12:56 p.m.
Message ID <4e31dfddbb238cd5e3c2ce19a49996e113419212.1332507302.git.Martin.Jansa@gmail.com>
Download mbox | patch
Permalink /patch/24267/
State Accepted
Commit d5d1508f25299ab215799d85f2ac4b31de69abf6
Headers show

Comments

Martin Jansa - March 23, 2012, 12:56 p.m.
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 meta/classes/kernel.bbclass |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
Darren Hart - March 26, 2012, 6:46 p.m.
What is the motivation?

On 03/23/2012 05:56 AM, Martin Jansa wrote:
> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
> ---
>  meta/classes/kernel.bbclass |    8 +++-----
>  1 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> index 975ae13..54ed7f7 100644
> --- a/meta/classes/kernel.bbclass
> +++ b/meta/classes/kernel.bbclass
> @@ -407,16 +407,14 @@ python populate_packages_prepend () {
>  		# appropriate modprobe commands to the postinst
>  		autoload = d.getVar('module_autoload_%s' % basename, True)
>  		if autoload:
> -			name = '%s/etc/modutils/%s' % (dvar, basename)
> -			f = open(name, 'w')
> -			for m in autoload.split():
> -				f.write('%s\n' % m)
> -			f.close()
>  			name = '%s/etc/modules-load.d/%s.conf' % (dvar, basename)
>  			f = open(name, 'w')
>  			for m in autoload.split():
>  				f.write('%s\n' % m)
>  			f.close()
> +			modutils_name = '%s/etc/modutils/%s' % (dvar, basename)
> +			modutils_target = '../modules-load.d/%s.conf' % (basename)
> +			os.symlink(modutils_target, modutils_name)

This basically undoes what was added in 1/2 and replaces it with
symblinks right?

If so, just do it as symlinks in the first place.
Martin Jansa - March 26, 2012, 6:58 p.m.
On Mon, Mar 26, 2012 at 11:46:48AM -0700, Darren Hart wrote:
> What is the motivation?

RP's review comment.
 
> On 03/23/2012 05:56 AM, Martin Jansa wrote:
> > Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
> > ---
> >  meta/classes/kernel.bbclass |    8 +++-----
> >  1 files changed, 3 insertions(+), 5 deletions(-)
> > 
> > diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> > index 975ae13..54ed7f7 100644
> > --- a/meta/classes/kernel.bbclass
> > +++ b/meta/classes/kernel.bbclass
> > @@ -407,16 +407,14 @@ python populate_packages_prepend () {
> >  		# appropriate modprobe commands to the postinst
> >  		autoload = d.getVar('module_autoload_%s' % basename, True)
> >  		if autoload:
> > -			name = '%s/etc/modutils/%s' % (dvar, basename)
> > -			f = open(name, 'w')
> > -			for m in autoload.split():
> > -				f.write('%s\n' % m)
> > -			f.close()
> >  			name = '%s/etc/modules-load.d/%s.conf' % (dvar, basename)
> >  			f = open(name, 'w')
> >  			for m in autoload.split():
> >  				f.write('%s\n' % m)
> >  			f.close()
> > +			modutils_name = '%s/etc/modutils/%s' % (dvar, basename)
> > +			modutils_target = '../modules-load.d/%s.conf' % (basename)
> > +			os.symlink(modutils_target, modutils_name)
> 
> This basically undoes what was added in 1/2 and replaces it with
> symblinks right?
> 
> If so, just do it as symlinks in the first place.

I have't squashed them because 
[PATCH 1/6] kernel.bbclass: populate /etc/modules-load.d/ with module_autoload
was already applied to meta-oe's kernel.bbclass copy, before I got RP's
review this patchset here, so I wanted to keep those patches 1to1.

Cheers,
Richard Purdie - March 26, 2012, 10:05 p.m.
On Mon, 2012-03-26 at 11:46 -0700, Darren Hart wrote:
> What is the motivation?
> 
> On 03/23/2012 05:56 AM, Martin Jansa wrote:
> > Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
> > ---
> >  meta/classes/kernel.bbclass |    8 +++-----
> >  1 files changed, 3 insertions(+), 5 deletions(-)
> > 
> > diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> > index 975ae13..54ed7f7 100644
> > --- a/meta/classes/kernel.bbclass
> > +++ b/meta/classes/kernel.bbclass
> > @@ -407,16 +407,14 @@ python populate_packages_prepend () {
> >  		# appropriate modprobe commands to the postinst
> >  		autoload = d.getVar('module_autoload_%s' % basename, True)
> >  		if autoload:
> > -			name = '%s/etc/modutils/%s' % (dvar, basename)
> > -			f = open(name, 'w')
> > -			for m in autoload.split():
> > -				f.write('%s\n' % m)
> > -			f.close()
> >  			name = '%s/etc/modules-load.d/%s.conf' % (dvar, basename)
> >  			f = open(name, 'w')
> >  			for m in autoload.split():
> >  				f.write('%s\n' % m)
> >  			f.close()
> > +			modutils_name = '%s/etc/modutils/%s' % (dvar, basename)
> > +			modutils_target = '../modules-load.d/%s.conf' % (basename)
> > +			os.symlink(modutils_target, modutils_name)
> 
> This basically undoes what was added in 1/2 and replaces it with
> symblinks right?
> 
> If so, just do it as symlinks in the first place.

This is one patch set its best to read in totality as the symlinks get
removed later. I thought about squashing the series but decided to leave
it for history.

Cheers,

Richard

Patch

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 975ae13..54ed7f7 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -407,16 +407,14 @@  python populate_packages_prepend () {
 		# appropriate modprobe commands to the postinst
 		autoload = d.getVar('module_autoload_%s' % basename, True)
 		if autoload:
-			name = '%s/etc/modutils/%s' % (dvar, basename)
-			f = open(name, 'w')
-			for m in autoload.split():
-				f.write('%s\n' % m)
-			f.close()
 			name = '%s/etc/modules-load.d/%s.conf' % (dvar, basename)
 			f = open(name, 'w')
 			for m in autoload.split():
 				f.write('%s\n' % m)
 			f.close()
+			modutils_name = '%s/etc/modutils/%s' % (dvar, basename)
+			modutils_target = '../modules-load.d/%s.conf' % (basename)
+			os.symlink(modutils_target, modutils_name)
 			postinst = d.getVar('pkg_postinst_%s' % pkg, True)
 			if not postinst:
 				bb.fatal("pkg_postinst_%s not defined" % pkg)