summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunghyun Kim <jh0822.kim@samsung.com>2016-11-01 20:21:19 +0900
committerJunghyun Kim <jh0822.kim@samsung.com>2016-11-01 20:21:44 +0900
commitbafbdd9120f169e5297e39ab663c8c5ae81e1c27 (patch)
treeb9932530d4f6dc3b6ee255f4e922af6865a17516
parentf436ce9cfa2d277160375c0b6f0678e93462123a (diff)
downloadrepa-bafbdd9120f169e5297e39ab663c8c5ae81e1c27.tar.gz
repa-bafbdd9120f169e5297e39ab663c8c5ae81e1c27.tar.bz2
repa-bafbdd9120f169e5297e39ab663c8c5ae81e1c27.zip
Do not accept aggregate packages.
Conditions of aggregate packages: 1. The name includes "aggregate" 2. The package has a source file named "_aggregate" Squashed commit of the following: commit c519222bcdc7e8aa0fc87502ee57f0786cefa6c4 Author: Junghyun Kim <jh0822.kim@samsung.com> Date: Tue Nov 1 20:19:17 2016 +0900 FIXED: typo. Change-Id: I73582f80e790616a512ecae323cd208c4345c8c9 Signed-off-by: Junghyun Kim <jh0822.kim@samsung.com> commit 83cedfca3da74e0c2c687fea2513d64829ce20c9 Author: Junghyun Kim <jh0822.kim@samsung.com> Date: Tue Nov 1 20:06:15 2016 +0900 Do not accept "*aggregate*" packages having "_aggregate" file. It is more general approach to ignore aggregate packages. Reviewed by Chan Lee <chan45.lee@samsung.com> Change-Id: I71f0d1b2af1da93b73ca94059dfe630163d03388 Signed-off-by: Junghyun Kim <jh0822.kim@samsung.com> commit 6ef788191edfd86172b5dafa6f7c0af486fe2021 Author: Junghyun Kim <jh0822.kim@samsung.com> Date: Mon Sep 12 09:16:23 2016 +0900 indentation modified. Change-Id: I874d5f90c8282e019786533773861f409729a394 Signed-off-by: Junghyun Kim <jh0822.kim@samsung.com> commit 3ae8401ebde101cecabf2d70b63e4713973b17a3 Author: Junghyun Kim <jh0822.kim@samsung.com> Date: Thu Sep 8 13:50:22 2016 +0900 "import re" added. Change-Id: I8f4a5ebcf8a54a5ddd1b3fe661055616fa4e6bb6 Signed-off-by: Junghyun Kim <jh0822.kim@samsung.com> commit 5938c43829bb770a1d09f8b219a36c0f05bc0100 Author: Junghyun Kim <jh0822.kim@samsung.com> Date: Thu Sep 8 11:26:40 2016 +0900 Remove *_aggregate packages before accepting OBS SR. Change-Id: I4321acf02212310bcf8ea75d98883cec7e253131 Signed-off-by: Junghyun Kim <jh0822.kim@samsung.com> Change-Id: I289ae301084510aab7e0c9aadfa2eb4e6be83319 Signed-off-by: Junghyun Kim <jh0822.kim@samsung.com>
-rw-r--r--repa/common.py15
-rw-r--r--repa/obs.py16
2 files changed, 30 insertions, 1 deletions
diff --git a/repa/common.py b/repa/common.py
index e63f073..9d22cca 100644
--- a/repa/common.py
+++ b/repa/common.py
@@ -35,6 +35,7 @@ import time
import json
import tempfile
import subprocess
+import re
from functools import wraps, partial
from distutils.spawn import find_executable
@@ -86,6 +87,12 @@ def delete_project(obs, name, target):
project = get_project_by_name(obs, name, target)[0]
obs.delete_project(project)
+def is_aggregate_package(obs, proj, pack):
+ if re.search("aggregate", pack):
+ if "_aggregate" in obs.get_file_list(proj, pack):
+ return True
+
+ return False
def accept_or_reject(obs, submission, state, target, comment='',
jenkins_cred=None):
@@ -122,7 +129,13 @@ def accept_or_reject(obs, submission, state, target, comment='',
print out
else:
# Create SR
- reqid = obs.create_sr(project, obs.get_source_packages(project),
+ org_source_packages=obs.get_source_packages(project)
+ source_packages=[]
+ for p in org_source_packages:
+ if not is_aggregate_package(obs, project, p):
+ source_packages.append(p)
+
+ reqid = obs.create_sr(project, source_packages,
target_prj, message=message)
print 'created SR %s' % reqid
diff --git a/repa/obs.py b/repa/obs.py
index d25017f..997ae54 100644
--- a/repa/obs.py
+++ b/repa/obs.py
@@ -255,6 +255,22 @@ class OBS(OSC):
ET.SubElement(elem, value)
self.set_meta(ET.tostring(root), prj, pkg)
+ def get_file_list(self, prj, pkg):
+ """Get file list from OBS."""
+ url = core.makeurl(self.apiurl,
+ ['source', prj, pkg]);
+ files=[]
+ try:
+ xml = self.core_http(core.http_GET, url).read()
+ root = ET.fromstring(''.join(xml))
+ for entry in root.findall("entry"):
+ files.append(entry.get('name'))
+ return files
+ except OSCError as error:
+ if error.message == "HTTP Error 404: Not Found":
+ return None
+ raise
+
def get_file(self, prj, pkg, fname, rev=None):
"""Get file content from OBS."""
query = {'expand': 1}