Fix versioning code
Removed cruft from OpenStack common versioning code that was removed. Added optional git SHA information if module is available. The intent is to have the additional git revision reported only when FINAL is set to False. Change-Id: Iae94b84027e7428cd394726e07845d2bad631586 Signed-off-by: Jeff Peeler <jpeeler@redhat.com>
This commit is contained in:
parent
9cf1c6f269
commit
2e3bdd9510
@ -116,7 +116,7 @@ class Service(object):
|
|||||||
self.timers = []
|
self.timers = []
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
vcs_string = version.version_string_with_vcs()
|
vcs_string = version.version_string(type='long')
|
||||||
LOG.info(_('Starting %(topic)s node (version %(vcs_string)s)'),
|
LOG.info(_('Starting %(topic)s node (version %(vcs_string)s)'),
|
||||||
{'topic': self.topic, 'vcs_string': vcs_string})
|
{'topic': self.topic, 'vcs_string': vcs_string})
|
||||||
# TODO do we need this ? -> utils.cleanup_file_locks()
|
# TODO do we need this ? -> utils.cleanup_file_locks()
|
||||||
|
@ -13,33 +13,52 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
import git
|
||||||
|
except ImportError:
|
||||||
|
git = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from heat.vcsversion import version_info
|
from heat.vcsversion import version_info
|
||||||
except ImportError:
|
except ImportError:
|
||||||
version_info = {'branch_nick': u'LOCALBRANCH',
|
version_info = {'sha': ''}
|
||||||
'revision_id': 'LOCALREVISION',
|
|
||||||
'revno': 0}
|
|
||||||
|
|
||||||
HEAT_VERSION = ['7']
|
|
||||||
REVISION = HEAT_VERSION
|
|
||||||
|
|
||||||
|
HEAT_VERSION = '7'
|
||||||
FINAL = False # This becomes true at Release Candidate time
|
FINAL = False # This becomes true at Release Candidate time
|
||||||
|
|
||||||
|
|
||||||
def canonical_version_string():
|
def get_git_sha():
|
||||||
return '.'.join(filter(None, HEAT_VERSION))
|
if not git:
|
||||||
|
return version_info['sha']
|
||||||
|
|
||||||
|
try:
|
||||||
|
repo = git.Repo('.')
|
||||||
|
except InvalidGitRepositoryError:
|
||||||
|
return version_info['sha']
|
||||||
|
return repo.head.commit.hexsha
|
||||||
|
|
||||||
|
|
||||||
def version_string():
|
def write_git_sha():
|
||||||
if FINAL:
|
if not git:
|
||||||
return canonical_version_string()
|
return
|
||||||
else:
|
|
||||||
return '%s-dev' % (canonical_version_string(),)
|
sha = get_git_sha()
|
||||||
|
|
||||||
|
if sha:
|
||||||
|
with open('heat/vcsversion.py', 'w') as version_file:
|
||||||
|
version_file.write("""
|
||||||
|
# This file is automatically generated by heat's setup.py, so don't edit it. :)
|
||||||
|
version_info = {
|
||||||
|
'sha': '%s'
|
||||||
|
}
|
||||||
|
""" % (sha))
|
||||||
|
|
||||||
|
|
||||||
def vcs_version_string():
|
def version_string(type='short'):
|
||||||
return "%s:%s" % (version_info['branch_nick'], version_info['revision_id'])
|
version = HEAT_VERSION
|
||||||
|
if not FINAL:
|
||||||
|
version += '-dev ' + get_git_sha()
|
||||||
def version_string_with_vcs():
|
elif type != 'short':
|
||||||
return "%s-%s" % (canonical_version_string(), vcs_version_string())
|
version += ' ' + get_git_sha()
|
||||||
|
return version
|
||||||
|
4
setup.py
4
setup.py
@ -21,12 +21,12 @@ import setuptools
|
|||||||
|
|
||||||
from heat.openstack.common import setup
|
from heat.openstack.common import setup
|
||||||
|
|
||||||
# import this after write_vcsversion because version imports vcsversion
|
|
||||||
from heat import version
|
from heat import version
|
||||||
|
version.write_git_sha()
|
||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name='heat',
|
name='heat',
|
||||||
version=version.canonical_version_string(),
|
version=version.HEAT_VERSION,
|
||||||
description='The heat project provides services for provisioning '
|
description='The heat project provides services for provisioning '
|
||||||
'virtual machines',
|
'virtual machines',
|
||||||
license='Apache License (2.0)',
|
license='Apache License (2.0)',
|
||||||
|
Loading…
Reference in New Issue
Block a user