Why is rpmbuild installing package?

571 views Asked by At

Is rpmbuild actually installing packages I'm building? I'm trying to build an rpm package of kernel module. It runs fine up until it gets to the (%install). The error claims to not have permissions. It looks like it's trying to install the module. Is it safe to assume I'm doing this wrong, or my SPEC file is incorrect?

Output with Error:

[arozar@buildhost SPECS]$ rpmbuild -bb bypass.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.SbBJbR
+ umask 022
+ cd /home/arozar/rpmbuild/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /home/arozar/rpmbuild/BUILD
+ rm -rf bypass-9.0.6
+ /usr/bin/gzip -dc /home/arozar/rpmbuild/SOURCES/bypass-9.0.6.tar.gz
+ /bin/tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd bypass-9.0.6
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.nsuldT
+ umask 022
+ cd /home/arozar/rpmbuild/BUILD
+ '[' /home/arozar/rpmbuild/BUILDROOT/bypass-9.0.6-1.el6.x86_64 '!=' / ']'
+ rm -rf /home/arozar/rpmbuild/BUILDROOT/bypass-9.0.6-1.el6.x86_64
++ dirname /home/arozar/rpmbuild/BUILDROOT/bypass-9.0.6-1.el6.x86_64
+ mkdir -p /home/arozar/rpmbuild/BUILDROOT
+ mkdir /home/arozar/rpmbuild/BUILDROOT/bypass-9.0.6-1.el6.x86_64
+ cd bypass-9.0.6
+ LANG=C
+ export LANG
+ unset DISPLAY
+ rm -rf /home/arozar/rpmbuild/BUILDROOT/bypass-9.0.6-1.el6.x86_64
+ cd lib
+ make DESTDIR=/home/arozar/rpmbuild/BUILDROOT/bypass-9.0.6-1.el6.x86_64
make -C /lib/modules/2.6.32-504.23.4.el6.x86_64/build SUBDIRS=/home/arozar/rpmbuild/BUILD/bypass-9.0.6/lib modules
make[1]: Entering directory `/usr/src/kernels/2.6.32-504.23.4.el6.x86_64'
  CC [M]  /home/arozar/rpmbuild/BUILD/bypass-9.0.6/lib/bplib.o
  LD [M]  /home/arozar/rpmbuild/BUILD/bypass-9.0.6/lib/bypass.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/arozar/rpmbuild/BUILD/bypass-9.0.6/lib/bypass.mod.o
  LD [M]  /home/arozar/rpmbuild/BUILD/bypass-9.0.6/lib/bypass.ko.unsigned
  NO SIGN [M] /home/arozar/rpmbuild/BUILD/bypass-9.0.6/lib/bypass.ko
make[1]: Leaving directory `/usr/src/kernels/2.6.32-504.23.4.el6.x86_64'
+ '[' 2.6.32-504.23.4.el6.x86_64 '!=' 2.6.32-504.23.4.el6.x86_64 ']'
+ make install DESTDIR=/home/arozar/rpmbuild/BUILDROOT/bypass-9.0.6-1.el6.x86_64/lib/modules/2.6.32-504.23.4.el6.x86_64/kernel/lib/bypass.ko
make -C /lib/modules/2.6.32-504.23.4.el6.x86_64/build SUBDIRS=/home/arozar/rpmbuild/BUILD/bypass-9.0.6/lib modules
make[1]: Entering directory `/usr/src/kernels/2.6.32-504.23.4.el6.x86_64'
  Building modules, stage 2.
  MODPOST 1 modules
make[1]: Leaving directory `/usr/src/kernels/2.6.32-504.23.4.el6.x86_64'
# remove all old versions of the driver
find /lib/modules/2.6.32-504.23.4.el6.x86_64 -name bypass.ko -exec rm -f {} \; || true
find /lib/modules/2.6.32-504.23.4.el6.x86_64 -name bypass.ko.gz -exec rm -f {} \; || true
install -D -m 644 bypass.ko /lib/modules/2.6.32-504.23.4.el6.x86_64/kernel/lib/bypass/bypass.ko
install: cannot create directory /lib/modules/2.6.32-504.23.4.el6.x86_64/kernel/lib/bypass: Permission denied
make: *** [install] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.nsuldT (%install)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.nsuldT (%install)

Here is my .rpmmacros:

%_topdir %(echo $HOME)/rpmbuild

SPEC file:

%define build_kernel 2.6.32-504.23.4.el6.x86_64
%define current_kernel %(uname -r)
%define destdir /lib/modules/%{current_kernel}/kernel/lib
%define realname bypass
%define lib lib

Name:           %{realname}
Version:        9.0.6
Release:        1%{?dist}
Summary:        Silicom Bypass Kernel Level Library

Group:          Silicom Ltd.
License:        GPLv2+
URL:            http://www.silicom-usa.com
Source0:        http://www.silicom-usa.com/ProductDrivers.aspx/%{realname}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

# BuildRequires:  
# Requires:       

%description
Silicom’s Quad Port Copper Gigabit Ethernet PCI Express Bypass server adapter is a PCI-Express X8 network interface card that contains four ports on a PCI-E adapter.
Silicom’s Quad Port Gigabit Ethernet Bypass server adapter supports Normal, Disconnect and Bypass modes.

%prep
%setup -q

%install
rm -rf $RPM_BUILD_ROOT
cd %{lib}
make DESTDIR=$RPM_BUILD_ROOT

if [ "%{build_kernel}" != "%{current_kernel}" ]; then
echo "This RPM is for %{build_kernel} kernel version. Ensure that you are usining the right module/kernel combo"
exit 1
fi

make install DESTDIR=$RPM_BUILD_ROOT%{destdir}/bypass.ko

%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
# %doc



# %changelog
0

There are 0 answers