# defines global options
enableDryRun = False
enableTizenMain = False
-enableTizenSDK = False
-version = 0
-commit_id = ""
+
+patchVersion = 0
+commitId = ""
def help():
print ("""
Usage: release-webkit [OPTION]
-General WebKit package release order :
- 1. Commit and push master branch. (--tizen-main)
- 2. Commit and push sdk branch. (--tizen-sdk, After merged #1)
-
[Options]
- --help, -h : Print this message.
- --dry-run, -n : Don't actually run any commands; just print them.
- --tizen-main, -i : Create Release commit in master branch and push to Gerrit. (Tizen:main)
- --tizen-sdk, -d : Merge Release commit in sdk branch and push to Gerrit. (Tizen:SDK)
+ -h, --help : Print this message.
+ -n, --dry-run : Don't actually run any commands; just print them.
+ -i, --tizen : Create Release commit in tizen_2.1 branch and push to Gerrit. (Tizen:2.1:Main)
""")
def checkRepo(repo):
currentRepo = "RSA"
os.system("git remote -v > tmp")
- input_file = open("tmp", "r")
+ inputFile = open("tmp", "r")
- for line in input_file:
+ for line in inputFile:
if (("origin" in line) and ("magnolia" in line)):
print("ERROR : This command can executed only RSA repo.")
exit()
def checkoutBranch(branch):
findBranch = False
os.system("git branch > tmp")
- input_file = open("tmp", "r")
+ inputFile = open("tmp", "r")
- for line in input_file:
+ for line in inputFile:
if (line.find(branch) > -1):
execute("git checkout " + branch)
findBranch = True
if findBranch == False:
execute("git checkout -b " + branch + " origin/" + branch)
- input_file.close()
+ inputFile.close()
os.system("rm tmp")
def execute(command):
return path
def getTagMsg(branch):
- global commit_id, version
+ global commitId, patchVersion
os.system("git log " + branch + " > tmp")
#Find commit id, tag msg
- input_file = open("tmp","r")
+ inputFile = open("tmp","r")
#Find commit Id
- for line in input_file:
+ for line in inputFile:
if "commit" in line:
- commit_id = line.replace("commit ","").strip()
+ commitId = line.replace("commit ","").strip()
elif line.find("[Release] Webkit2-efl-123997") == 4:
- version = line.replace("[Release] ", "")
- version = version.strip()
+ patchVersion = line.replace("[Release] ", "").strip()
break
- input_file.close()
+ inputFile.close()
tag = ""
- os.system("git log " + commit_id + " > tmp")
- input_file = open("tmp","r")
+ os.system("git log " + commitId + " > tmp")
+ inputFile = open("tmp","r")
findFirstCommit = False
saveTag = False
- for line in input_file:
+ for line in inputFile:
if line.find("[") == 4:
if "[Release] Webkit2" in line:
if findFirstCommit == False:
saveTag = False
if saveTag:
tag += line.strip() + '\n'
- output_file = open("tmp_tag","w")
- output_file.write(tag)
- output_file.close()
- input_file.close()
+ outputFile = open("tmp_tag","w")
+ outputFile.write(tag)
+ outputFile.close()
+ inputFile.close()
os.system("rm tmp")
isFirst = False
noPatch = False
- input_file = open("tmp_log", "r")
- for line in input_file:
+ inputFile = open("tmp_log", "r")
+ for line in inputFile:
if "commit" in line:
if isFirst:
break
if "[Release] Webkit2" in line:
noPatch = True
- input_file.close()
+ inputFile.close()
os.system("rm tmp_log")
if noPatch:
exit()
def versionUp(minor):
- global version
+ global patchVersion
path = getPath()
# Change version in OptionsTizen.cmake
- input_file = open(path + "Source/cmake/OptionsTizen.cmake","r")
- output_file = open("tmp","w")
+ inputFile = open(path + "Source/cmake/OptionsTizen.cmake","r")
+ outputFile = open("tmp","w")
- for line in input_file:
+ for line in inputFile:
if "SET(PROJECT_VERSION_PATCH" in line:
- version = line.replace("SET(PROJECT_VERSION_PATCH ", "")
- version = version.replace(")", "")
+ patchVersion = line.replace("SET(PROJECT_VERSION_PATCH ", "")
+ patchVersion = patchVersion.replace(")", "")
- version = int(version) + 1
+ patchVersion = int(patchVersion) + 1
- tmp = "SET(PROJECT_VERSION_PATCH " + str(version) +")\n"
- output_file.write(tmp)
+ tmp = "SET(PROJECT_VERSION_PATCH " + str(patchVersion) +")\n"
+ outputFile.write(tmp)
print "Modified PROJECT_VERSION_PATCH in OptionsTizen.cmake to " + tmp.strip()
else:
- output_file.write(line)
+ outputFile.write(line)
- input_file.close()
- output_file.close()
+ inputFile.close()
+ outputFile.close()
if enableDryRun:
os.system("rm tmp")
os.system("mv tmp " + path + "Source/cmake/OptionsTizen.cmake")
# Change version in webkit2-efl.spec
- input_file = open(path + "packaging/webkit2-efl.spec","r")
- output_file = open("tmp","w")
+ inputFile = open(path + "packaging/webkit2-efl.spec","r")
+ outputFile = open("tmp","w")
- for line in input_file:
+ for line in inputFile:
if "Version:" in line:
- tmp = "Version: 123997_0." + str(minor) + "." + str(version) + "\n"
- output_file.write(tmp)
+ tmp = "Version: 123997_0." + str(minor) + "." + str(patchVersion) + "\n"
+ outputFile.write(tmp)
print "Modified Version in webkit2-efl.spec to " + tmp.strip()
else:
- output_file.write(line)
+ outputFile.write(line)
- input_file.close()
- output_file.close()
+ inputFile.close()
+ outputFile.close()
if enableDryRun:
os.system("rm tmp")
execute("git add " + path + "Source/cmake/OptionsTizen.cmake " + path + "packaging/webkit2-efl.spec" )
def TizenMain():
- global version
- path = getPath()
-
+ global patchVersion
+ branchName = "tizen_2.1"
+ minorVersion = 11
checkRepo("RSA")
- checkoutBranch("master")
+ checkoutBranch(branchName)
checkNewPatch()
- versionUp(10)
- execute("git commit -m '[Release] Webkit2-efl-123997_0.10." + str(version) + "'" )
- getTagMsg("master")
- execute("git tag -a submit/trunk/`date --utc +%Y%m%d.%H%M%S` -F tmp_tag")
- execute("git push --tags origin HEAD:refs/for/master")
- os.system("rm tmp_tag")
-
- print "[Tizen:Main release] finished."
-
-def TizenSDK():
- global commit_id
- checkRepo("RSA")
- checkoutBranch("sdk")
- execute("git pull --rebase")
-
- getTagMsg("origin/master")
- execute("git merge " + commit_id)
- execute("git commit --amend -m 'Merge commit " + commit_id.strip() + "'")
- execute("git tag -a submit/sdk/`date --utc +%Y%m%d.%H%M%S` -F tmp_tag")
- execute("git push --tags origin HEAD:refs/for/sdk")
- os.system("rm tmp_tag")
-
- print "[Tizen:SDK release] finished."
-
+ versionUp(minorVersion)
+ execute("git commit -m '[Release] Webkit2-efl-123997_0." + str(minorVersion) + "." + str(patchVersion) + "'" )
+ getTagMsg(branchName)
+ execute("git tag -a submit/" + branchName + "/`date --utc +%Y%m%d.%H%M%S` -F tmp_tag")
+ execute("git push --tags origin HEAD:refs/for/" + branchName)
+
+ print "[Tizen:2.1:Main release] finished."
def release():
count = 0
if enableTizenMain:
count = count + 1
- if enableTizenSDK:
- count = count + 1
if count > 1:
print "ERROR : Package release is can't executed two branch simultaneously "
if enableTizenMain:
TizenMain()
- elif enableTizenSDK:
- TizenSDK()
if count == 0:
help()
def main():
- global enableDryRun, enableTizenMain, enableTizenSDK
- optlist, args = getopt.getopt(sys.argv[1:], 'hdeilnm:o', [ 'help', 'dry-run', 'tizen-main', 'tizen-sdk'])
+ global enableDryRun, enableTizenMain
+ optlist, args = getopt.getopt(sys.argv[1:], 'hdeilnm:o', [ 'help', 'dry-run', 'tizen'])
for opt, var in optlist:
if opt in ('--help', '-h'):
help()
enableDryRun = True
if opt in ('--tizen-main', '-i'):
enableTizenMain = True
- if opt in ('--tizen-sdk', '-d'):
- enableTizenSDK = True
release()
main()