:: Re: [DNG] Devuan ASCII point releas…
Etusivu
Poista viesti
Vastaa
Lähettäjä: s
Päiväys:  
Vastaanottaja: fsmithred
Kopio: dng
Aihe: Re: [DNG] Devuan ASCII point release
Hello fsmithred,
>
> On Fri, 25 Oct 2019 18:06:06 -0400
> fsmithred via Dng <dng@???> wrote:
> >
> > I don't know exactly where the 2.0 is coming from. It's not in
> > /etc/os-release, /etc/devuan_version or /etc/issue, and there is no
> > /etc/lsb-release file.
> >
> > man lsb_release says
> >    "Detection of systems using a mix of packages from various 
> > distributions or releases is something of a black art; the current 
> > heuristic tends to assume that the installation is of the earliest 
> > distribution which is still being used by apt but that heuristic is 
> > subject to error."

> >
> > It can't hurt to file a bug report. If you know how to fix it, let us know
> > and we can correct that in the future.
> >
> > fsmithred
>
> That information come from python2.7 'lsb_release' module..
>
> root@desktop0:~# python2.7
> Python 2.7.13 (default, Sep 26 2018, 18:42:22)
> [GCC 6.3.0 20170516] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import lsb_release
> >>> distinfo = lsb_release.get_distro_information()
> >>> print(distinfo.get('RELEASE', 'n/a'))
> 2.0
>
>
> I will try to trace it, to its origin..
>


I think that I now understand the "black-magic part", also the "/etc/lsb-release" :)

in: /usr/lib/python2.7/dist-packages/lsb_release.py
this doesn't help :
     32 RELEASE_CODENAME_LOOKUP = {
     33     '1' : 'jessie',
     34 #    '2' : 'ascii',
     35     '2.1' : 'ascii',
     36     # '1.3' : 'bo',
     37     # '2.0' : 'hamm',
     38     # '2.1' : 'slink',
     39     # '2.2' : 'potato',
     40     # '3.0' : 'woody',
     41     # '3.1' : 'sarge',
     42     # '4.0' : 'etch',
     43     # '5.0' : 'lenny',
     44     # '6.0' : 'squeeze',
     45     # '7'   : 'wheezy',
     46     # '8'   : 'jessie',
     47     }


Initial function:
    371 def get_distro_information():
    372     lsbinfo = get_lsb_information()
    373     # OS is only used inside guess_devuan_release anyway
    374     for key in ('ID', 'RELEASE', 'CODENAME', 'DESCRIPTION',):
    375         if key not in lsbinfo:
    376             distinfo = guess_devuan_release()
    377             distinfo.update(lsbinfo)
    378             return distinfo
    379     else:
    380         return lsbinfo



I think Its guessed: :)

root@desktop0:~# python2.7
Python 2.7.13 (default, Sep 26 2018, 18:42:22)
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import lsb_release
>>> distinfo = lsb_release.get_distro_information()
>>> print(distinfo.get('RELEASE', 'n/a'))

2.0
>>> lsb_release.guess_release_from_apt()

{'origin': u'Devuan', 'suite': u'stable', 'version': u'2.0', 'component': u'main', 'label': u'Devuan'}


You see here the '2.0' String, and it comes from the funtion guess_release_from_apt().. like you can see above..
The guess_release_from_apt() function:
    228 def guess_release_from_apt(origin='Devuan', component='main',
    229                            ignoresuites=('experimental'),
    230                            label='Devuan',
    231                            alternate_olabels={'Devuan Ports':'packages.devuan.org'}):
    232     releases = parse_apt_policy()
    233 
    234     if not releases:
    235         return None
    236 
    237     # We only care about the specified origin, component, and label
    238     releases = [x for x in releases if (
    239         x[1].get('origin', '') == origin and
    240         x[1].get('component', '') == component and
    241         x[1].get('label', '') == label) or (
    242         x[1].get('origin', '') in alternate_olabels and
    243         x[1].get('label', '') == alternate_olabels.get(x[1].get('origin', '')))]
    244 
    245     # Check again to make sure we didn't wipe out all of the releases
    246     if not releases:
    247         return None
    248 
    249     releases.sort(key=lambda tuple: tuple[0],reverse=True)
    250 
    251     # We've sorted the list by descending priority, so the first entry should
    252     # be the "main" release in use on the system
    253 
    254     max_priority = releases[0][0]
    255     releases = [x for x in releases if x[0] == max_priority]
    256     releases.sort(key=release_index)
    257 
    258     return releases[0][1]


I am afraid that this info, you already know..
I am not a python guy( I love the Lua simplicity way :) ), I can't help.. :(

Best Regards,
tux

--
tux <tuxd3v@???>