def _getAppPackage(self): self.logger.debug('get Package') #Attention: For OSImage, here must be FolderPath other than FilePath #task.addPara('FolderPath', self.parameter['APPPacklocation']) #FIXME if self.parameter['installerType'] == 'RAW': appLocation = self.parameter['APPPacklocation'] self.downloadFolder = os.path.join(self.downloadFolder, 'BridgeRawBuild') self.logger.debug('download raw build from: %s', appLocation) elif 'APPPacklocation' in self.parameter: appLocation = self.parameter['APPPacklocation'] self.downloadFolder = os.path.join(self.downloadFolder, 'Build') self.logger.debug('download raw build from: %s', appLocation) else: buildNum = "unknown" from CodexTask import childTask task = childTask('codexTask') latestBuild = task.getBuild( self.parameter["appName"], self.parameter["appVer"], self.compileTarget, #CompileTarget self.platform, self.parameter["appLang"], self.parameter['appCertLevel'], self.parameter['appSubProduct']) if latestBuild==None: return None latestBuildLocation = latestBuild._location['protocol'] + "://" + \ latestBuild._location['server'] + \ latestBuild._location['path'] buildNum = latestBuild._build if not globalProperty.isMachineOutOfChina(): #Support the machine out of China, will download directly localLatestBuild = self._dbutil.getLatestBuild( self.parameter['appName'], self.parameter['appVer'], self.platform, self.parameter['appLang'], self.parameter['appCertLevel'], self.parameter['appSubProduct']) if localLatestBuild==None: return None localLatestBuildLocation = localLatestBuild[1] localBuildNum = localLatestBuild[0] if localBuildNum==buildNum: latestBuildLocation = localLatestBuildLocation appLocation = re.sub(r'^/*(.*)', r'\1', latestBuildLocation.replace("\\", "/")) self.note += self.parameter["appName"] + ":" + self.parameter['appVer'] + "(" + buildNum + ")" self.buildNum = buildNum #set build folder path self.logger.debug('Build Location is %s', appLocation) return self._downloadAppPackage(appLocation)
def _downloadAppPackage(self, appLocation): self.logger.debug('get Package') self.downloadFolder = os.path.join(self.downloadFolder, self.parameter['appName'].replace(" ", "") + self.parameter['appVer']) if re.match('^ftp:', appLocation.lower()): from FTPTask import childTask task = childTask('task') if re.match('.*@.*', appLocation): host = re.sub(r'^.*@([^/]*)/.*', r'\1', appLocation) task.addPara('Host', host) username = re.sub(r'^ftp://(.*):.*@([^/]*)/.*', r'\1', appLocation) password = re.sub(r'^.*:(.*)@([^/]*)/.*', r'\1', appLocation) task.addPara('User', username) task.addPara('Passwd', password) else: host = re.sub(r'^ftp://([^/]*)/.*', r'\1', appLocation) task.addPara('Host', host) task.addPara('User', self._commonDomain + '\\' + self._commonUser) task.addPara('Passwd', self._commonPassword) appLocation = re.sub(r'^[^/]*(/.*)', r'\1', appLocation[6:]) if re.match('.*/$', appLocation): #Delete ftp:// task.addPara('FolderPath', appLocation) else: task.addPara('FilePath', appLocation) else: from SambaTask import childTask task = childTask('task') task.addPara('sambaDomain', self._commonDomain) task.addPara('sambaUser', self._commonUser) task.addPara('sambaPsw', self._commonPassword) if 'appLang' in self.parameter: task.addPara('appLang', self.parameter['appLang']) task.addPara('FolderPath', appLocation) #Change downloadFolder to avoid collision with other Product task.addPara('Repository', self.downloadFolder) task.run() return task.getDownloadList()
def __getLatestBuildNumber(self): if 'buildNum' in self.parameter and self.parameter['buildNum'] != None: self.buildNum = self.parameter['buildNum'] else: import AppInstall task = AppInstall.childTask('appInstall') task.addPara('appName', 'Photoshop') task.addPara('appVer', self.parameter['ProductVersion']) task.addPara('appSubProduct', 'Application') self.buildNum = task._getInstalledBuildNum() if self.buildNum!="" and self.buildNum!=None: pass elif 'molecule' in self.parameter: moleculeReStr = "\d{8}\." + self.parameter['molecule'] + "\.\d{1,}" from CodexTask import childTask task = childTask('codexTask') self.buildNum = "unknown" builds = task.getBuilds( 'Photoshop', self.parameter['ProductVersion'], "Molecule", "Release", #CompileTarget self.platform, globalProperty.getSysInfo().locale, 'Build Failed') if builds==None: return None latestBuildLocation = None for build in builds: if re.match(moleculeReStr, build._build): latestBuildLocation = build._location['protocol'] + "://" + \ build._location['server'] + \ build._location['path'] self.buildNum = build._build break else: if globalProperty.isMachineOutOfChina(): #Support the machine out of China, will download directly import CodexTask task = CodexTask.childTask('codexTask') latestBuild = task.getBuild( 'Photoshop', self.parameter['ProductVersion'], "Release", #CompileTarget self.platform, globalProperty.getSysInfo().locale, 'Build Failed') if latestBuild==None: return None self.buildNum = latestBuild._build else: self.buildNum = globalProperty.getLatestBuildNum('Photoshop', self.parameter['ProductVersion'], self.platform, globalProperty.getSysInfo().locale, 'Build Failed', 'Application')
buildInfoFileContent = self.buildNum buildInfoFile = self._getBuildInfoFile() self.creatFile(buildInfoFile, buildInfoFileContent) def _getInstalledBuildNum(self): buildInfoFile = self._getBuildInfoFile() buildNum = None if os.path.exists(buildInfoFile): buildNum = open(buildInfoFile).read() return buildNum ##################This section is mainly for debug -- Begin ############################# if __name__ == '__main__': o=childTask('AppInstall', 1) #filePath = o._searchFile("C:\Program Files\Adobe\Adobe Bridge CS4", "application.xml") task = childTask('ai', 1) #deploymentFile = "D:\\work\\innovation\\ioix_ws\\dev\\qms\\qmsClient\\src\\allTasks\\download\\Bridge4.0\\Installer\\AdobeBridge4-mul\\deployment\\AdobeBridge4-mul.install.xml" #task.getNewDeploymentFileWithSerialNumber(deploymentFile, '123412341234123412341234') """ task.addPara('installerType', 'RIBS') task.addPara('appName', 'Bridge') task.addPara('appVer', '4.0') task.addPara('appLang', 'mul') task.addPara('appCertLevel', 'Build Failed') task.addPara('serialNumber', '123412341234123412341234') task.run() """ task._backUpUnDeploymentFile();
self.buildNum = build._build break else: if globalProperty.isMachineOutOfChina(): #Support the machine out of China, will download directly import CodexTask task = CodexTask.childTask('codexTask') latestBuild = task.getBuild( 'Photoshop', self.parameter['ProductVersion'], "Release", #CompileTarget self.platform, globalProperty.getSysInfo().locale, 'Build Failed') if latestBuild==None: return None self.buildNum = latestBuild._build else: self.buildNum = globalProperty.getLatestBuildNum('Photoshop', self.parameter['ProductVersion'], self.platform, globalProperty.getSysInfo().locale, 'Build Failed', 'Application') ##################This section is mainly for debug -- Begin ############################# if __name__ == '__main__': runSikuli = childTask('RunSikuli', 1) runSikuli.run()