diff options
author | Ed Bartosh <eduard.bartosh@intel.com> | 2013-08-17 12:02:19 +0300 |
---|---|---|
committer | Ed Bartosh <eduard.bartosh@intel.com> | 2013-08-17 12:10:36 +0300 |
commit | 2a976434fcaec9ebd3e06bab3cbaf9ddb481fa27 (patch) | |
tree | 5d0afb928b38d611ed00c935300157fe97a2b201 | |
parent | f03bb8cbf4eceb6e795b96e8a42ec099d63c8bd0 (diff) | |
download | repa-2a976434fcaec9ebd3e06bab3cbaf9ddb481fa27.tar.gz repa-2a976434fcaec9ebd3e06bab3cbaf9ddb481fa27.tar.bz2 repa-2a976434fcaec9ebd3e06bab3cbaf9ddb481fa27.zip |
OBS: Added 2 new APIs
create_sr and set_sr_state APIs have been added to OBS class.
Both APIs are generic enough to go to oscapi.
They are going to be used by repa accept and repa reject subcommands.
Change-Id: Ifca34c9b655fdb1065adc178ce0252ce38b28365
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
-rw-r--r-- | repa/obs.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/repa/obs.py b/repa/obs.py index e0d1ef0..174a1d8 100644 --- a/repa/obs.py +++ b/repa/obs.py @@ -22,7 +22,7 @@ from StringIO import StringIO from osc import core -from gitbuildsys.oscapi import OSC +from gitbuildsys.oscapi import OSC, ObsError, OSCError from gitbuildsys.utils import Temp @@ -110,3 +110,26 @@ class OBS(OSC): dst_project, dst_package) finally: sys.stdout = saved + + + def create_sr(self, src_project, package, dst_project, + message='', revision=None): + """Create submit request for the project.""" + rev = revision + if not rev: + url = core.makeurl(self.apiurl, ['source', src_project, package], + query="expand=1") + try: + answer = self.core_http(core.http_GET, url) + except OSCError, err: + raise ObsError("cat't query source %s from project %s: %s" % \ + (package, src_project, err)) + rev = ET.parse(answer).getroot().get('rev') + return core.create_submit_request(self.apiurl, src_project, package, + dst_project, package, message=message, + orev=rev) + + def set_sr_state(self, reqid, state, message='', force=False): + """Set SR state.""" + return core.change_request_state(self.apiurl, reqid, state, + message=message, force=force) |