2 #####################################################################
3 # Helper script to release
4 #####################################################################
10 # defines global options
12 enableTizenMain = False
19 Usage: release-webkit [OPTION]
22 -h, --help : Print this message.
23 -n, --dry-run : Don't actually run any commands; just print them.
24 -i, --tizen : Create Release commit in tizen_2.1 branch and push to Gerrit. (Tizen:2.1:Main)
30 os.system("git remote -v > tmp")
31 inputFile = open("tmp", "r")
33 for line in inputFile:
34 if (("origin" in line) and ("magnolia" in line)):
35 print("ERROR : This command can executed only RSA repo.")
38 def checkoutBranch(branch):
40 os.system("git branch > tmp")
41 inputFile = open("tmp", "r")
43 for line in inputFile:
44 if (line.find(branch) > -1):
45 execute("git checkout " + branch)
48 if findBranch == False:
49 execute("git checkout -b " + branch + " origin/" + branch)
62 if "TizenScripts" in os.getcwd():
66 def getTagMsg(branch):
67 global commitId, patchVersion
69 os.system("git log " + branch + " > tmp")
70 #Find commit id, tag msg
72 inputFile = open("tmp","r")
75 for line in inputFile:
77 commitId = line.replace("commit ","").strip()
78 elif line.find("[Release] Webkit2-efl-123997") == 4:
79 patchVersion = line.replace("[Release] ", "").strip()
84 os.system("git log " + commitId + " > tmp")
85 inputFile = open("tmp","r")
87 findFirstCommit = False
90 for line in inputFile:
91 if line.find("[") == 4:
92 if "[Release] Webkit2" in line:
93 if findFirstCommit == False:
94 findFirstCommit = True
100 elif "[Solution]" in line:
102 elif "[Problem]" in line:
104 elif "[Cause]" in line:
107 if line.find("[WK2]") == -1:
108 tag += line.strip() + '\n'
110 if "Change-Id" in line:
114 if len(line.strip()) < 1:
117 tag += line.strip() + '\n'
118 outputFile = open("tmp_tag","w")
119 outputFile.write(tag)
126 os.system("git log > tmp_log")
130 inputFile = open("tmp_log", "r")
131 for line in inputFile:
139 if "[Release] Webkit2" in line:
143 os.system("rm tmp_log")
146 print "There is no new patch after previous release."
149 def versionUp(minor):
153 # Change version in OptionsTizen.cmake
154 inputFile = open(path + "Source/cmake/OptionsTizen.cmake","r")
155 outputFile = open("tmp","w")
157 for line in inputFile:
158 if "SET(PROJECT_VERSION_PATCH" in line:
159 patchVersion = line.replace("SET(PROJECT_VERSION_PATCH ", "")
160 patchVersion = patchVersion.replace(")", "")
162 patchVersion = int(patchVersion) + 1
164 tmp = "SET(PROJECT_VERSION_PATCH " + str(patchVersion) +")\n"
165 outputFile.write(tmp)
166 print "Modified PROJECT_VERSION_PATCH in OptionsTizen.cmake to " + tmp.strip()
168 outputFile.write(line)
176 os.system("chmod 644 tmp")
177 os.system("mv tmp " + path + "Source/cmake/OptionsTizen.cmake")
179 # Change version in webkit2-efl.spec
180 inputFile = open(path + "packaging/webkit2-efl.spec","r")
181 outputFile = open("tmp","w")
183 for line in inputFile:
184 if "Version:" in line:
185 tmp = "Version: 123997_0." + str(minor) + "." + str(patchVersion) + "\n"
186 outputFile.write(tmp)
187 print "Modified Version in webkit2-efl.spec to " + tmp.strip()
189 outputFile.write(line)
197 os.system("chmod 644 tmp")
198 os.system("mv tmp " + path + "packaging/webkit2-efl.spec")
200 execute("git add " + path + "Source/cmake/OptionsTizen.cmake " + path + "packaging/webkit2-efl.spec" )
204 branchName = "tizen_2.1"
207 checkoutBranch(branchName)
210 versionUp(minorVersion)
211 execute("git commit -m '[Release] Webkit2-efl-123997_0." + str(minorVersion) + "." + str(patchVersion) + "'" )
212 getTagMsg(branchName)
213 execute("git tag -a submit/" + branchName + "/`date --utc +%Y%m%d.%H%M%S` -F tmp_tag")
214 execute("git push --tags origin HEAD:refs/for/" + branchName)
216 print "[Tizen:2.1:Main release] finished."
225 print "ERROR : Package release is can't executed two branch simultaneously "
235 global enableDryRun, enableTizenMain
236 optlist, args = getopt.getopt(sys.argv[1:], 'hdeilnm:o', [ 'help', 'dry-run', 'tizen'])
237 for opt, var in optlist:
238 if opt in ('--help', '-h'):
241 if opt in ('--dry-run', '-n'):
243 if opt in ('--tizen-main', '-i'):
244 enableTizenMain = True