On Thu, Feb 08, 2007 at 01:08:43PM +0500, Tahir Saleh wrote: > My status is that iam learning to create a spec file 4 rpm.While creating > it i account certain problems. Hi. There's a lot of problems in your sample spec file, actually. where to begin. > First problem is that while running the %prep section there is creation of > an extra directory on path usr/src/redhat/BUILD naming Sbull-1.1 untaring > within it sbull-1.1({pakagename}-{ver}) (Source file)rather than untaring > sbull-1.1 directly on to the BUILD. That's because you did "%setup -c" -- you're telling it to do exactly what you describe. > Second problem is while running the %install section at the time of > installing rpm it could not find binary and source files.If it helps iam And that's because of everything else that's wrong. :) > attaching the spec file,illustrating the list of tared files below,tared > within directory sbull-1.1. > GPL > sbull.c > Makefile > sbull.1 Comments follow the lines from your spec file: > %define pkg sbull > %define ver 1.1 There's no need to do that. The Name and Version tags define the right macros automatically. > %define install_path opt/tahir2/ Again, not usually useful. > SUMMARY:A simple ramdisk. It's normal to put the tags, like "Summary" in lower case. Additionally, that might be a bit *too* concise of a summary. > NAME:Sbull Should be: Name: sbull Keep the capitalization here matching that of the package. > VERSION:1.1 > RELEASE:1 Version: 1.1 Release: 1 > URL:Nil If there isn't a URL, just leave out the tag. Better to provide an actual pointer to the project's web site, though. > COPYRIGHT:GPL "Copyright" should now be "License." > GROUP:System Environment/kernel This can be whatever you want, but one recommended practice is to make this match the closest from /usr/share/doc/rpm-*/GROUPS and not to add anything new -- even if there's not a great match there. > SOURCE:sbull-1.1.tar.gz Ideally, this would provide a full URL for the package, but not necessary. > PATCH:Nil Again, if there's no patches, just leave this tag out completely. > BUILDROOT:_/usr/src/redhat/BUILD/Sbull-1.1/sbull-1.1 Nope -- this will break things. The buildroot is where your program is "built" into an RPM, *not* where it's compiled. The proper thing to do is to use the following line (or similar) in every package: BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Don't change anything -- just copy it in like that. > prefix: usr/src/redhat/BUILD/Sbull-1.1/sbull-1.1 Again, no. You should probably just leave PrefixL out entirely. > Packager: Muhammad Tahir Saleh <tahirsaleh@xxxxxxxxxxx> It's okay to put this in, but typically modern packages don't. > %description > It is a kernel based cache management system, programs a ram in such a way > that the ram provides faster acces to memory. An aside -- there are further complications with packaging kernel modules. See here for some gory details on one approach: <http://fedoraproject.org/wiki/Packaging/KernelModules> > %prep > %setup -c You just want "%setup" with no -c, as explained above. > %build > cd /usr/src/redhat/BUILD/Sbull-1.1/sbull-1.1 Don't change directory -- it'll happen automatically. Also, don't reference absolute paths, because it's not likely to be correct on all systems. > make clean Is this necessary? > make Okay, this line is correct. :) > #insmod sbull.ko > #rmmod sbull.ko Yeah, don't do that. > %install > rm -rf $RPM_BUILD_ROOT > install -D /usr/src/redhat/BUILD/Sbull-1.1/sbull-1.1/sbull.ko > ${RPM_BUILD_ROOT}/usr/bin/sbull The install section (as do the other sections) starts by automatically by changing to the directory where everything was compiled. So, don't refer to the full path (which as noted above isn't necessarily right anyway). Instead, just install -D sbull.ko ${RPM_BUILD_ROOT}/usr/bin/sbull Except, wait a second. A kernel module .ko doesn't go in /usr/bin at all. That's not going to be useful. But even if it were, good practice is to use the ${_bindir} macro instead of hardcoding /usr/bin. Like this: install -D someprogram ${RPM_BUILD_ROOT}%{_bindir}/someprogram > install -D /usr/src/redhat/BUILD/Sbull-1.1/sbull-1.1/sbull.1 > ${RPM_BUILD_ROOT}/usr/share/man/man1/sbull.1 Same deal with the macro: install -D sbull.1 ${RPM_BUILD_ROOT}/${_mandir}/man1/sbull.1 Although a kernel module shouldn't normally get a man page in section one. That's a different issue. > install -D /usr/src/redhat/BUILD/Sbull-1.1/sbull-1.1/GPL > ${RPM_BUILD_ROOT}/usr/share/docs/sbull-1.1/GPL Don't install docs here. Instead use the %docs macro in the %files section. > cd /usr/src/redhat/BUILD/Sbull-1.1 > cp -a sbull-1.1 /opt/ Wait, this is in the install section? What? > rpm -ivv --prefix /opt/tahir2 sbull-1.1-1.i386.rpm I'm a little bit confused. Whta is this doing here? > > rmmod sbull.ko And this? > %files > %dir /usr/src/redhat/BUILD/sbull-1.1/* > %defattr(-,root,root) First, the %defattr line should be the first thing after %files. Second, you're listing where the files will be *in your final package*, not where they are in your build area. So, pretending the above %install section is correct (ignoring the .ko issue and the man page section), you want: %files %defattr(-,root,root) %doc GPL %{_bindir}/sbull %{_mandir}/man1/sbull.1* > %clean > cd /usr/src/redhat/BUILD > rm -rf sbull-1.1 This section is used for cleaning the buildroot -- not the BUILD area. Two different things. > %post > mkdir /tahir2 > cd /usr/src/redhat/BUILD > cp -a sbull-1.1 /tahir2 > cd /usr/src/redhat/BUILD > rm -rf sbull-1.1 Remove the above completely. Hope this helps. -- Matthew Miller mattdm@xxxxxxxxxx <http://mattdm.org/> Boston University Linux ------> <http://linux.bu.edu/> _______________________________________________ Rpm-list mailing list Rpm-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/rpm-list