1
0
mirror of https://gitlab.com/openlp/packaging.git synced 2024-12-22 13:02:50 +00:00

Merge branch 'gitlab-packaging' into 'master'

Some updates to get packaing working after the gitlab migration.

See merge request openlp/packaging!2
This commit is contained in:
Raoul Snyman 2019-09-24 18:47:13 +00:00
commit a762877cc5
2 changed files with 17 additions and 17 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,13 @@ 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')
if not git_version or len(git_version.strip()) == 0:
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,10 +258,10 @@ 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
self.portable_version = version + '.' + revision.split('+')[0]
else:
self.portable_version = self.version + '.0' * (3 - self.version.count('.'))
with open(os.path.join(config_dir, 'appinfo.ini.default'), 'r') as input_file, \