summaryrefslogtreecommitdiff
path: root/scripts/package-build/linux-kernel
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2024-09-06 08:15:22 +0000
committerViacheslav Hletenko <v.gletenko@vyos.io>2024-09-06 08:15:22 +0000
commit9055e9bae11c66b41e8c18f59e99dda7df5c2d0a (patch)
treea082bb02ba891d636361215ba35c78344312e436 /scripts/package-build/linux-kernel
parentae3e89deeaf80eb2457aa9235e19e9da1fb2f1ad (diff)
downloadvyos-build-9055e9bae11c66b41e8c18f59e99dda7df5c2d0a.tar.gz
vyos-build-9055e9bae11c66b41e8c18f59e99dda7df5c2d0a.zip
T6674: build-kernel: Get kernel version from the defatults
Get kernel version from the vyos-build/data/defaults.toml for buld 'linux-kernel' and related packages Retrun the original build-jool.py script
Diffstat (limited to 'scripts/package-build/linux-kernel')
-rwxr-xr-xscripts/package-build/linux-kernel/build-jool.py13
-rwxr-xr-xscripts/package-build/linux-kernel/build.py7
-rw-r--r--scripts/package-build/linux-kernel/package.toml7
3 files changed, 14 insertions, 13 deletions
diff --git a/scripts/package-build/linux-kernel/build-jool.py b/scripts/package-build/linux-kernel/build-jool.py
index e51301fc..570293f5 100755
--- a/scripts/package-build/linux-kernel/build-jool.py
+++ b/scripts/package-build/linux-kernel/build-jool.py
@@ -1,21 +1,14 @@
#!/usr/bin/env python3
-import toml
-
from tomllib import loads as toml_loads
from requests import get
from pathlib import Path
from subprocess import run
-
-package: dict = toml.load("package.toml")
-
-
def find_arch() -> str:
tmp=run(['dpkg-architecture', '-q', 'DEB_HOST_ARCH'], capture_output=True)
return tmp.stdout.decode().strip()
-
# dependency modifier
def add_depends(package_dir: str, package_name: str,
depends: list[str]) -> None:
@@ -35,8 +28,10 @@ def add_depends(package_dir: str, package_name: str,
# find kernel version and source path
arch: str = find_arch()
-KERNEL_VER: str = package.get('defaults').get('kernel_version')
-KERNEL_FLAVOR: str = package.get('defaults').get('kernel_flavor')
+defaults_file: str = Path('../../../data/defaults.toml').read_text()
+architecture_file: str = Path(f'../../../data/architectures/{arch}.toml').read_text()
+KERNEL_VER: str = toml_loads(defaults_file).get('kernel_version')
+KERNEL_FLAVOR: str = toml_loads(architecture_file).get('kernel_flavor')
KERNEL_SRC: str = Path.cwd().as_posix() + '/linux'
# define variables
diff --git a/scripts/package-build/linux-kernel/build.py b/scripts/package-build/linux-kernel/build.py
index 41652c71..1bcab686 100755
--- a/scripts/package-build/linux-kernel/build.py
+++ b/scripts/package-build/linux-kernel/build.py
@@ -26,6 +26,9 @@ from argparse import ArgumentParser
from pathlib import Path
from subprocess import run, CalledProcessError
+# Relative path to defaults.toml
+defaults_path = "../../../data/defaults.toml"
+
def ensure_dependencies(dependencies: list) -> None:
"""Ensure Debian build dependencies are met"""
@@ -211,7 +214,9 @@ if __name__ == '__main__':
config = toml.load(file)
# Extract defaults and packages
- defaults = config.get('defaults', {})
+ with open(defaults_path, 'r') as file:
+ defaults = toml.load(file)
+
packages = config['packages']
# Filter packages if specific packages are specified in the arguments
diff --git a/scripts/package-build/linux-kernel/package.toml b/scripts/package-build/linux-kernel/package.toml
index bd1b5466..8b030da0 100644
--- a/scripts/package-build/linux-kernel/package.toml
+++ b/scripts/package-build/linux-kernel/package.toml
@@ -1,6 +1,7 @@
-[defaults]
-kernel_version = "6.6.47"
-kernel_flavor = "amd64-vyos"
+# [defaults]
+# We get the kernel_version from vyos-build/data/defaults.toml
+# kernel_version = "6.6.47"
+# kernel_flavor = "amd64-vyos"
[[packages]]