wiki:svn2rpm.sh

The "svn2rpm.sh" script

Objective

Updates the package repository, so that the source tarball of a given package will have the latest source code from the software repository.

Where to get it

The script is in the SVN caixamagica repository at:

svn2rpm.sh

To use it you should check out the entire directory with the following command:

svn co http://contribsoft.caixamagica.pt/repo/caixamagica/scripts/cmbuild

Config Files

This script uses the following configuration files:

svn_fonts: This file indicates for each RPM SOURCE package which software repositories should be checked out from the Caixa Mágica SVN server

tarball_files: This file indicates wich files/directories from the software repositories should be added to the source tarball and where inside the tarball they should be placed. There can be more than one line for each RPM package, in case there are multiple files from diferent software repositories tha need to be added to the tarball.

tarball_names: This file indicates for each RPM SOURCE package the name of the tarball to be made, it's type (bz2, tgz, tar, etc), and, if necessary, the file where the version number is (usually it's in the Makefile) to use in any directory, file or the tarball name

Usage

./svn2rpm.sh <package_name> [--initial] [--commit] [--tarball] [--cmmdv]

package_name -> Name of the package whose source RPM we want to use.

Options:

--initial -> First download of the package. Default option;

--commit -> Commits the SOURCE and SPEC files to the packages SVN;

--cm -> It will use the Caixa Magica repository. This is the default repository;

--mdv -> It will use the Mandriva repository.;

--tarball -> Creates a new tarball for the package, using the latest source code.

--all -> The same as "--initial --commit --tarball".

Example:

I've updated some source files files in the software repository "drakx-net", that are installed with the package "drakx-net", an I want to make sure that the Packages repository gets updated, so that I can create an updated "drakx-net" package using the svnbuild.sh script.

Step 1: Find out what is the source RPM for the "drakx-net" package

Doing the command "rpm -qi drakx-net" I found that it uses the "drakx-net" source package.

Step 2: Find out which software repositories are needed to create the source files for the "drakx-net" source package.

This has to be done manually, by checking out the "drakx-net" source package and analysing the sources it uses.

I've found that it uses the files from the "drakx-net/trunk" software repository, so I must make sure the the configuration file svn_fonts has this information. If not I must add the following line to it:

drakx-net->drakx-net/trunk

If more repositories were used, justa add them in the end of the line separated by spaces:

drakx-net->drakx-net/trunk another_repo and_another_repo

Step 3: With steps 1 and 2 already made, I can now do an initial checkout of the package, by issuing the command:

./svn2rpm.sh drakx-net --initial

This will checkout the current source and spec files of the Packages repository, and also all the needed files from the software repository.

Step 4: Find out the name of the tarball to be created, the type and, if necessary, the file from which to retrieve the current version number.

Search for the Makefile in "SOURCES/source_name";

Search for the tarball in "PACKAGES/package_name>/SOURCES/";

I've found that the tarball name is drakx-net-_VERSION_.tar.bz2 (_VERSION_ will be replaced with the actual version number) and the version information is in the file "drakx-net/trunk/Makefile" in the software sources, so I must make sure the the configuration file tarball_names has this information. If not I must add the following line to it:

drakx-net->drakx-net-_VERSION_ tar.bz2 drakx-net/trunk/Makefile

Step 5: The last configuration to be made is to make sure that correct files are added to the tarball

Again this must be done manually the first time, by opening the current tarball and finding out from which software repository did each file came from.
In this example, it was clear that the drakx-net tarball was the exact contents of the trunk of the drakx-net software repository, so I must make sure the the configuration file tarball_files has this information. If not I must add the following line to it:

drakx-net->drakx-net/trunk/* drakx-net-_VERSION_/

For each file or directory to be added to the tarball I can create a new line with information about it, so that I can add to the tarball files from different locations. Example:

drakx-net->drakx-net/trunk/* drakx-net-_VERSION_/
drakx-net->drakx-global/trunk/directory/test drakx-net-_VERSION_/global/test_2

In this example the tarball for the drakx-net Source RPM will have the contents of the files from the "drakx-net/trunk/" directory, and also the file "drakx-global/trunk/directory/test" which will be added to the root of the tarball in a directory called "global", and with the name ""test_2"

Step 6: If all the config files are OK, then we can make the tarball issuing the command:

./svn2rpm.sh drakx-net --tarball

Step 7: Finnaly, if all is well we can commit the tarball to the SVN packages repository with the command:

./svn2rpm.sh drakx-net --commit

TO DO's

Last modified 12 years ago Last modified on Aug 9, 2007, 12:34:34 PM