:: Re: [DNG] Devuan ASCII point releas…
Top Pagina
Delete this message
Reply to this message
Auteur: Pontus Goffe
Datum:  
Aan: dng
Onderwerp: Re: [DNG] Devuan ASCII point release
Hi,

On 2019-10-26 02:27, s@po wrote:
> 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


Who is a python guy?

parse_apt_policy executes 'apt-cache policy' and parses
(parse_policy_line) the output for lines beginning with release matching
o=Devuan and c=main

longnames = {'v' : 'version', 'o': 'origin', 'a': 'suite', 'c' :
'component', 'l': 'label'}

In my case that is

 500 http://se.deb.devuan.org/merged ascii/main amd64 Packages
     release v=2.0,o=Devuan,a=stable,n=ascii,l=Devuan,c=main,b=amd64
     origin se.deb.devuan.org
//PG