summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packaging/repa.spec2
-rw-r--r--repa.131
-rwxr-xr-xrepa/main.py2
-rw-r--r--repa/update.py105
-rwxr-xr-xsetup.py3
5 files changed, 138 insertions, 5 deletions
diff --git a/packaging/repa.spec b/packaging/repa.spec
index 35f79e0..63cf1e5 100644
--- a/packaging/repa.spec
+++ b/packaging/repa.spec
@@ -1,5 +1,5 @@
Name: repa
-Version: 0.5
+Version: 0.6
Summary: Release Engineering Process Assistant
%if 0%{?opensuse_bs}
Release: 1.<CI_CNT>.<B_CNT>
diff --git a/repa.1 b/repa.1
index bbed6eb..4a1a42a 100644
--- a/repa.1
+++ b/repa.1
@@ -58,6 +58,9 @@ Submission group is a temporary group of submissions, created for testing purpos
.RS 2
11. \fBremove\fR - remove submission
.RE
+.RS 2
+12. \fBupdate\fR - update submission
+.RE
.\" ===========================================================================
.\" Global options
@@ -533,6 +536,30 @@ Provide a comment with the explanation of a reason for remove. This is mandatory
Run editor to edit comment. Editor is taken from EDITOR environment variable.
.RE
+.\"
+.\" The "update" command description
+.\"
+.SS \fBupdate\fR <submission> [options]
+
+.RS 2
+Update submission
+
+.\"
+.\" The "remove" command's options
+.\"
+.RS 2
+\fBOPTIONS\fR
+.RS 2
+.B \-h, \-\-help
+.RS 2
+Print short help text about the "update" command and exit.
+.RE
+
+.PP
+.B \-r \-\-refprj COMMENT
+.RS 2
+Provide a update with the reference project. This is mandatory option.
+.RE
.SH CONFIGURATION FILE
@@ -548,7 +575,7 @@ Example:
[general]
.RE
.RS 2
-apiurl = https://api.tizen.org
+apiurl = https://build.tizen.org
.RE
.RS 2
apiuser = your_user_name
@@ -557,7 +584,7 @@ apiuser = your_user_name
apipasswd = your_password
.RE
.RS 2
-jenkins_url = https://build.tizen.org/robot
+jenkins_url = https://robot.tizen.org
.RE
.RS 2
jenkins_user = your_jenkins_user_name
diff --git a/repa/main.py b/repa/main.py
index 37f62db..68bfac8 100755
--- a/repa/main.py
+++ b/repa/main.py
@@ -57,7 +57,7 @@ def parse_args(argv):
ArgumentParser(prog='repa',
description='Release Engineering Process Assistant')
parser.add_argument('--version', action='version',
- version='%(prog)s version 0.5')
+ version='%(prog)s version 0.6')
parser.add_argument('-s', '--section', default='general',
help='config section to use')
parser.add_argument('-p', '--project', help='target project',
diff --git a/repa/update.py b/repa/update.py
new file mode 100644
index 0000000..fbf6f78
--- /dev/null
+++ b/repa/update.py
@@ -0,0 +1,105 @@
+#!/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 json
+from xml.etree import cElementTree as ET
+
+from repa.common import get_project_by_name
+from repa.obs import OBS
+
+from repa.main import sub_main
+
+def set_update_reference_project(obs, prj, ref_target_prj=None):
+ """ Set update reference for project """
+
+ if ref_target_prj is None:
+ raise RepaException("Update reference is not supported. ")
+
+ meta = obs.get_meta(prj)
+ # repalace link project
+ xml_meta = ET.fromstring(''.join(meta))
+ for link_project in xml_meta.findall('link'):
+ link_project.set('project', ref_target_prj)
+ # replace repository path
+ for repo_element in xml_meta.findall('repository'):
+ for element in repo_element.findall('path'):
+ element.set('project',ref_target_prj)
+ # replace description
+ description = json.loads(xml_meta.find('description').text)
+ if description:
+ description['ref_obs_target_prj'] = ref_target_prj
+ xml_meta.find('description').text = json.dumps(description)
+ obs.set_meta(ET.tostring(xml_meta), prj)
+
+def update(obs, name, target, ref_target_prj):
+ """update meta of information about submission"""
+ 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)
+ else:
+ raise RepaException("update is not supported. "
+ "ref_obs_target_prj values: %s" % \
+ (ref_obs_target_prj))
+
+ if not obs.exists(ref_target_prj):
+ raise RepaException("update is not supported. "
+ "ref_target_prj %s is not exists" % \
+ (ref_target_prj))
+ set_update_reference_project(obs, prj, ref_target_prj)
+
+class Update(object):
+ """Subcommand: Update meta of information about submission."""
+
+ name = 'update'
+ description = 'Update meta of 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('-r', '--refprj',
+ help='Update reference project in project')
+ @staticmethod
+ def run(argv):
+ """Command line entry point. Called from [sub_]main"""
+ obs = OBS(argv.apiurl, argv.apiuser, argv.apipasswd)
+ return update(obs, argv.submission, argv.project, argv.refprj)
+
+
+if __name__ == '__main__':
+ sys.exit(sub_main(sys.argv[1:], Update()))
diff --git a/setup.py b/setup.py
index 53515aa..5f7f4e9 100755
--- a/setup.py
+++ b/setup.py
@@ -31,7 +31,7 @@ import os
from setuptools import setup
setup(name="repa",
- version='0.5',
+ version='0.6',
author='Ed Bartosh',
author_email='eduard.bartosh@intel.com',
packages=['repa'],
@@ -52,5 +52,6 @@ setup(name="repa",
'rebuild = repa.rebuild:Rebuild',
'lock = repa.lock:Lock',
'unlock = repa.unlock:Unlock',
+ 'update = repa.update:Update',
'remove = repa.remove:Remove']
})