wiki:Howto/Trac0.12OnUbuntuLucid

Trac 0.12 on Ubuntu 10.04 Lucid

Upgrading this server from Ubuntu 8.04 Hardy LTS to 10.04 Lucid LTS I met a few issues. One of them is the need to manually update some of Trac's supporting Python packages to enable the installation of Trac 0.12, which was released after Lucid shipped.

Genshi

Trac 0.12 requires Genshi v0.6 or later. Lucid ships with python-genshi 0.5.1-2ubuntu1. I installed the latest version (currently 0.7) from the code repository directly:

cd /home/all/SourceCode/
mkdir genshi
cd genshi
svn co http://svn.edgewall.org/repos/genshi/trunk
cd trunk/
python setup.py bdist_egg
ls dist
sudo easy_install --prefix=/usr --force-installation-into-system-dir --install-dir /usr/lib/python2.6/dist-packages dist/Genshi-0.7dev_r1134-py2.6.egg

Trac

This was quite painless, although it has to be forced to install into the system location (/usr/) rather than /usr/local/. To upgrade to the latest stable release:

sudo easy_install --prefix=/usr --force-installation-into-system-dir --install-dir /usr/lib/python2.6/dist-packages upgrade Trac==0.12

Searching for Trac==0.12
Reading http://pypi.python.org/simple/Trac/
Reading http://trac.edgewall.org/
Reading http://trac.edgewall.org/wiki/TracDownload
Reading http://trac.edgewall.com/
Reading http://projects.edgewall.com/trac
Reading http://projects.edgewall.com/trac/wiki/TracDownload
Best match: Trac 0.12
Downloading ftp://ftp.edgewall.com/pub/trac/Trac-0.12.zip
Processing Trac-0.12.zip
Running Trac-0.12/setup.py -q bdist_egg --dist-dir /tmp/easy_install-ZfRdKQ/Trac-0.12/egg-dist-tmp-3yb_jP
Adding Trac 0.12 to easy-install.pth file
Installing trac-admin script to /usr/bin
Installing tracd script to /usr/bin

Installed /usr/lib/python2.6/dist-packages/Trac-0.12-py2.6.egg
Processing dependencies for Trac==0.12
Finished processing dependencies for Trac==0.12

To upgrade to the latest development release (tracks the head of the SVN code repository):

sudo easy_install --prefix=/usr --force-installation-into-system-dir --install-dir /usr/lib/python2.6/dist-packages upgrade Trac==dev

Then for each Trac installation I used su to switch to the user's credentials and upgrade the configuration:

su ${USER_ACCOUNT}
cd $HOME
trac-admin $HOME/trac upgrade
trac-admin $HOME/trac wiki upgrade
trac-admin $HOME/trac repository resync '*'
exit

Finally I restarted the web server:

sudo /etc/init.d/apache2 restart

DOS line-endings

Warning The files from the zip installed by the upgrade have DOS-style line ending codes (CR/LF) rather than the Unix-style (LF). This can cause some hidden problems including applying patches so to avoid these before they bite it is a good idea to convert all the files to Unix-style now.

sudo apt-get install tofrodos
sudo -i
cd /usr/lib/python2.6/dist-packages/Trac-0.12-py2.6.egg/trac
find . -name '*.py' -exec fromdos {} \;
exit

Plug-ins

WYSIWYG

Updating the WYSIWYG plug-in required removing the per-site installation:

cd /home/${DOMAIN}/trac
rm -rf eggs/TracWysiwyg-0.2_r3414-py2.5.egg-tmp

and replacing it with a system-wide instance:

sudo easy_install --prefix=/usr --force-installation-into-system-dir --install-dir /usr/lib/python2.6/dist-packages --always-unzip http://trac-hacks.org/svn/tracwysiwygplugin/0.12

Full Blog

Despite being targeted at Trac 0.11 Full Blog does work on 0.12.

sudo easy_install --prefix=/usr --force-installation-into-system-dir --install-dir /usr/lib/python2.6/dist-packages --always-unzip http://trac-hacks.org/svn/fullblogplugin/0.11

Customisations

I had previously customised the TracTitleIndex macro (see Hacking/TracTitleIndexImproved). This improvement was lost when Lucid upgraded Trac to 0.11.7-1. I've updated the patch for 0.12 and it is attached to the original wiki article. To install it:

cd /tmp
wget http://tjworld.net/raw-attachment/wiki/Hacking/TracTitleIndexImproved/trac-0.12-wiki-macros.diff
cd /usr/lib/python2.6/dist-packages/Trac-0.12-py2.6.egg/trac
sudo patch -p1 < /tmp/trac-0.12-wiki-macros.diff