Skip to content

Commit

Permalink
Extend version numbering with revision number
Browse files Browse the repository at this point in the history
  • Loading branch information
Gyorgy Orban committed Jan 11, 2017
1 parent b30b166 commit a28db14
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 43 deletions.
2 changes: 1 addition & 1 deletion Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ PROJECT_NAME = "Code Checker"
# This could be handy for archiving the generated documentation or
# if some version control system is used.

PROJECT_NUMBER = 5.6
PROJECT_NUMBER = 5.6.0

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer
Expand Down
4 changes: 1 addition & 3 deletions codechecker_lib/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ def run_check(args, actions, context):

actions = prepare_actions(actions, enabled_analyzers)

package_version = context.version['major'] + '.' + context.version['minor']

suppress_file = ''
try:
suppress_file = os.path.realpath(args.suppress)
Expand All @@ -111,7 +109,7 @@ def run_check(args, actions, context):
with client.get_connection() as connection:
context.run_id = connection.add_checker_run(' '.join(sys.argv),
args.name,
package_version,
context.version,
args.force)

# Clean previous suppress information.
Expand Down
36 changes: 7 additions & 29 deletions codechecker_lib/arg_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,9 @@ def handle_plist(args):
conn_mgr.start_report_server()

with client.get_connection() as connection:
package_version = context.version['major'] + '.' + \
context.version['minor']
context.run_id = connection.add_checker_run(' '.join(sys.argv),
args.name,
package_version,
context.version,
args.force)

pool = multiprocessing.Pool(args.jobs)
Expand All @@ -396,33 +394,13 @@ def handle_version_info(args):
"""

context = generic_package_context.get_context()
version_file = context.version_file

try:
with open(version_file) as v_file:
v_data = v_file.read()

version_data = json.loads(v_data)
base_version = version_data['version']['major'] + \
'.' + version_data['version']['minor']
db_schema_version = version_data['db_version']['major'] + \
'.' + version_data['db_version']['minor']

print(('Base package version: \t' + base_version).expandtabs(30))
print(('Package build date: \t' +
version_data['package_build_date']).expandtabs(30))
print(('Git hash: \t' + version_data['git_hash']).expandtabs(30))
print(('DB schema version: \t' + db_schema_version).expandtabs(30))

except ValueError as verr:
LOG.error('Failed to decode version information from the config file.')
LOG.error(verr)
sys.exit(1)

except IOError as ioerr:
LOG.error('Failed to read version config file: ' + version_file)
LOG.error(ioerr)
sys.exit(1)
print('Base package version: \t' + context.version).expandtabs(30)
print('Package build date: \t' +
context.package_build_date).expandtabs(30)
print('Git hash: \t' + context.package_git_hash).expandtabs(30)
print('DB schema version: \t' +
str(context.db_version_info)).expandtabs(30)

# Thift api version for the clients.
from codeCheckerDBAccess import constants
Expand Down
44 changes: 35 additions & 9 deletions codechecker_lib/generic_package_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ def __init__(self, package_root, pckg_layout, cfg_dict):

self.__package_root = package_root

version, database_version = self.__get_version(self.version_file)
self.__package_version = version
self.__db_version_info = db_version.DBVersionInfo(
database_version['major'],
database_version['minor'])
self.__package_version = None
self.__db_version_info = None
self.__package_build_date = None
self.__package_git_hash = None

self.__set_version()

Context.__instance = self

def set_env(self, env_vars):
Expand All @@ -64,24 +66,40 @@ def set_env(self, env_vars):
self.ld_preload = os.environ.get(env_vars['ld_preload'])
self.ld_lib_path = env_vars['env_ld_lib_path']

def __get_version(self, version_file):
def __set_version(self):
"""
Get the package version from the version config file.
"""
try:
with open(version_file, 'r') as vfile:
with open(self.version_file, 'r') as vfile:
vfile_data = json.loads(vfile.read())

package_version = vfile_data['version']
db_version = vfile_data['db_version']
package_build_date = vfile_data['package_build_date']
package_git_hash = vfile_data['git_hash']
database_version = vfile_data['db_version']

self.__package_version = package_version['major'] + '.' + \
package_version['minor'] + '.' + \
package_version['revision']
self.__db_version_info = db_version.DBVersionInfo(
database_version['major'],
database_version['minor'])

self.__package_build_date = package_build_date
self.__package_git_hash = package_git_hash

except ValueError as verr:
# db_version is required to know if the db schema is compatible.
LOG.error('Failed to get version info from the version file.')
LOG.error(verr)
sys.exit(1)

return package_version, db_version
except IOError as ioerr:
LOG.error('Failed to read version config file: ' +
self.version_file)
LOG.error(ioerr)
sys.exit(1)

@property
def default_checkers_config(self):
Expand All @@ -91,6 +109,14 @@ def default_checkers_config(self):
def version(self):
return self.__package_version

@property
def package_build_date(self):
return self.__package_build_date

@property
def package_git_hash(self):
return self.__package_git_hash

@property
def db_version_info(self):
return self.__db_version_info
Expand Down
3 changes: 2 additions & 1 deletion config/version.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"version":{
"major" : "5",
"minor" : "6"
"minor" : "6",
"revision" : "0"
},
"db_version":{
"major" : "5",
Expand Down

0 comments on commit a28db14

Please sign in to comment.