kernel.spec: reverse dependency logic for moving packages between kernel and kernel-modules-extra

The logic to process mod-extra.list finds modules that depend on
the modules in that list and includes those in kernel-module-extra
as well.  This logic is broken, because it does not account for
multi-layer dependency chains.  Specifically, if a module depends
on another module, and only the second one depends on something in
mod-extra.list, then only the second would get moved.  This leaves the
first module in the kernel package, resulting in WARNING messages
when the kernel rpm is installed:

Preparing...                ########################################### [100%]
   1:kernel                 ########################################### [100%]
WARNING: /lib/modules/3.2.0-0.rc3.git1.2.fc14.x86_64/kernel/drivers/scsi/bnx2fc/bnx2fc.ko needs unknown symbol cnic_register_driver
WARNING: /lib/modules/3.2.0-0.rc3.git1.2.fc14.x86_64/kernel/drivers/scsi/bnx2fc/bnx2fc.ko needs unknown symbol cnic_unregister_driver
WARNING: /lib/modules/3.2.0-0.rc3.git1.2.fc14.x86_64/kernel/drivers/scsi/bnx2i/bnx2i.ko needs unknown symbol cnic_register_driver
WARNING: /lib/modules/3.2.0-0.rc3.git1.2.fc14.x86_64/kernel/drivers/scsi/bnx2i/bnx2i.ko needs unknown symbol cnic_unregister_driver
WARNING: /lib/modules/3.2.0-0.rc3.git1.2.fc14.x86_64/kernel/drivers/usb/wusbcore/wusb-wa.ko needs unknown symbol wusbhc_reset_all
WARNING: /lib/modules/3.2.0-0.rc3.git1.2.fc14.x86_64/kernel/drivers/usb/wusbcore/wusb-wa.ko needs unknown symbol wusbhc_handle_dn
WARNING: /lib/modules/3.2.0-0.rc3.git1.2.fc14.x86_64/kernel/drivers/usb/wusbcore/wusb-wa.ko needs unknown symbol wusbd
WARNING: /lib/modules/3.2.0-0.rc3.git1.2.fc14.x86_64/kernel/drivers/usb/wusbcore/wusb-wa.ko needs unknown symbol __wusb_dev_get_by_usb_dev
WARNING: /lib/modules/3.2.0-0.rc3.git1.2.fc14.x86_64/kernel/drivers/usb/wusbcore/wusb-wa.ko needs unknown symbol wusbhc_giveback_urb
WARNING: /lib/modules/3.2.0-0.rc3.git1.2.fc14.x86_64/kernel/drivers/usb/wusbcore/wusb-wa.ko needs unknown symbol wusb_dev_destroy
WARNING: /lib/modules/3.2.0-0.rc3.git1.2.fc14.x86_64/kernel/drivers/usb/atm/xusbatm.ko needs unknown symbol usbatm_usb_disconnect
WARNING: /lib/modules/3.2.0-0.rc3.git1.2.fc14.x86_64/kernel/drivers/usb/atm/xusbatm.ko needs unknown symbol usbatm_usb_probe
WARNING: /lib/modules/3.2.0-0.rc3.git1.2.fc14.x86_64/kernel/net/bridge/netfilter/ebtable_broute.ko needs unknown symbol br_should_route_hook

This patch reverses that logic, so that anything in kernel with
a dependency on something in mod-extra.list will cause the module
in mod-extra.list to be treated as if it was _not_ in that list.
This prevents the WARNING lines above.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
John W. Linville 2011-12-02 13:02:03 -05:00 committed by Josh Boyer
parent 42087d6524
commit 8be461cb79

View File

@ -1655,6 +1655,7 @@ BuildKernel() {
# Look through all of the modules, and throw any that have a dependency in
# our list into the list as well.
rm -rf dep.list dep2.list
rm -rf req.list req2.list
cp %{SOURCE16} .
for dep in `cat modnames`
do
@ -1667,12 +1668,16 @@ BuildKernel() {
then
continue
else
echo $dep >> dep.list
echo $mod.ko >> req.list
fi
done
done
for mod in `cat mod-extra.list`
sort -u req.list > req2.list
sort -u mod-extra.list > mod-extra2.list
join -v 1 mod-extra2.list req2.list > mod-extra3.list
for mod in `cat mod-extra3.list`
do
# get the path for the module
modpath=`grep /$mod modnames`
@ -1690,7 +1695,8 @@ BuildKernel() {
mv $mod $newpath
done
rm modnames mod-extra.list dep.list dep2.list
rm modnames dep.list dep2.list req.list req2.list
rm mod-extra.list mod-extra2.list mod-extra3.list
popd
# remove files that will be auto generated by depmod at rpm -i time