R-repo/setup for build
From Bioinformatics.Org Wiki
In overview, we perform the following steps:
- Rsync all the srpm
- Get the script smock.pl
- configure correctly the files for the repository:
- the smock.pl (one line to adjust)
- the mock config file
- run smock
In details below.
Contents |
Requirements
- For RHEL/CentOS you will need the EPEL repository (you should 'install' that repo now if you don't already have it).
For creating our repo we use the following packages:
- createrepo
- fedora-packager
- mock
- repoview
To install them, execute the following command as root:
yum install createrepo fedora-packager mock repoview
Once the packages installed, on CentOS you will need to run (with the user you are using for the builds):
rpmdev-setuptree
This will create the tree needed for the construction of rpm. It will be similar to:
rpmbuild/ ├── BUILD ├── BUILDROOT ├── log ├── RPMS ├── SOURCES ├── SPECS └── SRPMS
We also need the following script:
- smock.pl
Which can be downloaded here:
http://git.annexia.org/?p=fedora-mingw.git;a=blob_plain;f=smock/smock.pl
NB: After installing mock, you will need to add your user to the mock group. Without this step mock will not work properly when called as your user (it will ask for the root password which is not something you want).
Configure the system
In the following examples, I used ~/repo as the location of the local copy of the repository.
Here is the tree structure of ~/repo:
repo/ ├── RPMS │ ├── epel-5 │ ├── fedora-11 │ ├── fedora-12 │ ├── fedora-13 │ └── scratch └── SRPMS
You should create the folders ~/repo/{SRPMS|RPMS} (or wherever you decide to put it). The various sub-folders under RPMS will be generated automatically by smock.
Retrieve the files from the CVS
R-repo has a cvs module on the cvs from bioinformatics.org
Please follow the instruction on Concurrent_Versions_System to use the CVS from bioinformatics.org.
Once you have set up your client and run the cvs co r-repo you will see this structure:
r-repo ├── CVS ├── scripts └── specs
The specs folder contains the spec file for all the rpm of r-repo.
The scripts file contains usefull scripts for the project.
Configure smock.pl
- Put smock.pl into ~/bin
- Update the lines of smock.pl:
from
my $localrepo = $ENV{HOME} . "/public_html/smock/yum";
to
my $localrepo = $ENV{HOME} . "/repo/RPMS";
Configure mock
- Update mock's configuration file
add to the list of repositories the following section
[smock] name=smock baseurl=file:///home/USER/repo/RPMS/ARCH/$basearch enabled=1 keepcache=0
replace
- USER by the name of your user
- ARCH by the name of the architecture you are building for (i.e. fedora-13, epel-5)
Generating the srpm
Because of the difference between the rpm version on RHEL and Fedora, we can not use the srpm from one onto the other. We therefore need to reconstruct the srpm from the spec file (reason why we use this specs folder in the cvs).
In order to do this, the script GenerateSrcRpmOfSpec.py will help you.
This script takes all the spec in the folder defined line 76, download the source and build the srpm.
So to rebuild all the srpm, just adapt the line 76 of the script to make it point to the specs folder from the cvs and run the script.
Test your setting
Before running on the complete list of SRPMs you might want to test if your settings are correct, to do so run:
smock.pl --arch=i386 --arch=x86_64 --distro=fedora-13 ~/repo/SRPMS/R-aaMI-1.0.1-1.fc12.src.rpm smock.pl --arch=i386 --arch=x86_64 --distro=epel-5 ~/repo/SRPMS/R-aaMI-1.0.1-1.fc12.src.rpm
This will generate the cache for mock for these two distro and these two architectures.
If the builds pass, you will have the output in the folders:
repo/RPMS/fedora-13/i386 repo/RPMS/fedora-13/x86_64 repo/RPMS/epel-5/i386 repo/RPMS/epel-5/x86_64
If the builds failed, you will have all the logs in the folders:
repo/RPMS/scratch
Note that you can also monitor the builds while they are happening through this folder
Building
Once you system is set-up and your tests have passed, you will be able to rebuild all the SRPM for the system and architecture of your choice using for example:
smock.pl --arch=i386 --arch=x86_64 --distro=fedora-13 ~/repo/SRPMS/*.src.rpm --keepgoing
(Be aware that it might take some days... ;-) ).
Building EPEL-5 on Fedora
Fedora has a newer version of rpm than RHEL, so far no big deal, except that among the changes are the switch from md5 to sha1!
This change makes rpm from Fedora and RHEL not being able to speak to each other. The simplest solution is then to regenerate the srpm using rpmbuild-md5.
This will generate a rpm which can be understand by epel-5 and therefore built in mock.
(As a side note, Fedora's builder uses a modified rpm version available at: http://infrastructure.fedoraproject.org/builder-rpms/x86_64/)