Hide Forgot
Description of problem: Uninstalling kmod packages built with kmodtool fails due to the %preun scriptlet Version-Release number of selected component (if applicable): redhat-rpm-config-9.0.3-25.el6.noarch How reproducible: always Steps to Reproduce: 1. Build a kmod package with kmodtool 2. Install kmod package from step 1 3. Attempt to uninstall kmod package Actual results: # rpm -e kmod-hellop error: ^%{kmod_version}$: regcomp failed: Invalid content of \{\} error: %preun(kmod-hellop-0.5-1.el6.elrepo.x86_64) scriptlet failed, exit status Expected results: The package uninstalls cleanly Additional info: The error is due to the %preun scriptlet in kmodtool: cat <<EOF %preun -n kmod-${kmod_name}${dashvariant} rpm -ql kmod-${kmod_name}${dashvariant}-%{kmod_version}-%{kmod_release}.$(arch) | grep '\.ko$' > /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules EOF The following code fixes the issue: cat <<EOF %preun -n kmod-${kmod_name}${dashvariant} rpm -ql kmod-${kmod_name}${dashvariant}-%{version}-%{release}.$(arch) | grep '\.ko$' > /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules EOF
Are you using the %kernel_module_package RPM macro to build your package?
No, I'm just building with rpmbuild as we do on RHEL5: rpmbuild -ba --target=`uname -m` foo.spec Looking in the %kernel_module_package RPM macro, I see %{kmod_version} and %{kmod_release} are defined there so that is probably my mistake. Thanks for the heads up.
No problem. I see you pinged me on IRC earlier. I apologize that I missed you. I have been operating on various timezones over the past few days (not physically, just long hours). Please do ping me again Thu or Fri afternoon.
No worries Jon - just wanted to run this past you before filing a bug if you were around. As I didn't explain very well above, we are still calling kmodtool's rpmtemplate in our SPEC file for RHEL6 builds, much like we did for RHEL5, hence why %{kmod_version} and %{kmod_release} throw up errors when the %preun scriptlet is run. %{expand:%(%{kmodtool} rpmtemplate %{kmod_name} %{kversion} %{kvariants} 2>/dev/null)} I hope to get some time this weekend to take a closer look at the %kernel_module_package macro.
I meant to say before, I don't consider this a bug. As I mentioned, those two macros: %kmod_version and %kmod_release are defined as a result of using %kernel_module_package. We have since spoken by email about RHEL6, and the process of using these macros. So, I'm going to close this bug now and then we can discuss the best way for you to use the RHEL6 macros. If you don't want to switch to %kernel_module_package (yet), then you can of course just define those two macros yourself for now (and for "legacy" RHEL6 packages that already might exist). Jon.