New member, package review, questions about template .spec

Philip Prindeville philipp_subx at redfish-solutions.com
Mon Jan 23 08:45:00 CET 2012


Hi.

I've been developing packages for 6 or 7 years now, and I'm a contributor to Fedora (and occasionally EPEL).

I have the bad habit of buying discount hardware from vendors that do a poor job upstreaming their drivers into linux-next, so... I end up having to package (or repackage) drivers.

Most recently, the Perle Systems Speed/LE-8 PCI Octal serial card... but they mostly support Linux 2.2 and 2.4 and apparently aren't familiar with kbuild's.

Anyway, so I've taken their driver and repackaged it for rpmfusion.  My first cut is here:

ftp://ftp.redfish-solutions.com/pub/perle-serial-kmod-3.8.0-6.1.fc16.1.src.rpm

Anyway, I noticed the following things I had to change to the .spec file I cut and pasted from the Wiki to get it to work:

(1) added the lines

%define repo   rpmfusion
%define _name  foo

as %{repo} is undefined otherwise. This might be a glitch in my installing the rpmfusion stuff improperly.

Also, there are places (listed below) where you want the module name without the -kmod suffix.

(2) modified the line

Release:        1{?dist}.1

there's a missing "%" before the "{". And changed:

Name:          %{_name}-kmod

(3) modified the lines:

# needed for plague to make sure it builds for i586 and i686
ExclusiveArch:  i586 i686 x86_64 ppc ppc64

not sure why "ppc" and "ppc64" are included... that seems to contradict the accompanying comment (which probably should mention x86_64 but doesn't).

(4) added the lines:

%package common
Summary:       Foo userland files.
Group:         System Environment/Kernel
Requires:      %{name}

%description common
Userland support for Foo.

as well as the lines:

%files common
%defattr (-,root,root,-)
%config(noreplace) %{_sysconfdir}/modprobe.d/%{_name}.conf

%post common
/sbin/modprobe %{_name}

%preun common
/sbin/modprobe -r %{_name}

further down. My modprobe.d/foo.conf file is %{SOURCE1} in my .spec.

(5) commented out this line:

kmodtool  --target %{_target_cpu}  --repo %{repo} --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null

(6) modified the loop:

for kernel_version in %{?kernel_versions} ; do
    cp -a foo-%{version} _kmod_build_${kernel_version%%___*}
done

to use %{_name} instead of "foo".


(7) modified the loop:

for kernel_version in %{?kernel_versions}; do
    make install DESTDIR=${RPM_BUILD_ROOT} KMODPATH=%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}
    # install -D -m 755 _kmod_build_${kernel_version%%___*}/foo/foo.ko  ${RPM_BUILD_ROOT}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/foo.kmod
done

this shouldn't install into .../foo.kmod but into ".../foo.ko" instead.

(8) added the lines to the %install section:

mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/modprobe.d/
%{__cp} -p %{SOURCE1} ${RPM_BUILD_ROOT}%{_sysconfdir}/modprobe.d/%{_name}.conf

Please review my package and let me know if I'm mistaken about any of the changes above, or if they should be integrated into the Wiki.

Thanks,

-Philip


More information about the rpmfusion-developers mailing list