forked from openlp/openlp
Update script
This commit is contained in:
parent
b546b6b825
commit
cad82e637d
@ -87,7 +87,7 @@ class JenkinsTrigger(object):
|
|||||||
:param token: The token we need to trigger the build. If you do not have this token, ask in IRC.
|
:param token: The token we need to trigger the build. If you do not have this token, ask in IRC.
|
||||||
"""
|
"""
|
||||||
self.token = token
|
self.token = token
|
||||||
self.repo_name = get_repo_name()
|
self.base_name, self.repo_name = get_repo_name('b')
|
||||||
self.jenkins_instance = Jenkins(JENKINS_URL)
|
self.jenkins_instance = Jenkins(JENKINS_URL)
|
||||||
|
|
||||||
def trigger_build(self):
|
def trigger_build(self):
|
||||||
@ -111,7 +111,8 @@ class JenkinsTrigger(object):
|
|||||||
bzr = Popen(('bzr', 'revno'), stdout=PIPE, stderr=PIPE)
|
bzr = Popen(('bzr', 'revno'), stdout=PIPE, stderr=PIPE)
|
||||||
raw_output, error = bzr.communicate()
|
raw_output, error = bzr.communicate()
|
||||||
revno = raw_output.decode().strip()
|
revno = raw_output.decode().strip()
|
||||||
print('%s (revision %s)' % (get_repo_name(), revno))
|
print('Remote repository: %s ' % self.repo_name)
|
||||||
|
print(' Local repository: %s (revision %s)' % (self.repo_name, revno))
|
||||||
|
|
||||||
for job in OpenLPJobs.Jobs:
|
for job in OpenLPJobs.Jobs:
|
||||||
self.__print_build_info(job)
|
self.__print_build_info(job)
|
||||||
@ -146,7 +147,7 @@ class JenkinsTrigger(object):
|
|||||||
print('[%s] %s' % (result_string, url))
|
print('[%s] %s' % (result_string, url))
|
||||||
|
|
||||||
|
|
||||||
def get_repo_name():
|
def get_repo_name(branch_type='l'):
|
||||||
"""
|
"""
|
||||||
This returns the name of branch of the working directory. For example it returns *lp:~googol/openlp/render*.
|
This returns the name of branch of the working directory. For example it returns *lp:~googol/openlp/render*.
|
||||||
"""
|
"""
|
||||||
@ -162,6 +163,7 @@ def get_repo_name():
|
|||||||
output_list = list(map(str.strip, raw_output.split('\n')))
|
output_list = list(map(str.strip, raw_output.split('\n')))
|
||||||
# Determine the branch's name
|
# Determine the branch's name
|
||||||
repo_name = ''
|
repo_name = ''
|
||||||
|
base_name = ''
|
||||||
for line in output_list:
|
for line in output_list:
|
||||||
# Check if it is remote branch.
|
# Check if it is remote branch.
|
||||||
if 'push branch' in line:
|
if 'push branch' in line:
|
||||||
@ -174,6 +176,14 @@ def get_repo_name():
|
|||||||
if match:
|
if match:
|
||||||
repo_name = 'lp:%s' % match.group(2)
|
repo_name = 'lp:%s' % match.group(2)
|
||||||
break
|
break
|
||||||
|
elif 'repository branch' in line:
|
||||||
|
base_name = line.split(':')[1]
|
||||||
|
break
|
||||||
|
if branch_type == 'b':
|
||||||
|
return base_name.strip('/'), repo_name.strip('/')
|
||||||
|
elif branch_type == 'r':
|
||||||
|
return base_name.strip('/')
|
||||||
|
else:
|
||||||
return repo_name.strip('/')
|
return repo_name.strip('/')
|
||||||
|
|
||||||
|
|
||||||
@ -188,9 +198,12 @@ def main():
|
|||||||
options, args = parser.parse_args(sys.argv)
|
options, args = parser.parse_args(sys.argv)
|
||||||
|
|
||||||
if len(args) == 2:
|
if len(args) == 2:
|
||||||
if not get_repo_name():
|
if not get_repo_name('l'):
|
||||||
print('Not a branch. Have you pushed it to launchpad? Did you cd to the branch?')
|
print('Not a branch. Have you pushed it to launchpad? Did you cd to the branch?')
|
||||||
return
|
return
|
||||||
|
if not get_repo_name('r'):
|
||||||
|
print('No remote branch. Have you pushed it to launchpad? Did you cd to the branch?')
|
||||||
|
return
|
||||||
token = args[-1]
|
token = args[-1]
|
||||||
if token in OLD_TOKENS:
|
if token in OLD_TOKENS:
|
||||||
print('Your token is not valid anymore. Get the most recent one.')
|
print('Your token is not valid anymore. Get the most recent one.')
|
||||||
|
Loading…
Reference in New Issue
Block a user