Commit 57ae7506 authored by Eike Ziller's avatar Eike Ziller

Allow packaging additional 7zips in the installer

Change-Id: I435602671ef5cde46580d4ca383930951765ebde
Reviewed-by: default avatarKai Koehne <kai.koehne@theqtcompany.com>
parent 9a69a05f
......@@ -47,6 +47,15 @@ Component.prototype.loaded = function()
}
}
Component.prototype.createOperationsForArchive = function(archive)
{
// if there are additional plugin 7zips, these must be extracted in .app/Contents on OS X
if (systemInfo.productType !== "osx" || archive.indexOf('qtcreator.7z') !== -1)
component.addOperation("Extract", archive, "@TargetDir@");
else
component.addOperation("Extract", archive, "@TargetDir@/Qt Creator.app/Contents");
}
Component.prototype.beginInstallation = function()
{
component.qtCreatorBinaryPath = installer.value("TargetDir");
......
......@@ -38,7 +38,7 @@ import shutil
import inspect
def usage():
print('Usage: %s [-v|--version-string=versionstring] [-i|--installer-path=/path/to/installerfw] [-a|--archive=archive.7z] <outputname>' % os.path.basename(sys.argv[0]))
print('Usage: %s [-v|--version-string=versionstring] [-i|--installer-path=/path/to/installerfw] [-a|--archive=archive.7z] [-d|--debug] <outputname>' % os.path.basename(sys.argv[0]))
def substitute_file(infile, outfile, substitutions):
with open(infile, 'r') as f:
......@@ -53,7 +53,7 @@ def ifw_template_dir():
def main():
try:
opts, args = getopt.gnu_getopt(sys.argv[1:], 'hv:i:a:', ['help', 'version-string=', 'installer-path=', 'archive'])
opts, args = getopt.gnu_getopt(sys.argv[1:], 'hv:i:a:d', ['help', 'version-string=', 'installer-path=', 'archive', 'debug'])
except:
usage()
sys.exit(2)
......@@ -64,7 +64,8 @@ def main():
version = ''
ifw_location = ''
archive = ''
archives = []
debug = False
for o, a in opts:
if o in ('-h', '--help'):
usage()
......@@ -74,7 +75,9 @@ def main():
if o in ('-i', '--installer-path'):
ifw_location = a
if o in ('-a', '--archive'):
archive = a
archives.append(a)
if o in ('-d', '--debug'):
debug = True
if (version == ''):
raise Exception('Version not specified (--version-string)!')
......@@ -82,8 +85,8 @@ def main():
if (ifw_location == ''):
raise Exception('Installer framework location not specified (--installer-path)!')
if (archive == ''):
raise Exception('Archive not specified (--archive)!')
if not archives:
raise ValueError('No archive(s) specified (--archive)!')
installer_name = args[0]
config_postfix = ''
......@@ -100,12 +103,15 @@ def main():
try:
temp_dir = tempfile.mkdtemp()
except:
raise Exception('Failed to create a temporary directory!')
raise IOError('Failed to create a temporary directory!')
if debug:
print('Working directory: {0}'.format(temp_dir))
try:
substs = {}
substs['version'] = version
substs['date'] = datetime.date.today().isoformat()
substs['archives'] = ','.join(archives)
template_dir = ifw_template_dir()
out_config_dir = os.path.join(temp_dir,'config')
......@@ -127,13 +133,17 @@ def main():
data_path = os.path.join(out_packages_dir, 'org.qtproject.qtcreator.application', 'data')
if not os.path.exists(data_path):
os.makedirs(data_path)
shutil.copy(archive, data_path)
for archive in archives:
shutil.copy(archive, data_path)
ifw_call = [os.path.join(ifw_location, 'bin', 'binarycreator'), '-c', os.path.join(out_config_dir, config_name), '-p', out_packages_dir, installer_name, '--offline-only' ]
if debug:
ifw_call.append('-v')
subprocess.check_call(ifw_call, stderr=subprocess.STDOUT)
finally:
print('Cleaning up...')
shutil.rmtree(temp_dir)
if not debug:
print('Cleaning up...')
shutil.rmtree(temp_dir)
print('Done.')
if __name__ == '__main__':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment