def modifyReleaseFile(releaseFileName, newVersionNumber, userName, fileListFileName, skipBuild): import datetime import shutil now = datetime.date.today().strftime('%B %d, %Y') tempFileName = miscUtils.getRandomFileName(releaseFileName) tempFile = open(tempFileName, 'w') seenHistory = False for line in open(releaseFileName): if (seenHistory == False): if (line.find('MSLVERSION') >= 0): line = '#define MSLVERSION "' + newVersionNumber + '"\n' if (line.find('MSLDATE') >= 0): line = '#define MSLDATE "' + now + '"\n' tempFile.write(line) if (line.find('HISTORY:') >= 0): templine = newVersionNumber + ' ' + now + ' ' + userName + '\n' if (skipBuild): templine += ' WARNING! Files submitted without building tree or running tests.\n' for submitline in open(fileListFileName): #temp = eval(submitline.strip())[1] temp = eval(submitline.strip()) files = str(temp[1]).strip('[]') while (len(files) < 15): files = files + ' ' comment = temp[2] temp = createTextForReleaseFile(files + ' -' + comment) + '\n' templine += temp tempFile.write(templine) seenHistory = True tempFile.close() shutil.copyfile(tempFileName, releaseFileName) os.remove(tempFileName)
def modifyReleaseFile(releaseFileName, newVersionNumber, userName, fileListFileName, skipBuild): import datetime import shutil now = datetime.date.today().strftime('%B %d, %Y') tempFileName = miscUtils.getRandomFileName(releaseFileName) tempFile = open(tempFileName, 'w') seenHistory = False for line in open(releaseFileName): if(seenHistory == False): if(line.find('MSLVERSION') >= 0): line = '#define MSLVERSION "' + newVersionNumber + '"\n' if(line.find('MSLDATE') >= 0): line = '#define MSLDATE "' + now + '"\n' tempFile.write(line) if(line.find('HISTORY:') >= 0): templine = newVersionNumber + ' ' + now + ' ' + userName + '\n' if(skipBuild): templine += ' WARNING! Files submitted without building tree or running tests.\n' for submitline in open(fileListFileName): #temp = eval(submitline.strip())[1] temp = eval(submitline.strip()) files = str(temp[1]).strip('[]') while(len(files) < 15): files = files + ' ' comment = temp[2] temp = createTextForReleaseFile(files + ' -' + comment) + '\n' templine += temp tempFile.write(templine) seenHistory = True tempFile.close() shutil.copyfile(tempFileName, releaseFileName) os.remove(tempFileName)
if(options.fileList != None): options.fileList = re.split('[, ]', options.fileList) addFilesAndMessagesToFileListFile(fullFileListFileName, options.fileList, 'f', options.fileMessage) if(options.filesToDelete != None): options.filesToDelete = re.split('[, ', options.filesToDelete) addFilesAndMessagesToFileListFile(fullFileListFileName, options.filesToDelete, 'd', options.fileMessage) # If now was specified on the command line, # then we want to actually do the submit now. releaseFileModified = False try: if(options.doSubmit): myFiles = getFilesToModify(fullFileListFileName) newDirName = miscUtils.getRandomFileName(os.path.join(SHARED_SUBMIT_DIR, options.userName)) createAndSyncDir(newDirName, mslSubDir, options.userName) #newMslDirName = os.path.join(newDirName,'msl') newMslDirName = os.path.join(newDirName, mslSubDir) # Set the MSL_DIR environmental directory to the new, test trunk. os.environ['MSL_DIR'] = newMslDirName myVersion = getVersionNumber(os.path.join(cwd, RELEASE_FILE)) topVersion = getVersionNumber(os.path.join(newMslDirName, RELEASE_FILE)) if(myVersion != topVersion): print 'The version given in your release.h, ' + myVersion + ', does not match that at the top of the tree, ' + topVersion + '.' print 'Please sync your tree to the top of the tree, merge any conflicting files, and try to submit again.' print 'Your list of files to submit will be kept, so once the tree is synced and merged, just run submit.py -now again.' sys.exit(1) versionLegal = False
'f', options.fileMessage) if (options.filesToDelete != None): options.filesToDelete = re.split('[, ', options.filesToDelete) addFilesAndMessagesToFileListFile(fullFileListFileName, options.filesToDelete, 'd', options.fileMessage) # If now was specified on the command line, # then we want to actually do the submit now. releaseFileModified = False try: if (options.doSubmit): myFiles = getFilesToModify(fullFileListFileName) newDirName = miscUtils.getRandomFileName( os.path.join(SHARED_SUBMIT_DIR, options.userName)) createAndSyncDir(newDirName, mslSubDir, options.userName) #newMslDirName = os.path.join(newDirName,'msl') newMslDirName = os.path.join(newDirName, mslSubDir) # Set the MSL_DIR environmental directory to the new, test trunk. os.environ['MSL_DIR'] = newMslDirName myVersion = getVersionNumber(os.path.join(cwd, RELEASE_FILE)) topVersion = getVersionNumber(os.path.join(newMslDirName, RELEASE_FILE)) if (myVersion != topVersion): print 'The version given in your release.h, ' + myVersion + ', does not match that at the top of the tree, ' + topVersion + '.' print 'Please sync your tree to the top of the tree, merge any conflicting files, and try to submit again.' print 'Your list of files to submit will be kept, so once the tree is synced and merged, just run submit.py -now again.' sys.exit(1)