[Kolab-devel] PEAR packaging problems

Richard Bos ml at radoeka.nl
Fri Dec 5 08:40:23 CET 2008


Op Thursday 04 December 2008 08:48:14 schreef Richard Bos:
> > We experienced some problems with PEAR packaging during preparations for
> > the next Kolab server release. Maybe some packagers from other distros
> > have additional insight or can make use of the information.
>
> I encounter the same thing.
> My specfiles contain:
> # %setup -q -n %{prj}-%{version}
> # %__cp %{SOURCE0} %{prj}-%{version}.tgz
>
> The last line (%__cp) should not be needed as the package is
> there already, but in an unpackage format.  The cp is there
> because the pear install command expects a package, just
> as you stated.

Thanks to an example provided by Mathieu P, I was able to improve the rpm 
build (for openSUSE), I added a update to issue 3260
https://www.intevation.de/roundup/kolab/issue3260 :

I made first the following change:

horde-cli> osc diff horde-cli.spec
Index: horde-cli.spec
===================================================================
--- horde-cli.spec     (revision 1)
+++ horde-cli.spec     (working copy)
@@ -27,17 +27,17 @@

 %prep
 %setup -q -n %{prj}-%{version}
-%__cp %{SOURCE0} %{prj}-%{version}.tgz

 %build
+%__mv ../package.xml .

 %install
-pear 
install --packagingroot %{buildroot} --nodeps --offline %{prj}-%{version}.tgz
+pear install --packagingroot %{buildroot} --nodeps package.xml

 %__rm -rf %{buildroot}/%{peardir}/.
{filemap,lock,registry,channels,depdb,depdblock}

 %__mkdir_p %{buildroot}%{xmldir}
-%__cp %{_builddir}/package.xml %{buildroot}%{xmldir}/%{prj}.xml
+%__cp package.xml %{buildroot}%{xmldir}/%{prj}.xml

 %clean
 %__rm -rf %{buildroot}
@@ -57,6 +57,10 @@


 %changelog
+* Thu Dec 04 2008 
+- Changed the build method to use the unpacked tarbal.  This will allow the
+  rpm to apply patches against the pristine sources, with the former method
+  this was not possible.
 * Fri Nov 28 2008 
 - initial version

This copies the package.xml into the unpacked sources directory, which makes
it possible to build from the unpacked sources.

Next I tried to build an rpm for a patched pear module.  This works quite
well now :)  But it is with some trickery:


horde-cli> osc diff
Index: horde-cli.spec
===================================================================
--- horde-cli.spec     (revision 2)
+++ horde-cli.spec     (working copy)
@@ -13,6 +13,7 @@
 Group:         Productivity/Networking/Web/Servers
 Url:           http://pear.horde.org/index.php?package=%{prj}
 Source0:       %{prj}-%{version}.tgz
+Patch0:        horde.patch
 BuildArch:     noarch
 BuildRoot:     %{_tmppath}/%{name}-%{version}-build
 PreReq:        %{_bindir}/pear
@@ -27,6 +28,8 @@

 %prep
 %setup -q -n %{prj}-%{version}
+cd ..
+%patch0 -p0

 %build
 %__mv ../package.xml .

The horde.patch file contains 2 patches (in this case); 1 patched pear module
and a patched package.xml file (providing a updated md5sum for the file).

The patch is obtained using the following commands:
#  (diff -u package.xml package.xml.new; diff -Naur Horde_CLI-0.0.2 
Horde_CLI-0.0.2.new) > horde.patch

The trickery is the line with 'cd ..'  as the setup tag moves into the
unpacked sources directory the only way to patch the package.xml file, is
to return to the parent directory.  This all seems to work well :)

Hopefully this build method can be used by others too.

-- 
Richard Bos
We are borrowing the world of our children,
It is not inherited from our parents.




More information about the devel mailing list