-#!/usr/bin/env python\r
-# vim: ai ts=4 sts=4 et sw=4\r
-#\r
-# Copyright (C) 2010, 2011, 2012, 2013, 2014 Intel, Inc.\r
-#\r
-# This program is free software; you can redistribute it and/or\r
-# modify it under the terms of the GNU General Public License\r
-# as published by the Free Software Foundation; version 2\r
-# of the License.\r
-#\r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-#\r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\r
-#\r
-\r
-import os\r
-import sys\r
-import re\r
-import requests\r
-from bs4 import BeautifulSoup\r
-\r
-sys.path.insert(0, os.path.join(os.getcwd(), 'jenkins-scripts'))\r
-from common.send_mail import prepare_mail\r
-\r
-\r
-# set default char-set endcoding to utf-8\r
-reload(sys)\r
-sys.setdefaultencoding('utf-8') # pylint: disable-msg=E1101\r
-\r
-TOOLS_RELEASE_URL = "http://download.tizen.org/tools/archive/"\r
-TOOLS_RELEASE_TITLE = '[Dev] Tizen SCM Tools Release - %s'\r
-\r
-TOOLS_RELEASE_BODY = 'Hi, Everyone.\n\n' \\r
- 'Tizen SCM Tools packages are released.\n' \\r
- '- Tizen SCM Tools : http://download.tizen.org/tools/latest-release/ ( http://download.tizen.org/tools/archive/%s/ )\n\n' \\r
- 'For details on \'New Features & Enhancements\' and \'Bug Fixes\', please refer to Release Notes : \n' \\r
- '- http://download.tizen.org/tools/archive/%s/RELEASE_NOTES_GBS.txt \n' \\r
- '- http://download.tizen.org/tools/archive/%s/RELEASE_NOTES_MIC.txt \n\n' \\r
- 'Best Regards.' \\r
-\r
-\r
-TOOLS_RELEASE_FOOTER = '\n\n--------------------------------------------------------\n'\\r
- 'Automatically generated by backend service.\n'\\r
- 'Please DO NOT Reply!'\r
-\r
-TOOLS_RELEASE_FILES = ["RELEASE_NOTES_GBS.txt",\\r
- "RELEASE_NOTES_MIC.txt",\\r
- "RELEASE_NOTES_REPA.txt"]\r
-\r
-def send_mail_tool_release_message(release_id):\r
- """ send mail about tools release """\r
-\r
- #make a message\r
- title = TOOLS_RELEASE_TITLE % ( release_id)\r
- email_body = TOOLS_RELEASE_BODY % (release_id, release_id, release_id)\r
-\r
- msg = email_body + TOOLS_RELEASE_FOOTER\r
-\r
- submitter = os.getenv('TO')\r
-\r
- if submitter:\r
- prepare_mail("%s.env" % os.getenv('BUILD_TAG'), title, msg,\r
- os.getenv('NOREPLY_EMAIL_SENDER'), submitter)\r
-\r
- print "\n\n--------------------------------------------------------\n"\r
- print os.getenv('NOREPLY_EMAIL_SENDER')\r
- print title\r
- print msg\r
- print submitter\r
-\r
-def check_mail_send_option(option):\r
- #check option condition\r
- check_result = "TRUE"\r
-\r
- if len(option) < 5:\r
- print "Need more input data"\r
- return "Need more input data"\r
-\r
- release_id = option[2]\r
- destination = option[3]\r
-\r
- if release_id != None:\r
- regex = re.compile(r'^[0-9]{2}.[0-9]{2}.[0-9]{1,3}$')\r
- release_id_pattern = regex.search(release_id)\r
- print release_id, release_id_pattern\r
- if release_id_pattern == None:\r
- return "Need change value for release_id : %s " % (release_id)\r
-\r
- if option[3] == "staging":\r
- print "Jenkins destination parameter value is staging"\r
- return "Need change value for destination" \r
-\r
- return check_result\r
-\r
-\r
-def check_release_txt_file(option):\r
- #check option condition\r
- check_result = "TRUE"\r
- url = TOOLS_RELEASE_URL+option[2]\r
- f = requests.get(url, timeout=30)\r
- if f.status_code != 200:\r
- return ("%s url error" % (url))\r
-\r
- soup = BeautifulSoup(f.text, 'html.parser')\r
-\r
- for l in TOOLS_RELEASE_FILES:\r
- pattern_text = l\r
- result=str(soup.findAll('a', attrs={'href': re.compile(pattern_text)}))\r
- if pattern_text not in result:\r
- return (" %s version is not in %s " % (pattern_text, url))\r
-\r
- return check_result\r
-\r
-\r
-def check_release_id_option(option):\r
- #check option condition\r
- check_result = "TRUE"\r
- url = TOOLS_RELEASE_URL\r
-\r
- f = requests.get(url, timeout=30)\r
- if f.status_code != 200:\r
- return ("%s url error" % (url))\r
-\r
- soup = BeautifulSoup(f.text, 'html.parser')\r
- pattern_version=option[2]\r
- result=str(soup.findAll('a', attrs={'href': re.compile(pattern_version)}))\r
-\r
- if pattern_version not in result:\r
- return (" %s version is not in %s " % (pattern_version, url))\r
-\r
- return check_result\r
-\r
-\r
-def mail_send_condion_check(option):\r
- """ Check condition before send mail """\r
-\r
- #check option condition\r
- check_result = "TRUE"\r
-\r
- #1) Check option\r
- check_result = check_mail_send_option(option)\r
- if check_result != "TRUE":\r
- return check_result\r
- else:\r
- print "Checked : option for release mail send"\r
-\r
- #2) Check download Server\r
- check_result = check_release_id_option(option)\r
- if check_result != "TRUE":\r
- return check_result\r
- else:\r
- print "Checked : %s version is in %s" % (option[2], TOOLS_RELEASE_URL)\r
-\r
- #3) Check release txt file\r
- check_result = check_release_txt_file(option)\r
- if check_result != "TRUE":\r
- return check_result\r
- else:\r
- print "Checked : release txt files are in %s%s" % (TOOLS_RELEASE_URL, option[2] )\r
-\r
- return check_result\r
-\r
-def main(option):\r
- """\r
- Script entry point.\r
- Parameters:\r
- project - type of project for release\r
- release_id - release version\r
- destination - code release destination ( staging or download.tizen.org )\r
- update_latest_release ( version update or not )\r
-\r
- """\r
- if len(option) < 5:\r
- print "Need more input data"\r
- return 0\r
-\r
- script=option[0]\r
- project = option[1]\r
- release_id = option[2]\r
- destination = option[3]\r
- update_latest_release = option[4]\r
-\r
-\r
- # Before Send mail , must check condition ( test result, public download server , and so on )\r
- check_mail_send_condition = mail_send_condion_check(option)\r
-\r
- if check_mail_send_condition == 'TRUE':\r
- print "Create release mail body"\r
- send_mail_tool_release_message(release_id)\r
- else:\r
- print "Mail send condition is wrong"\r
- print check_mail_send_condition\r
-\r
-if __name__ == '__main__':\r
- sys.exit(main(sys.argv))\r
-\r
+#!/usr/bin/env python
+# vim: ai ts=4 sts=4 et sw=4
+#
+# Copyright (C) 2010, 2011, 2012, 2013, 2014 Intel, Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; version 2
+# of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+import os
+import sys
+import re
+import requests
+from bs4 import BeautifulSoup
+
+sys.path.insert(0, os.path.join(os.getcwd(), 'jenkins-scripts'))
+from common.send_mail import prepare_mail
+
+
+# set default char-set endcoding to utf-8
+reload(sys)
+sys.setdefaultencoding('utf-8') # pylint: disable-msg=E1101
+
+TOOLS_RELEASE_URL = "http://download.tizen.org/tools/archive/"
+TOOLS_RELEASE_TITLE = '[Dev] Tizen SCM Tools Release - %s'
+
+TOOLS_RELEASE_BODY = 'Hi, Everyone.\n\n' \
+ 'Tizen SCM Tools packages are released.\n' \
+ '- Tizen SCM Tools : http://download.tizen.org/tools/latest-release/ ( http://download.tizen.org/tools/archive/%s/ )\n\n' \
+ 'For details on \'New Features & Enhancements\' and \'Bug Fixes\', please refer to Release Notes : \n' \
+ '- http://download.tizen.org/tools/archive/%s/RELEASE_NOTES_GBS.txt \n' \
+ '- http://download.tizen.org/tools/archive/%s/RELEASE_NOTES_MIC.txt \n\n' \
+ 'Best Regards.' \
+
+
+TOOLS_RELEASE_FOOTER = '\n\n--------------------------------------------------------\n'\
+ 'Automatically generated by backend service.\n'\
+ 'Please DO NOT Reply!'
+
+TOOLS_RELEASE_FILES = ["RELEASE_NOTES_GBS.txt",\
+ "RELEASE_NOTES_MIC.txt",\
+ "RELEASE_NOTES_REPA.txt"]
+
+def send_mail_tool_release_message(release_id):
+ """ send mail about tools release """
+
+ #make a message
+ title = TOOLS_RELEASE_TITLE % ( release_id)
+ email_body = TOOLS_RELEASE_BODY % (release_id, release_id, release_id)
+
+ msg = email_body + TOOLS_RELEASE_FOOTER
+
+ submitter = os.getenv('TO')
+
+ if submitter:
+ prepare_mail("%s.env" % os.getenv('BUILD_TAG'), title, msg,
+ os.getenv('NOREPLY_EMAIL_SENDER'), submitter)
+
+ print "\n\n--------------------------------------------------------\n"
+ print os.getenv('NOREPLY_EMAIL_SENDER')
+ print title
+ print msg
+ print submitter
+
+def check_mail_send_option(option):
+ #check option condition
+ check_result = "TRUE"
+
+ if len(option) < 5:
+ print "Need more input data"
+ return "Need more input data"
+
+ release_id = option[2]
+ destination = option[3]
+
+ if release_id != None:
+ regex = re.compile(r'^[0-9]{2}.[0-9]{2}.[0-9]{1,3}$')
+ release_id_pattern = regex.search(release_id)
+ print release_id, release_id_pattern
+ if release_id_pattern == None:
+ return "Need change value for release_id : %s " % (release_id)
+
+ if option[3] == "staging":
+ print "Jenkins destination parameter value is staging"
+ return "Need change value for destination"
+
+ return check_result
+
+
+def check_release_txt_file(option):
+ #check option condition
+ check_result = "TRUE"
+ url = TOOLS_RELEASE_URL+option[2]
+ f = requests.get(url, timeout=30)
+ if f.status_code != 200:
+ return ("%s url error" % (url))
+
+ soup = BeautifulSoup(f.text, 'html.parser')
+
+ for l in TOOLS_RELEASE_FILES:
+ pattern_text = l
+ result=str(soup.findAll('a', attrs={'href': re.compile(pattern_text)}))
+ if pattern_text not in result:
+ return (" %s version is not in %s " % (pattern_text, url))
+
+ return check_result
+
+
+def check_release_id_option(option):
+ #check option condition
+ check_result = "TRUE"
+ url = TOOLS_RELEASE_URL
+
+ f = requests.get(url, timeout=30)
+ if f.status_code != 200:
+ return ("%s url error" % (url))
+
+ soup = BeautifulSoup(f.text, 'html.parser')
+ pattern_version=option[2]
+ result=str(soup.findAll('a', attrs={'href': re.compile(pattern_version)}))
+
+ if pattern_version not in result:
+ return (" %s version is not in %s " % (pattern_version, url))
+
+ return check_result
+
+
+def mail_send_condion_check(option):
+ """ Check condition before send mail """
+
+ #check option condition
+ check_result = "TRUE"
+
+ #1) Check option
+ check_result = check_mail_send_option(option)
+ if check_result != "TRUE":
+ return check_result
+ else:
+ print "Checked : option for release mail send"
+
+ #2) Check download Server
+ check_result = check_release_id_option(option)
+ if check_result != "TRUE":
+ return check_result
+ else:
+ print "Checked : %s version is in %s" % (option[2], TOOLS_RELEASE_URL)
+
+ #3) Check release txt file
+ check_result = check_release_txt_file(option)
+ if check_result != "TRUE":
+ return check_result
+ else:
+ print "Checked : release txt files are in %s%s" % (TOOLS_RELEASE_URL, option[2] )
+
+ return check_result
+
+def main(option):
+ """
+ Script entry point.
+ Parameters:
+ project - type of project for release
+ release_id - release version
+ destination - code release destination ( staging or download.tizen.org )
+ update_latest_release ( version update or not )
+
+ """
+ if len(option) < 5:
+ print "Need more input data"
+ return 0
+
+ script=option[0]
+ project = option[1]
+ release_id = option[2]
+ destination = option[3]
+ update_latest_release = option[4]
+
+
+ # Before Send mail , must check condition ( test result, public download server , and so on )
+ check_result = mail_send_condion_check(option)
+
+ if check_result == 'TRUE':
+ print "Create release mail body"
+ send_mail_tool_release_message(release_id)
+ else:
+ print "Mail send condition is wrong"
+ print check_result
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
+
-from common.git import Git, clone_gitproject, GitError\r
-from common.gerrit import Gerrit, GerritError\r
-from gbp.git.repository import GitRepositoryError\r
-import sys\r
-import os\r
-import datetime\r
-from time import sleep\r
-\r
-def request_github_release_tag(release_version):\r
-\r
- WORKSPACE = os.getcwd()\r
- git_tools_repo=['tools/mic', 'tools/gbs']\r
- gerrit = Gerrit('review.tizen.org', 'tizentools', 29418, 0)\r
-\r
- for git_repo in git_tools_repo:\r
- git_cache = os.path.join(WORKSPACE)\r
- prjdir = os.path.join(git_cache, git_repo)\r
-\r
- try:\r
- gitprj = Git(prjdir)\r
- except GitRepositoryError, err:\r
- #clone project to local workspace if it doesn't exist in git cache\r
- \r
- localdir = os.path.join(WORKSPACE, git_repo)\r
- if not clone_gitproject(git_repo, localdir, gerrit_hostname="review.tizen.org", gerrit_username="tizentools", gerrit_sshport=29418, git_cache_dir=WORKSPACE):\r
- return -1\r
- gitprj = Git('%s/%s' % (WORKSPACE,git_repo))\r
-\r
- message = 'Release Tools : %s ' % (release_version)\r
-\r
- release_tag = "released-tools-"+release_version\r
-\r
- commitid = gitprj.rev_parse('HEAD')\r
-\r
- gitprj.create_tag(release_tag, message, commitid)\r
- sleep(1)\r
-\r
- remote = 'ssh://%s@%s:%s/%s' % (gerrit.username, gerrit.host, gerrit.port,git_repo)\r
-\r
- print "git_repo : ", git_repo\r
- print "message : ", message\r
- print "release_tag : ", release_tag\r
- print "commitid : ", commitid\r
- print "remote : ", remote\r
-\r
- try:\r
- gitprj.push_tag(remote, release_tag)\r
- except GitRepositoryError, gre:\r
- print gre\r
- return -1\r
-\r
-def main(option):\r
- release_version = option[1]\r
- request_github_release_tag(release_version)\r
- return 0\r
-\r
-if __name__ == '__main__':\r
- sys.exit(main(sys.argv))\r
+from common.git import Git, clone_gitproject, GitError
+from common.gerrit import Gerrit, GerritError
+from gbp.git.repository import GitRepositoryError
+import sys
+import os
+import datetime
+from time import sleep
+
+def request_github_release_tag(release_version):
+
+ WORKSPACE = os.getcwd()
+ git_tools_repo=['tools/mic', 'tools/gbs']
+ gerrit = Gerrit('review.tizen.org', 'tizentools', 29418, 0)
+
+ for git_repo in git_tools_repo:
+ git_cache = os.path.join(WORKSPACE)
+ prjdir = os.path.join(git_cache, git_repo)
+
+ try:
+ gitprj = Git(prjdir)
+ except GitRepositoryError, err:
+ #clone project to local workspace if it doesn't exist in git cache
+
+ localdir = os.path.join(WORKSPACE, git_repo)
+ if not clone_gitproject(git_repo, localdir, gerrit_hostname="review.tizen.org", gerrit_username="tizentools", gerrit_sshport=29418, git_cache_dir=WORKSPACE):
+ return -1
+ gitprj = Git('%s/%s' % (WORKSPACE,git_repo))
+
+ message = 'Release Tools : %s ' % (release_version)
+
+ release_tag = "released-tools-"+release_version
+
+ commitid = gitprj.rev_parse('HEAD')
+
+ gitprj.create_tag(release_tag, message, commitid)
+ sleep(1)
+
+ remote = 'ssh://%s@%s:%s/%s' % (gerrit.username, gerrit.host, gerrit.port,git_repo)
+
+ print "git_repo : ", git_repo
+ print "message : ", message
+ print "release_tag : ", release_tag
+ print "commitid : ", commitid
+ print "remote : ", remote
+
+ try:
+ gitprj.push_tag(remote, release_tag)
+ except GitRepositoryError, gre:
+ print gre
+ return -1
+
+def main(option):
+ release_version = option[1]
+ request_github_release_tag(release_version)
+ return 0
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))