critical fixes to installFile()

git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@442 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
(no author)
2007-08-12 06:25:25 +00:00
parent bf6b205ab4
commit 979ed246d4
2 changed files with 13 additions and 6 deletions

View File

@@ -1435,13 +1435,13 @@ def installFile(package, infoDict = None):
if (rc != 0):
return 3
try:
shutil.copy2(fromfile,tofile)
shutil.move(fromfile,tofile)
except IOError,(errno,strerror):
if errno == 2:
# better to pass away, sometimes gentoo packages are fucked up and contain broken things
pass
else:
rc = os.system("/bin/cp "+fromfile+" "+tofile)
rc = os.system("mv "+fromfile+" "+tofile)
if (rc != 0):
return 4
try:
@@ -1452,7 +1452,7 @@ def installFile(package, infoDict = None):
except:
pass # sometimes, gentoo packages are fucked up and contain broken symlinks
os.system("rm -rf "+imageDir)
shutil.rmtree(imageDir,True) # rm and ignore errors
if infoDict is not None:
rc = installPackageIntoGentooDatabase(infoDict,unpackDir+etpConst['packagecontentdir']+"/"+package)
@@ -1938,7 +1938,11 @@ def searchBelongs(files, idreturn = False, quiet = False):
dataInfo = [] # when idreturn is True
for file in files:
result = clientDbconn.searchBelongs(file)
like = False
if file.find("*") != -1:
like = True
file = "%"+file+"%"
result = clientDbconn.searchBelongs(file, like)
if (result):
# print info
if (not idreturn) and (not quiet):

View File

@@ -2083,10 +2083,13 @@ class etpDatabase:
dbLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_VERBOSE,"areCompileFlagsAvailable: flags tuple "+chost+"|"+cflags+"|"+cxxflags+" available.")
return result
def searchBelongs(self, file):
def searchBelongs(self, file, like = False):
dbLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_VERBOSE,"searchBelongs: called for "+file)
result = []
self.cursor.execute('SELECT idpackage FROM content WHERE file = "'+file+'"')
if (like):
self.cursor.execute('SELECT idpackage FROM content WHERE file LIKE "'+file+'"')
else:
self.cursor.execute('SELECT idpackage FROM content WHERE file = "'+file+'"')
for row in self.cursor:
result.append(row[0])
return result