Commit 100a39e2 by Alexander Popov

Improve versioning

parent 75bed5d6
...@@ -44,7 +44,7 @@ or simply run `./bin/kconfig-hardened-check` from the cloned repository. ...@@ -44,7 +44,7 @@ or simply run `./bin/kconfig-hardened-check` from the cloned repository.
## Usage ## Usage
``` ```
usage: kconfig-hardened-check [-h] [-p {X86_64,X86_32,ARM64,ARM}] [-c CONFIG] 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 Checks the hardening options in the Linux kernel config
...@@ -56,6 +56,7 @@ optional arguments: ...@@ -56,6 +56,7 @@ optional arguments:
check the config_file against these preferences check the config_file against these preferences
--debug enable verbose debug mode --debug enable verbose debug mode
--json print results in JSON format --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 ## 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 ...@@ -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. 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 version format is: __[major_number].[kernel_version].[kernel_patchlevel]__
The current version of `kconfig-hardened-check` is __0.5.5__, it's marked with the git tag.
## Questions and answers ## Questions and answers
......
__version__ = '0.5.5'
...@@ -59,6 +59,7 @@ from argparse import ArgumentParser ...@@ -59,6 +59,7 @@ from argparse import ArgumentParser
from collections import OrderedDict from collections import OrderedDict
import re import re
import json import json
from .__about__ import __version__
# debug_mode enables: # debug_mode enables:
# - reporting about unknown kernel options in the config, # - reporting about unknown kernel options in the config,
...@@ -603,7 +604,8 @@ def main(): ...@@ -603,7 +604,8 @@ def main():
config_checklist = [] 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, parser.add_argument('-p', '--print', choices=supported_archs,
help='print hardening preferences for selected architecture') help='print hardening preferences for selected architecture')
parser.add_argument('-c', '--config', parser.add_argument('-c', '--config',
...@@ -612,6 +614,7 @@ def main(): ...@@ -612,6 +614,7 @@ def main():
help='enable verbose debug mode') help='enable verbose debug mode')
parser.add_argument('--json', action='store_true', parser.add_argument('--json', action='store_true',
help='print results in JSON format') help='print results in JSON format')
parser.add_argument('--version', action='version', version='%(prog)s ' + __version__)
args = parser.parse_args() args = parser.parse_args()
if args.debug: if args.debug:
......
[metadata] [metadata]
name = kconfig-hardened-check name = kconfig-hardened-check
version = 0.5.5
author = Alexander Popov author = Alexander Popov
author_email = alex.popov@linux.com author_email = alex.popov@linux.com
home-page = https://github.com/a13xp0p0v/kconfig-hardened-check home-page = https://github.com/a13xp0p0v/kconfig-hardened-check
......
...@@ -2,4 +2,11 @@ ...@@ -2,4 +2,11 @@
from setuptools import setup 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__'])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment