When I noticed that Novell does not offer RPMS of Mono 2.0 for RedHat Linux, I had a look at the Fedora 10 Beta and found that there is a Mono 2.0 Source RPM:
mono-2.0-6.fc10.src.rpm
Update: mono-2.0.1-12.fc10.src.rpm

Because we work with CentOS4/RedHat Enterprise Linux 4, I installed the source package on that system, and tried to build the rpms.

Building the code was fine after I deactivated a couple of dependencies.
But I ran into some problems at the file checking stage. I wondered if I can prevent the build stage to happen again and again. That way I should be able to debug the file list check etc.

Reading the man page, these parameters are interesting:

--short-circuit
--nobuild
-bi
-bl

So with rpmbuild -bl mono.spec I was able to just run the file checking stage.

The errors I got were like this:
rpm build errors: File not found: /var/tmp/mono-2.0-6-root-root/usr/bin/certmgr/usr/bin/chktrust/usr/bin/gacutil/usr/bin/gmcs/usr/bin/mcs/usr/bin/mcs1

But the files do exist in the /var/tmp/mono-2.0-6-root-root/ directory

I finally realised that the problem was caused by the Macros.
see also http://rpm.org/wiki/PackagerDocs/Macros
I had to first add curly brackets to each Macro call:
%{macro parameters}
But even then only the first line of the Macro had an effect.
This command was helpful in the files section to see that the Macros just were not resolved correctly:
%{echo: %{your_macro_here}}

In the end, I ended up adding the missing files to my own mono.spec file.
I also had a look at the last available RedHat spec file from Novell for Mono 1.9.x, and I guess there is a different rpm version for RHEL 4 and RHEL 5.

Here is my modified mono.spec file that works for RHEL4/CentOS4 for Mono 2.0:
http://download.pokorra.de/mono/mono.spec

Please download the src.rpm file from the Fedora 10 Beta, or later, and install it:
rpm -i mono-2.0-6.fc10.src.rpm
Then copy my modified mono.spec to /usr/src/redhat/SPECS, and build the packages:
rpmbuild -ba mono.spec

Alternatively, here is a zip file with the compiled RPM files for CentOS4/RHEL4:
mono-2.0-6.i386.rhel4.rpm.zip
I cannot guarantuee that it actually works, but feel free to use it for your own experiments!

Config files in RPM files   November 19th, 2007

see this very helpful description of RPM, %config, and (noreplace) by Jon Warbrick

all about when files are stored with extension .rpmnew or .rpmsave, and when the current file is actually replaced with the new file

Tags: , ,
Posted in Software Development | Comments Closed

Use patched files in RPMs   November 17th, 2007

see Packaging software with RPM

diff -uNr the_package/the_file \
the_package/the_file.new > the_file.patch

copy the patch file to /usr/src/redhat/SOURCES

The spec file has those lines:

After Sources:
Patch0: the_file.patch

After %setup, before %build

%patch -p1

To get your new version from the original file:
patch slapd.conf.template \
../../slapd.conf.template.patch \
-o slapd.conf.template.new

Tags: , ,
Posted in Software Development | Comments Closed

Package a Perl module   November 17th, 2007

First check if somebody did already the job, e.g. on artfiles.org RPMS (SRPMS) or just for RPMS: RPMPan or this search site: Linux Software Directory .

You need to install perl-Archive-Tar-1.08-2.noarch.rpm and perl-RPM-Specfile-1.17-1.noarch.rpm.
A description of the module perl-RPM-Specfile can be found on cpan.
Download this perl script, called cpan-to-rpm.pl. It is described as followed: “Grab a module from CPAN and sock it into an RPM using cpanflute2”
Call it this way:
perl cpan-to-rpm.pl \
authors/id/M/MU/MUIR/modules/Net-Netmask-1.9011.tar.gz
perl cpan-to-rpm.pl \
authors/id/D/DJ/DJKERNEN/Mail-IMAPClient-2.2.9.tar.gz

That will create
/usr/src/redhat/SRPMS/perl-Net-Netmask-1.9011-1.src.rpm
If you install it with
rpm -i /usr/src/redhat/SRPMS/perl-Net-Netmask-1.9011-1.src.rpm
you can build the rpm from it with
rpmbuild -ba /usr/src/redhat/SPECS/perl-Net-Netmask.spec
to see what an rpm provides: rpm -qlp --provides perl-LDAP-0.31-4.noarch.rpm

Tags: , , ,
Posted in Software Development | Comments Closed

The file list conversion from OpenPKG   November 17th, 2007

rpmtool:
One idea could be, to download the file from the OpenPKG CVS and save it to /usr/bin/rpmtool; you need to change the first line of that file to #!/bin/bash
Also add at the top of the spec file:

%define l_rpmtool /usr/bin/rpmtool

The other idea is, to install the OpenPKG source rpm of the package concerned:

/kolab/bin/openpkg rpm -i kolab-webadmin-0.4.0-20050318.src.rpm

In the /kolab/RPM/SRC/kolab-webadmin/kolab-webadmin.spec
insert after the l_rpmtool line:
cp files /usr/src/redhat/SOURCES/kolab-webadmin.files

Rebuild the package, which will create the kolab-webadmin.files:
/kolab/libexec/openpkg/rpmbuild -ba /kolab/RPM/SRC/kolab-webadmin/kolab-webadmin.spec

Perhaps need to change the paths, e.g. for perl:
in vi:

:%s/\/kolab\/lib\/perl\/vendor_perl\/5.8.5/\/usr\/lib\/perl5\/vendor_perl\/5.8.3/g

You need to put it into an archive:
cd /usr/src/redhat/SOURCES/
tar cvf kolab-webadmin.files.tar kolab-webadmin.files

In the fedora spec file, /usr/src/redhat/SPECS/kolab-webadmin.spec, you would add in the sources:
Source1: kolab-webadmin.files.tar

In the %prep section, insert:
%setup1 -D -T -b 1 -n kolab-webadmin-%{version}
As the parameter for -n, give the name of a directory that is created for the main tar file anyway.

In the %install section, remove the rpmtool lines; instead, you change the %files line:
%files -f ../kolab-webadmin.files

Tags: , , , ,
Posted in Software Development | Comments Closed

have a look at Building Packages with OpenPKG
See /usr/local/kolabopenpkg/etc/openpkg/rpmmacros to know what the macros (e.g. %l_musr) mean.

To get the spec file, install the OpenPKG source package:

/kolab/bin/openpkg rpm -i kolab-webadmin-0.4.0-20050318.src.rpm

Copy the /kolab/RPM/SRC/kolab-webadmin/kolab-webadmin.spec to /usr/src/redhat/SPECS;
Copy the other files (e.g. .tar.gz archives) to /usr/src/redhat/SOURCES

One special thing is that the required packages in OpenPKG don’t only include the package name and required version number, but often also options that were included when configuring and building the package.
For example, cyrus-sasl::with_ldap would require that the cyrus-sasl::with_ldap is advertised in the Provides: tag in the spec file.
A common approach is not to advertise all compiling options, but to know the packages and test them thoroughly.

Remove the line:
Class: JUNK

To understand some of the macros, in the form %{something}, have a look at /usr/lib/rpm/macros and /usr/local/kolab/etc/openpkg/rpmmacros.

Insert these lines near the top:

%define l_prefix /kolab
%define l_make %{__make}
%define l_mflags -m
# m actually is ignored, compatibility

Replace all occurances of “apache” with “httpd” in your spec file.

It seems, the spaces before the %setup -q are not correct. Remove them!

Lines like %{l_shtool} install: just remove all the %{l_shtool}; install should work fine;
remove also the %{l_value -s -a} (though I am not sure what those characters stand for)

Tags: , , , ,
Posted in Software Development | Comments Closed

Quick RPM lookaround   November 17th, 2007

April 2005:
That is how I learnt about RPM packaging of software for Fedora Linux.
My goal was to create Fedora packages for Kolab, which is packaged with OpenPKG.

Links to RPM introductions

Basic Idea of SRPMS

rpm -i some-package-0.0.1.src.rpm
will put some tar file(s) and patches in /usr/src/redhat/SOURCES; and will put the some-package.spec file in /usr/src/redhat/SPECS
to build the src.rpm and the rpm, run
rpmbuild -ba /usr/src/redhat/SPECS/some-package.spec
That will create the files /usr/src/redhat/SRPMS/some-package.src.rpm and /usr/src/redhat/RPMS/i386/some-package.rpm.

Tags: , ,
Posted in Software Development | Comments Closed