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

Some updates to get packaing working after the gitlab migration.

This commit is contained in:
Tomas Groth 2019-09-24 18:47:13 +00:00 committed by Raoul Snyman
parent 81e4db7463
commit ce5b55ef1a
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, parser.add_argument('--skip-translations', action='store_true', default=False,
help='Do NOT update the language translation files') 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('--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, parser.add_argument('--tag-override', metavar='<tag>.dev<revision-count>+<commit-hash>', default=None,
help='Override tag and revision, should be in format <tag>-git<revision-count>-<commit-hash>') help='Override tag and revision, should be in format <tag>.dev<revision-count>+<commit-hash>')
self.add_extra_args(parser) self.add_extra_args(parser)
self.args = parser.parse_args() self.args = parser.parse_args()
@ -316,18 +316,13 @@ class Builder(object):
if self.args.tag_override: if self.args.tag_override:
self.version = self.args.tag_override self.version = self.args.tag_override
else: else:
# This is a development build, get the tag and revision # This is a development build, get the version info based on tags
output = self._git('tag', self.branch_path, ['--list'], err_msg='Error running git tag') git_version = self._git('describe', self.branch_path, ['--tags'], err_msg='Error running git describe')
lines = output.strip().splitlines() if not git_version or len(git_version.strip()) == 0:
if len(lines) == 0: self.version = '0.0.0'
tag = '0.0.0'
else: else:
tag = lines[-1] self.version = '+'.join(git_version.strip().rsplit('-g', 1))
revision_count = self._git('rev-list', self.branch_path, ['--count', 'HEAD'], 'Error running git rev-list') self.version = '.dev'.join(self.version.rsplit('-', 1))
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)
# Write the version to the version file # Write the version to the version file
with open(os.path.join(self.dist_path, '.version'), 'w') as version_file: with open(os.path.join(self.dist_path, '.version'), 'w') as version_file:
version_file.write(str(self.version)) 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: with open(os.path.join(config_dir, 'OpenLP-base.wxs'), 'rt') as base_file:
xml = base_file.read() xml = base_file.read()
progfilefolder = 'ProgramFiles64Folder' if self.arch == 'x64' else 'ProgramFilesFolder' 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'), xml = xml % dict(dialog=os.path.join(config_dir, 'WizardMain.bmp'),
banner=os.path.join(config_dir, 'WizardBanner.bmp'), banner=os.path.join(config_dir, 'WizardBanner.bmp'),
platform=self.arch, platform=self.arch,
@ -253,10 +258,10 @@ class WindowsBuilder(Builder):
""" """
self._print_verbose('... Creating PortableApps appinfo file ...') self._print_verbose('... Creating PortableApps appinfo file ...')
config_dir = os.path.dirname(self.config_path) config_dir = os.path.dirname(self.config_path)
if '-git' in self.version: if '.dev' in self.version:
version, revision = self.version.split('-git') version, revision = self.version.split('.dev')
version = version + '.0' * (2 - version.count('.')) version = version + '.0' * (2 - version.count('.'))
self.portable_version = version + '.' + revision self.portable_version = version + '.' + revision.split('+')[0]
else: else:
self.portable_version = self.version + '.0' * (3 - self.version.count('.')) self.portable_version = self.version + '.0' * (3 - self.version.count('.'))
with open(os.path.join(config_dir, 'appinfo.ini.default'), 'r') as input_file, \ with open(os.path.join(config_dir, 'appinfo.ini.default'), 'r') as input_file, \