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

Didier Raboud <[email protected]>
Newsgroups gmane.linux.debian.devel.lsb
Organization EPFL - GR-KA
Message-ID <[email protected]>
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.
fix_624769.patch (text/plain, 1.5 KB)
commit cefe7d7f9ff855e16b2a089c376b5a4cdd7716e2
Author: Didier Raboud <[email protected]>
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 <[email protected]>
    Signed-off-by: Didier Raboud <[email protected]>

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:
signature.asc (application/pgp-signature, 663 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)

iQGcBAEBAgAGBQJPRkXyAAoJEIvPpx7KFjRVlrUMAJCigWZqb9D9QZohv3ybc5AM
O5WQjfm4z/7wf90n3wYOsW5pH3HrHL5RRUy5ZbVPkAz3jGk1lZXqQYiqQou4PwHB
tdmYU5hRHV1Q6Jaqg5aiOOd1u7o+XsmqzXiKWHzqFXQiv7uWp/k9loNRd3HQagdi
BnFkLiDMXtueqD902hznPVnOt2rvGBoW5+rBtZz2vXGDtqy1EJIh0ee6NICV6r3j
rhsJo+XnhqtGNC2g3zByjxPYnWLKqecg+t63S7JC2OrlBm2fQnGb/rBnR2bGqtOl
46OfxfFd6n8YNglI1gF+MERXx3g7gURLBvDUjIL4xAZPKYQUsqsX8kOEr9nZzkzw
+Y6c5ccaKtTbOp7udWXmovmoCQ80U25AC4h8FYm2jt1b88ZvnIeA9LttfaFrrHPP
pL2wnS66UwRpn+arLP29BaWkNNlDcnpOlmkjqim3VE8yJ9Px9JeO+Lt7uJ4DmpmF
NG6DKj2uQCV+Ywr+iiVO3vq4SYPFvvWiKGnAFLZ3xg==
=PkY7
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.