[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#624769: lsb-release: wrong output on debian-ports architectures breaks other packages



tags 634769 +patch
thanks

Le 01.05.2011 15:47, Thorsten Glaser a écrit :
> All debian-ports.org architectures [alpha armhf avr32 hppa
> (maybe)hurd-i386 (maybe)kfreebsd-amd64 (maybe)kfreebsd-i386
> m68k powerpcspe sh4 sparc64] will have broken output:
> 
> (pbuild17226)root@aranym:/ # lsb_release -a
> No LSB modules are available.
> Distributor ID: Debian
> Description:    Debian GNU/Linux testing/unstable
> Release:        testing/unstable
> Codename:       n/a
> 
> The cause is this:
> 
> Python 2.6.6 (r266:84292, Apr 27 2011, 15:17:58)
> [GCC 4.4.6] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from lsb_release import *
>>>> releases = parse_apt_policy()
>>>> releases
> [(100, {'suite': 'now'}), (500, {'origin': 'Debian Ports', 'suite': 'unreleased', 'version': '1.0', 'component': 'main', 'label': 'ftp.debian-ports.org'}), (500, {'origin': 'Debian Ports', 'suite': 'unstable', 'version': '1.0', 'component': 'main', 'label': 'ftp.debian-ports.org'}), (500, {'origin': 'ARAnyM from Debian Ports', 'suite': 'sid', 'component': 'main', 'label': 'tg68k'})]
> 
> As you can see, the “origin” and “label” differ, which leads to
> not being recognised as “sid”.

Hi Thorsten, and thanks for your bugreport,

does the attached patch on lsb_release.py fix this bug ?

Cheers,

OdyX

N.B. I'm not sure that's the best way to solve it, but it should work.
commit cefe7d7f9ff855e16b2a089c376b5a4cdd7716e2
Author: Didier Raboud <odyx@debian.org>
Date:   Thu Feb 23 14:52:07 2012 +0100

    Recognise Debian Ports as `sid` too.
    
    This changes the interface of guess_release_from_apt() by permitting the
    use of arrays as input variables.
    
    Closes: #624769
    Reported-by: Thorsten Glaser <tg@mirbsd.de>
    Signed-off-by: Didier Raboud <odyx@debian.org>

diff --git a/lsb_release.py b/lsb_release.py
index 8ea001f..e72cb49 100644
--- a/lsb_release.py
+++ b/lsb_release.py
@@ -191,9 +191,9 @@ def parse_apt_policy():
 
     return data
 
-def guess_release_from_apt(origin='Debian', component='main',
+def guess_release_from_apt(origin=('Debian', 'Debian Ports'), component='main',
                            ignoresuites=('experimental'),
-                           label='Debian'):
+                           label=('Debian', 'ftp.debian-ports.org')):
     releases = parse_apt_policy()
 
     if not releases:
@@ -201,9 +201,9 @@ def guess_release_from_apt(origin='Debian', component='main',
 
     # We only care about the specified origin, component, and label
     releases = [x for x in releases if (
-        x[1].get('origin', '') == origin and
-        x[1].get('component', '') == component and
-        x[1].get('label', '') == label)]
+        x[1].get('origin', '') in origin and
+        x[1].get('component', '') in component and
+        x[1].get('label', '') in label)]
 
     # Check again to make sure we didn't wipe out all of the releases
     if not releases:

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: