Patchwork [5/6] kernel.bbclass: remove references to update-modules

login
register
mail settings
Submitter Laurentiu Palcu
Date Jan. 17, 2013, 2:58 p.m.
Message ID <81a1810d4c60fe2648c4e34d64c63ced7e0a7296.1358432402.git.laurentiu.palcu@intel.com>
Download mbox | patch
Permalink /patch/42815/
State Accepted
Commit 71537bb721b64968f1a3ccaef9a5490290df8b51
Headers show

Comments

Laurentiu Palcu - Jan. 17, 2013, 2:58 p.m.
Since update-modules is now obsolete, remove it from the bbclass.

[YOCTO #3598]

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
 meta/classes/kernel.bbclass |   36 +++++++++++++++++-------------------
 1 file changed, 17 insertions(+), 19 deletions(-)
Bruce Ashfield - Jan. 17, 2013, 3:26 p.m.
On Thu, Jan 17, 2013 at 9:58 AM, Laurentiu Palcu
<laurentiu.palcu@intel.com>wrote:

> Since update-modules is now obsolete, remove it from the bbclass.
>
>
This seems to capture all the concerns that I had about removing
update-modules.

Acked-by: Bruce Ashfield <bruce.ashfield@windriver.com>


> [YOCTO #3598]
>
> Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
> ---
>  meta/classes/kernel.bbclass |   36 +++++++++++++++++-------------------
>  1 file changed, 17 insertions(+), 19 deletions(-)
>
> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> index 46ba55f..4893cf2 100644
> --- a/meta/classes/kernel.bbclass
> +++ b/meta/classes/kernel.bbclass
> @@ -1,7 +1,7 @@
>  inherit linux-kernel-base module_strip
>
>  PROVIDES += "virtual/kernel"
> -DEPENDS += "virtual/${TARGET_PREFIX}gcc kmod-native
> virtual/${TARGET_PREFIX}gcc${KERNEL_CCSUFFIX} update-modules"
> +DEPENDS += "virtual/${TARGET_PREFIX}gcc kmod-native
> virtual/${TARGET_PREFIX}gcc${KERNEL_CCSUFFIX}"
>
>  # we include gcc above, we dont need virtual/libc
>  INHIBIT_DEFAULT_DEPS = "1"
> @@ -293,12 +293,17 @@ fi
>  pkg_postinst_modules () {
>  if [ -z "$D" ]; then
>         depmod -a ${KERNEL_VERSION}
> -       update-modules || true
> +else
> +       depmod -a -b $D -F
> ${STAGING_KERNEL_DIR}/System.map-${KERNEL_VERSION} ${KERNEL_VERSION}
>  fi
>  }
>
>  pkg_postrm_modules () {
> -update-modules || true
> +if [ -z "$D" ]; then
> +       depmod -a ${KERNEL_VERSION}
> +else
> +       depmod -a -b $D -F
> ${STAGING_KERNEL_DIR}/System.map-${KERNEL_VERSION} ${KERNEL_VERSION}
> +fi
>  }
>
>  autoload_postinst_fragment() {
> @@ -403,12 +408,10 @@ python populate_packages_prepend () {
>
>          dvar = d.getVar('PKGD', True)
>
> -        use_update_modules = oe.utils.contains('DISTRO_FEATURES',
> 'update-modules', True, False, d)
> -
>          # If autoloading is requested, output
> /etc/modules-load.d/<name>.conf and append
>          # appropriate modprobe commands to the postinst
>          autoload = d.getVar('module_autoload_%s' % basename, True)
> -        if autoload and use_update_modules:
> +        if autoload:
>              name = '%s/etc/modules-load.d/%s.conf' % (dvar, basename)
>              f = open(name, 'w')
>              for m in autoload.split():
> @@ -422,16 +425,15 @@ python populate_packages_prepend () {
>
>          # Write out any modconf fragment
>          modconf = d.getVar('module_conf_%s' % basename, True)
> -        if modconf and use_update_modules:
> +        if modconf:
>              name = '%s/etc/modprobe.d/%s.conf' % (dvar, basename)
>              f = open(name, 'w')
>              f.write("%s\n" % modconf)
>              f.close()
>
> -        if use_update_modules:
> -            files = d.getVar('FILES_%s' % pkg, True)
> -            files = "%s /etc/modules-load.d/%s.conf
> /etc/modprobe.d/%s.conf" % (files, basename, basename)
> -            d.setVar('FILES_%s' % pkg, files)
> +        files = d.getVar('FILES_%s' % pkg, True)
> +        files = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf"
> % (files, basename, basename)
> +        d.setVar('FILES_%s' % pkg, files)
>
>          if vals.has_key("description"):
>              old_desc = d.getVar('DESCRIPTION_' + pkg, True) or ""
> @@ -447,17 +449,13 @@ python populate_packages_prepend () {
>      module_regex = '^(.*)\.k?o$'
>      module_pattern = 'kernel-module-%s'
>
> -    use_update_modules = oe.utils.contains('DISTRO_FEATURES',
> 'update-modules', True, False, d)
> -    if use_update_modules:
> -        postinst = d.getVar('pkg_postinst_modules', True)
> -        postrm = d.getVar('pkg_postrm_modules', True)
> -    else:
> -        postinst = None
> -        postrm = None
> +    postinst = d.getVar('pkg_postinst_modules', True)
> +    postrm = d.getVar('pkg_postrm_modules', True)
> +
>      do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.bin$',
> output_pattern='kernel-firmware-%s', description='Firmware for %s',
> recursive=True, extra_depends='')
>      do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.fw$',
> output_pattern='kernel-firmware-%s', description='Firmware for %s',
> recursive=True, extra_depends='')
>      do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.cis$',
> output_pattern='kernel-firmware-%s', description='Firmware for %s',
> recursive=True, extra_depends='')
> -    do_split_packages(d, root='/lib/modules', file_regex=module_regex,
> output_pattern=module_pattern, description='%s kernel module',
> postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata,
> extra_depends='%skernel-%s' % (['', 'update-modules '][use_update_modules],
> d.getVar("KERNEL_VERSION", True)))
> +    do_split_packages(d, root='/lib/modules', file_regex=module_regex,
> output_pattern=module_pattern, description='%s kernel module',
> postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata,
> extra_depends='kernel-%s' % (d.getVar("KERNEL_VERSION", True)))
>
>      # If modules-load.d and modprobe.d are empty at this point, remove
> them to
>      # avoid warnings. removedirs only raises an OSError if an empty
> --
> 1.7.9.5
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>
Darren Hart - Jan. 22, 2013, 8:48 p.m.
On 01/17/2013 06:58 AM, Laurentiu Palcu wrote:
> Since update-modules is now obsolete, remove it from the bbclass.
> 
> [YOCTO #3598]
> 
> Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
> ---
>  meta/classes/kernel.bbclass |   36 +++++++++++++++++-------------------
>  1 file changed, 17 insertions(+), 19 deletions(-)
> 
> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> index 46ba55f..4893cf2 100644
> --- a/meta/classes/kernel.bbclass
> +++ b/meta/classes/kernel.bbclass
> @@ -1,7 +1,7 @@
>  inherit linux-kernel-base module_strip
>  
>  PROVIDES += "virtual/kernel"
> -DEPENDS += "virtual/${TARGET_PREFIX}gcc kmod-native virtual/${TARGET_PREFIX}gcc${KERNEL_CCSUFFIX} update-modules"
> +DEPENDS += "virtual/${TARGET_PREFIX}gcc kmod-native virtual/${TARGET_PREFIX}gcc${KERNEL_CCSUFFIX}"
>  

...

> -    use_update_modules = oe.utils.contains('DISTRO_FEATURES', 'update-modules', True, False, d)
> -    if use_update_modules:
> -        postinst = d.getVar('pkg_postinst_modules', True)
> -        postrm = d.getVar('pkg_postrm_modules', True)
> -    else:
> -        postinst = None
> -        postrm = None
> +    postinst = d.getVar('pkg_postinst_modules', True)
> +    postrm = d.getVar('pkg_postrm_modules', True)

This seems to be inverted logic from the original. If update-modules is
removed, then use_update_modules should be false right? Which would have
previously set postinst and postrm to None.
Laurentiu Palcu - Jan. 23, 2013, 8:22 a.m.
On 01/22/2013 10:48 PM, Darren Hart wrote:
>> -    use_update_modules = oe.utils.contains('DISTRO_FEATURES', 'update-modules', True, False, d)
>> > -    if use_update_modules:
>> > -        postinst = d.getVar('pkg_postinst_modules', True)
>> > -        postrm = d.getVar('pkg_postrm_modules', True)
>> > -    else:
>> > -        postinst = None
>> > -        postrm = None
>> > +    postinst = d.getVar('pkg_postinst_modules', True)
>> > +    postrm = d.getVar('pkg_postrm_modules', True)
> This seems to be inverted logic from the original. If update-modules is
> removed, then use_update_modules should be false right? Which would have
> previously set postinst and postrm to None.
I believe both the previous and current logic are right:
  * Before, the update-modules script was called in the postinst/postrm.
So, when the update-modules package was not part of the build, the
postinst/postrm could not call update-modules anymore. As a consequence,
they were set to none.
  * After update-modules has been removed, we are not constrained by
calling update-modules anymore in postinst/postrm but we can safely call
depmod to have the dependencies computed.

So, is there anything wrong with the current logic?

Thanks,
Laurentiu
Darren Hart - Jan. 23, 2013, 4:24 p.m.
On 01/23/2013 12:22 AM, Laurentiu Palcu wrote:
> 
> 
> On 01/22/2013 10:48 PM, Darren Hart wrote:
>>> -    use_update_modules = oe.utils.contains('DISTRO_FEATURES', 'update-modules', True, False, d)
>>>> -    if use_update_modules:
>>>> -        postinst = d.getVar('pkg_postinst_modules', True)
>>>> -        postrm = d.getVar('pkg_postrm_modules', True)
>>>> -    else:
>>>> -        postinst = None
>>>> -        postrm = None
>>>> +    postinst = d.getVar('pkg_postinst_modules', True)
>>>> +    postrm = d.getVar('pkg_postrm_modules', True)
>> This seems to be inverted logic from the original. If update-modules is
>> removed, then use_update_modules should be false right? Which would have
>> previously set postinst and postrm to None.
> I believe both the previous and current logic are right:
>   * Before, the update-modules script was called in the postinst/postrm.
> So, when the update-modules package was not part of the build, the
> postinst/postrm could not call update-modules anymore. As a consequence,
> they were set to none.
>   * After update-modules has been removed, we are not constrained by
> calling update-modules anymore in postinst/postrm but we can safely call
> depmod to have the dependencies computed.
> 
> So, is there anything wrong with the current logic?

Ah, I see. That makes sense to me.

Thanks,

Patch

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 46ba55f..4893cf2 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -1,7 +1,7 @@ 
 inherit linux-kernel-base module_strip
 
 PROVIDES += "virtual/kernel"
-DEPENDS += "virtual/${TARGET_PREFIX}gcc kmod-native virtual/${TARGET_PREFIX}gcc${KERNEL_CCSUFFIX} update-modules"
+DEPENDS += "virtual/${TARGET_PREFIX}gcc kmod-native virtual/${TARGET_PREFIX}gcc${KERNEL_CCSUFFIX}"
 
 # we include gcc above, we dont need virtual/libc
 INHIBIT_DEFAULT_DEPS = "1"
@@ -293,12 +293,17 @@  fi
 pkg_postinst_modules () {
 if [ -z "$D" ]; then
 	depmod -a ${KERNEL_VERSION}
-	update-modules || true
+else
+	depmod -a -b $D -F ${STAGING_KERNEL_DIR}/System.map-${KERNEL_VERSION} ${KERNEL_VERSION}
 fi
 }
 
 pkg_postrm_modules () {
-update-modules || true
+if [ -z "$D" ]; then
+	depmod -a ${KERNEL_VERSION}
+else
+	depmod -a -b $D -F ${STAGING_KERNEL_DIR}/System.map-${KERNEL_VERSION} ${KERNEL_VERSION}
+fi
 }
 
 autoload_postinst_fragment() {
@@ -403,12 +408,10 @@  python populate_packages_prepend () {
 
         dvar = d.getVar('PKGD', True)
 
-        use_update_modules = oe.utils.contains('DISTRO_FEATURES', 'update-modules', True, False, d)
-
         # If autoloading is requested, output /etc/modules-load.d/<name>.conf and append
         # appropriate modprobe commands to the postinst
         autoload = d.getVar('module_autoload_%s' % basename, True)
-        if autoload and use_update_modules:
+        if autoload:
             name = '%s/etc/modules-load.d/%s.conf' % (dvar, basename)
             f = open(name, 'w')
             for m in autoload.split():
@@ -422,16 +425,15 @@  python populate_packages_prepend () {
 
         # Write out any modconf fragment
         modconf = d.getVar('module_conf_%s' % basename, True)
-        if modconf and use_update_modules:
+        if modconf:
             name = '%s/etc/modprobe.d/%s.conf' % (dvar, basename)
             f = open(name, 'w')
             f.write("%s\n" % modconf)
             f.close()
 
-        if use_update_modules:
-            files = d.getVar('FILES_%s' % pkg, True)
-            files = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (files, basename, basename)
-            d.setVar('FILES_%s' % pkg, files)
+        files = d.getVar('FILES_%s' % pkg, True)
+        files = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (files, basename, basename)
+        d.setVar('FILES_%s' % pkg, files)
 
         if vals.has_key("description"):
             old_desc = d.getVar('DESCRIPTION_' + pkg, True) or ""
@@ -447,17 +449,13 @@  python populate_packages_prepend () {
     module_regex = '^(.*)\.k?o$'
     module_pattern = 'kernel-module-%s'
 
-    use_update_modules = oe.utils.contains('DISTRO_FEATURES', 'update-modules', True, False, d)
-    if use_update_modules:
-        postinst = d.getVar('pkg_postinst_modules', True)
-        postrm = d.getVar('pkg_postrm_modules', True)
-    else:
-        postinst = None
-        postrm = None
+    postinst = d.getVar('pkg_postinst_modules', True)
+    postrm = d.getVar('pkg_postrm_modules', True)
+
     do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.bin$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
     do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.fw$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
     do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.cis$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
-    do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='%skernel-%s' % (['', 'update-modules '][use_update_modules], d.getVar("KERNEL_VERSION", True)))
+    do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='kernel-%s' % (d.getVar("KERNEL_VERSION", True)))
 
     # If modules-load.d and modprobe.d are empty at this point, remove them to
     # avoid warnings. removedirs only raises an OSError if an empty