From: Alexander Popov Date: Mon, 6 Apr 2020 14:36:19 +0000 (+0300) Subject: Improve versioning X-Git-Tag: v0.5.7~26 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=100a39e2b01dadd2d27ed805cbe2b4ead7fc8b05;p=kconfig-hardened-check.git Improve versioning --- diff --git a/README.md b/README.md index ffae444..76d4e1d 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ or simply run `./bin/kconfig-hardened-check` from the cloned repository. ## Usage ``` usage: kconfig-hardened-check [-h] [-p {X86_64,X86_32,ARM64,ARM}] [-c CONFIG] - [--debug] [--json] + [--debug] [--json] [--version] Checks the hardening options in the Linux kernel config @@ -56,6 +56,7 @@ optional arguments: check the config_file against these preferences --debug enable verbose debug mode --json print results in JSON format + --version show program's version number and exit ``` ## Output for `Ubuntu 18.04 (Bionic Beaver with HWE)` kernel config @@ -215,9 +216,7 @@ I usually update the kernel hardening recommendations after each Linux kernel re So the version of `kconfig-hardened-check` is associated with the corresponding version of the kernel. -The version format is: __[major_number].[kernel_version]__ - -The current version of `kconfig-hardened-check` is __0.5.5__, it's marked with the git tag. +The version format is: __[major_number].[kernel_version].[kernel_patchlevel]__ ## Questions and answers diff --git a/kconfig_hardened_check/__about__.py b/kconfig_hardened_check/__about__.py new file mode 100755 index 0000000..31d29d8 --- /dev/null +++ b/kconfig_hardened_check/__about__.py @@ -0,0 +1 @@ +__version__ = '0.5.5' diff --git a/kconfig_hardened_check/__init__.py b/kconfig_hardened_check/__init__.py index ea5a4c9..047beff 100755 --- a/kconfig_hardened_check/__init__.py +++ b/kconfig_hardened_check/__init__.py @@ -59,6 +59,7 @@ from argparse import ArgumentParser from collections import OrderedDict import re import json +from .__about__ import __version__ # debug_mode enables: # - reporting about unknown kernel options in the config, @@ -603,7 +604,8 @@ def main(): config_checklist = [] - parser = ArgumentParser(description='Checks the hardening options in the Linux kernel config') + parser = ArgumentParser(prog='kconfig-hardened-check', + description='Checks the hardening options in the Linux kernel config') parser.add_argument('-p', '--print', choices=supported_archs, help='print hardening preferences for selected architecture') parser.add_argument('-c', '--config', @@ -612,6 +614,7 @@ def main(): help='enable verbose debug mode') parser.add_argument('--json', action='store_true', help='print results in JSON format') + parser.add_argument('--version', action='version', version='%(prog)s ' + __version__) args = parser.parse_args() if args.debug: diff --git a/setup.cfg b/setup.cfg index 2ac1c3b..66bd0b7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,5 @@ [metadata] name = kconfig-hardened-check -version = 0.5.5 author = Alexander Popov author_email = alex.popov@linux.com home-page = https://github.com/a13xp0p0v/kconfig-hardened-check diff --git a/setup.py b/setup.py index 7f317b8..8197fab 100755 --- a/setup.py +++ b/setup.py @@ -2,4 +2,11 @@ from setuptools import setup -setup() +about = {} +with open("kconfig_hardened_check/__about__.py") as f: + exec(f.read(), about) + +print('v: "{}"'.format(about['__version__'])) + +# See the options in setup.cfg +setup(version = about['__version__'])