1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-31 00:39:46 +00:00

devtool: standard: simplify get_staging_kver

The goal is to make this more Pythonic, as it was a little cryptic the
first time I looked at it.

(From OE-Core rev: 80285b0f9b716ebad87a2feb08f12f87d70c27e3)

Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Chris Laplante
2025-01-29 15:20:15 -05:00
committed by Richard Purdie
parent b7327c7c28
commit e85a3c8f2c
+6 -8
View File
@@ -726,15 +726,13 @@ def _check_preserve(config, recipename):
def get_staging_kver(srcdir): def get_staging_kver(srcdir):
# Kernel version from work-shared # Kernel version from work-shared
kerver = [] import itertools
staging_kerVer="" try:
if os.path.exists(srcdir) and os.listdir(srcdir):
with open(os.path.join(srcdir, "Makefile")) as f: with open(os.path.join(srcdir, "Makefile")) as f:
version = [next(f) for x in range(5)][1:4] # Take VERSION, PATCHLEVEL, SUBLEVEL from lines 1, 2, 3
for word in version: return ".".join(line.rstrip().split('= ')[1] for line in itertools.islice(f, 1, 4))
kerver.append(word.split('= ')[1].split('\n')[0]) except FileNotFoundError:
staging_kerVer = ".".join(kerver) return ""
return staging_kerVer
def get_staging_kbranch(srcdir): def get_staging_kbranch(srcdir):
import bb.process import bb.process