Some fixes to get appveyor packaging working with the gitlab integration.

This commit is contained in:
Tomas Groth 2019-09-23 19:08:15 +00:00
parent 81e4db7463
commit fb473fa5a2
2 changed files with 17 additions and 16 deletions

View File

@ -160,8 +160,8 @@ class Builder(object):
parser.add_argument('--skip-translations', action='store_true', default=False,
help='Do NOT update the language translation files')
parser.add_argument('--debug', action='store_true', default=False, help='Create a debug build')
parser.add_argument('--tag-override', metavar='<tag>-git<revision-count>-<commit-hash>', default=None,
help='Override tag and revision, should be in format <tag>-git<revision-count>-<commit-hash>')
parser.add_argument('--tag-override', metavar='<tag>.dev<revision-count>+<commit-hash>', default=None,
help='Override tag and revision, should be in format <tag>.dev<revision-count>+<commit-hash>')
self.add_extra_args(parser)
self.args = parser.parse_args()
@ -316,18 +316,14 @@ class Builder(object):
if self.args.tag_override:
self.version = self.args.tag_override
else:
# This is a development build, get the tag and revision
output = self._git('tag', self.branch_path, ['--list'], err_msg='Error running git tag')
lines = output.strip().splitlines()
if len(lines) == 0:
tag = '0.0.0'
# This is a development build, get the version info based on tags
git_version = self._git('describe', self.branch_path, ['--tags'], err_msg='Error running git describe')
git_version = git_version.strip()
if not git_version:
self.version = '0.0.0'
else:
tag = lines[-1]
revision_count = self._git('rev-list', self.branch_path, ['--count', 'HEAD'], 'Error running git rev-list')
revision_count = revision_count.strip()
sha = self._git('rev-parse', self.branch_path, ['--short', 'HEAD'], 'Error running git rev-parse')
sha = sha.strip()
self.version = '{tag}.git-r{revision}-{sha}'.format(tag=tag, revision=revision_count, sha=sha)
self.version = '+'.join(git_version.strip().rsplit('-g', 1))
self.version = '.dev'.join(self.version.rsplit('-', 1))
# Write the version to the version file
with open(os.path.join(self.dist_path, '.version'), 'w') as version_file:
version_file.write(str(self.version))

View File

@ -196,7 +196,12 @@ class WindowsBuilder(Builder):
with open(os.path.join(config_dir, 'OpenLP-base.wxs'), 'rt') as base_file:
xml = base_file.read()
progfilefolder = 'ProgramFiles64Folder' if self.arch == 'x64' else 'ProgramFilesFolder'
windows_version = self.version.replace('-git', '.')
# convert the version string to format x.x.x if needed
if '.dev' in self.version:
windows_version = self.version.replace('.dev', '.')
windows_version = windows_version.rsplit('+', 1)[0]
else:
windows_version = self.version
xml = xml % dict(dialog=os.path.join(config_dir, 'WizardMain.bmp'),
banner=os.path.join(config_dir, 'WizardBanner.bmp'),
platform=self.arch,
@ -253,8 +258,8 @@ class WindowsBuilder(Builder):
"""
self._print_verbose('... Creating PortableApps appinfo file ...')
config_dir = os.path.dirname(self.config_path)
if '-git' in self.version:
version, revision = self.version.split('-git')
if '.dev' in self.version:
version, revision = self.version.split('.dev')
version = version + '.0' * (2 - version.count('.'))
self.portable_version = version + '.' + revision
else: