- some nice improvements to --resume

- when gentoo post* trigger run, also verify if it has to run pkg_setup()


git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@921 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
(no author)
2007-12-20 09:50:52 +00:00
parent 101c79cbdd
commit 03ccf1985a
4 changed files with 21 additions and 5 deletions
+8 -2
View File
@@ -853,11 +853,14 @@ def getFailingMirrorStatus(mirrorname):
@input package: repository -> name of the repository, filename -> name of the file to download, digest -> md5 hash of the file
@output: 0 = all fine, -3 = error on all the available mirrors
'''
def fetchFileOnMirrors(repository, filename, digest = False):
def fetchFileOnMirrors(repository, filename, digest = False, verified = False):
uris = etpRepositories[repository]['packages'][::-1]
remaining = set(uris[:])
if verified: # file is already in place, matchChecksum set infoDict['verified'] to True
return 0
mirrorcount = 0
for uri in uris:
@@ -953,6 +956,7 @@ def matchChecksum(infoDict):
dlcheck = checkNeededDownload(infoDict['download'], checksum = infoDict['checksum'])
if dlcheck == 0:
print_info(red(" ## ")+blue("Package checksum matches."))
infoDict['verified'] = True
match = True
break # file downloaded successfully
else:
@@ -962,6 +966,8 @@ def matchChecksum(infoDict):
if fetch != 0:
print_info(red(" ## ")+blue("Cannot properly fetch package! Quitting."))
return 1
else:
infoDict['verified'] = True
if (not match):
print_info(red(" ## ")+blue("Cannot properly fetch package or checksum does not match. Try running again '")+bold("equo update")+blue("'"))
return 1
@@ -1599,7 +1605,7 @@ def stepExecutor(step, infoDict, loopString = None):
if step == "fetch":
print_info(red(" ## ")+blue("Fetching archive: ")+red(os.path.basename(infoDict['download'])))
xtermTitle(loopString+' Fetching archive: '+os.path.basename(infoDict['download']))
output = fetchFileOnMirrors(infoDict['repository'],infoDict['download'],infoDict['checksum'])
output = fetchFileOnMirrors(infoDict['repository'],infoDict['download'],infoDict['checksum'], infoDict['verified'])
if output < 0:
print_error(red("Package cannot be fetched. Try to run: '")+bold("equo update")+red("' and this command again. Error "+str(output)))
+3 -3
View File
@@ -587,7 +587,7 @@ def searchPackage(packages, idreturn = False):
foundPackages = {}
dataInfo = set() # when idreturn is True
if (not idreturn):
if (not idreturn) or (etpUi['quiet']):
print_info(darkred(" @@ ")+darkgreen("Searching..."))
# search inside each available database
repoNumber = 0
@@ -596,7 +596,7 @@ def searchPackage(packages, idreturn = False):
foundPackages[repo] = {}
repoNumber += 1
if (not idreturn):
if (not idreturn) and (not etpUi['quiet']):
print_info(blue(" #"+str(repoNumber))+bold(" "+etpRepositories[repo]['description']))
dbconn = openRepositoryDatabase(repo)
@@ -621,7 +621,7 @@ def searchPackage(packages, idreturn = False):
dataInfo.add((idpackage,repo))
else:
printPackageInfo(idpackage,dbconn)
if (not idreturn):
if (not idreturn) and (not etpUi['quiet']):
print_info(blue(" Keyword: ")+bold("\t"+package))
print_info(blue(" Found: ")+bold("\t"+str(len(foundPackages[repo][package])))+red(" entries"))
+3
View File
@@ -701,6 +701,8 @@ def ebuild_postinstall(pkgdata):
portage_atom = pkgdata['category']+"/"+pkgdata['name']+"-"+pkgdata['version']
print_info(red(" ##")+brown(" Ebuild postinstall hook."))
try:
if not os.path.isfile(pkgdata['unpackdir']+"/portage/"+portage_atom+"/temp/environment"): # if environment is not yet created, we need to run pkg_setup()
portage_doebuild(myebuild, mydo = "setup", tree = "bintree", cpv = portage_atom, portage_tmpdir = pkgdata['unpackdir'])
portage_doebuild(myebuild, mydo = "postinst", tree = "bintree", cpv = portage_atom, portage_tmpdir = pkgdata['unpackdir'])
except Exception, e:
equoLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_NORMAL,"[POST] ATTENTION Cannot run Gentoo postinst trigger for "+portage_atom+"!! "+str(Exception)+": "+str(e))
@@ -715,6 +717,7 @@ def ebuild_preinstall(pkgdata):
portage_atom = pkgdata['category']+"/"+pkgdata['name']+"-"+pkgdata['version']
print_info(red(" ##")+brown(" Ebuild preinstall hook."))
try:
portage_doebuild(myebuild, mydo = "setup", tree = "bintree", cpv = portage_atom, portage_tmpdir = pkgdata['unpackdir']) # create mysettings["T"]+"/environment"
portage_doebuild(myebuild, mydo = "preinst", tree = "bintree", cpv = portage_atom, portage_tmpdir = pkgdata['unpackdir'])
except Exception, e:
equoLog.log(ETP_LOGPRI_INFO,ETP_LOGLEVEL_NORMAL,"[POST] ATTENTION Cannot run Gentoo preinst trigger for "+portage_atom+"!! "+str(Exception)+": "+str(e))
+7
View File
@@ -794,6 +794,7 @@ def installPackages(packages = [], atomsdata = [], deps = True, emptydeps = Fals
infoDict['idpackage'] = packageInfo[0]
infoDict['checksum'] = dbconn.retrieveDigest(idpackage)
infoDict['download'] = dbconn.retrieveDownloadURL(idpackage)
infoDict['verified'] = False
dbconn.closeDB()
del dbconn
@@ -805,6 +806,10 @@ def installPackages(packages = [], atomsdata = [], deps = True, emptydeps = Fals
steps.append("fetch")
steps.append("checksum")
# if file exists, first checksum then fetch
if os.path.isfile(os.path.join(etpConst['entropyworkdir'],infoDict['download'])):
steps.reverse()
if not (etpUi['quiet'] or returnQueue): print_info(red(" :: ")+bold("(")+blue(str(fetchqueue))+"/"+red(totalqueue)+bold(") ")+">>> "+darkgreen(pkgatom))
for step in steps:
@@ -816,6 +821,8 @@ def installPackages(packages = [], atomsdata = [], deps = True, emptydeps = Fals
return -1,rc
# disable fetch now, file fetched
# also taint actionQueue[pkgatom]['fetch'] so resume won't re-fetch all again
actionQueue[pkgatom]['fetch'] = 1
del infoDict
del fetchqueue