Change-Id: I10c5bcbe7330b9b7a645cf464726ecf1d25183c5
Signed-off-by: biao716.wang <biao716.wang@samsung.com>
17 files changed:
Maintainer: Junghyun Kim <jh0822.kim@samsung.com>
Section: utils
Priority: optional
Maintainer: Junghyun Kim <jh0822.kim@samsung.com>
Section: utils
Priority: optional
-Build-Depends: debhelper (>= 9),
- python-all (>= 2.6),
- python-setuptools
+Build-Depends: debhelper (>= 9), dh-python,
+ python3-all, python3, python3-setuptools
Standards-Version: 3.8.4
XS-Python-Version: >= 2.6
Package: repa
Architecture: all
Standards-Version: 3.8.4
XS-Python-Version: >= 2.6
Package: repa
Architecture: all
-Depends: python (>=2.6),
- python-setuptools,
- python-jenkinsapi,
+ python3-setuptools,
+ python3-jenkinsapi,
Description: tool to help release engineers to maintain code submissions
Release Engineering Process Assistant(REPA) is a tool for release engineers
of Tizen projects. It allows to list submissions, accept or reject them and
Description: tool to help release engineers to maintain code submissions
Release Engineering Process Assistant(REPA) is a tool for release engineers
of Tizen projects. It allows to list submissions, accept or reject them and
+ dh $@ --with python3 --buildsystem=pybuild
def run(self, argv):
"""Command line entry point."""
def run(self, argv):
"""Command line entry point."""
- print '%s: Not implemented yet' % self.help
- print 'paremeter: %s' % argv.opt
+ print('%s: Not implemented yet' % self.help)
+ print('paremeter: %s' % argv.opt)
if __name__ == '__main__':
if __name__ == '__main__':
Source0: %{name}_%{version}.tar.gz
BuildArch: noarch
Source0: %{name}_%{version}.tar.gz
BuildArch: noarch
-BuildRequires: python-setuptools
+BuildRequires: python3-setuptools
Requires: gbs-api
Requires: osc
Requires: gbs-api
Requires: osc
-Requires: python >= 2.6
-Requires: python-setuptools
-Requires: python-jenkinsapi
+Requires: python3
+Requires: python3-setuptools
+Requires: python3-jenkinsapi
%description
This tool is to assist release engineers to operate with submissions
%description
This tool is to assist release engineers to operate with submissions
-%{__python} ./setup.py build
+python3 ./setup.py build
-%{__python} ./setup.py install --root=%{buildroot} --prefix=%{_prefix}
+python3 ./setup.py install --root=%{buildroot} --prefix=%{_prefix}
%clean
rm -rf %{buildroot}
%clean
rm -rf %{buildroot}
%defattr(-,root,root,-)
%config %{_sysconfdir}/%{name}.conf
%{_datadir}/doc/packages/%{name}
%defattr(-,root,root,-)
%config %{_sysconfdir}/%{name}.conf
%{_datadir}/doc/packages/%{name}
-%{python_sitelib}/%{name}-%{version}*.egg-info
-%{python_sitelib}/%{name}-%{version}*-nspkg.pth
-%{python_sitelib}/%{name}
+%{python3_sitelib}/%{name}-%{version}*.egg-info
+%{python3_sitelib}/%{name}-%{version}*-nspkg.pth
+%{python3_sitelib}/%{name}
%{_bindir}/%{name}
%{_mandir}/man1/*
%{_bindir}/%{name}
%{_mandir}/man1/*
for name, project, meta in _resolve_submissions(obs, submission, target):
# osc submitreq [OPTIONS] SOURCEPRJ SOURCEPKG DESTPRJ [DESTPKG]
# osc request accept [-m TEXT] ID
for name, project, meta in _resolve_submissions(obs, submission, target):
# osc submitreq [OPTIONS] SOURCEPRJ SOURCEPKG DESTPRJ [DESTPKG]
# osc request accept [-m TEXT] ID
- print "submission %s" % str(name)
+ print("submission %s" % str(name))
submitter = meta.get('submitter')
projects = '[' + ', '.join(meta['projects']) + ']'
submitter = meta.get('submitter')
projects = '[' + ', '.join(meta['projects']) + ']'
'submission': str(name),
'target_project': target_prj,
'comment': comment}, jenkins_cred)
'submission': str(name),
'target_project': target_prj,
'comment': comment}, jenkins_cred)
- print "Jenkins job: re, build #%s, status: %s" % (build, status)
- print out
+ print("Jenkins job: re, build #%s, status: %s" % (build, status))
+ print(out)
else:
# Create SR
org_source_packages=obs.get_source_packages(project)
else:
# Create SR
org_source_packages=obs.get_source_packages(project)
reqid = obs.create_sr(project, source_packages,
target_prj, message=message)
reqid = obs.create_sr(project, source_packages,
target_prj, message=message)
- print 'created SR %s' % reqid
+ print('created SR %s' % reqid)
# and immediately set its state
message = "SR %s is set to %s" % (reqid, state)
# and immediately set its state
message = "SR %s is set to %s" % (reqid, state)
message += comment
obs.set_sr_state(reqid, state=state,
message=str(message), force=True)
message += comment
obs.set_sr_state(reqid, state=state,
message=str(message), force=True)
- print 'set SR state to', state
+ print('set SR state to', state)
# delete submit group
if submission.startswith('submitgroup'):
# delete submit group
if submission.startswith('submitgroup'):
except RepaException:
pass
except RepaException:
pass
- print "%-55s %-12s %-12s %-40s %s" % \
- (path, rev_cmp[:10], str(rev_target)[:10], cmp_tag, status)
+ print("%-55s %-12s %-12s %-40s %s" % \
+ (path, rev_cmp[:10], str(rev_target)[:10], cmp_tag, status))
import re
from collections import defaultdict
import re
from collections import defaultdict
-from StringIO import StringIO
from multiprocessing.pool import ThreadPool
from functools import partial
from multiprocessing.pool import ThreadPool
from functools import partial
def check_target_prj(submissions):
"""Check if target projects are the same for all submissions"""
result = defaultdict(list)
def check_target_prj(submissions):
"""Check if target projects are the same for all submissions"""
result = defaultdict(list)
- for submission, data in submissions.iteritems():
+ for submission, data in submissions.items():
result[data['meta']['obs_target_prj']].append(submission)
if len(result) > 1:
message = '\n'.join('%s: %s' % (project, ' '.join(subms)) \
result[data['meta']['obs_target_prj']].append(submission)
if len(result) > 1:
message = '\n'.join('%s: %s' % (project, ' '.join(subms)) \
- for project, subms in result.iteritems())
+ for project, subms in result.items())
raise RepaException('Target projects differ:\n%s\n' % message)
def check_build_results(bresults):
"""Check if build targets are published."""
for subm, _, results in bresults:
raise RepaException('Target projects differ:\n%s\n' % message)
def check_build_results(bresults):
"""Check if build targets are published."""
for subm, _, results in bresults:
- for target, res in results.iteritems():
+ for target, res in results.items():
if res['state'] != 'published' or res['code'] != 'published':
if res['packages']:
raise RepaException("%s: target %s is not published yet" %
if res['state'] != 'published' or res['code'] != 'published':
if res['packages']:
raise RepaException("%s: target %s is not published yet" %
"""
binaries = defaultdict(dict)
result = set(submissions.keys())
"""
binaries = defaultdict(dict)
result = set(submissions.keys())
- for submission, data in sorted(submissions.iteritems()):
+ for submission, data in sorted(submissions.items()):
pkgs = list(obs.get_binary_packages(data['project']))
# check if submission has binary packages
for repo, bins in pkgs:
# check if submissions have common packages
pkgs = list(obs.get_binary_packages(data['project']))
# check if submission has binary packages
for repo, bins in pkgs:
# check if submissions have common packages
- for subm, info in binaries.iteritems():
+ for subm, info in binaries.items():
if repo in info:
common = set(info[repo]).intersection(bins)
if common and noaggregate:
common = set(pkg for pkg in common \
if not re.match(noaggregate, pkg))
if common:
if repo in info:
common = set(info[repo]).intersection(bins)
if common and noaggregate:
common = set(pkg for pkg in common \
if not re.match(noaggregate, pkg))
if common:
- print '%s and %s have %d common packages,' \
+ print('%s and %s have %d common packages,' \
' skipping %s' % (subm, submission,
' skipping %s' % (subm, submission,
- len(common), submission)
+ len(common), submission))
if submission in result:
result.remove(submission)
break
if submission in result:
result.remove(submission)
break
if processes > 1:
pool = ThreadPool(processes=processes)
for subm, prj, results in bresults:
if processes > 1:
pool = ThreadPool(processes=processes)
for subm, prj, results in bresults:
- for res in results.itervalues():
+ for res in results.values():
for pkg, state in res['packages']:
if state == 'succeeded' and pkg not in aggregated:
if processes > 1:
for pkg, state in res['packages']:
if state == 'succeeded' and pkg not in aggregated:
if processes > 1:
callback=callback)
else:
obs.aggregate_package(prj, pkg, gproject, pkg)
callback=callback)
else:
obs.aggregate_package(prj, pkg, gproject, pkg)
- print 'aggregated %s/%s' % (subm, pkg)
+ print('aggregated %s/%s' % (subm, pkg))
aggregated.add(pkg)
if processes > 1:
aggregated.add(pkg)
if processes > 1:
check_target_prj(info)
bresults = [(subm, data['project'], data['build_results']) \
check_target_prj(info)
bresults = [(subm, data['project'], data['build_results']) \
- for subm, data in info.iteritems()]
+ for subm, data in info.items()]
check_build_results(bresults)
# filter out conflicting submissions
filtered = check_binary_pkgs(obs, info, noaggregate)
bresults = [item for item in bresults if item[0] in filtered]
check_build_results(bresults)
# filter out conflicting submissions
filtered = check_binary_pkgs(obs, info, noaggregate)
bresults = [item for item in bresults if item[0] in filtered]
- info = dict(item for item in info.iteritems() if item[0] in filtered)
+ info = dict(item for item in info.items() if item[0] in filtered)
- name, gproject = create_group_project(obs, info.keys(),
- info.itervalues().next()['meta'],
+ name, gproject = create_group_project(obs, list(info.keys()),
+ iter(info.values()).next()['meta'],
- print 'Created submit group %s\n' % name
+ print('Created submit group %s\n' % name)
aggregated = aggregate(obs, bresults, gproject, processes)
aggregated = aggregate(obs, bresults, gproject, processes)
- print '\n%d submissions (%d packages) have been merged into %s' % \
- (len(info), len(aggregated), name)
+ print('\n%d submissions (%d packages) have been merged into %s' % \
+ (len(info), len(aggregated), name))
class Group(object):
"""Subcommand: Manage group submissions."""
class Group(object):
"""Subcommand: Manage group submissions."""
if build_results:
codes = set()
pkgstatus = {}
if build_results:
codes = set()
pkgstatus = {}
- for (repo, arch), target in build_results.iteritems():
+ for (repo, arch), target in build_results.items():
codes.add(target.get('code'))
codes.add(target.get('state'))
for pkginfo in target['packages']:
codes.add(target.get('code'))
codes.add(target.get('state'))
for pkginfo in target['packages']:
# Add build time to the status
project = get_prerelease(meta['git_tag'], meta['obs_target_prj'])
btime = 0
# Add build time to the status
project = get_prerelease(meta['git_tag'], meta['obs_target_prj'])
btime = 0
- for (repo, arch), target in build_results.iteritems():
+ for (repo, arch), target in build_results.items():
btime = max(btime, obs.get_build_time(str(project), str(repo),
str(arch)))
minutes, seconds = divmod(btime, 60)
btime = max(btime, obs.get_build_time(str(project), str(repo),
str(arch)))
minutes, seconds = divmod(btime, 60)
"""Print OBS and download urls."""
download_url = get_download_url(meta)
if download_url:
"""Print OBS and download urls."""
download_url = get_download_url(meta)
if download_url:
- print ' download url: ', download_url
+ print(' download url: ', download_url)
obs_url = get_obs_url(meta)
if obs_url:
obs_url = get_obs_url(meta)
if obs_url:
- print ' obs url: ', obs_url
- print
+ print(' obs url: ', obs_url)
+ print()
def get_sr(obs, project, package, tag, status):
"""Check if tag is in comments of accepted/declined SRs."""
def get_sr(obs, project, package, tag, status):
"""Check if tag is in comments of accepted/declined SRs."""
if rsr:
base_status = colorizer.red('rejected. SR %s' % rsr)
if refprj:
if rsr:
base_status = colorizer.red('rejected. SR %s' % rsr)
if refprj:
- print '%-37s %-37s %-37s %-37s %s' % \
+ print('%-37s %-37s %-37s %-37s %s' % \
(meta['git_tag'],
meta['ref_obs_target_prj'],
get_status(meta, colorizer, build_results,
ignore, obs, showtime),
(meta['git_tag'],
meta['ref_obs_target_prj'],
get_status(meta, colorizer, build_results,
ignore, obs, showtime),
- base_status, ','.join(projects))
+ base_status, ','.join(projects)))
- print '%-37s %-37s %-37s %s' % \
+ print('%-37s %-37s %-37s %s' % \
(meta['git_tag'],
get_status(meta, colorizer, build_results,
ignore, obs, showtime),
(meta['git_tag'],
get_status(meta, colorizer, build_results,
ignore, obs, showtime),
- base_status, ','.join(projects))
+ base_status, ','.join(projects)))
- print '%-37s %-37s %-37s %s' % \
+ print('%-37s %-37s %-37s %s' % \
(meta['git_tag'],
meta['ref_obs_target_prj'],
get_status(meta, colorizer, build_results,
ignore, obs, showtime),
(meta['git_tag'],
meta['ref_obs_target_prj'],
get_status(meta, colorizer, build_results,
ignore, obs, showtime),
- print '%-37s %-37s %s' % \
+ print('%-37s %-37s %s' % \
(meta['git_tag'],
get_status(meta, colorizer, build_results,
ignore, obs, showtime),
(meta['git_tag'],
get_status(meta, colorizer, build_results,
ignore, obs, showtime),
if showurls:
show_urls(meta)
# groups
if groups:
if showurls:
show_urls(meta)
# groups
if groups:
- print '%-37s %-37s' % (meta['name'], get_status(meta, colorizer))
+ print('%-37s %-37s' % (meta['name'], get_status(meta, colorizer)))
if showurls:
show_urls(meta)
if showurls:
show_urls(meta)
'submission': argv.submission,
'target_project': argv.project,
'comment': argv.comment}, cred)
'submission': argv.submission,
'target_project': argv.project,
'comment': argv.comment}, cred)
- print "Jenkins job: %s, build #%s, status: %s" % (job, build, status)
- print out
+ print("Jenkins job: %s, build #%s, status: %s" % (job, build, status))
+ print(out)
return status == 'SUCCESS'
if __name__ == '__main__':
return status == 'SUCCESS'
if __name__ == '__main__':
import sys
import pkg_resources
import sys
import pkg_resources
from os.path import expanduser
from argparse import ArgumentParser
from os.path import expanduser
from argparse import ArgumentParser
Configuration is read from the set of files provided.
Optional section name can be specified to read options from
"""
Configuration is read from the set of files provided.
Optional section name can be specified to read options from
"""
- conf = ConfigParser.RawConfigParser()
+ conf = configparser.RawConfigParser()
if not conf.read(paths):
raise RepaException("Configuration file not found")
if not conf.has_section(section):
if not conf.read(paths):
raise RepaException("Configuration file not found")
if not conf.has_section(section):
def update_args(config, args):
"""Set configuration options as args attributes."""
def update_args(config, args):
"""Set configuration options as args attributes."""
- for key, val in config.iteritems():
+ for key, val in config.items():
if not hasattr(args, key):
setattr(args, key, val)
return args
if not hasattr(args, key):
setattr(args, key, val)
return args
args = parse_args(argv)
return args.func(args)
except (RepaException, KeyboardInterrupt) as error:
args = parse_args(argv)
return args.func(args)
except (RepaException, KeyboardInterrupt) as error:
- print >> sys.stderr, error
+ print(error, file=sys.stderr)
if __name__ == '__main__':
if __name__ == '__main__':
from base64 import b64encode
from xml.etree import cElementTree as ET
from base64 import b64encode
from xml.etree import cElementTree as ET
-from StringIO import StringIO
-from urllib2 import HTTPError
+from io import StringIO
+from urllib.error import HTTPError
'package': argv.package,
'target_project': argv.project,
'comment': argv.comment}, cred)
'package': argv.package,
'target_project': argv.project,
'comment': argv.comment}, cred)
- print "Jenkins job: %s, build #%s, status: %s" % (job, build, status)
- print out
+ print("Jenkins job: %s, build #%s, status: %s" % (job, build, status))
+ print(out)
return status == 'SUCCESS'
if __name__ == '__main__':
return status == 'SUCCESS'
if __name__ == '__main__':
'submission': argv.submission,
'target_project': argv.project,
'comment': argv.comment}, cred)
'submission': argv.submission,
'target_project': argv.project,
'comment': argv.comment}, cred)
- print "Jenkins job: %s, build #%s, status: %s" % (job, build, status)
- print out
+ print("Jenkins job: %s, build #%s, status: %s" % (job, build, status))
+ print(out)
return status == 'SUCCESS'
if __name__ == '__main__':
return status == 'SUCCESS'
if __name__ == '__main__':
raise RepaException("Group name must start from 'submitgroup/'")
project = get_project_by_name(obs, name, target)[0]
obs.delete_project(project, force=True)
raise RepaException("Group name must start from 'submitgroup/'")
project = get_project_by_name(obs, name, target)[0]
obs.delete_project(project, force=True)
- print 'Submission group %s has been removed' % name
+ print('Submission group %s has been removed' % name)
"""Gest submission status."""
# Process project build results
codes = set()
"""Gest submission status."""
# Process project build results
codes = set()
- for target in results.itervalues():
+ for target in results.values():
codes.add(target.get('code'))
codes.add(target.get('state'))
for pkginfo in target['packages']:
codes.add(target.get('code'))
codes.add(target.get('state'))
for pkginfo in target['packages']:
is_group = name.startswith('submitgroup/')
_, meta, build_results = get_project_by_name(obs, name, target)
is_group = name.startswith('submitgroup/')
_, meta, build_results = get_project_by_name(obs, name, target)
- print 'Submit Group:', name
+ print('Submit Group:', name)
- print 'Submission:', name
- print 'Target project:', target
+ print('Submission:', name)
+ print('Target project:', target)
- print 'Commit:', meta['git_commit']
+ print('Commit:', meta['git_commit'])
- print 'Submitter:', meta['submitter']
+ print('Submitter:', meta['submitter'])
download_url = get_download_url(meta)
if download_url:
download_url = get_download_url(meta)
if download_url:
- print 'Download Url:', download_url
- print 'OBS Url:', get_obs_url(meta)
+ print('Download Url:', download_url)
+ print('OBS Url:', get_obs_url(meta))
for subm in meta['submissions']:
for subm in meta['submissions']:
for tree in meta['projects']:
for tree in meta['projects']:
- print
- print 'Images:'
+ print()
+ print('Images:')
for img in meta['images']:
for img in meta['images']:
- print ' %-40s %s' % (img['name'], img['status'])
+ print(' %-40s %s' % (img['name'], img['status']))
if build_results:
result = defaultdict(list)
if build_results:
result = defaultdict(list)
- for (repo, arch), target in build_results.iteritems():
+ for (repo, arch), target in build_results.items():
for pkg, status in target['packages']:
if status not in ('succeeded', 'building',
'blocked', 'disabled'):
result[(repo, arch)].append((pkg, status))
if result:
for pkg, status in target['packages']:
if status not in ('succeeded', 'building',
'blocked', 'disabled'):
result[(repo, arch)].append((pkg, status))
if result:
- print
- print 'Package build failures:'
- for (repo, arch), pkginfo in result.iteritems():
+ print()
+ print('Package build failures:')
+ for (repo, arch), pkginfo in result.items():
- print ' %s/%s' % (repo, arch)
+ print(' %s/%s' % (repo, arch))
for pkg, status in pkginfo:
for pkg, status in pkginfo:
- print ' %-40s %s' % (pkg, status)
+ print(' %-40s %s' % (pkg, status))
'submission': argv.submission,
'target_project': argv.project,
'comment': argv.comment}, cred)
'submission': argv.submission,
'target_project': argv.project,
'comment': argv.comment}, cred)
- print "Jenkins job: %s, build #%s, status: %s" % (job, build, status)
- print out
+ print("Jenkins job: %s, build #%s, status: %s" % (job, build, status))
+ print(out)
return status == 'SUCCESS'
if __name__ == '__main__':
return status == 'SUCCESS'
if __name__ == '__main__':
prj, meta, build_results = get_project_by_name(obs, name, target)
if meta['ref_obs_target_prj']:
prj, meta, build_results = get_project_by_name(obs, name, target)
if meta['ref_obs_target_prj']:
- print 'old_ref: %s new_ref: %s' %(meta['ref_obs_target_prj'],
- ref_target_prj)
+ print('old_ref: %s new_ref: %s' %(meta['ref_obs_target_prj'],
+ ref_target_prj))
else:
raise RepaException("update is not supported. "
"ref_obs_target_prj values: %s" % \
else:
raise RepaException("update is not supported. "
"ref_obs_target_prj values: %s" % \