[CentOS-devel] How Centos compiles SRPMs from Red Hat

Sat Apr 7 14:42:39 UTC 2012
Johnny Hughes <johnny at centos.org>

On 04/07/2012 08:24 AM, Peter Penzov wrote:
> I have some more questions:

You are still top posting ... please don't.

> 1. Do you use a cluster for building the source code or you take the
> SRPMs and manually copy/paste them into the building systems?

There are any number of build systems out there for different things.
There is the OBS (Open Build System from open SUSE ... Dell uses this
alot), Koji (the Scientific Linux system uses this), or plague (we use
this for CentOS-4 and CentOS-5).

However, we wrote our own build system for CentOS-6.

We basically use a beanstalk queue.  However, what you use does not
matter.  I still use scripts like the ones we initially used at the very
beginning of CentOS-3 as well.

> 2. What tool do you use to find differences into SRPMs? I don't believe
> that you extract the packets manually and compate the code with diff
> tool every time.

There is NO PROGRAM that I use.  I am a Unix system admin.  If I want to
do something, I use the tools I have been using for 20 years to do it.

In the case of looking at the inside of an SRPM, I would personally do
it this way.

1.  Download the redhat SRPM from here (for example, lets do the latest


and the centos SRPM


2.  Now you need to extract the SRPMS in to separate directories.  There
are many ways to do this.  2 ways are are to use "rpm2cpio" ...OR...
"rpm -Uvh"

If all want to do is to see the differences and not rebuild the pack, I
would use rpm2cpio like this:

 a. create a separate directory and put each SRPM in there.

 b. extract the RedHat SRPM like this:
    rpm2cpio firefox-10.0.3-1.el6_2.src.rpm | cpio -idv

 c. go to the directory with the CentOS SRPM in it and do this:
    rpm2cpio firefox-10.0.3-1.el6.centos.src.rpm | cpio -idv

 d. now do a diff of the two directories:
    diff -uNrp RHEL/ CentOS/

The output looks like this:


So, you can see that besides the actual SRPM files (which you know are
different and line 1 and 2 in the link) ... there are 3 other differences.

We added a file named "firefox-centos-default-prefs.js" (lines 4-18) and
removed a file named "firefox-redhat-default-prefs.js" (lines 20-34).

We also modified the SPEC file (lines 36-58)

(The changes are changing the name redhat to centos for sources 12 and
13 and a changelog entry ... note that since this is centos6 there is no
source 13)

3.  Every other file in those two directories are the same.


How would I compare every file ... I would script something to do it.

You could also create one directory named firefox, and you could (if you
had rpm and rpmbuild installed) also do it this way:

1.  download both files.

2.  Install the CentOS SRPM like this:

rpm --define "_topdir `pwd`" firefox-10.0.3-1.el6.centos.src.rpm
mv SPECS SPECS.centos

3. Install the Red Hat SRPM like this:

rpm --define "_topdir `pwd`" firefox-10.0.3-1.el6_2.src.rpm

4. do diffs for each dir like this:

diff -uNrp SPECS.rhel/ SPECS.centos/ > SPECS.diff
diff -uNrp SOURCES.rhel/ SOURCES.centos/ > SOURCES.diff

If you want to have a local git repo that tracks the differences, you
could do this instead:

1. download both files, put them in a firefox dir.

2.  Install the RHEL SRPM (the original file):

rpm --define "_topdir `pwd`" firefox-10.0.3-1.el6_2.src.rpm

3.  add the SPECS and SOURCES directories to the git repo (I don't like
to add bzipped or gzipped or tar files to git, so I exclude those from
the repos):

cd SPECS; git add *; cd ../

cd SOURCES; git add $(ls | egrep -v "\.bz2|\.gz|\.tar"); cd ../

4.  commit the changes to the git repo so you can track the centos
changes later:

git commit -m "initial rhel rpm imported"

5.  Repeat steps 2, 3 for the CentOS SRPM ...

  a.  Now you can see the spec diff doing:

git diff SPECS/

  b.  or the SOURCES diff doing:

git diff SOURCES/

6.  Now you can commit the CentOS changes to git:

git commit -m "initial centos rpm imported"

I am not going to also tell you how to do it for svn or some other VCS
system ... the bottom line is that there are a hundred different ways to
extract the original SRPMS and make changes and track the changes.

Once you do the changes to the SPEC file and the SOURCES, you rebuild
the SRPM and then submit that SRPM somehow to a build system (mock,
build locally, plague, koji, brew, OBS, ect.).  You can have any number
of build systems.

This is not rocket science ...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.centos.org/pipermail/centos-devel/attachments/20120407/78cf71a8/attachment-0005.sig>