[packagers] help with packaging an rpm

Dave dmehler26 at woh.rr.com
Sat Nov 17 16:16:43 CET 2007


    Hello,
    This was originally posted to users but i was told of this list and 
thought it would be more appropriate for here.
    I'm running CentOS 5 and wanting to make rpms out of some software for 
eventual inclusion in rpmforge. I've got some rpm urls i can scare them up 
if needed and have learned a lot reading them, at least i know the process.
    The first package i'm trying to do is gnump3d as an rpm, and that's 
version 3.0. I've got the file and have created a .spec file. All goes well 
in the %prep stage, %build i've commented out as it isn't needed, the 
package is a perl base and all needs is a make install, which i handle in 
the %install section. I'm building as nonroot and the %install is failing 
when atempting to change permissions on a directory to 777, it's saying it 
doesn't have permission to do this. I thought i had my Buildroot defined 
wrong, so i looked at the samba rpm spec file and it was identical, so i am 
wondering what my issue is?
    I'm also going to have to patch the makefile or perform some other 
action on it. It defines the ManDir as /usr/local/man/man1 which is not 
standard, it works but i'd like this package to conform to rhel standards, i 
was thinking /usr/share/man/man1. Patch is new to me, perl is not, i could 
use a s//g; regexp in a one-liner to fix this, it seems simple, but it's 
beyound my knowledge at the moment.
    Lastly for now my %files definition i've got all the directories needed, 
identified files as docs or configs but am not sure i got all of them. How 
can i be sure on this point?
    I've included both the .spec file and the error typescript below.
    This is a first draft of this specfile and my first rpm atempt, so i 
don't expect this to be pretty, accurate, frankly i'm surprised %prep 
worked, any suggestions are welcome.
Thanks.
Dave.

gnump3d.spec
#
# Spec file for Gnump3d version 3.0
# For CentOS5
# May work on other RHEL or rpm-based distributions but i can not test it
#

Name: gnump3d
Version: 3.0
Release: 1
Group: Applications/Internet
#Group: Applications/Multimedia
Distribution: CentOS Linux
#Vendor:
#Url:
License: LGPL
Summary: GNUMP3d - The GNU Streaming MP3 / OGG Vorbis Server.
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Source: gnump3d-3.0.tar.gz

%description
The Gnu Mp3d mp3 and Ogg Vorbis server.

%prep
%setup -q

# %build
#/bin/cp rcfiles/redhat /etc/init.d/gnump3d

%install
make install
# make install Prefix=$RPM_BUILD_ROOT/usr

%clean
rm -rf $RPM_BUILD_ROOT

%post
/sbin/chkconfig --add gnump3d

%preun
if [ "$1" = 0 ] ; then
/sbin/service gnump3d stop > /dev/null 2>&1
/sbin/chkconfig --del gnump3d
fi
exit 0

%files
%defattr(-,root,root)
/etc/gnump3d
/usr/share/gnump3d
/var/cache/gnump3d
/var/cache/gnump3d/serving
/usr/share/man/man1
/var/log/gnump3d
%doc /usr/share/man/man1/gnump3d.*
%config /etc/gnump3d
%config /etc/init.d/gnump3d
%doc AUTHORS ChangeLog COPYING INSTALL README README.MacOSX README.Windows 
TODO
%attr(0755, root, root) /etc/init.d/gnump3d
%_mandir /usr/share/man

Build process:
$rpmbuild -ba gnump3d.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.73987
+ umask 022
+ cd /home/dmehler/redhat/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /home/dmehler/redhat/BUILD
+ rm -rf gnump3d-3.0
+ /bin/gzip -dc /home/dmehler/redhat/SOURCES/gnump3d-3.0.tar.gz
+ tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd gnump3d-3.0
++ /usr/bin/id -u
+ '[' 1001 = 0 ']'
++ /usr/bin/id -u
+ '[' 1001 = 0 ']'
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ LANG=C
+ export LANG
+ unset DISPLAY
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.56551
+ umask 022
+ cd /home/dmehler/redhat/BUILD
+ cd gnump3d-3.0
+ LANG=C
+ export LANG
+ unset DISPLAY
+ make install
install -d //etc/gnump3d
install -d //usr/bin
install -d //usr/share/gnump3d
install -d //usr/local/man/man1
install -d /`perl bin/getlibdir`/gnump3d/plugins
install -d /`perl bin/getlibdir`/gnump3d/lang
install -d //var/log/gnump3d
install -d //var/cache/gnump3d
chmod 777 //var/cache/gnump3d
chmod: changing permissions of `//var/cache/gnump3d': Operation not 
permitted
make: *** [install] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.56551 (%install)
RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.56551 (%install)



More information about the packagers mailing list