fix an issue in removePackage
git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@701 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
1
TODO
1
TODO
@@ -1,5 +1,6 @@
|
||||
TODO list:
|
||||
CLIENT:
|
||||
- give removal depends calculation a bit of love
|
||||
- find a way to better handle real smartapps deps
|
||||
- add support for database revisions log
|
||||
- add external trigger for splashutils
|
||||
|
||||
@@ -684,6 +684,7 @@ def generateDependsTree(idpackages, deep = False):
|
||||
if rx == -2:
|
||||
# generation needed
|
||||
clientDbconn.regenerateDependsTable(output = False)
|
||||
rx = clientDbconn.retrieveDepends(idpackages[0])
|
||||
|
||||
while (not dependsOk):
|
||||
treedepth += 1
|
||||
@@ -963,21 +964,35 @@ def removePackage(infoDict):
|
||||
equoLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_VERBOSE,"[remove] Protecting config file: "+file)
|
||||
print_warning(darkred(" ## ")+red("[remove] Protecting config file: ")+file)
|
||||
else:
|
||||
try:
|
||||
os.remove(file)
|
||||
#print file
|
||||
# is now empty?
|
||||
filedir = os.path.dirname(file)
|
||||
dirlist = os.listdir(filedir)
|
||||
if (not dirlist):
|
||||
os.removedirs(filedir)
|
||||
except OSError:
|
||||
try:
|
||||
os.removedirs(file) # is it a dir?, empty?
|
||||
#print "debug: was a dir"
|
||||
except:
|
||||
#print "debug: the dir wasn't empty? -> "+str(file)
|
||||
pass
|
||||
if not os.path.lexists(file):
|
||||
continue # file does not exist
|
||||
if os.path.isdir(file) and os.path.islink(file):
|
||||
# directory symlink
|
||||
mylist = os.listdir(file)
|
||||
if not mylist:
|
||||
try:
|
||||
os.remove(file)
|
||||
except OSError:
|
||||
pass
|
||||
elif os.path.isdir(file):
|
||||
# plain directory
|
||||
mylist = os.listdir(file)
|
||||
if not mylist:
|
||||
try:
|
||||
os.removedirs(file)
|
||||
except OSError:
|
||||
pass
|
||||
else: # files, symlinks or not
|
||||
# just a file or something like that
|
||||
try:
|
||||
os.remove(file)
|
||||
# is directory of the file now empty?
|
||||
filedir = os.path.dirname(file)
|
||||
dirlist = os.listdir(filedir)
|
||||
if (not dirlist):
|
||||
os.removedirs(filedir)
|
||||
except OSError:
|
||||
pass
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
@@ -791,6 +791,7 @@ def removePackages(packages = [], atomsdata = [], ask = False, pretend = False,
|
||||
if (ask):
|
||||
rc = entropyTools.askquestion(question)
|
||||
if rc == "No":
|
||||
lookForOrphanedPackages = False
|
||||
if (not deps):
|
||||
clientDbconn.closeDB()
|
||||
return 0,0
|
||||
@@ -813,7 +814,7 @@ def removePackages(packages = [], atomsdata = [], ask = False, pretend = False,
|
||||
choosenRemovalQueue.append(y)
|
||||
|
||||
if (choosenRemovalQueue):
|
||||
print_info(red(" @@ ")+blue("These are the packages that would added to the removal queue:"))
|
||||
print_info(red(" @@ ")+blue("These are the packages that would be added to the removal queue:"))
|
||||
totalatoms = str(len(choosenRemovalQueue))
|
||||
atomscounter = 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user