Move some of the less expensive QA checks before dep_check() so that they're
authorZac Medico <zmedico@gentoo.org>
Thu, 6 Sep 2007 17:55:56 +0000 (17:55 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 6 Sep 2007 17:55:56 +0000 (17:55 -0000)
still done even in --force mode. (trunk r7718)

svn path=/main/branches/2.1.2/; revision=7742

bin/repoman

index c7f60592c4f7ed8f1d8ee603637b854c8d1ea7ac..f4a33f7c3177558549641062fa056228e808f3fc 100755 (executable)
@@ -1247,112 +1247,6 @@ for x in scanlist:
                                stats["usage.obsolete"] += 1
                                fails["usage.obsolete"].append("%s/%s.ebuild: not migrated to modular X" % (x, y))
 
-               if "--force" in myoptions:
-                       # The dep_check() calls are the most expensive QA test. If --force
-                       # is enabled, there's no point in wasting time on these since the
-                       # user is intent on forcing the commit anyway.
-                       continue
-
-               for keyword,arch,groups in arches:
-
-                       if not profiles.has_key(arch):
-                               # A missing profile will create an error further down
-                               # during the KEYWORDS verification.
-                               continue
-                               
-                       for prof in profiles[arch]:
-
-                               profdir = portdir+"/profiles/"+prof[0]
-       
-                               if prof[0] in arch_caches:
-                                       dep_settings = arch_caches[prof[0]]
-                               else:
-                                       dep_settings = portage.config(
-                                               config_profile_path=profdir,
-                                               config_incrementals=portage_const.INCREMENTALS,
-                                               local_config=False)
-                                       arch_caches[prof[0]] = dep_settings
-                                       while True:
-                                               try:
-                                                       # Protect ACCEPT_KEYWORDS from config.regenerate()
-                                                       # (just in case)
-                                                       dep_settings.incrementals.remove("ACCEPT_KEYWORDS")
-                                               except ValueError:
-                                                       break
-
-                               xmatch_cache_key = (prof[0], tuple(groups))
-                               xcache = arch_xmatch_caches.get(xmatch_cache_key)
-                               if xcache is None:
-                                       portdb.melt()
-                                       portdb.freeze()
-                                       xcache = portdb.xcache
-                                       arch_xmatch_caches[xmatch_cache_key] = xcache
-
-                               trees["/"]["porttree"].settings = dep_settings
-                               portdb.mysettings = dep_settings
-                               portdb.xcache = xcache
-                               # for package.use.mask support inside dep_check
-                               dep_settings.setcpv("/".join((catdir, y)))
-                               dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
-                               # just in case, prevent config.reset() from nuking these.
-                               dep_settings.backup_changes("ACCEPT_KEYWORDS")
-
-                               for myprovide in myaux["PROVIDE"].split():
-                                       prov_cp = portage.dep_getkey(myprovide)
-                                       if prov_cp not in dep_settings.getvirtuals():
-                                               stats["virtual.unavailable"]+=1
-                                               fails["virtual.unavailable"].append(x+"/"+y+".ebuild: "+keyword+"("+prof[0]+") "+prov_cp)
-
-                               if not baddepsyntax:
-                                       ismasked = os.path.join(catdir, y) not in \
-                                               portdb.xmatch("list-visible", x)
-                                       if ismasked:
-                                               if "--ignore-masked" in myoptions:
-                                                       continue
-                                               #we are testing deps for a masked package; give it some lee-way
-                                               suffix="masked"
-                                               matchmode="match-all"
-                                       else:
-                                               suffix=""
-                                               matchmode="match-visible"
-       
-                                       if prof[1] == "dev":
-                                               suffix=suffix+"indev"
-
-                                       for mytype,mypos in [["DEPEND",len(missingvars)],["RDEPEND",len(missingvars)+1],["PDEPEND",len(missingvars)+2]]:
-                                               
-                                               mykey=mytype+".bad"+suffix
-                                               myvalue = myaux[mytype]
-                                               if not myvalue:
-                                                       continue
-                                               try:
-                                                       mydep = portage.dep_check(myvalue, portdb,
-                                                               dep_settings, use="all", mode=matchmode,
-                                                               trees=trees)
-                                               except KeyError, e:
-                                                       stats[mykey]=stats[mykey]+1
-                                                       fails[mykey].append(x+"/"+y+".ebuild: "+keyword+"("+prof[0]+") "+repr(e[0]))
-                                                       continue
-       
-                                               if mydep[0]==1:
-                                                       if mydep[1]!=[]:
-                                                               #we have some unsolvable deps
-                                                               #remove ! deps, which always show up as unsatisfiable
-                                                               d=0
-                                                               while d<len(mydep[1]):
-                                                                       if mydep[1][d][0]=="!":
-                                                                               del mydep[1][d]
-                                                                       else:
-                                                                               d += 1
-                                                               #if we emptied out our list, continue:
-                                                               if not mydep[1]:
-                                                                       continue
-                                                               stats[mykey]=stats[mykey]+1
-                                                               fails[mykey].append(x+"/"+y+".ebuild: "+keyword+"("+prof[0]+") "+repr(mydep[1]))
-                                               else:
-                                                       stats[mykey]=stats[mykey]+1
-                                                       fails[mykey].append(x+"/"+y+".ebuild: "+keyword+"("+prof[0]+") "+repr(mydep[1]))
-
                # this check needs work, it won't catch (\ndie)
                if not os.system("egrep '^[^#]*\([^)]*\<die\>' "+checkdir+"/"+y+".ebuild >/dev/null 2>&1"):
                        stats["ebuild.nesteddie"]=stats["ebuild.nesteddie"]+1
@@ -1493,6 +1387,112 @@ for x in scanlist:
                        previous_line = line
                del previous_line
 
+               if "--force" in myoptions:
+                       # The dep_check() calls are the most expensive QA test. If --force
+                       # is enabled, there's no point in wasting time on these since the
+                       # user is intent on forcing the commit anyway.
+                       continue
+
+               for keyword,arch,groups in arches:
+
+                       if not profiles.has_key(arch):
+                               # A missing profile will create an error further down
+                               # during the KEYWORDS verification.
+                               continue
+                               
+                       for prof in profiles[arch]:
+
+                               profdir = portdir+"/profiles/"+prof[0]
+       
+                               if prof[0] in arch_caches:
+                                       dep_settings = arch_caches[prof[0]]
+                               else:
+                                       dep_settings = portage.config(
+                                               config_profile_path=profdir,
+                                               config_incrementals=portage_const.INCREMENTALS,
+                                               local_config=False)
+                                       arch_caches[prof[0]] = dep_settings
+                                       while True:
+                                               try:
+                                                       # Protect ACCEPT_KEYWORDS from config.regenerate()
+                                                       # (just in case)
+                                                       dep_settings.incrementals.remove("ACCEPT_KEYWORDS")
+                                               except ValueError:
+                                                       break
+
+                               xmatch_cache_key = (prof[0], tuple(groups))
+                               xcache = arch_xmatch_caches.get(xmatch_cache_key)
+                               if xcache is None:
+                                       portdb.melt()
+                                       portdb.freeze()
+                                       xcache = portdb.xcache
+                                       arch_xmatch_caches[xmatch_cache_key] = xcache
+
+                               trees["/"]["porttree"].settings = dep_settings
+                               portdb.mysettings = dep_settings
+                               portdb.xcache = xcache
+                               # for package.use.mask support inside dep_check
+                               dep_settings.setcpv("/".join((catdir, y)))
+                               dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
+                               # just in case, prevent config.reset() from nuking these.
+                               dep_settings.backup_changes("ACCEPT_KEYWORDS")
+
+                               for myprovide in myaux["PROVIDE"].split():
+                                       prov_cp = portage.dep_getkey(myprovide)
+                                       if prov_cp not in dep_settings.getvirtuals():
+                                               stats["virtual.unavailable"]+=1
+                                               fails["virtual.unavailable"].append(x+"/"+y+".ebuild: "+keyword+"("+prof[0]+") "+prov_cp)
+
+                               if not baddepsyntax:
+                                       ismasked = os.path.join(catdir, y) not in \
+                                               portdb.xmatch("list-visible", x)
+                                       if ismasked:
+                                               if "--ignore-masked" in myoptions:
+                                                       continue
+                                               #we are testing deps for a masked package; give it some lee-way
+                                               suffix="masked"
+                                               matchmode="match-all"
+                                       else:
+                                               suffix=""
+                                               matchmode="match-visible"
+       
+                                       if prof[1] == "dev":
+                                               suffix=suffix+"indev"
+
+                                       for mytype,mypos in [["DEPEND",len(missingvars)],["RDEPEND",len(missingvars)+1],["PDEPEND",len(missingvars)+2]]:
+                                               
+                                               mykey=mytype+".bad"+suffix
+                                               myvalue = myaux[mytype]
+                                               if not myvalue:
+                                                       continue
+                                               try:
+                                                       mydep = portage.dep_check(myvalue, portdb,
+                                                               dep_settings, use="all", mode=matchmode,
+                                                               trees=trees)
+                                               except KeyError, e:
+                                                       stats[mykey]=stats[mykey]+1
+                                                       fails[mykey].append(x+"/"+y+".ebuild: "+keyword+"("+prof[0]+") "+repr(e[0]))
+                                                       continue
+       
+                                               if mydep[0]==1:
+                                                       if mydep[1]!=[]:
+                                                               #we have some unsolvable deps
+                                                               #remove ! deps, which always show up as unsatisfiable
+                                                               d=0
+                                                               while d<len(mydep[1]):
+                                                                       if mydep[1][d][0]=="!":
+                                                                               del mydep[1][d]
+                                                                       else:
+                                                                               d += 1
+                                                               #if we emptied out our list, continue:
+                                                               if not mydep[1]:
+                                                                       continue
+                                                               stats[mykey]=stats[mykey]+1
+                                                               fails[mykey].append(x+"/"+y+".ebuild: "+keyword+"("+prof[0]+") "+repr(mydep[1]))
+                                               else:
+                                                       stats[mykey]=stats[mykey]+1
+                                                       fails[mykey].append(x+"/"+y+".ebuild: "+keyword+"("+prof[0]+") "+repr(mydep[1]))
+
        # Check for 'all unstable' or 'all masked' -- ACCEPT_KEYWORDS is stripped
        # XXX -- Needs to be implemented in dep code. Can't determine ~arch nicely.
        #if not portage.portdb.xmatch("bestmatch-visible",x):