From 1a242d125450581ab16be5a9c33be60063cd14af Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Wed, 23 May 2007 16:30:04 +0000 Subject: [PATCH] Merged from trunk 6550:6560 +------------------------------------------------------------------------+ | 6550 | Catch a potential OSError if the child process has already | | zmedico | died. | |----------+-------------------------------------------------------------| | 6551 | Only show extra whitespace where there are some news items | | zmedico | to display. | |----------+-------------------------------------------------------------| | 6552 | Fall back to pickle if cPickle is unavailable. Thanks to | | zmedico | Michael Haubenwallner | | | for reporting. | |----------+-------------------------------------------------------------| | 6553 | fix from James C. Georgas to not modify EXTRA_EINSTALL | | SpankMan | #178544 | |----------+-------------------------------------------------------------| | 6554 | For bug #176539, add a "manifest" target to repoman so that | | zmedico | there's a simple way to just generate a Manifest. | |----------+-------------------------------------------------------------| | 6555 | Avoid permission errors when trying to lock repo_path. Note | | zmedico | that the lock file should be mapped into /var somewhere. | |----------+-------------------------------------------------------------| | 6556 | In --tree output, keep track of which graph edges have | | zmedico | already been displayed and try not to display a given edge | | | more than once. | |----------+-------------------------------------------------------------| | 6557 | Add edges to shown_edges at the first oportunity. | | zmedico | | |----------+-------------------------------------------------------------| | 6558 | For bug #178378, make the default src_compile() check for | | zmedico | configure in ${ECONF_SOURCE:-.} (instead of just .) before | | | it calls econf. Thanks to James C. Georgas | | | . | |----------+-------------------------------------------------------------| | 6559 | Use device number and i-node number (like os.path.samefile | | zmedico | does) to check if the current directory is inside a given | | | overlay. This solves issues with path comparison and | | | symlinks. | |----------+-------------------------------------------------------------| | 6560 | For bug #179206, improve efficiency by using a containment | | zmedico | test instead of str.count inside update_dbentry. Thanks to | | | Jason Lai . | +------------------------------------------------------------------------+ svn path=/main/branches/prefix/; revision=6594 --- bin/ebuild.sh | 9 +++++---- bin/repoman | 37 +++++++++++++++++++++++++++++++++--- pym/emerge/__init__.py | 19 ++++++++++++++---- pym/portage/dbapi/vartree.py | 6 +++++- pym/portage/news.py | 7 ++++++- pym/portage/update.py | 4 ++-- 6 files changed, 67 insertions(+), 15 deletions(-) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 6d59d51bc..5d8709087 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -522,6 +522,7 @@ econf() { einstall() { # CONF_PREFIX is only set if they didn't pass in libdir above. + local LOCAL_EXTRA_EINSTALL="${EXTRA_EINSTALL}" LIBDIR_VAR="LIBDIR_${ABI}" if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then CONF_LIBDIR="${!LIBDIR_VAR}" @@ -530,7 +531,7 @@ einstall() { if [ -n "${CONF_LIBDIR}" ] && [ "${CONF_PREFIX:-unset}" != "unset" ]; then EI_DESTLIBDIR="${D}/${CONF_PREFIX}/${CONF_LIBDIR}" EI_DESTLIBDIR="$(strip_duplicate_slashes ${EI_DESTLIBDIR})" - EXTRA_EINSTALL="libdir=${EI_DESTLIBDIR} ${EXTRA_EINSTALL}" + LOCAL_EXTRA_EINSTALL="libdir=${EI_DESTLIBDIR} ${LOCAL_EXTRA_EINSTALL}" unset EI_DESTLIBDIR fi @@ -542,7 +543,7 @@ einstall() { localstatedir="${ED}/var/lib" \ mandir="${ED}/usr/share/man" \ sysconfdir="${ED}/etc" \ - ${EXTRA_EINSTALL} \ + ${LOCAL_EXTRA_EINSTALL} \ "$@" install fi make prefix="${ED}/usr" \ @@ -551,7 +552,7 @@ einstall() { localstatedir="${ED}/var/lib" \ mandir="${ED}/usr/share/man" \ sysconfdir="${ED}/etc" \ - ${EXTRA_EINSTALL} \ + ${LOCAL_EXTRA_EINSTALL} \ "$@" install || die "einstall failed" else die "no Makefile found" @@ -577,7 +578,7 @@ src_unpack() { } src_compile() { - if [ -x ./configure ]; then + if [ -x "${ECONF_SOURCE:-.}/configure" ] ; then econf fi if [ -f Makefile ] || [ -f GNUmakefile ] || [ -f makefile ]; then diff --git a/bin/repoman b/bin/repoman index d95d09ae7..c4ac3902f 100755 --- a/bin/repoman +++ b/bin/repoman @@ -93,6 +93,7 @@ signal.signal(signal.SIGINT,exithandler) shortmodes={"ci":"commit"} modeshelp={ "scan" : "Scan directory tree for QA issues (default)", +"manifest" : "Generate a Manifest (fetches files if necessary)", "fix" : "Fix simple QA issues (stray digests, missing digests)", "full" : "Scan directory tree for QA issues (full listing)", "help" : "Show this screen", @@ -485,13 +486,28 @@ if "PWD" in os.environ and os.environ["PWD"] != mydir and \ # the current working directory (from the shell). mydir = os.environ["PWD"] mydir = normalize_path(mydir) +path_ids = set() +p = mydir +s = None +while True: + s = os.stat(p) + path_ids.add((s.st_dev, s.st_ino)) + if p == "/": + break + p = os.path.dirname(p) if mydir[-1] != "/": mydir += "/" for overlay in repoman_settings["PORTDIR_OVERLAY"].split(): + overlay = os.path.realpath(overlay) + try: + s = os.stat(overlay) + except OSError: + continue + overlay_id = (s.st_dev, s.st_ino) if overlay[-1] != "/": overlay += "/" - if mydir.startswith(overlay): + if overlay_id in path_ids: portdir_overlay = overlay subdir = mydir[len(overlay):] if subdir and subdir[-1] != "/": @@ -500,6 +516,8 @@ for overlay in repoman_settings["PORTDIR_OVERLAY"].split(): portdir = portdir_overlay break +del p, s, path_ids + if not portdir_overlay: if (repoman_settings["PORTDIR"] + os.path.sep).startswith(mydir): portdir_overlay = repoman_settings["PORTDIR"] @@ -566,7 +584,9 @@ for x in range(0,repolevel-1): def caterror(mycat): err(mycat+" is not an official category. Skipping QA checks in this directory.\nPlease ensure that you add "+catdir+" to "+repodir+"/profiles/categories\nif it is a new category.") -if "--pretend" in myoptions: +if mymode == "manifest": + pass +elif "--pretend" in myoptions: print green("\nRepoMan does a once-over of the neighborhood...") elif quiet < 1: print green("\nRepoMan scours the neighborhood...") @@ -790,7 +810,7 @@ def x11_deprecation_check(depstr): return True return False - +dofail = 0 arch_caches={} arch_xmatch_caches = {} for x in scanlist: @@ -801,6 +821,14 @@ for x in scanlist: dadded=[] catdir,pkgdir=x.split("/") checkdir=repodir+"/"+x + + if mymode == "manifest": + repoman_settings["O"] = checkdir + if not portage.digestgen([], repoman_settings, myportdb=portdb): + print "Unable to generate manifest." + dofail = 1 + continue + checkdirlist=os.listdir(checkdir) ebuildlist=[] for y in checkdirlist: @@ -1505,6 +1533,9 @@ for x in scanlist: stats["ebuild.allmasked"]+=1 fails["ebuild.allmasked"].append(x) +if mymode == "manifest": + sys.exit(dofail) + #Pickle and save results for instant reuse in last and lfull if os.access(portage.const.CACHE_PATH, os.W_OK): for myobj, fname in (stats, "repo.stats"), (fails, "repo.fails"): diff --git a/pym/emerge/__init__.py b/pym/emerge/__init__.py index 0109f8488..5cdda0cfe 100644 --- a/pym/emerge/__init__.py +++ b/pym/emerge/__init__.py @@ -2372,6 +2372,7 @@ class depgraph: mygraph = self._parent_child_digraph i = 0 depth = 0 + shown_edges = set() for x in mylist: if "blocks" == x[0]: display_list.append((x, 0, True)) @@ -2386,6 +2387,7 @@ class depgraph: tree_nodes = tree_nodes[:depth] tree_nodes.append(graph_key) display_list.append((x, depth, True)) + shown_edges.add((graph_key, tree_nodes[depth-1])) else: traversed_nodes = set() # prevent endless circles traversed_nodes.add(graph_key) @@ -2398,15 +2400,22 @@ class depgraph: for node in parent_nodes: if node not in traversed_nodes and \ node not in child_nodes: + edge = (current_node, node) + if edge in shown_edges: + continue selected_parent = node break if not selected_parent: # A direct cycle is unavoidable. for node in parent_nodes: if node not in traversed_nodes: + edge = (current_node, node) + if edge in shown_edges: + continue selected_parent = node break if selected_parent: + shown_edges.add((current_node, selected_parent)) traversed_nodes.add(selected_parent) add_parents(selected_parent, False) display_list.append((list(current_node), @@ -3731,20 +3740,22 @@ def display_news_notification(settings): UNREAD_PATH = os.path.join(target_root, NEWS_LIB_PATH, "news") porttree = portdbapi(porttree_root=settings["PORTDIR"], mysettings=settings) newsReaderDisplay = False - - print + for repo in porttree.getRepositories(): unreadItems = checkUpdatedNewsItems(target_root, NEWS_PATH, UNREAD_PATH, repo) if unreadItems: + if not newsReaderDisplay: + newsReaderDisplay = True + print print colorize("WARN", " * IMPORTANT:"), print "%s news items need reading for repository '%s'." % (unreadItems, repo) - newsReaderDisplay = True + if newsReaderDisplay: print colorize("WARN", " *"), print "Use " + colorize("GOOD", "eselect news") + " to read news items." + print - print def post_emerge(settings, mtimedb, retval): """ Misc. things to run at the end of a merge session. diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 9aa9b1909..be9577c48 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -20,9 +20,13 @@ from portage import listdir, dep_expand, config, flatten, key_expand, \ doebuild_environment, doebuild, env_update, dircache, \ abssymlink, movefile, bsd_chflags -import os, sys, stat, cPickle, errno, commands, copy, time +import os, sys, stat, errno, commands, copy, time from itertools import izip +try: + import cPickle +except ImportError: + import pickle as cPickle class PreservedLibsRegistry(object): """ This class handles the tracking of preserved library objects """ diff --git a/pym/portage/news.py b/pym/portage/news.py index 0bb12c5ed..327fe15f4 100644 --- a/pym/portage/news.py +++ b/pym/portage/news.py @@ -66,7 +66,12 @@ class NewsManager(object): path = os.path.join(self.portdb.getRepositoryPath(repoid), self.NEWS_PATH) newsdir_lock = None try: - newsdir_lock = lockdir(self.portdb.getRepositoryPath(repoid)) + repo_path = self.portdb.getRepositoryPath(repoid) + if os.access(os.path.dirname(repo_path), os.W_OK): + # This lock file should really be mapped into /var somewhere + # since the repo_path or it's parent directory may not even be + # writable. + newsdir_lock = lockdir(repo_path) # Skip reading news for repoid if the news dir does not exist. Requested by # NightMorph :) if not os.path.exists(path): diff --git a/pym/portage/update.py b/pym/portage/update.py index 804ee7598..4886998db 100644 --- a/pym/portage/update.py +++ b/pym/portage/update.py @@ -16,7 +16,7 @@ ignored_dbentries = ("CONTENTS", "environment.bz2") def update_dbentry(update_cmd, mycontent): if update_cmd[0] == "move": old_value, new_value = update_cmd[1], update_cmd[2] - if mycontent.count(old_value): + if old_value in mycontent: old_value = re.escape(old_value); mycontent = re.sub(old_value+"(:|$|\\s)", new_value+"\\1", mycontent) def myreplace(matchobj): @@ -28,7 +28,7 @@ def update_dbentry(update_cmd, mycontent): elif update_cmd[0] == "slotmove" and get_operator(update_cmd[1]) is None: pkg, origslot, newslot = update_cmd[1:] old_value = "%s:%s" % (pkg, origslot) - if mycontent.count(old_value): + if old_value in mycontent: old_value = re.escape(old_value) new_value = "%s:%s" % (pkg, newslot) mycontent = re.sub(old_value+"($|\\s)", new_value+"\\1", mycontent) -- 2.26.2