1. \fBlist\fR - list submissions and submission groups
.RE
.RS 2
-2. \fBaccept\fR - accept submissions
+2. \fBinfo\fR - show detailed info about submission or submission group
.RE
.RS 2
-3. \fBreject\fR - reject submissions
+3. \fBaccept\fR - accept submissions
.RE
.RS 2
-4. \fBgroup\fR - group submissions into submission group
+4. \fBreject\fR - reject submissions
.RE
.RS 2
-5. \fBrmgroup\fR - remove submission group
+5. \fBgroup\fR - group submissions into submission group
+.RE
+.RS 2
+6. \fBrmgroup\fR - remove submission group
.RE
.\" ===========================================================================
.RE
+.PP
+.\"
+.\" The "info" command description
+.\"
+.SS \fBinfo\fR [\-\-help] \-\-project <project> <submission or group>
+
+.RS 2
+Show detailed information about submission
+
+ Download Url: url of prerelease directory on download server
+ OBS Url: url of prerelease OBS project
+ Images: list of image names and their build statuses
+ Package build failures: list of failed package builds
+
+.PP
+
+Example of output:
+
+.RS 0
+Submission: submit/tizen/20140328.213722
+.RS 0
+Download Url: http://download.tizen.org/prerelease/tizen/ivi/ivi/tizen_20140328.8/tizen_20140328.8.20140328.213722/
+.RS 0
+OBS Url: https://build.tizen.org/project/show?project=home:prerelease:Tizen:IVI:submit:tizen:20140328.213722
+.RS 0
+
+Images:
+ ivi-min-mbr-i586 success
+ ivi-min-efi-i586 success
+ ivi-mbr-i586-emul success
+ ivi-mbr-i586 success
+ ivi-efi-i586 success
+ ivi-mbr-i586-JJ failed
+
+Package build failures:
+ wifi-direct-manager failed
+.RE
+
+.\"
+.\" The "info" command's options
+.\"
+.RS 2
+\fBOPTIONS\fR
+.RS 2
+\-h, \-\-help
+.RS 2
+Print short help text about the "info" command and exit.
+.RE
+
+.PP
+\-p, \-\-project PROJECT
+.RS 2
+Target project name. Mandatory option.
+.RE
+
+
.\"
.\" The "accept" command description
.\"
--- /dev/null
+#!/usr/bin/env python
+#
+# This file is part of REPA: Release Engineering Process Assistant.
+#
+# Copyright (C) 2013 Intel Corporation
+#
+# REPA is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# version 2 as published by the Free Software Foundation.
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+"""
+REPA: Release Engineering Process Assistant.
+
+Copyright (C) Intel Corporation 2013
+Licence: GPL version 2
+Author: Ed Bartosh <eduard.bartosh@intel.com>
+
+List module.
+Get list of submissions.
+"""
+
+import sys
+import os
+
+from collections import defaultdict
+
+from repa.common import get_project_by_name
+from repa.obs import OBS
+
+from repa.main import sub_main
+
+def get_status(results):
+ """Gest submission status."""
+ # Process project build results
+ codes = set()
+ for target in results.itervalues():
+ codes.add(target.get('code'))
+ codes.add(target.get('state'))
+ for pkginfo in target['packages']:
+ codes.add(pkginfo[1])
+ status = ','.join(codes) or 'None'
+ return status
+
+
+def get_download_url(meta):
+ """Get download url from meta."""
+ if 'download_url' in meta:
+ return meta['download_url']
+ # Guess url from image url if download_url is not in the meta
+ if 'images' not in meta:
+ return
+ for img in meta['images']:
+ if 'url' in img:
+ return img['url'].split('images')[0]
+
+
+def get_obs_url(meta, buildurl='https://build.tizen.org'):
+ """Get obs project url from meta."""
+ if 'obs_url' in meta:
+ return meta['obs_url']
+ # Make it from git tag and obs_target_prj if obs_url is not in the meta
+ if 'obs_target_prj' not in meta:
+ return
+ if 'name' not in meta and 'git_tag' not in meta:
+ return
+ name = meta.get('git_tag') or meta.get('name')
+ return os.path.join(buildurl, 'project/show?project=home:prerelease:%s:%s'
+ % (meta['obs_target_prj'], name.replace('/', ':')))
+
+
+def info(obs, name, target):
+ """Print detailed info about submission or submitgroup."""
+ is_group = name.startswith('submitgroup/')
+ _project, meta, build_results = get_project_by_name(obs, name, target)
+
+ print
+ if is_group:
+ print 'Submit Group:', name
+ else:
+ print 'Submission:', name
+ print 'Target project:', target
+ if 'git_commit' in meta:
+ print 'Commit:', meta['git_commit']
+ if 'submitter' in meta:
+ print 'Submitter:', meta['submitter']
+
+ download_url = get_download_url(meta)
+ if download_url:
+ print 'Download Url:', download_url
+ print 'OBS Url:', get_obs_url(meta)
+
+ if is_group:
+ print 'Submissions:'
+ for subm in meta['submissions']:
+ print ' ', subm
+ else:
+ print 'Git trees:'
+ for tree in meta['projects']:
+ print ' ', tree
+ if 'images' in meta:
+ print
+ print 'Images:'
+ for img in meta ['images']:
+ print ' %-40s %s' % (img['name'], img['status'])
+
+ if build_results:
+ result = defaultdict(list)
+ for (repo, arch), target in build_results.iteritems():
+ for pkg, status in target['packages']:
+ if status != 'succeeded':
+ result[(repo, arch)].append((pkg, status))
+ if result:
+ print
+ print 'Package build failures:'
+ for (repo, arch), pkginfo in result.iteritems():
+ if pkginfo:
+ print ' %s/%s' % (repo, arch)
+ for pkg, status in pkginfo:
+ print ' %-40s %s' % (pkg, status)
+
+
+class Info(object):
+ """Subcommand: Print detailed information about submission."""
+
+ name = 'info'
+ description = 'Information about submission'
+ help = description
+
+ @staticmethod
+ def add_arguments(parser, _config):
+ """
+ Add arguments to the parser. Called from [sub_]main.
+ Set defaults for arguments from config.
+ """
+ parser.add_argument('submission', help='submission or group')
+ parser.add_argument('-p', '--project', help='target project',
+ required=True)
+
+ @staticmethod
+ def run(argv):
+ """Command line entry point. Called from [sub_]main"""
+ obs = OBS(argv.apiurl, argv.apiuser, argv.apipasswd)
+ return info(obs, argv.submission, argv.project)
+
+
+if __name__ == '__main__':
+ sys.exit(sub_main(sys.argv[1:], Info()))