We recently upgraded our version of Subversion from a very old version of Subversion to v1.7.1. We really wanted the newer merging capabilities that arrived in Subversion 1.5 and figured it was worth the energy to upgrade Subversion to the latest version. Fortunately upgrading our Subversion repositories went very smoothly. I even decided to just do a full dump/load to make sure the repositories were fresh 1.7.x repositories. While this process took a little extra time, the upgrade itself went very smoothly.
However, where things really fell apart for us was with our Trac/SVN integration. The problem is we were still running Python 2.4, which include old SVN bindings, so any attempt to do anything with our SVN ended up with an error that looked like:
TracError: Couldn't open Subversion repository c:/path/to/repository: SubversionException: ("Expected FS format '2'; found format '4'", 160043)
In order to get the SVN commit hooks working with Trac, I was going to need SVN bindings that worked with SVN v1.7.1, but also were compiled for my version of Python. While one might think this wouldn't be difficult, I couldn't find any SVN bindings for Python 2.4. This left my options at either trying to compile my own versions or upgrade Python. Since I don't have easy access to tools for compiling my own version of the Windows binaries, I thought the best option was just to upgrade Python—especially since Trac is soon dropping support for Python 2.4.
The problem is there's no easy way to just migrate a Trac install to a new version of Python, because you're going to need to recompile all your Python *.egg files for the version of Python you're using. After spending way too much time getting all this working, I thought it was wise that I compile a list of all the steps you may need to take in order to get Trac migrated to a new version of Python.
Here is the general install instructions. I don't break this down as a true step-by-step instructions, because so much varies based on your environment. However I do break down all the major steps you'll need to take and try to point you to step-by-step instructions for each bullet when possible.
- Install the version of Python you intend to run
- Make sure to install Python into a new folder (do not install over your old version of Python)
- Compile a list of all the Trac plug-ins you're currently running (check both your Trac/path/to/env/eggs folder and the Python/Lib/site-packages folders for EGG packages you currently have installed)
- Back up your current Trac environment folder (where all your Trac repository files are)
- Follow the instructions for installing Trac (but ignore the steps for creating new repositories—you can use your existing ones)
- Delete any old EGG packages from the Trac/path/to/env/eggs folder
- Reinstall all your old Trac Plugins
- Shut down your Trac server
- Follow the Trac guide for upgrading Trac, with the following notes:
- You don't need to update the Trac Code (you just installed the latest version)
- Skip the "Resynchronize the Trac Environment Against the Source Code Repository" step—you'll do that after updating SVN
- For Trac/SVN Integration, the Trac and Subversion page outlines the basic steps needed, but this is the step that cost me the most pain, so I'm going to break down some extra notes.
- Download the SVN binaries from http://alagazam.net. You'll want to download the Windows binaries and Python bindings for the version of Subversion you plan on using.
NOTE: This site has the largest collection of Python SVN bindings that I could find and also offers the command line SVN binaries you'll also need. While you should be able to use another SVN command line binaries, using the Setup-Subversion-*.msi installer is probably going to be the most forward way to get started.
- Install the Subversion binaries.
NOTE: You may be required to reboot your server. You will also want to confirm that the Subversion/bin path is in your Window PATH environment variable.
- If running Apache, you'll want to make sure to replace the mod_authz_svn.so and mod_dav_svn.so in your /Apache/modules with the versions in the /Subversion/bin folder.
- Copy the files in the Python bindings file (e.g. svn-win32-1.7.1_py27.zip) to the Python/Lib/site-packages folder. You'll want to overwrite the existing files or delete the existing directories.
- You'll now want to test your Python SVN installation:
- Go to your Python folder and type "python"
- Verify that you can load the bindings using the Python interactive interpreter by typing:
from svn import core
- If all is successful you should just see a new Python prompt. The only time you should see output is if there is an error.
NOTE: This is the part where I spent a lot of time troubleshooting. I kept getting a "ImportError: DLL load failed: The specified module could not be found." After much digging and research, this turns out to be related to Trac Issue #665. The fix for me was to copy the following files into the Windows\system32 folder: - libdb42.dll
- libeay32.dll
- ssleay32.dll
I'd recommend backing up existing files before replacing them. - If you're still getting errors, see the Trac/Subversion checklist for more tips.
- Resynchronize the Trac Environment Against the Source Code Repository, using the following syntax for each repository:
trac-admin /path/to/projenv repository resync '*'
- Check all your SVN hooks and update any paths pointing to the old version of Python to make sure they point to the new install. For example, your trac-svn-post-commit-hook.cmd may point to your old Python path and these need to be updated in order to work.
- Check your Windows PATH environment variable and make sure the new version of Python is in the PATH statement. If it's not, update/add it and reboot your server.
- Restart your Trac server.
If all goes well, your environment should now be running under your new Python installation.
This process ended up costing me way more time than expected, so hopefully this guide will prevent you from struggling the way I did.
1 Comments
Comments for this entry have been disabled.