diff options
author | K900 <me@0upti.me> | 2024-01-05 21:19:53 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-05 21:19:53 +0300 |
commit | 7632cf76bcbe5817d54eaefaf1711ec2d7080615 (patch) | |
tree | 0df095ba1ae0c090c180eb01149f28a1dd43eacc /pkgs/os-specific/linux/kernel/update-mainline.py | |
parent | da93dfdcd5c90c0560b3a19364c6c9017e162c90 (diff) | |
parent | 1ecd7075270529848da929a8fc8b1c3b1ef81716 (diff) | |
download | nixlib-7632cf76bcbe5817d54eaefaf1711ec2d7080615.tar nixlib-7632cf76bcbe5817d54eaefaf1711ec2d7080615.tar.gz nixlib-7632cf76bcbe5817d54eaefaf1711ec2d7080615.tar.bz2 nixlib-7632cf76bcbe5817d54eaefaf1711ec2d7080615.tar.lz nixlib-7632cf76bcbe5817d54eaefaf1711ec2d7080615.tar.xz nixlib-7632cf76bcbe5817d54eaefaf1711ec2d7080615.tar.zst nixlib-7632cf76bcbe5817d54eaefaf1711ec2d7080615.zip |
Merge pull request #277708 from Ma27/min-supported-kernel
linux: avoid re-adding unsupported kernel branches (4.14) in this case in updater scripts
Diffstat (limited to 'pkgs/os-specific/linux/kernel/update-mainline.py')
-rwxr-xr-x | pkgs/os-specific/linux/kernel/update-mainline.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/pkgs/os-specific/linux/kernel/update-mainline.py b/pkgs/os-specific/linux/kernel/update-mainline.py index 30b9ebec984c..020e55c5fe40 100755 --- a/pkgs/os-specific/linux/kernel/update-mainline.py +++ b/pkgs/os-specific/linux/kernel/update-mainline.py @@ -1,5 +1,5 @@ #!/usr/bin/env nix-shell -#!nix-shell -i python3 -p "python3.withPackages (ps: [ ps.beautifulsoup4 ps.lxml ])" +#!nix-shell -i python3 -p "python3.withPackages (ps: [ ps.beautifulsoup4 ps.lxml ps.packaging ])" import json import os import pathlib @@ -10,6 +10,8 @@ from dataclasses import dataclass from enum import Enum from bs4 import BeautifulSoup, NavigableString, Tag +from packaging.version import parse as parse_version, Version +from typing import List HERE = pathlib.Path(__file__).parent ROOT = HERE.parent.parent.parent.parent @@ -80,6 +82,18 @@ def get_hash(kernel: KernelRelease): return f"sha256:{hash}" +def get_oldest_branch() -> Version: + with open(VERSIONS_FILE) as f: + return parse_version(sorted(json.load(f).keys())[0]) + + +def predates_oldest_branch(oldest: Version, to_compare: str) -> bool: + if to_compare == "testing": + return False + + return parse_version(to_compare) < oldest + + def commit(message): return subprocess.check_call(["git", "commit", "-m", message, VERSIONS_FILE]) @@ -97,6 +111,8 @@ def main(): parsed_releases = filter(None, [parse_release(release) for release in releases]) all_kernels = json.load(VERSIONS_FILE.open()) + oldest_branch = get_oldest_branch() + for kernel in parsed_releases: branch = get_branch(kernel.version) nixpkgs_branch = branch.replace(".", "_") @@ -106,6 +122,13 @@ def main(): print(f"linux_{nixpkgs_branch}: {kernel.version} is latest, skipping...") continue + if predates_oldest_branch(oldest_branch, kernel.branch): + print( + f"{kernel.branch} is too old and not supported anymore, skipping...", + file=sys.stderr + ) + continue + if old_version is None: message = f"linux_{nixpkgs_branch}: init at {kernel.version}" else: |