Jump to content

src.rpm how do I use source rpm


aperahama
 Share

Recommended Posts

From a ternminal, cd to the directory containing the src.rpm

 

su to root

 

rpm --rebuild whatever.src.rpm

 

After it is done compilling, it will leave you with an rpm in /usr/src/RPM/RPMS/i586

 

Cd to that directory and

 

rpm -ivh whatever.rpm

Link to comment
Share on other sites

I hate building rpms as root, I prefer creating my own rpmbuild directory for these kind of things:

 

 cd ~
cp -a /usr/src/RPM/  rpmbuild
echo '%_topdir %(echo $HOME)/rpmbuild' >> .rpmmacros

 

This is slightly adapted from what I did on fedora, I'd assume it'll work on mandrake too.

Link to comment
Share on other sites

rpmbuild --rebuild <name.src.rpm>

 

Used to be different.

rpm --rebuild

was to be done away with and

rpmbuild --rebuild

the new way but since rpm --rebuild is still around I'd imagine they do the same/call the same scripts. You use to actual get errors with rpm --rebuild and didn't with rpmbuild --rebuild when nvidia was still available as src.rpm's. Which was proof enough for me that they were different. I don't mess with src.rpms anymore. If I need source I use the tarballs so I don't know what the story is anymore with the 2 commands. Point is, use rpmbuild.

Link to comment
Share on other sites

# rpmbuild --rebuild <pack.src.rpm>

If anything goes wrong (dependencies that should not be there, or something else), you can try

# rpm -i <pack.src.rpm>

# cd /usr/src/RPM

# <edit with vi or other...> SPECS/<pack>.spec (adapt as needed)

# rpm -bb ./SPECS/<pack>.spec

If still things go wrong, get sources from /usr/src/RPM/SOURCES.

 

Yves.

Link to comment
Share on other sites

Could some one briefly tell us what the pros and cons are of installing using each of the above methods,ie. binary rpms, source rpms, and source tarball.

 

Obviously binary rpms have the advantage of being the easiest for a newb and it seems the tarballs have the advantage of being available soonest since they are not platform dependent. How about the source rpms? I've never used them.

Edited by cptaylor
Link to comment
Share on other sites

A source rpm basically contains the source code, any patches and a SPEC file. The SPEC file allows the creation of a binary rpm as it contains all the necessary data for their production, such as which source code to use, what files will be produced etc.

 

Basically you should only need a src rpm if a binary isn't available or you want to build your own rpm with a newer version of a program or a different patch applied.

 

It is best to build new rpms as a mortal user so processes are unneccessairly running as root from the newly created binary, its more secure..

Link to comment
Share on other sites

RPM are good for dependancy tracking. Using RPM also makes it easier to uninstall, and:

- to know what files are part of a given package,

- to know what package a file belongs to,

- to make sure one package's files won't override another's.

...

That's why if you have choice between package-A.B.C.tgz, and package-A.B.C-src.rpm (which is basically the same, plus a spec file), you'd better try first with the src.rpm. And you don't need to download the .tgz file because in case of failure with the src.rpm file, you can break it apart and get the source tarball from inside (see previous post).

 

That being said, I do a lot of tarball installing. But I am very prudent at it:

- I always (as far as possible) compile with --prefix=/opt/<packagename>, so that all my compiles end-up under /opt/ after make install.

- I wrote a script that "installs" man, bin, sbin, include, lib... from /opt/<prog>/ into /usr/local/ using symlinks (in the spirit of GoboLinux) while taking care of conflicts; And another script that is for uninstall.

 

Yves.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...