microsoft-edge: ensure stable order for upstream sources

This commit addresses the issue of unstable key ordering in default.nix.
Previously, the keys could appear in different orders such as "stable,
beta, dev" or "beta, stable, dev".
To simplify the reviewing process and minimize merge conflicts, this
commit introduces the use of OrderedDict, ensuring consistent key
ordering for upstream sources.
Also, the gzip import was unused, so just drop it.
This commit is contained in:
Michael Adler 2023-07-19 09:57:10 +02:00
parent 7f256d7da2
commit 1f892619d5

View File

@ -2,14 +2,13 @@
#! nix-shell -i python3 -p python3Packages.packaging python3Packages.debian
import base64
import gzip
import textwrap
from urllib import request
from collections import OrderedDict
from debian.deb822 import Packages
from debian.debian_support import Version
def packages():
packages_url = 'https://packages.microsoft.com/repos/edge/dists/stable/main/binary-amd64/Packages'
handle = request.urlopen(packages_url)
@ -17,7 +16,7 @@ def packages():
def latest_packages(packages: bytes):
latest_packages: dict[str, Packages] = {}
latest_packages: OrderedDict[str, Packages] = {}
for package in Packages.iter_paragraphs(packages, use_apt_pkg=False):
name: str = package['Package']
if not name.startswith('microsoft-edge-'):