Kevin,
If you have been given a src.rpm package, and you want to create an
installable version, then as the two previous posters mentioned, you
can either use:
rpm -i xxxx.src.rpm
rpm -ba xxxx.spec
Where the spec file is in the /usr/src/redhat/SPECS directory (for
RedHat, not sure about Mandrake).
Or:
rpm --rebuild xxxxx.src.rpm
In both cases, assuming there are no errors, you will get a newly
created src.rpm and <arch>.rpm. (For RedHat they will be in
/usr/src/redhat/SRPMS/ and /usr/src/redhat/RPMS/<arch>/ respectively)
Using the first method will leave all the intermediate files on your
hard drive. So you will be able to find the spec file in the
previously mentioned directory, the archived source (tar.gz, tar.bz...)
and any optional patches in the SOURCES directory, and the build
environment in the BUILD directory. This can be useful if you think
that you may want to go and look at the source or at any other files
that may not be installed in the final package.
The second method cleans up after itself, so there will be no spec ...
files left. Just the newly created rpm and src.rpm. This is good
where you want to install and forget about the original sources.
-- However --
I originally read your email to be asking how to create a src.rpm
package. If this is your question, then read on ...
You need the source data in an archive that RedHat understands, using
their naming conventions and directory structures. For example, the
"ytree" source is packaged in ytree-1.63.tar.gz. The source files in
that are stored in the appropriate directories under master directory
"ytree-1.63".
Put this source archive in the /usr/src/redhat/SOURCES directory.
Then create a *.spec file for your application in the SPECS directory.
It will look something like this (for ytree.spec):
Summary: ytree is a DOS-XTREE(tm) similar file manager.
Name: ytree
Version: 1.63
Release: 1
Group: Utilities/Text
Copyright: GPL
Source: sunsite.unc.edu:/pub/Linux/utils/file/managers/ytree-1.63.tar.gz
%description
Ytree is a nifty filemanager similar to xtree.
With some helper-applications (zip/zoo/tar etc.)
you can also browse archive files. Viewers for
"special" files are configurable (*.wav, *.gif etc.).
For a screenshot visit http://www.han.de/~werner/ytree.html
%prep
%setup
%build
make
%install
make install
%files
/usr/bin/ytree
/usr/man/man1/ytree.1
/root/.ytree
%clean
rm -f $RPM_BUILD_ROOT
This is a very minimalistic SPEC file, and does not use many of the
RPM features, however it does get the job done.
The sections you need are:
Summary: ......
You should know this
Name: ....
The package name without version information
Version: .....
The version number. This MUST match the version number in the source
archive name and the directory structure that is created when you
unpack the source archive.
Release: ....
What release of the RPM is this. Usually used when the program itself
hasnt changed, however something it relies on has changed (e.g. New
version of libc).
Group: Utilities/Text
What group do you want it installed into? To see what groups you are
already using, try `rpm -qa --qf "%{GROUP}\n" | sort | uniq`
Copyright: GPL
What copyright restricions has the author placed on this software?
Source:
sunsite.unc.edu:/pub/Linux/utils/file/managers/ytree-1.63.tar.gz
Where did you get this software from. You do not have to fully qualify
this, you can just list the source archive file, e.g.:
Source: ytree-1.63.tar.gz
%description
A nice text description of the package. Useful when you do an rpm -qi
<package>
%prep
If the source archive is in a single package of known format (e.g.
<package>.tar.gz or similar) then you do not need to do any special
work here. Normally this section is used for extracting data from
formats not handled automatically and for applying patches
%setup
If the source comes with a `./configure` you would normally add that
command here. Any commands entered here will be run in the base
directory of the source files. If you do not specify a build root
(which I have left out for simplicity) then they will be run in
/usr/src/redhat/BUILD/<package>-<version>/
%build
This is where you run the `make` commands or any other commands that
need to be run after setup
%install
This is where you run the `make install` commands, or manually copy
files (yuck) or whatever else is required.
%files
List the files that are installed by the `make install` command. If an
entire directory is to be package, just list the directory, not its
contents.
%clean
What to do to clean up.
--
When you have created the spec file, you can run `rpm -ba
<package>.spec` and it will create the <pkg>src.rpm and the <pkg>.rpm
files as detailed above.
Clear as mud?
Regards, Andrew
> From: Mike MacCana <[EMAIL PROTECTED]>
> To: Kevin Saenz <[EMAIL PROTECTED]>
> Cc: [EMAIL PROTECTED]
> Date: 12 Mar 2003 12:57:15 +1100
>
> rpmbuild --rebuild whatever.src.rpm
>
> Mike
>
> On Wed, 2003-03-12 at 12:17, Kevin Saenz wrote:
> > Hi all,
> >
> > I would like to build a src.rpm package does anyone know how to
> > do this? man pages only have either how to build from specfile
> > or source files.
--
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug