2 #####################################################################
3 # Helper script to release
4 #####################################################################
10 # defines global options
12 enableTizenMain = False
20 Usage: release-webkit [OPTION]
23 -h, --help : Print this message.
24 -n, --dry-run : Don't actually run any commands; just print them.
25 -i, --tizen : Create Release commit in tizen_2.2 branch and push to Gerrit. (Tizen:2.2:Mobile)
26 -t, --push-tag : Add tag and Send SR(Submit Request).
32 os.system("git remote -v > tmp")
33 inputFile = open("tmp", "r")
35 for line in inputFile:
36 if (("origin" in line) and ("magnolia" in line)):
37 print("ERROR : This command can executed only RSA repo.")
40 def checkoutBranch(branch):
42 os.system("git branch > tmp")
43 inputFile = open("tmp", "r")
45 for line in inputFile:
46 if (line.find(branch) > -1):
47 execute("git checkout " + branch)
50 if findBranch == False:
51 execute("git checkout -b " + branch + " origin/" + branch)
64 if "TizenScripts" in os.getcwd():
68 def getTagMsg(branch):
69 global commitId, patchVersion
71 os.system("git log " + branch + " > tmp")
72 #Find commit id, tag msg
74 inputFile = open("tmp","r")
77 for line in inputFile:
79 commitId = line.replace("commit ","").strip()
80 elif line.find("[Release] Webkit2-efl-123997") == 4:
81 patchVersion = line.replace("[Release] ", "").strip()
86 os.system("git log " + commitId + " > tmp")
87 inputFile = open("tmp","r")
89 findFirstCommit = False
92 for line in inputFile:
93 if line.find("[") == 4:
94 if "[Release] Webkit2" in line:
95 if findFirstCommit == False:
96 findFirstCommit = True
100 if "[Title]" in line:
102 elif "[Solution]" in line:
104 elif "[Problem]" in line:
106 elif "[Cause]" in line:
109 if line.find("[WK2]") == -1:
110 tag += line.strip() + '\n'
112 if "Change-Id" in line:
116 if len(line.strip()) < 1:
119 tag += line.strip() + '\n'
120 outputFile = open("tmp_tag","w")
121 outputFile.write(tag)
128 os.system("git log > tmp_log")
132 inputFile = open("tmp_log", "r")
133 for line in inputFile:
141 if "[Release] Webkit2" in line:
145 os.system("rm tmp_log")
148 print "There is no new patch after previous release."
151 def versionUp(minor):
155 # Change version in OptionsTizen.cmake
156 inputFile = open(path + "Source/cmake/OptionsTizen.cmake","r")
157 outputFile = open("tmp","w")
159 for line in inputFile:
160 if "SET(PROJECT_VERSION_PATCH" in line:
161 patchVersion = line.replace("SET(PROJECT_VERSION_PATCH ", "")
162 patchVersion = patchVersion.replace(")", "")
164 patchVersion = int(patchVersion) + 1
166 tmp = "SET(PROJECT_VERSION_PATCH " + str(patchVersion) +")\n"
167 outputFile.write(tmp)
168 print "Modified PROJECT_VERSION_PATCH in OptionsTizen.cmake to " + tmp.strip()
170 outputFile.write(line)
178 os.system("chmod 644 tmp")
179 os.system("mv tmp " + path + "Source/cmake/OptionsTizen.cmake")
181 # Change version in webkit2-efl.spec
182 inputFile = open(path + "packaging/webkit2-efl.spec","r")
183 outputFile = open("tmp","w")
185 for line in inputFile:
186 if "Version:" in line:
187 tmp = "Version: 123997_0." + str(minor) + "." + str(patchVersion) + "\n"
188 outputFile.write(tmp)
189 print "Modified Version in webkit2-efl.spec to " + tmp.strip()
191 outputFile.write(line)
199 os.system("chmod 644 tmp")
200 os.system("mv tmp " + path + "packaging/webkit2-efl.spec")
202 execute("git add " + path + "Source/cmake/OptionsTizen.cmake " + path + "packaging/webkit2-efl.spec" )
206 branchName = "tizen_2.2"
209 checkoutBranch(branchName)
212 versionUp(minorVersion)
213 execute("git commit -m '[Release] Webkit2-efl-123997_0." + str(minorVersion) + "." + str(patchVersion) + "'" )
214 execute("git push origin HEAD:refs/for/" + branchName)
216 print "Release commit created."
219 branchName = "tizen_2.2"
221 getTagMsg(branchName)
222 execute("git tag -a submit/" + branchName + "/`date --utc +%Y%m%d.%H%M%S` -F tmp_tag")
223 execute("git push --tags")
225 print "Release " + branchName + " finished."
236 print "ERROR : Invalid Options"
249 global enableDryRun, enableTizenMain, enablePushTag
250 optlist, args = getopt.getopt(sys.argv[1:], 'hnit', [ 'help', 'dry-run', 'tizen', 'push-tag' ])
251 for opt, var in optlist:
252 if opt in ('--help', '-h'):
255 if opt in ('--dry-run', '-n'):
257 if opt in ('--tizen', '-i'):
258 enableTizenMain = True
259 if opt in ('--push-tag', '-t'):