From f383caf3ca459ba790523c393ae734df5b01c73f Mon Sep 17 00:00:00 2001 From: 13r0ck Date: Thu, 7 Jul 2022 18:57:37 -0600 Subject: [PATCH 1/2] Switch from distutils to setuptools distutils was depricated in Python3.12 trying to build kernelstub on 22.04 (jammy) results in the folowing error: ``` DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives ``` --- debian/control | 2 +- setup.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/debian/control b/debian/control index eb3cc72..cb3d6fb 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: kernelstub Maintainer: Ian Santopietro Section: python Priority: optional -Build-Depends: python3-all, pyflakes3, debhelper (>= 7.4.3), dh-python +Build-Depends: python3-all, pyflakes3, debhelper (>= 7.4.3), dh-python, python3-setuptools Standards-Version: 3.9.1 Package: kernelstub diff --git a/setup.py b/setup.py index ced88b0..4095250 100755 --- a/setup.py +++ b/setup.py @@ -19,8 +19,8 @@ """ -from distutils.core import setup -from distutils.cmd import Command +from setuptools import setup +from setuptools import Command import os, subprocess, sys TREE = os.path.dirname(os.path.abspath(__file__)) From c567d1b2f866484c3e21327783843fca7a83dc27 Mon Sep 17 00:00:00 2001 From: 13r0ck Date: Thu, 7 Jul 2022 16:21:37 -0600 Subject: [PATCH 2/2] Prevent keyerror: None Kernelstub will crash when used in building some immutable images because the latest_version will be none. --- kernelstub/kernel_option.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernelstub/kernel_option.py b/kernelstub/kernel_option.py index baf53f7..12edd2a 100755 --- a/kernelstub/kernel_option.py +++ b/kernelstub/kernel_option.py @@ -46,7 +46,8 @@ def latest_option(path): opts = options(path) latest_option, latest_version = get_newest_option(opts) - opts.pop(latest_version) + if latest_version is not None: + opts.pop(latest_version) previous_option = None if len(opts) > 0: previous_option, latest_version = get_newest_option(opts)