fix some small bugs

git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@406 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
lxnay
2007-08-07 13:28:22 +00:00
parent 240c79bf05
commit 09e490e2f2
4 changed files with 61 additions and 63 deletions
+37 -51
View File
@@ -220,69 +220,55 @@ def packages(options):
# if a package is in the packages directory but not online, we have to upload it
# we have localPackagesRepository and remotePackages
for localPackage in localPackagesRepository:
pkgfound = False
for remotePackage in remotePackages:
if localPackage == remotePackage:
pkgfound = True
# it's already on the mirror, but... is its size correct??
localSize = int(os.stat(etpConst['packagesbindir']+"/"+localPackage)[6])
remoteSize = 0
for file in remotePackagesInfo:
if file.split()[8] == remotePackage:
remoteSize = int(file.split()[4])
if (localSize != remoteSize) and (localSize != 0):
# size does not match, adding to the upload queue
uploadQueue.append(localPackage)
break
if (not pkgfound):
try:
remotePackages.index(localPackage)
# it's already on the mirror, but... is its size correct?? FIXME: add md5 check
localSize = int(os.stat(etpConst['packagesbindir']+"/"+localPackage)[6])
remoteSize = 0
for file in remotePackagesInfo:
if file.split()[8] == remotePackage:
remoteSize = int(file.split()[4])
if (localSize != remoteSize) and (localSize != 0):
uploadQueue.append(localPackage)
except:
# this means that the local package does not exist
# so, we need to download it
uploadQueue.append(localPackage)
# Fill uploadQueue and if something weird is found, add the packages to downloadQueue
for localPackage in toBeUploaded:
pkgfound = False
for remotePackage in remotePackages:
if localPackage == remotePackage:
pkgfound = True
# it's already on the mirror, but... is its size correct??
localSize = int(os.stat(etpConst['packagessuploaddir']+"/"+localPackage)[6])
remoteSize = 0
for file in remotePackagesInfo:
if file.split()[8] == remotePackage:
remoteSize = int(file.split()[4])
if (localSize != remoteSize) and (localSize != 0):
# size does not match, adding to the upload queue
uploadQueue.append(localPackage)
break
if (not pkgfound):
try:
remotePackages.index(localPackage)
# it's already on the mirror, but... is its size correct??
localSize = int(os.stat(etpConst['packagessuploaddir']+"/"+localPackage)[6])
remoteSize = 0
for file in remotePackagesInfo:
if file.split()[8] == remotePackage:
remoteSize = int(file.split()[4])
if (localSize != remoteSize) and (localSize != 0):
uploadQueue.append(localPackage)
except:
# this means that the local package does not exist
# so, we need to download it
uploadQueue.append(localPackage)
# Fill downloadQueue and removalQueue
for remotePackage in remotePackages:
pkgfound = False
for localPackage in localPackagesRepository:
if localPackage == remotePackage:
pkgfound = True
# it's already on the mirror, but... is its size correct??
localSize = int(os.stat(etpConst['packagesbindir']+"/"+localPackage)[6])
remoteSize = 0
for file in remotePackagesInfo:
if file.split()[8] == remotePackage:
remoteSize = int(file.split()[4])
if (localSize != remoteSize) and (localSize != 0):
# size does not match, remove first
#print "removal of "+localPackage+" because its size differ"
removalQueue.append(localPackage) # just remove something that differs from the content of the mirror
# then add to the download queue
downloadQueue.append(remotePackage)
break
if (not pkgfound):
try:
localPackagesRepository.index(remotePackage)
# it's already on the mirror, but... is its size correct??
localSize = int(os.stat(etpConst['packagesbindir']+"/"+localPackage)[6])
remoteSize = 0
for file in remotePackagesInfo:
if file.split()[8] == remotePackage:
remoteSize = int(file.split()[4])
if (localSize != remoteSize) and (localSize != 0):
# size does not match, remove first
#print "removal of "+localPackage+" because its size differ"
removalQueue.append(localPackage) # just remove something that differs from the content of the mirror
# then add to the download queue
downloadQueue.append(remotePackage)
except:
# this means that the local package does not exist
# so, we need to download it
if not remotePackage.endswith(".tmp"): # ignore .tmp files
+15 -6
View File
@@ -169,6 +169,7 @@ def build(atoms):
enzymeRequestSimulation = False
enzymeRequestSkipfirst = False
enzymeRequestSkipN = False
enzymeRequestNoSync = False
_atoms = []
for i in atoms:
if ( i == "--verbose" ) or ( i == "-v" ):
@@ -190,6 +191,8 @@ def build(atoms):
enzymeRequestForceRebuild = True
elif ( i == "--use" ):
enzymeRequestUse = True
elif ( i == "--nosync" ):
enzymeRequestNoSync = True
elif ( i == "--skipfirst" ):
enzymeRequestSkipfirst = True
elif ( i.startswith("--skip=") ):
@@ -434,11 +437,12 @@ def build(atoms):
sys.exit(0)
# sync binary packages repository
import activatorTools
if (enzymeRequestInteraction):
activatorTools.packages(["sync" , "--ask"])
else:
activatorTools.packages(["sync"])
if (not enzymeRequestNoSync):
import activatorTools
if (enzymeRequestInteraction):
activatorTools.packages(["sync" , "--ask"])
else:
activatorTools.packages(["sync"])
# when the compilation ends, enzyme runs reagent
@@ -585,6 +589,7 @@ def world(options):
enzymeRequestJustRepackageWorld = False
enzymeRequestSkipfirst = False
enzymeRequestSkipN = False
enzymeRequestNoSync = False
for i in myopts:
if ( i == "--verbose" ) or ( i == "-v" ):
enzymeRequestVerbose = True
@@ -594,8 +599,10 @@ def world(options):
enzymeRequestAsk = True
elif ( i == "--pretend" ):
enzymeRequestPretend = True
elif ( i == "--nosync" ):
enzymeRequestPretend = True
elif ( i == "--skipfirst" ):
enzymeRequestSkipfirst = True
enzymeRequestNoSync = True
elif ( i.startswith("--skip=") ):
enzymeRequestSkipN = True
skip_number = i.split("--skip=")[len(i.split("--skip="))-1]
@@ -664,6 +671,8 @@ def world(options):
atoms.append("--nodeps")
if (enzymeRequestPretend):
atoms.append("--pretend")
if (enzymeRequestNoSync):
atoms.append("--nosync")
elif (enzymeRequestAsk):
atoms.append("--ask")
build(atoms)
+7 -6
View File
@@ -408,17 +408,18 @@ def extractPkgData(package, etpBranch = "unstable", structuredLayout = False):
except IOError:
tmpIUSE = []
for i in tmpIUSE:
if tmpUSE.find(" "+i+" ") != -1:
etpData['useflags'].append(i)
else:
etpData['useflags'].append("-"+i)
PackageFlags = []
for x in tmpUSE.split():
if (x):
PackageFlags.append(x)
for i in tmpIUSE:
try:
PackageFlags.index(i)
etpData['useflags'].append(i)
except:
etpData['useflags'].append("-"+i)
print_info(yellow(" * ")+red("Getting package provide content..."),back = True)
# Fill Provide
etpData['provide'] = []
+2
View File
@@ -52,6 +52,7 @@ def print_help():
print_info(" \t\t"+red("--repackage-installed")+"\t creates binaries of all the installed packages")
print_info(" \t\t"+red("--skipfirst")+"\t\t skip the first package in the packages list")
print_info(" \t\t"+red("--skip=n")+"\t\t skip N packages")
print_info(" \t\t"+red("--nosync")+"\t\t disable activator packages sync")
print_info(" \t"+green(bold("build"))+yellow("\t\t to build all the packages specified in <atom(s)>"))
print_info(" \t\t"+red("--force-rebuild")+"\t\t force the building of the package, nevertheless")
print_info(" \t\t"+red("--force-repackage")+"\t force the repackaging of all the possible package")
@@ -65,6 +66,7 @@ def print_help():
print_info(" \t\t"+red("--simulate-building")+"\t compilations are simulated only")
print_info(" \t\t"+red("--skipfirst")+"\t\t skip the first package in the packages list")
print_info(" \t\t"+red("--skip=n")+"\t\t skip N packages")
print_info(" \t\t"+red("--nosync")+"\t\t disable activator packages sync")
print_info(" \t"+green(bold("uninstall"))+yellow("\t to uninstall one or a list of packages"))
print_info(" \t\t"+red("--pretend")+"\t\t just show what would be done")
print_info(" \t\t"+red("--just-prune")+"\t\t with slotted packages, keep only the latest, remove the rest")