diff options
author | Chris Laplante <chris.laplante@agilent.com> | 2025-01-29 15:20:15 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-02-01 13:20:45 +0000 |
commit | e85a3c8f2c083e1d322bd25069631f7d8905f1d9 (patch) | |
tree | 3e364c450dbbabcde3dae0a8212e54a365600cbb /scripts/lib/devtool/standard.py | |
parent | b7327c7c281a9d661bcb43ccb858b1aaaddaaa12 (diff) | |
download | poky-e85a3c8f2c083e1d322bd25069631f7d8905f1d9.tar.gz |
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>
Diffstat (limited to 'scripts/lib/devtool/standard.py')
-rw-r--r-- | scripts/lib/devtool/standard.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index 20c94616b2..0cdb9c6cfb 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py | |||
@@ -726,15 +726,13 @@ def _check_preserve(config, recipename): | |||
726 | 726 | ||
727 | def get_staging_kver(srcdir): | 727 | def get_staging_kver(srcdir): |
728 | # Kernel version from work-shared | 728 | # Kernel version from work-shared |
729 | kerver = [] | 729 | import itertools |
730 | staging_kerVer="" | 730 | try: |
731 | if os.path.exists(srcdir) and os.listdir(srcdir): | ||
732 | with open(os.path.join(srcdir, "Makefile")) as f: | 731 | with open(os.path.join(srcdir, "Makefile")) as f: |
733 | version = [next(f) for x in range(5)][1:4] | 732 | # Take VERSION, PATCHLEVEL, SUBLEVEL from lines 1, 2, 3 |
734 | for word in version: | 733 | return ".".join(line.rstrip().split('= ')[1] for line in itertools.islice(f, 1, 4)) |
735 | kerver.append(word.split('= ')[1].split('\n')[0]) | 734 | except FileNotFoundError: |
736 | staging_kerVer = ".".join(kerver) | 735 | return "" |
737 | return staging_kerVer | ||
738 | 736 | ||
739 | def get_staging_kbranch(srcdir): | 737 | def get_staging_kbranch(srcdir): |
740 | import bb.process | 738 | import bb.process |