BuildANewPysvnOnAiiServer

From T2B Wiki
Jump to navigation Jump to search

Initial problem

When installing a new AII server in SL63, we have discovered that "svn co" was failing against our Quattor SVN. The reason for this seems to lie in the fact that the current subversion version was built with gnutls instead of openssl, and that gnutls doesn't like the kind of certificate we use on our SVN repo ("Key usage violation" error message when trying to checkout).

In this page, we will describe how we solved the problem by building a new openssl-based subversion, and then, how to build pysvn.

Preparation

  1. Disable quattor daemons (ncm-cdispd and cdp-listend).
2. Remove the actual subversion :
yum remove subversion

Building subversion

First, you need a compiler :

yum install gcc

Package that you might need when building neon :

yum install expat libxml2 libxml2-devel openssl-devel

Now, let's build everything :

cd /usr/local/src
wget http://apache.mirror.uber.com.au/subversion/subversion-1.7.17.tar.gz
tar xvzf subversion-1.7.17.tar.gz
cd subversion-1.7.17
./get-deps.sh
cd neon
./configure --with-ssl=openssl
make
make install
cd ..
wget http://www.sqlite.org/sqlite-amalgamation-3.7.0.1.tar.gz
tar xvzf sqlite-amalgamation-3.7.0.1.tar.gz
cp sqlite-3.7.0.1/sqlite3.c sqlite-amalgamation/
./configure --with-neon=/usr/local/lib/
make
make install

As a result of the two "make install" commands, everything got copied in /usr/local/bin and /usr/local/lib.

Now, we can test :

mkdir /root/test_checkout
cd /root/test_checkout
export PATH=$PATH:/usr/local/bin/svn
svn co  https://quattorrepository.begrid.be/repos/centralised-begrid-v9/trunk

Building pysvn

Compiler g++ needed :

yum install gcc-c++

Some dependencies :

yum install python-devel

Follow these steps :

mkdir /root/pysvn
cd /root/pysvn
wget http://pysvn.barrys-emacs.org/source_kits/pysvn-1.7.8.tar.gz
tar xvzf pysvn-1.7.8.tar.gz
cd pysvn-1.7.8
cd Source

Due to a bug described here, you will have to modify the file setup_configure.py in three different places :

Index: /Users/barry/wc/svn/​pysvn/Extension/Sour​ce/setup_configure.p​y
====================​====================​====================​=======
--- /Users/barry/wc/svn/​pysvn/Extension/Sour​ce/setup_configure.p​y	(revision 1578)
+++ /Users/barry/wc/svn/​pysvn/Extension/Sour​ce/setup_configure.p​y	(working copy)
@@ -1183,6 +1183,7 @@
     def _getLdLibs( self ):
         py_ld_libs = [
                 '-L%(SVN_LIB)s',
+                '-L%(APR_LIB)s',
                 ]
         if not self.setup.options.hasOption( '--norpath' ):
             py_ld_libs.extend( [
@@ -1207,6 +1208,7 @@
     def _getLdLibs( self ):
         py_ld_libs = [
                 '-L%(SVN_LIB)s',
+                '-L%(APR_LIB)s',
                 '-Wl,--rpath',
                 '-Wl,/usr/lib:/usr/local/lib',
                 '-lsvn_client-1',
@@ -1231,6 +1233,7 @@
     def _getLdLibs( self ):
         py_ld_libs = [
                 '-L%(svn_lib_dir)s',
+                '-L%(apr_lib_dir)s',
                 '-L/usr/lib/python%d.%d/config -lpython%d.%d.dll' %
                     (sys.version_info[0], sys.version_info[1], sys.version_info[0], sys.version_info[1]),
                 '-lsvn_client-1',

After this bug fixing, you can go back to the normal recipe :

python setup.py configure
make

To test the newly built pysvn library :

cd ..
cd Tests
make

Installing the new pysvn in the "runcheck" tool

Taking CB9 as an example :

rm -rf /opt/CB9/svncheck/pysvn
cp -a /root/pysvn/pysvn-1.7.8/Source/pysvn /opt/CB9/svncheck/

Before running the runcheck command, your environment must be set like this :

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/apr/lib
export PATH=$PATH:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/bin/svn


Template:TracNotice