I’m trying to make my own rpm and I did so. It has succeeded to build the rpm and at the same time has installed it (rpmbuild -ba).
But when I build only the source and the binary and I try to install it with rpm -i *.rpm, it says it has installed the rpm, but it is nowhere and I can’t launch it.
When I try to “reinstall” it, it prompt me that the package is already installed…
On 2013-10-24 19:46, kamikaz92 wrote:
>
> Hi,
>
> I’m trying to make my own rpm and I did so. It has succeeded to build
> the rpm and at the same time has installed it (rpmbuild -ba).
> But when I build only the source and the binary and I try to install it
> with rpm -i *.rpm, it says it has installed the rpm, but it is nowhere
> and I can’t launch it.
What can’t you launch, the install or your program?
–
Cheers / Saludos,
Carlos E. R.
(from 11.4, with Evergreen, x86_64 “Celadon” (Minas Tirith))
Good point, I thought it already had included the executable file in the rpm when building it.
Now, how can I include this file ? It is in my “/usr/src/packages/SOURCES/test-1.0” directory and the %file section look in the “/usr/src/packages/BUILDROOT” directory. Does that mean I have to copy my rpm in the buildroot ?
Well, apparently you never created an RPM before, have you?
Here’s an overview: Building RPMs
For this case, have a look at “6.8 Files” especially.
So in short: That “%make_install” in the %install section copies your files to buildroot (it “installs” them during the build). For the files to actually be in the RPM (and be copied by RPM into the system when you install it), you have to list those files in the %files section, as I already said.
F.e. let’s say, compiling your tarball results in a program /usr/bin/test (during the build with rpmbuild it will not be copied to /usr/bin/ but %buildroot/usr/bin/ instead, but just forget about that detail for now). For /usr/bin/test to be in the RPM, you would have a %files section like this:
%files
%defattr(755,root,root)
/usr/bin/test
There are rpm macros you can use though, so this could f.e. also be:
You have to do this for all other files that are installed by “make install” as well. In fact if you build your RPM on OBS it will fail if it creates any files not listed in %files (rpmbuild should give a warning by default). If you specify a directory there, all the files in that directory get included as well.
HTH. Maybe also have a look at existing spec files.
Or just use “checkinstall” to create an RPM from the source tarball, you don’t need to write a spec file then.
You’re welcome.
Btw, that documentation is included in the rpm package as well.
Just point your browser to /usr/share/doc/packages/rpm/RPM-HOWTO/index.html