[WBEL-users] editing and src rpm

Phil Schaffner Philip.R.Schaffner@NASA.gov
Thu, 15 Apr 2004 11:28:10 -0400


On Thu, 2004-04-15 at 10:17, scty Library wrote:
> Hello all,
> 
> I would like to edit the freetype src rpm and then
> create a new rpm.  Now I know what file has to be
> edited in the source but I don't know how to make it
> an bin rpm again that will install the files in
> exactly the same place as the distro installed it.  If
> anyone could point me in the right direction it would
> be greatly appreciated.
> 
> 
> Thanks all
> Dominic

One could write a book on this.  May want to check out
http://www.rpm.org/max-rpm/index.html

Briefly:

# rpm -ivh freetype-2.1.4-4.0.src.rpm
# cd /usr/src/redhat/SPECS

>From here on, it depends on the details of what you want to accomplish.
Inspect freetype.spec in the above directory.  You will want to unpack
the relevant sources (in ../SOURCES).

# rpmbuild -bp freetype.spec
will unpack in ../BUILD/ and apply existing patches. If your patch does
not overlap with others you can use that directory structure for your
edits.  Otherwise unpack the tarball(s) elsewhere and make changes
there.

In either case you probably want to create a duplicate directory tree
with cp -al <source-tree-dir> <modified-source-tree-dir> so you can
create a patch file against the unmodified sources.

After making your changes, create a patch file (see *.patch in the
SOURCES directory for examples, and add yours there also, for instance
"freetype-my-hack.patch")  then edit freetype.spec to add in your patch
(e.g. "Patch99: freetype-my-hack.patch") and increment the release
version (e.g "Release: 4.0.1").  Then in /usr/src/redhat/SPECS try:

# rpmbuild -ba freetype.spec

Fix any errors and repeat until you get new source and binary packages
built in ../RPMS/i386 and ../SRPMS.

Do "rpm -Fvh ../RPMS/i386/freetype-*" or move the packages to a local
repository and upgrade with yum or up2date.

Good luck,
Phil