Changed installer filename to use branch, stage and revision #4898
This commit is contained in:
parent
392f2904aa
commit
41c03b8f37
|
@ -848,7 +848,7 @@ class InternalCommands:
|
|||
pwd = lines[0]
|
||||
|
||||
if (dist):
|
||||
self.signFile(pfx, pwd, 'bin/Release', self.dist_name('win'))
|
||||
self.signFile(pfx, pwd, 'bin/Release', self.getDistFilename('win'))
|
||||
else:
|
||||
self.signFile(pfx, pwd, 'bin/Release', 'synergy.exe')
|
||||
self.signFile(pfx, pwd, 'bin/Release', 'synergyc.exe')
|
||||
|
@ -1086,7 +1086,7 @@ class InternalCommands:
|
|||
templateFile = open(self.cmake_dir + '/synergy.spec.in')
|
||||
template = templateFile.read()
|
||||
|
||||
template = template.replace('${in:version}', self.getVersionFromCmake())
|
||||
template = template.replace('${in:version}', self.getVersionNumber())
|
||||
|
||||
specPath = rpmDir + '/synergy.spec'
|
||||
|
||||
|
@ -1094,10 +1094,8 @@ class InternalCommands:
|
|||
specFile.write(template)
|
||||
specFile.close()
|
||||
|
||||
version = self.getVersionFromCmake()
|
||||
target = '../../bin/synergy-%s-%s.rpm' % (
|
||||
version, self.getLinuxPlatform())
|
||||
|
||||
self.getVersionForFilename(), self.getLinuxPlatform())
|
||||
|
||||
try:
|
||||
self.try_chdir(rpmDir)
|
||||
|
@ -1123,9 +1121,10 @@ class InternalCommands:
|
|||
binDir = self.getGenerator().binDir
|
||||
resDir = self.cmake_dir
|
||||
|
||||
version = self.getVersionFromCmake()
|
||||
package = '%s-%s-%s' % (
|
||||
self.project, version, self.getLinuxPlatform())
|
||||
self.project,
|
||||
self.getVersionForFilename(),
|
||||
self.getLinuxPlatform())
|
||||
|
||||
debDir = '%s/deb' % buildDir
|
||||
if os.path.exists(debDir):
|
||||
|
@ -1138,7 +1137,7 @@ class InternalCommands:
|
|||
template = templateFile.read()
|
||||
|
||||
template = template.replace('${in:version}',
|
||||
self.getVersionFromCmake())
|
||||
self.getVersionNumber())
|
||||
|
||||
template = template.replace('${in:arch}',
|
||||
self.getDebianArch())
|
||||
|
@ -1226,8 +1225,11 @@ class InternalCommands:
|
|||
self.restore_chdir()
|
||||
|
||||
def distSrc(self):
|
||||
version = self.getVersionFromCmake()
|
||||
name = (self.project + '-' + version + '-Source')
|
||||
name = '%s-%s-%s' % (
|
||||
self.project,
|
||||
self.getVersionForFilename(),
|
||||
'Source')
|
||||
|
||||
exportPath = self.getGenerator().buildDir + '/' + name
|
||||
|
||||
if os.path.exists(exportPath):
|
||||
|
@ -1280,7 +1282,7 @@ class InternalCommands:
|
|||
|
||||
fileName = "%s-%s-%s.dmg" % (
|
||||
self.project,
|
||||
self.getVersionFromCmake(),
|
||||
self.getVersionForFilename(),
|
||||
self.getMacPackageName())
|
||||
|
||||
cmd = "hdiutil create " + fileName + " -srcfolder ./" + name + "/ -ov"
|
||||
|
@ -1296,7 +1298,7 @@ class InternalCommands:
|
|||
if generator.endswith('Win64'):
|
||||
arch = 'x64'
|
||||
|
||||
version = self.getVersionFromCmake()
|
||||
version = self.getVersionNumber()
|
||||
args = "/p:DefineConstants=\"Version=%s\"" % version
|
||||
|
||||
self.run_vcbuild(
|
||||
|
@ -1305,7 +1307,7 @@ class InternalCommands:
|
|||
|
||||
filename = "%s-%s-Windows-%s.msi" % (
|
||||
self.project,
|
||||
version,
|
||||
self.getVersionForFilename(),
|
||||
arch)
|
||||
|
||||
old = "bin/Release/synergy.msi"
|
||||
|
@ -1340,7 +1342,7 @@ class InternalCommands:
|
|||
templateFile = open(self.cmake_dir + '\Installer.nsi.in')
|
||||
template = templateFile.read()
|
||||
|
||||
template = template.replace('${in:version}', self.getVersionFromCmake())
|
||||
template = template.replace('${in:version}', self.getVersionNumber())
|
||||
template = template.replace('${in:arch}', arch)
|
||||
template = template.replace('${in:vcRedistDir}', vcRedistDir)
|
||||
template = template.replace('${in:qtDir}', qtDir)
|
||||
|
@ -1357,7 +1359,7 @@ class InternalCommands:
|
|||
if err != 0:
|
||||
raise Exception('Package failed: ' + str(err))
|
||||
|
||||
def getVersionFromCmake(self):
|
||||
def getVersionNumber(self):
|
||||
cmakeFile = open('CMakeLists.txt')
|
||||
cmake = cmakeFile.read()
|
||||
|
||||
|
@ -1370,7 +1372,20 @@ class InternalCommands:
|
|||
revRe = re.search('VERSION_REV (\d+)', cmake)
|
||||
rev = revRe.group(1)
|
||||
|
||||
return major + '.' + minor + '.' + rev
|
||||
return "%s.%s.%s" % (major, minor, rev)
|
||||
|
||||
def getVersionStage(self):
|
||||
cmakeFile = open('CMakeLists.txt')
|
||||
cmake = cmakeFile.read()
|
||||
|
||||
stageRe = re.search('VERSION_STAGE (\w+)', cmake)
|
||||
return stageRe.group(1)
|
||||
|
||||
def getVersionForFilename(self):
|
||||
versionStage = self.getVersionStage()
|
||||
gitBranch = self.getGitBranchName()
|
||||
gitRevision = self.getGitRevision()
|
||||
return "%s-%s-%s" % (gitBranch, versionStage, gitRevision)
|
||||
|
||||
def distftp(self, type, ftp):
|
||||
if not type:
|
||||
|
@ -1380,8 +1395,9 @@ class InternalCommands:
|
|||
|
||||
binDir = self.getGenerator().getBinDir('Release')
|
||||
|
||||
packageSource = binDir + '/' + self.dist_name(type)
|
||||
packageTarget = self.dist_name_rev(type)
|
||||
filename = self.getDistFilename(type)
|
||||
packageSource = binDir + '/' + filename
|
||||
packageTarget = filename
|
||||
ftp.upload(packageSource, packageTarget)
|
||||
|
||||
if type != 'src':
|
||||
|
@ -1393,9 +1409,7 @@ class InternalCommands:
|
|||
|
||||
def getLibraryDistFilename(self, type, dir, name):
|
||||
(platform, packageExt, libraryExt) = self.getDistributePlatformInfo(type)
|
||||
branch = self.getGitBranchName()
|
||||
revision = self.getGitRevision()
|
||||
firstPart = '%s-%s-%s-%s' % (name, branch, revision, platform)
|
||||
firstPart = '%s-%s-%s' % (name, self.getVersionForFilename(), platform)
|
||||
|
||||
filename = '%s.%s' % (firstPart, libraryExt)
|
||||
if type == 'rpm' or type == 'deb':
|
||||
|
@ -1453,30 +1467,14 @@ class InternalCommands:
|
|||
|
||||
return (platform, ext, libraryExt)
|
||||
|
||||
def dist_name(self, type):
|
||||
(platform, packageExt, libraryExt) = self.getDistributePlatformInfo(type)
|
||||
ext = packageExt
|
||||
|
||||
pattern = (
|
||||
re.escape(self.project + '-') + '\d+\.\d+\.\d+' +
|
||||
re.escape('-' + platform + '.' + ext))
|
||||
|
||||
def getDistFilename(self, type):
|
||||
pattern = self.getVersionForFilename()
|
||||
for filename in os.listdir(self.getBinDir('Release')):
|
||||
if re.search(pattern, filename):
|
||||
return filename
|
||||
|
||||
# still here? package probably not created yet.
|
||||
raise Exception('Could not find package name with pattern: ' + pattern)
|
||||
|
||||
def dist_name_rev(self, type):
|
||||
branch = self.getGitBranchName()
|
||||
revision = self.getGitRevision()
|
||||
|
||||
# find the version number (we're puting the rev in after this)
|
||||
pattern = '(\d+\.\d+\.\d+)'
|
||||
replace = "%s-%s" % (branch, revision)
|
||||
return re.sub(pattern, replace, self.dist_name(type))
|
||||
|
||||
def getDebianArch(self):
|
||||
if os.uname()[4][:3] == 'arm':
|
||||
return 'armhf'
|
||||
|
|
Loading…
Reference in New Issue