Skip to content

Commit

Permalink
linux/hardened: fix update script
Browse files Browse the repository at this point in the history
Due to releases now including a v (and before didn't) hardened hasn't
been updated since May 2024 (4 months ago)
  • Loading branch information
fabianhjr authored and Ma27 committed Sep 23, 2024
1 parent a6b5b8d commit 60623de
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkgs/os-specific/linux/kernel/hardened/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def find_asset(filename: str) -> str:
if not sig_ok:
return None

kernel_ver = re.sub(r"(.*)(-hardened[\d]+)$", r'\1', release_info.release.tag_name)
kernel_ver = re.sub(r"v?(.*)(-hardened[\d]+)$", r'\1', release_info.release.tag_name)
major = kernel_ver.split('.')[0]
sha256_kernel, _ = nix_prefetch_url(f"mirror://kernel/linux/kernel/v{major}.x/linux-{kernel_ver}.tar.xz")

Expand All @@ -157,8 +157,11 @@ def find_asset(filename: str) -> str:


def parse_version(version_str: str) -> Version:
# There have been two variants v6.10[..] and 6.10[..], drop the v
version_str_without_v = version_str[1:] if not version_str[0].isdigit() else version_str
version: Version = []
for component in re.split(r'\.|\-', version_str):

for component in re.split(r'\.|\-', version_str_without_v):
try:
version.append(int(component))
except ValueError:
Expand Down Expand Up @@ -227,7 +230,7 @@ def commit_patches(*, kernel_key: str, message: str) -> None:
# It's not reliable to exit earlier because not every kernel minor may
# have hardened patches, hence the naive search below.
i += 1
if i > 500:
if i > 100:
break

version = parse_version(release.tag_name)
Expand Down

0 comments on commit 60623de

Please sign in to comment.