Merge pull request #122 from scarabeusiv/master

Do change project build state when removing packages properly. Progress ...
This commit is contained in:
Alberto Planas 2014-03-24 15:27:27 +01:00
commit 3f4ea8bf8a
3 changed files with 18 additions and 16 deletions

View File

@ -18,7 +18,7 @@ class CheckCommand(object):
# If the project is empty just skip it # If the project is empty just skip it
if not state: if not state:
return None return False
print('Checking staging project: {}'.format(project)) print('Checking staging project: {}'.format(project))
if type(state) is list: if type(state) is list:

View File

@ -106,13 +106,6 @@ class SelectCommand(object):
return False return False
# now make sure we enable the prj if the prj contains any ringed package # now make sure we enable the prj if the prj contains any ringed package
meta = self.api.get_prj_pseudometa(target_project) self.api.build_switch_staging_project(target_project)
staged_requests = list()
for request in meta['requests']:
staged_requests.append(request['id'])
if self.api.check_ring_packages(target_project, staged_requests):
self.api.build_switch_prj(target_project, 'enable')
else:
self.api.build_switch_prj(target_project, 'disable')
return True return True

View File

@ -122,15 +122,9 @@ class StagingAPI(object):
# Delete the old one # Delete the old one
self.rm_from_prj(source_project, request_id=req_id, self.rm_from_prj(source_project, request_id=req_id,
msg='Moved to {}'.format(destination_project)) msg='Moved to {}'.format(destination_project))
return True
# Build disable the old project if empty # Build disable the old project if empty
meta = self.get_prj_pseudometa(source_project) self.build_switch_staging_project(source_project)
staged_requests = list()
for request in meta['requests']:
staged_requests.append(request['id'])
if not self.check_ring_packages(source_project, staged_requests):
self.build_switch_prj(source_project, 'disable')
return True return True
@ -924,3 +918,18 @@ class StagingAPI(object):
return True return True
return False return False
def build_switch_staging_project(self, target_project):
"""
Verify what packages are in project and switch the build
accordingly.
:param target_project: project we validate and switch
"""
meta = self.get_prj_pseudometa(target_project)
staged_requests = list()
for request in meta['requests']:
staged_requests.append(request['id'])
if self.check_ring_packages(target_project, staged_requests):
self.build_switch_prj(target_project, 'enable')
else:
self.build_switch_prj(target_project, 'disable')