diff options
author | Yonghee Han <onstudy@samsung.com> | 2017-07-12 12:31:24 +0900 |
---|---|---|
committer | Yonghee Han <onstudy@samsung.com> | 2017-07-14 17:25:07 +0900 |
commit | 1314dadfe634ebdeecefa80964522126a2c3ada0 (patch) | |
tree | 667e691c33bb9ac1259d75aa69a85a622f33f81e | |
parent | e1b724b754d5b9a6715afa8e21a590165c8717a3 (diff) | |
download | repa-1314dadfe634ebdeecefa80964522126a2c3ada0.tar.gz repa-1314dadfe634ebdeecefa80964522126a2c3ada0.tar.bz2 repa-1314dadfe634ebdeecefa80964522126a2c3ada0.zip |
DXLTTC-785 First SR acceptance problem.
PROBLEM : If you have a linked package when you first accept it, it will be added to linked package.
SOLUTION : First, create initial package and will be added to SR package.
Change-Id: I8df590cfcef48cac0c402b01ae2674656cf96773
-rw-r--r-- | repa/common.py | 8 | ||||
-rw-r--r-- | repa/obs.py | 14 |
2 files changed, 22 insertions, 0 deletions
diff --git a/repa/common.py b/repa/common.py index e4b743b..c28fc98 100644 --- a/repa/common.py +++ b/repa/common.py @@ -138,6 +138,14 @@ def accept_or_reject(obs, submission, state, target, comment='', if not is_aggregate_package(obs, project, p) and not is_link_package(obs, project, p): source_packages.append(p) + # If source_packages is not exists in target_prj + # create a package in target_prj + if state == 'accepted': + org_target_packages=obs.get_package_list(target_prj) + for package in source_packages: + if not package in org_target_packages: + obs.create_package(target_prj, package) + reqid = obs.create_sr(project, source_packages, target_prj, message=message) diff --git a/repa/obs.py b/repa/obs.py index 997ae54..2796e84 100644 --- a/repa/obs.py +++ b/repa/obs.py @@ -287,3 +287,17 @@ class OBS(OSC): if error.message == "HTTP Error 404: Not Found": return None raise + + def get_package_list(self, prj, deleted=None): + """Get package list of the project""" + query = {} + if deleted: + query['deleted'] = 1 + else: + query['deleted'] = 0 + + url = core.makeurl(self.apiurl, ['source', prj], query) + _file = core.http_GET(url) + root = ET.parse(_file).getroot() + return [node.get('name') for node in root.findall('entry')] + |