get_takeback_plan

This commit is contained in:
Faik Uygur
2008-06-16 09:13:31 +00:00
parent 2a55cae9d7
commit 4cb3cfadef
2 changed files with 17 additions and 4 deletions
+10
View File
@@ -347,6 +347,16 @@ def takeback(operation):
pisi.operations.history.takeback(operation) pisi.operations.history.takeback(operation)
def get_takeback_plan(operation):
"""
Calculates and returns the plan of the takeback operation that contains information of which
packages are going to be removed and which packages are going to be installed
@param operation: number of the operation that the system will be taken back -> integer
"""
beinstalled, beremoved, configs = pisi.operations.history.plan_takeback(operation)
return beinstalled, beremoved
def snapshot(): def snapshot():
""" """
Takes snapshot of the system packages. The snapshot is only a record of which packages are currently Takes snapshot of the system packages. The snapshot is only a record of which packages are currently
+7 -4
View File
@@ -34,7 +34,7 @@ def __pkg_already_installed(name, pkginfo):
return (ver, rel, build) == installdb.get_version(name) return (ver, rel, build) == installdb.get_version(name)
def __listactions(actions): def __listactions(actions):
beinstalled = [] beinstalled = []
beremoved = [] beremoved = []
configs = [] configs = []
@@ -108,15 +108,18 @@ def get_takeback_actions(operation):
return actions return actions
def takeback(operation): def plan_takeback(operation):
op = historydb.get_operation(operation) op = historydb.get_operation(operation)
if op.type == "snapshot": if op.type == "snapshot":
actions = get_snapshot_actions(op) actions = get_snapshot_actions(op)
else: else:
actions = get_takeback_actions(operation) actions = get_takeback_actions(operation)
beinstalled, beremoved, configs = __listactions(actions) return __listactions(actions)
def takeback(operation):
beinstalled, beremoved, configs = plan_takeback(operation)
if beinstalled: if beinstalled:
ctx.ui.info(_("Following packages will be installed:\n") + pisi.util.strlist(beinstalled)) ctx.ui.info(_("Following packages will be installed:\n") + pisi.util.strlist(beinstalled))