Here's something I got from someone else in this list

Date: Wed, 11 Aug 1999 12:07:02 +0300
From: Oren Tirosh <[EMAIL PROTECTED]>
Subject: Honey, I've RPMed the kids

 <snip>

> And one slightly related question:
> Do you know how how to "patch" a rpm package (repackage with very
> similar content and description, and keep the dependencies)?

The SRPM consists of a .spec file (installed to /usr/src/redhat/SPECS)
and one or more source and patch files (installed /usr/src/redhat/SOURCES)
To rebuild both the binary and source RPMs use:

rpm -ba /usr/src/redhat/SPECS/foo.spec

When building an RPM package it unpacks the source, applies any patches,
builds everything, installs into a temporary directory, verifies the .spec 
file list and only then, after successfully building a binary RPM it packs 
the spec and source files into a source RPM. There is no way to bypass this 
when creating a source RPM - this ensures that the source RPM is indeed 
valid and can be used to rebuild the package.  Of course, if the .spec or 
makefile have references to components outside the build environment which 
may not be available on other machines the resulting source RPM will not 
work for them.

The source tar in the SRPM is the original unmodified source from the
program author. Any changes are done using patches, spec file changes or 
adding extra source files.

Step 1: 
rpm -i foo-1.23.src.rpm
 This installs the spec and sources to /usr/src/redhat/{SPECS|SOURCES}

Step 2: 
rpm -bp /usr/src/redhat/SPECS/foo.spec
 This tells rpm to run only the %prep section of the spec file: unpack the 
 sources to /usr/src/redhat/BUILD/foo-1.23 and apply patches. 

 cd to the build directory, examine the source, make changes, run make, 
 test, etc.  Before changing sources keep a backup (foo.c.orig)

 You can use the actual commands in the spec file to compile:
   rpm -bc --short-circuit
 This tells rpm to run the %build section of the spec file. Short circuit
 means it will skip the %prep section to avoid overwriting the changes
 you made to the unpacked sources.
 
  rpm -bi --short-circuit
 Runs only the %install section of the spec file. Usually it installs 
 the package to /var/tmp/foo-root and creates there all the target 
 directories (/usr/bin, /usr/man/man1, etc). 

 When everything works ok you can generate the patches:
 In the BUILD directory type: 
  diff -u foo-1.23/foo.c.orig foo-1.23/foo.c > ../SOURCES/foo-fixit.patch

 Then add the patch file to the list of sources in the spec:
   Patch7: foo-fixit.patch
 And use the %patch macro to apply the patch in the %prep section
   %patch7 -p1 
 (or -p0, depending on how many path elements you need to strip)

 To test the patches use rpm -bp to rerun the %prep section which will
 erase the build directory, unpack the source and apply the new patches.
 After the patches apply cleanly you can test the %build and %install
 sections or just go all the way:
  rpm -ba /usr/src/redhat/specs/foo.spec

 If everything is ok it will build a binary and source rpms and put them in
 /usr/src/redhat/RPMS/i386/foo-1.23-2.i386.rpm
 /usr/src/redhat/SRPMS/foo-1.23-2.src.rpm

 Remember to update the revision number. The version number is the version
 of the original program, the revision is for modifications to the RPM.

        Oren

Tzafrir Cohen
mailto:[EMAIL PROTECTED]
http://www.technion.ac.il/~tzafrir


On Thu, 18 Nov 1999, Aviram Jenik wrote:

> Hi.
> 
> Could someone give me a short explanation how to create source RPMs? I'm
> successfully creating binary ones, but even after reading the outdated
> how-to (must be the worse how-to I've seen so far) and after trying to
> reverse-engineer various example I found on the net, I'm still clueless.
> 
> If someone can give me a hand here I'll really appreciate it; example spec
> files will also be welcomed.
> 
> Thanks.
> 
> -------------------------
> Aviram Jenik
> 
> "Addicted to Chaos"
> 
> -------------------------
> Today's quote:
> And so, my fellow Americans, ask not what you can do for your country;
> but ask what your country can do for you .
>                          - John F. Kennedy, Inaugural Address, 20 January
> 1961
>                          - ** rewritten by Megadeth
> 
> 
> 
> 
> =================================================================
> To unsubscribe, send mail to [EMAIL PROTECTED] with
> the word "unsubscribe" in the message body, e.g., run the command
> echo unsubscribe | mail [EMAIL PROTECTED]
> 
> 




=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to