commit
5812e0fe47
@ -85,6 +85,8 @@ def _full_project_name(self, project):
|
|||||||
help='show version of the plugin')
|
help='show version of the plugin')
|
||||||
@cmdln.option('--no-freeze', dest='no_freeze', action='store_true',
|
@cmdln.option('--no-freeze', dest='no_freeze', action='store_true',
|
||||||
help='force the select command ignoring the time from the last freeze')
|
help='force the select command ignoring the time from the last freeze')
|
||||||
|
@cmdln.option('--no-cleanup', dest='no_cleanup', action='store_true',
|
||||||
|
help='do not cleanup remaining packages in staging projects after accept')
|
||||||
def do_staging(self, subcmd, opts, *args):
|
def do_staging(self, subcmd, opts, *args):
|
||||||
"""${cmd_name}: Commands to work with staging projects
|
"""${cmd_name}: Commands to work with staging projects
|
||||||
|
|
||||||
@ -215,6 +217,9 @@ def do_staging(self, subcmd, opts, *args):
|
|||||||
for prj in args[1:]:
|
for prj in args[1:]:
|
||||||
if not cmd.perform(api.prj_from_letter(prj)):
|
if not cmd.perform(api.prj_from_letter(prj)):
|
||||||
return
|
return
|
||||||
|
if not opts.no_cleanup:
|
||||||
|
cmd.cleanup(api.prj_from_letter(prj))
|
||||||
|
cmd.cleanup("%s:DVD" % api.prj_from_letter(prj))
|
||||||
cmd.accept_other_new()
|
cmd.accept_other_new()
|
||||||
cmd.update_factory_version()
|
cmd.update_factory_version()
|
||||||
if api.item_exists(api.crebuild):
|
if api.item_exists(api.crebuild):
|
||||||
|
@ -5,6 +5,7 @@ from xml.etree import cElementTree as ET
|
|||||||
|
|
||||||
from osc.core import change_request_state
|
from osc.core import change_request_state
|
||||||
from osc.core import http_GET, http_PUT, http_DELETE
|
from osc.core import http_GET, http_PUT, http_DELETE
|
||||||
|
from osc.core import delete_package
|
||||||
from datetime import date
|
from datetime import date
|
||||||
from osclib.comments import CommentAPI
|
from osclib.comments import CommentAPI
|
||||||
|
|
||||||
@ -86,6 +87,16 @@ class AcceptCommand(object):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def cleanup(self, project):
|
||||||
|
pkgs_to_keep = ['Test-DVD-x86_64', 'Test-DVD-ppc64le', 'bootstrap-copy']
|
||||||
|
pkglist = self.api.list_packages(project)
|
||||||
|
clean_list = set(pkglist) - set(pkgs_to_keep)
|
||||||
|
|
||||||
|
for package in clean_list:
|
||||||
|
print "[cleanup] deleted %s/%s" % (project, package)
|
||||||
|
delete_package(self.api.apiurl, project, package, force=True, msg="autocleanup")
|
||||||
|
return True
|
||||||
|
|
||||||
def accept_other_new(self):
|
def accept_other_new(self):
|
||||||
changed = False
|
changed = False
|
||||||
rqlist = self.find_new_requests(self.api.project)
|
rqlist = self.find_new_requests(self.api.project)
|
||||||
|
@ -1145,20 +1145,20 @@ class StagingAPI(object):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def check_pkgs(self, rebuild_list):
|
def list_packages(self, project):
|
||||||
url = self.makeurl(['source', self.project])
|
url = self.makeurl(['source', project])
|
||||||
pkglist = []
|
pkglist = []
|
||||||
|
|
||||||
root = ET.parse(http_GET(url)).getroot()
|
root = ET.parse(http_GET(url)).getroot()
|
||||||
|
|
||||||
xmllines = root.findall("./entry")
|
xmllines = root.findall("./entry")
|
||||||
|
|
||||||
for pkg in xmllines:
|
for pkg in xmllines:
|
||||||
if pkg.attrib['name'] in rebuild_list:
|
pkglist.append(pkg.attrib['name'])
|
||||||
pkglist.append(pkg.attrib['name'])
|
|
||||||
|
|
||||||
return pkglist
|
return pkglist
|
||||||
|
|
||||||
|
def check_pkgs(self, rebuild_list):
|
||||||
|
return list(set(rebuild_list) & set(self.list_packages(self.project)))
|
||||||
|
|
||||||
def rebuild_pkg(self, package, prj, arch, code=None):
|
def rebuild_pkg(self, package, prj, arch, code=None):
|
||||||
query = {
|
query = {
|
||||||
'cmd': 'rebuild',
|
'cmd': 'rebuild',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user