From 09e490e2f2b74ee0f98eb1242181eb6f87d994b8 Mon Sep 17 00:00:00 2001 From: lxnay Date: Tue, 7 Aug 2007 13:28:22 +0000 Subject: [PATCH] fix some small bugs git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@406 cd1c1023-2f26-0410-ae45-c471fc1f0318 --- libraries/activatorTools.py | 88 ++++++++++++++++--------------------- libraries/enzymeTools.py | 21 ++++++--- libraries/reagentTools.py | 13 +++--- server/enzyme | 2 + 4 files changed, 61 insertions(+), 63 deletions(-) diff --git a/libraries/activatorTools.py b/libraries/activatorTools.py index 840aec1a9..154864768 100644 --- a/libraries/activatorTools.py +++ b/libraries/activatorTools.py @@ -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 diff --git a/libraries/enzymeTools.py b/libraries/enzymeTools.py index f548d0afb..aaac11203 100644 --- a/libraries/enzymeTools.py +++ b/libraries/enzymeTools.py @@ -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) diff --git a/libraries/reagentTools.py b/libraries/reagentTools.py index f51cc639d..d3f587353 100644 --- a/libraries/reagentTools.py +++ b/libraries/reagentTools.py @@ -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'] = [] diff --git a/server/enzyme b/server/enzyme index 7bf03b8ae..dbc194799 100644 --- a/server/enzyme +++ b/server/enzyme @@ -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 ")) 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")