Skip to content

Commit

Permalink
Merge pull request #375 from openSUSE/coolo_adi
Browse files Browse the repository at this point in the history
create several adi stagings - one per source project
  • Loading branch information
coolo committed Jul 28, 2015
2 parents 7f69c66 + 6b37247 commit 0166e9d
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions osclib/adi_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def create_new_adi(self, wanted_requests):
all_requests = self.api.get_open_requests()

non_ring_packages = []
non_ring_requests = []
non_ring_requests = dict()

for request in all_requests:
# Consolidate all data from request
Expand All @@ -57,28 +57,32 @@ def create_new_adi(self, wanted_requests):
action = action[0]

# Where are we targeting the package
source_project = action.find('source').get('project')
if len(wanted_requests):
source_project = 'wanted'
target_package = action.find('target').get('package')

if not self.api.ring_packages.get(target_package):
non_ring_packages.append(target_package)
non_ring_requests.append(request_id)

if not source_project in non_ring_requests:
non_ring_requests[source_project] = []
non_ring_requests[source_project].append(request_id)

if len(non_ring_packages):
print "Not in a ring:", ' '.join(sorted(non_ring_packages))
else:
return

name = self.api.create_adi_project(None)

sc = SelectCommand(self.api, name)

for request in non_ring_requests:
if not self.api.rq_to_prj(request, name):
return False
for source_project, requests in non_ring_requests.items():
name = self.api.create_adi_project(None)

# Notify everybody about the changes
self.api.update_status_comments(name, 'select')
for request in requests:
if not self.api.rq_to_prj(request, name):
return False

# Notify everybody about the changes
self.api.update_status_comments(name, 'select')

def perform(self, packages):
"""
Expand Down

0 comments on commit 0166e9d

Please sign in to comment.