From: Fabian Groffen Date: Sun, 27 May 2007 21:05:56 +0000 (-0000) Subject: Merged from trunk 6626:6634 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=21342977bf5d977fba4925f68d811ceb7cb6d178;p=portage.git Merged from trunk 6626:6634 +------------------------------------------------------------------------+ | 6627 | Store flags as a set inside the USE incremental loop. | | zmedico | | |---------+--------------------------------------------------------------| | 6629 | s/filing a report to/seeking support at/ Thanks to marienz. | | zmedico | | |---------+--------------------------------------------------------------| | 6630 | In the econf die message, don't mention bugs.gentoo.org | | zmedico | specifically. | |---------+--------------------------------------------------------------| | 6631 | xmlint can produce garbage output even on success, so only | | zmedico | dump the ouput when it fails. See bug #179008. | |---------+--------------------------------------------------------------| | 6633 | Create the Packages index whether or not $PKGDIR/All/ exists | | zmedico | so that improved binarytree.populate() performance will be | | | available in either case. When dealing with packages in | | | $PKGDIR/All/, it's assumed that the file name, size, and | | | timestamp are enough information to avoid reading the xpak | | | data. | |---------+--------------------------------------------------------------| | 6634 | Fix broken dict.get logic. | | zmedico | | +------------------------------------------------------------------------+ svn path=/main/branches/prefix/; revision=6645 --- diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 599d9bf3d..86dcf0ef2 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -510,7 +510,7 @@ econf() { if [ -s config.log ]; then echo - echo "!!! Please attach the following file when filing a report to bugs.gentoo.org:" + echo "!!! Please attach the following file when seeking support:" echo "!!! ${PWD}/config.log" fi die "econf failed" diff --git a/bin/repoman b/bin/repoman index 699e74580..7fca8538f 100755 --- a/bin/repoman +++ b/bin/repoman @@ -1098,10 +1098,15 @@ for x in scanlist: else: #Only carry out if in package directory or check forced if xmllint_capable: - st = spawn(["xmllint", "--nonet", "--noout", "--nowarning", "--dtdvalid", - metadata_dtd, os.path.join(checkdir, "metadata.xml")]) + # xmlint can produce garbage output even on success, so only dump + # the ouput when it fails. + st, out = getstatusoutput( + "xmllint --nonet --noout --dtdvalid '%s' '%s'" % \ + (metadata_dtd, os.path.join(checkdir, "metadata.xml"))) if st != os.EX_OK: - print red("!!! metadata.xml is invalid") + print red("!!!") + " metadata.xml is invalid:" + for z in out.splitlines(): + print red("!!! ")+z stats["metadata.bad"]+=1 fails["metadata.bad"].append(x+"/metadata.xml") diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 89d2ba8eb..8934248d8 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -1951,7 +1951,7 @@ class config: self.uvlist.append(self.configdict[x]) self.uvlist.reverse() - myflags = [] + myflags = set() for curdb in self.uvlist: cur_use_expand = [x for x in use_expand if x in curdb] mysplit = curdb.get("USE", "").split() @@ -1959,7 +1959,7 @@ class config: continue for x in mysplit: if x == "-*": - myflags = [] + myflags.clear() continue if x[0] == "+": @@ -1970,19 +1970,18 @@ class config: continue if x[0] == "-": - try: - myflags.remove(x[1:]) - except ValueError: - pass + myflags.discard(x[1:]) continue - myflags.append(x) + myflags.add(x) for var in cur_use_expand: var_lower = var.lower() if var not in myincrementals: prefix = var_lower + "_" - myflags = [x for x in myflags if not x.startswith(prefix)] + for x in list(myflags): + if x.startswith(prefix): + myflags.remove(x) for x in curdb[var].split(): # Any incremental USE_EXPAND variables have already been # processed, so leading +/- operators are invalid here. @@ -1996,9 +1995,8 @@ class config: "non-incremental variable '%s': '%s'\n" % (var, x)), noiselevel=-1) continue - myflags.append(var_lower + "_" + x) + myflags.add(var_lower + "_" + x) - myflags = set(myflags) myflags.update(self.useforce) # FEATURES=test should imply USE=test diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index 6976d4de5..c81de292e 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -291,17 +291,6 @@ class binarytree(object): ${PKGDIR}/${CATEGORY}/${PF}.tbz2 so that both can coexist.""" if not self._all_directory: return - if not self.populated: - # Try to avoid the population routine when possible, so that - # FEATURES=buildpkg doesn't always force population. - mycat, mypkg = catsplit(cpv) - myfile = mypkg + ".tbz2" - full_path = os.path.join(self.pkgdir, "All", myfile) - if not os.path.exists(full_path): - return - tbz2_cat = portage.xpak.tbz2(full_path).getfile("CATEGORY") - if tbz2_cat and tbz2_cat.strip() == mycat: - return full_path = self.getname(cpv) if "All" == full_path.split(os.path.sep)[-2]: return @@ -364,7 +353,7 @@ class binarytree(object): from portage.locks import lockfile, unlockfile pkgindex_lock = None try: - if not self._all_directory and os.access(self.pkgdir, os.W_OK): + if os.access(self.pkgdir, os.W_OK): pkgindex_lock = lockfile(self._pkgindex_file, wantnewlockfile=1) self._populate(getbinpkgs, getbinpkgsonly) @@ -388,6 +377,7 @@ class binarytree(object): pkgindex = portage.getbinpkg.PackageIndex() header = pkgindex.header metadata = pkgindex.packages + pf_index = None try: f = open(self._pkgindex_file) except EnvironmentError: @@ -408,19 +398,43 @@ class binarytree(object): s = os.lstat(full_path) if stat.S_ISLNK(s.st_mode): continue + + # Validate data from the package index and try to avoid + # reading the xpak if possible. if mydir != "All": - # Validate data from the package index and try to avoid - # reading the xpak if possible. - mycpv = mydir + "/" + myfile[:-5] - d = metadata.get(mycpv) - skip = False + possibilities = None + d = metadata.get(mydir+"/"+myfile[:-5]) if d: + possibilities = [d] + else: + if pf_index is None: + pf_index = {} + for mycpv in metadata: + mycat, mypf = catsplit(mycpv) + pf_index.setdefault( + mypf, []).append(metadata[mycpv]) + possibilities = pf_index.get(myfile[:-5]) + if possibilities: + match = None + for d in possibilities: try: - if long(d["MTIME"]) == long(s.st_mtime): - skip = True + if long(d["MTIME"]) != long(s.st_mtime): + continue except (KeyError, ValueError): - pass - if skip and not self._pkgindex_keys.difference(d): + continue + try: + if long(d["SIZE"]) != long(s.st_size): + continue + except (KeyError, ValueError): + continue + if not self._pkgindex_keys.difference(d): + match = d + break + if match: + mycpv = match["CPV"] + if mycpv in pkg_paths: + # discard duplicates (All/ is preferred) + continue pkg_paths[mycpv] = mypath self.dbapi.cpv_inject(mycpv) if not self.dbapi._aux_cache_keys.difference(d): @@ -494,8 +508,7 @@ class binarytree(object): # Do not bother to write the Packages index if $PKGDIR/All/ exists # since it will provide no benefit due to the need to read CATEGORY # from xpak. - if update_pkgindex and not self._all_directory and \ - os.access(self.pkgdir, os.W_OK): + if update_pkgindex and os.access(self.pkgdir, os.W_OK): cpv_all = self._pkg_paths.keys() stale = set(metadata).difference(cpv_all) for cpv in stale: @@ -568,15 +581,6 @@ class binarytree(object): @rtype: None """ mycat, mypkg = catsplit(cpv) - if not self.populated and self._all_directory: - if filename is not None: - # In order to avoid population, don't call getname() here. - os.rename(filename, os.path.join( - self.pkgdir, "All", mypkg + ".tbz2")) - self._create_symlink(cpv) - # There's nothing to update in this case, since the Packages - # index is not created when $PKGDIR/All/ exists. - return if not self.populated: self.populate() if filename is None: @@ -604,12 +608,6 @@ class binarytree(object): self.dbapi.cpv_inject(cpv) self.dbapi._aux_cache.pop(cpv, None) - if self._all_directory: - if filename is not None: - os.rename(filename, self.getname(cpv)) - self._create_symlink(cpv) - return - # Reread the Packages index (in case it's been changed by another # process) and then updated it, all while holding a lock. from portage.locks import lockfile, unlockfile @@ -619,6 +617,9 @@ class binarytree(object): wantnewlockfile=1) if filename is not None: os.rename(filename, self.getname(cpv)) + if self._all_directory and \ + self.getname(cpv).split(os.path.sep)[-2] == "All": + self._create_symlink(cpv) pkgindex = portage.getbinpkg.PackageIndex() try: f = open(self._pkgindex_file)