Bug#513039: could not find a distribution template - bug

Robert Wotzlaw Robert.Wotzlaw at web.de
Fri May 8 18:22:17 UTC 2009


Dear Bugged Users,,

yesterday I upgraded my system from Debian lenny/sid to squeeze/sid. The first
thing I have done after the upgrading - You can guess it - I pushed the menu
button of the Software Sources menu entry and nothing happened. Since, about one
year I could see this behavior. Nobody of the IT-gurus found the bug. In the
last weeks I learned a very, very, ... little bit about Python. With this
knowledge I tried again the hunting. Before I show You where the bug lives,
You will find in the next rows a system report and the involved Debian packages:

-- System Information:
Debian Release: lenny/sid
Architecture:   i386 (i686)
Kernel:         Linux 2.6.28-1-686 (SMP w/1 CPU core)
Locale:         LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell:          /bin/sh linked to /bin/bash

-- System Installation Sources:
DVD-ROM:        Debian GNU/Linux testing "Lenny"
                Official Snapshot i386 DVD Binary-1 to 5
                20081201-10:34

-- Involved Debian Packages:
software-properties-gtk   0.60.debian-1.1
python-apt                0.7.7.1+nmu1
lsb-release               3.2-20

-- The Python module with the bug:
distro.py       /usr/lib/python2.5/site-packages/aptsources/

Now comes the story. Open under GNOME a terminal. On the command line write
the following command and execute it:

$> sudo software-properties-gtk

The system will give the always known answer. The following print is an
excerpt of the whole message:

Traceback (most recent call last):
  .
  .
  .
  File "/usr/lib/python2.5/site-packages/aptsources/distro.py", line 85, in \
  get_sources
    "Error: could not find a distribution template")
aptsources.distro.NoDistroTemplateException

Then do the following:

$> lsb_release -i -c -d -r -s

The system gives the following answer:

Debian
Debian GNU/Linux testing/unstable
testing/unstable
n/a

In the next step change into the following directory:

$> cd /usr/lib/python2.5/site-packages/aptsources/

As user root open a text editor and pull in the Python file distro.py. Look for
the command lsb_release. The command resides in the Python function
get_distro(). In my edition of distro.py the command is found in the row 422:

 .
 .
 .

417: def get_distro():
418:     ''' Check the currently used distribution and return the corresponding
419:         distribution class that supports distro specific features. '''
420:     lsb_info = []
421:     for lsb_option in ["-i", "-c", "-d", "-r"]:
422:         pipe = os.popen("lsb_release %s -s" % lsb_option)
423:         lsb_info.append(pipe.read().strip())
424:         del pipe

 .
 .
 .

Now You know, why You should run the command lsb_release some lines above.

With this information in Your mind go up in the file distro.py until You find
the line with the following text:

 .
 .
 .

383:   def is_codename(self, name):
384:     ''' Compare a given name with the release codename and check if
385:         if it can be used as a synonym for a development releases '''
386:     if name == self.codename or self.release in ("testing", "unstable"):
387:         return True
388:     else:

 .
 .
 .

Read the line with the number 386 in front and You will find the cause of all
the trouble. The if clause test only for "testing" or "unstable" and not for
"testing/unstable". A first aid is the following change:

Line before the correction:

386:     .. self.release in ("testing", "unstable"):

Line after the correction:

386:     ... self.release in ("testing", "unstable", "testing/unstable"):

But that's not the whole story. Have a look in the file debian_version. The
file debian_version lives under the directory /etc/. In my system I found the
following character string (found before upgrade to squeeze/sid):

lenny/sid

Now change the string from lenny/sid to lenny or squeeze and then run the fol-
lowing command again:

$> lsb_release -r

The answer is the following print:

Release:        lenny  (or squeeze if You had change the string to squeeze)

Before You can start the next command delete the correction in the file
distro.py. If done, run the following command:

$> sudo software-properties-gtk

or

$> gksu --desktop /usr/share/applications/software-properties.desktop \
/usr/bin/software-properties-gtk

The last command is the command that is launched from the Software Source menu
entry. In both cases the system answers with the well known error message.

Next change the string lenny from lenny to testing and again run the following
command:

$> lsb_release -r

The answer comes in the next line:

Release:        testing

And the great question, what will happen next. Run again the following command:

$> sudo software-properties-gtk

Surprise, the long missed Software Sources window shows his face. As test run
the alternative command:

$> gksu --desktop /usr/share/applications/software-properties.desktop \
/usr/bin/software-properties-gtk

The course of the problem is not only the file distro.py. The command
lsb_release - a Python script - changed the string from debian_release:

1. lenny/sid  ->  testing/unstable
2. lenny      ->  lenny
3. testing    ->  testing

In the first case the script lsb_release transformed lenny/sid to /testing/un-
stable. The string sid at the end of lenny/sid is the cause of the transfor-
mation from lenny/sid to testing/unstable. Try the following. Change the string
lenny/sid in debian_release into bug/sid and run the following command:

$> lsb_release -r

The answer is printed on the following line:

Release:        testing/unstable

In this case the transformation is:

4. bug/sid    ->  testing/unstable

The Python module distro.py doesn't know a string "testing/unstable" and that
is Software Sources destiny.

Regards,
Robert Wotzlaw

__________________________________________________________________________
Verschicken Sie SMS direkt vom Postfach aus - in alle deutschen und viele 
ausländische Netze zum gleichen Preis! 
https://produkte.web.de/webde_sms/sms









More information about the pkg-gnome-maintainers mailing list