[Update1] Gitosis under Debian Wheezy

The last week, I managed to switch over to gitolite. It works like charm without any evil hack, does what it should do, but I don’t think the transfer is as easy as stated. The easiest way was to

  1. move all git-repos /somewhere/
  2. completely uninstall gitosis
  3. install and configure gitolite as stated on their homepage using glsetup
  4. move the repos back into gitolite’s “$GIT”-directory

Some months ago, a friend of mine showed me gitosis, a collection of scripts that provide an easy-to-configure git-server. By that time, there was an almost ready-to-use-.deb in debian/squeeze. But with migration to Wheezy, gitosis broke.

The exact traceback:

Traceback (most recent call last):
  File "/usr/bin/gitosis-serve", line 9, in <module>
    load_entry_point('gitosis==0.2', 'console_scripts', 'gitosis-serve')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 337, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 330, in get_distribution
    if isinstance(dist,Requirement): dist = get_provider(dist)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 209, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 686, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 584, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: gitosis==0.2

Several homepages proposed symlinking back from python2.x to python2.5, which SHOULD work. But would you like to switch to a deprecated version of python? I wouldn’t. (Furthermore, python2.5 isn’t in the wheezy-repos, either)

So here’s the REAL problem with gitosis: During the upgrade to Wheezy, some paths within the system changed, especially those for including. The “*.egg”-file gitosis provides (and gitosis-serve requires, loaded through pkg_resources.load_entry_point !) lies within ‘/usr/share/pyshared’, which is missing in python2.7’s ‘path’-variable (just try: call ‘sys.path’ in interactive python-session after having imported the ‘sys’-package)

For me, gitosis worked again after changing the file ‘/usr/bin/gitosis-serve’ in the following way:

--- /usr/bin/gitosis-serve-old  2013-08-12 11:27:15.126399705 +0200
+++ /usr/bin/gitosis-serve      2013-08-12 11:14:40.237563062 +0200
@@ -2,6 +2,7 @@
 # EASY-INSTALL-ENTRY-SCRIPT: 'gitosis==0.2','console_scripts','gitosis-serve'
 __requires__ = 'gitosis==0.2'
 import sys
+sys.path.append('/usr/share/pyshared/')
 from pkg_resources import load_entry_point
 
 if __name__ == '__main__':
Written by pheerai on 12/08/2013 Categories: Free/Open Source Software, International corner Tags: , , , ,
4 Comments on [Update1] Gitosis under Debian Wheezy