- moved system packages check to EquoInterface under validatePackageRemoval()
git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@1028 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
+4
-12
@@ -682,25 +682,17 @@ def removePackages(packages = [], atomsdata = [], deps = True, deep = False, sys
|
||||
for atomInfo in foundAtoms:
|
||||
atomscounter += 1
|
||||
idpackage = atomInfo[0]
|
||||
systemPackage = Equo.clientDbconn.isSystemPackage(idpackage)
|
||||
|
||||
# get needed info
|
||||
pkgatom = Equo.clientDbconn.retrieveAtom(idpackage)
|
||||
installedfrom = Equo.clientDbconn.retrievePackageFromInstalledTable(idpackage)
|
||||
|
||||
if (systemPackage) and (systemPackagesCheck):
|
||||
# check if the package is slotted and exist more than one installed first
|
||||
sysresults = Equo.clientDbconn.atomMatch(Equo.entropyTools.dep_getkey(pkgatom), multiMatch = True)
|
||||
slots = set()
|
||||
if sysresults[1] == 0:
|
||||
for x in sysresults[0]:
|
||||
slots.add(Equo.clientDbconn.retrieveSlot(x))
|
||||
if len(slots) < 2:
|
||||
print_warning(darkred(" # !!! ")+red("(")+brown(str(atomscounter))+"/"+blue(str(totalatoms))+red(")")+" "+enlightenatom(pkgatom)+red(" is a vital package. Removal forbidden."))
|
||||
continue
|
||||
else:
|
||||
if (systemPackagesCheck):
|
||||
valid = Equo.validatePackageRemoval(idpackage)
|
||||
if not valid:
|
||||
print_warning(darkred(" # !!! ")+red("(")+brown(str(atomscounter))+"/"+blue(str(totalatoms))+red(")")+" "+enlightenatom(pkgatom)+red(" is a vital package. Removal forbidden."))
|
||||
continue
|
||||
|
||||
plainRemovalQueue.append(idpackage)
|
||||
|
||||
print_info(" # "+red("(")+brown(str(atomscounter))+"/"+blue(str(totalatoms))+red(")")+" "+enlightenatom(pkgatom)+" | Installed from: "+red(installedfrom))
|
||||
|
||||
@@ -1471,6 +1471,25 @@ class EquoInterface(TextInterface):
|
||||
data['removalQueue'] += removal
|
||||
return data,status
|
||||
|
||||
def validatePackageRemoval(self, idpackage):
|
||||
system_pkg = self.clientDbconn.isSystemPackage(idpackage)
|
||||
if not system_pkg:
|
||||
return True # valid
|
||||
|
||||
pkgatom = self.clientDbconn.retrieveAtom(idpackage)
|
||||
# check if the package is slotted and exist more than one installed first
|
||||
sysresults = self.clientDbconn.atomMatch(self.entropyTools.dep_getkey(pkgatom), multiMatch = True)
|
||||
slots = set()
|
||||
if sysresults[1] == 0:
|
||||
for x in sysresults[0]:
|
||||
slots.add(self.clientDbconn.retrieveSlot(x))
|
||||
if len(slots) < 2:
|
||||
return False
|
||||
return True # valid
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
def retrieveRemovalQueue(self, idpackages, deep = False):
|
||||
queue = []
|
||||
treeview = self.generate_depends_tree(idpackages, deep = deep)
|
||||
|
||||
@@ -938,8 +938,8 @@
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow14">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user