[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: src.rpm



> 
> > 1: I believe someone said that you can re-create the original directory
> > structure (used for creating) of an rpm package by using the src.rpm. Is
> > this true, and how? I want to check if there aren't too much files in
> > it.
> Yes, you can recreate it. 
> rpm -i my_package.src.rpm
> This has the following effects:
> * the spec file gets unpacked into SPECS
> * the source archive, patches, and any additional files needed for the
>   package (e.g. sample config files) go into SOURCES
> 
> Thus. you are now ready to build the binary package with 
> rpm -bb my_package.spec
> if you so choose.
> 

A precision here: rpm -bb is for rebuilding a package built by someone
else, in case you are the original author you would also want the SRPM
and in that case you use "rpm -ba"


> > 2: Further on that: I put the files of all the 3 packages in the BUILD
> > etc. dirs before building the 3 rpms. Does this mean that a single
> > package contain all the files for the 3 packages (so including those
> > files not being used by it)?
> No, only files which are listed in the spec file will be included; any
> extra files lying around will always be ignored.
> 

Notice that if you list a directory everything under it will be included.

Now there are some cases where you want to include a directory but not
all of its files.  You could omit the directory but in tha case it
would be unowned and would not be removed when the user uninstalls the
package.  Solution is to use the %dir clause.  This includes the
directory in the package but not what is under it.

Another trick is to use the "%files -f filename packagename".  The
file will cotain a list of files to be included in the package thus
making possible dynaic building of the file list.

> > 3: I'm confused by the SOURCES and BUILD directories. When do you switch
> > from one to the other, when is one used, etc.?
> SOURCES is where the source archives you're working with go originally.
> BUILD is used by rpm as a working directory; rpm unpacks the source archive
> (tar.gz or tar.bz) into BUILD and proceeds to build the software there.
> 

when you do an 'rpm -i mysourcerpm' than it puts the spec file in
SPECS and the source and patches in SOURCES directories.

rpm -bp Specfile

will untar the sources and apply patches

rpm -bc Specfile
will do the above and compile the software.

rpm -bi Specfile

will do the above and additiion wil build the installation tree for
the softwre.  This will trash your if you don't use the BuildRoot
cluase.  Then you can study what files have been installed and list
them in the %files section.  By the way 'rpm -bi checks that the files
listed in %files exist so this is acleaner way to check you didn't
forget anything than removing the %clean clause.

rpm -bb Specfile

will do waht rpm -bi does but in addition will put the install tree
into a compressed cpio with a header.  That is an RPM

rpm -ba Specfile
 will do what rpm -bb does and in addition will put
the sources, patches and spec into an SRPM. 

Don't forget the --shortcircuit clause for debugging purposes.

-- 
			Jean Francois Martinez

Project Independence: Linux for the Masses
http://www.independence.seul.org