Index: /vendor/prefix-portage/current/DEVELOPING
===================================================================
--- /vendor/prefix-portage/current/DEVELOPING	(revision 3489)
+++ /vendor/prefix-portage/current/DEVELOPING	(revision 3489)
@@ -0,0 +1,67 @@
+Code Guidelines
+---------------
+A few code guidelines to try to stick to, please comment of none of these make
+sense, they are pretty basic and mostly apply to old code.  However for people
+who are looking at current code, they make take up bad habits that exist in the
+current codebase.
+
+Strings
+-------
+Try not to use the functions in the string module, they are deprecated.
+
+string.join(<iterable>," ")
+
+should be replaced with:
+
+" ".join(<iterable>)
+
+and:
+
+string.split(string, delimeter)
+
+should be replaced with:
+
+string.split(delimeter)
+
+Nearly all other methods in string work on string objects and have similar calling
+conventions.
+
+Comparisons
+-----------
+
+if foo == None
+
+should be replaced with:
+
+if foo is not None:
+
+Is not does a reference comparison (address1 = address2 basically) and 
+the == forces a by value compare (with __eq__())
+
+Dict Lookups
+------------
+
+Try not to use has_key, you can use
+
+if foo in dict
+
+instead of if dict.has_key(foo)
+
+Also don't do stuff like:
+
+if foo in dict and dict[foo]:
+
+Generally you can do two things here, if you are messing with defaults..
+
+dict.get(foo, some_default)
+
+will try to retrieve foo from dict, if there is a KeyError, will insert foo
+into dict with the value of some_default.  This method is preferred in cases where
+you are messing with defaults:
+
+try:
+	dict[foo]
+except KeyError:
+	dict[foo] = default_value
+
+The get call is nicer (compact) and faster (try,except are slow).
Index: /vendor/prefix-portage/current/INSTALL
===================================================================
--- /vendor/prefix-portage/current/INSTALL	(revision 3489)
+++ /vendor/prefix-portage/current/INSTALL	(revision 3489)
@@ -0,0 +1,234 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+2006 Free Software Foundation, Inc.
+
+This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package.  The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+   It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+   The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'.  You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.
+
+     Running `configure' might take a while.  While running, it prints
+     some messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+Compilers and Options
+=====================
+
+Some systems require unusual options for compilation or linking that the
+`configure' script does not know about.  Run `./configure --help' for
+details on some of the pertinent environment variables.
+
+   You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here
+is an example:
+
+     ./configure CC=c99 CFLAGS=-g LIBS=-lposix
+
+   *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you can use GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory.  After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
+
+Installation Names
+==================
+
+By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc.  You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+There may be some features `configure' cannot figure out automatically,
+but needs to determine by the type of machine the package will run on.
+Usually, assuming the package is built to be run on the _same_
+architectures, `configure' can figure that out, but if it prints a
+message saying it cannot guess the machine type, give it the
+`--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+     CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+     OS KERNEL-OS
+
+   See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+   If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+If you want to set default values for `configure' scripts to share, you
+can create a site shell script called `config.site' that gives default
+values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+Variables not defined in a site shell script can be set in the
+environment passed to `configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'.  For example:
+
+     ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug.  Until the bug is fixed you can use this workaround:
+
+     CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+`configure' Invocation
+======================
+
+`configure' recognizes the following options to control how it operates.
+
+`--help'
+`-h'
+     Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`--cache-file=FILE'
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     disable caching.
+
+`--config-cache'
+`-C'
+     Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`configure' also accepts some other, not widely useful, options.  Run
+`configure --help' for more details.
+
Index: /vendor/prefix-portage/current/Makefile.am
===================================================================
--- /vendor/prefix-portage/current/Makefile.am	(revision 3489)
+++ /vendor/prefix-portage/current/Makefile.am	(revision 3489)
@@ -0,0 +1,41 @@
+SUBDIRS = src man bin pym cnf
+
+AUTOMAKE_OPTIONS = dist-bzip2 no-dist-gzip
+
+BUILT_SOURCES = subst-install.vars
+
+subst-install: subst-install.vars
+
+#
+# shells vary interpreting backslash within single quote: echo '\\'
+# bourne shell: \
+#         bash: \\
+#
+subst-install.vars: subst-install.vars.in
+	@rm -f $@ \
+	; case `echo '\\'` in \
+	  \\) bss='\\\\\\\\';; \
+	  \\\\) bss='\\\\';; \
+	  *) echo "unknown shell escape behaviour"; exit 1 ;; \
+	  esac \
+	; { echo; sed -e "s,"'\\'"\",\",g" \
+			-e "s,\\\\,$${bss},g" \
+			-e "s,#,\\\\\\#,g" \
+			-e "s,\","'\\'"\",g" \
+		< subst-install.vars.in \
+	  ; echo "$@:" \
+	  ; echo "	@echo 'creating \$$@'" \
+	  ; echo "	@{ \\" \
+	  ; eval `grep '^all_configurevars=' $@.in` \
+	  ; for v in `echo $${all_configurevars}` all_configurevars \
+	  ; do echo "	echo $${v}='\"\$$($${v})\"' ; \\" \
+	  ; done \
+	  ; echo "	} > \$$@" \
+	; } \
+	| ${MAKE} -f - $@
+
+distclean-local:
+	rm -f subst-install.vars
+
+MAINTAINERCLEANFILES = subst-install.vars.in.in \
+	Makefile.in config.guess config.sub configure ltmain.sh aclocal.m4
Index: /vendor/prefix-portage/current/Makefile.in
===================================================================
--- /vendor/prefix-portage/current/Makefile.in	(revision 3489)
+++ /vendor/prefix-portage/current/Makefile.in	(revision 3489)
@@ -0,0 +1,670 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = .
+DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in $(srcdir)/subst-install.in \
+	$(srcdir)/subst-install.vars.in.in \
+	$(top_srcdir)/bin/Makefile.in $(top_srcdir)/cnf/Makefile.in \
+	$(top_srcdir)/configure $(top_srcdir)/pym/Makefile.in \
+	$(top_srcdir)/src/python-missingos/Makefile.in AUTHORS COPYING \
+	ChangeLog INSTALL NEWS config.guess config.sub depcomp \
+	install-sh ltmain.sh missing
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno config.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES = subst-install subst-install.vars.in \
+	src/python-missingos/Makefile bin/Makefile pym/Makefile \
+	cnf/Makefile
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+  { test ! -d $(distdir) \
+    || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+         && rm -fr $(distdir); }; }
+GZIP_ENV = --best
+DIST_ARCHIVES = $(distdir).tar.bz2
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+ARCH = @ARCH@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASENAME = @BASENAME@
+BASH = @BASH@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFAULT_PATH = @DEFAULT_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DIRNAME = @DIRNAME@
+DOMAIN_PREFIX = @DOMAIN_PREFIX@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FIND = @FIND@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MV = @MV@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PORTAGE_BASE = @PORTAGE_BASE@
+PYTHON = @PYTHON@
+RM = @RM@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+WGET = @WGET@
+XARGS = @XARGS@
+XCU_ID = @XCU_ID@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+portagegroup = @portagegroup@
+portageuser = @portageuser@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+rootuid = @rootuid@
+rootuser = @rootuser@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+wheelgid = @wheelgid@
+SUBDIRS = src man bin pym cnf
+AUTOMAKE_OPTIONS = dist-bzip2 no-dist-gzip
+BUILT_SOURCES = subst-install.vars
+MAINTAINERCLEANFILES = subst-install.vars.in.in \
+	Makefile.in config.guess config.sub configure ltmain.sh aclocal.m4
+
+all: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+am--refresh:
+	@:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
+	      cd $(srcdir) && $(AUTOMAKE) --gnu  \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    echo ' $(SHELL) ./config.status'; \
+	    $(SHELL) ./config.status;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	$(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+subst-install: $(top_builddir)/config.status $(srcdir)/subst-install.in
+	cd $(top_builddir) && $(SHELL) ./config.status $@
+subst-install.vars.in: $(top_builddir)/config.status $(srcdir)/subst-install.vars.in.in
+	cd $(top_builddir) && $(SHELL) ./config.status $@
+src/python-missingos/Makefile: $(top_builddir)/config.status $(top_srcdir)/src/python-missingos/Makefile.in
+	cd $(top_builddir) && $(SHELL) ./config.status $@
+bin/Makefile: $(top_builddir)/config.status $(top_srcdir)/bin/Makefile.in
+	cd $(top_builddir) && $(SHELL) ./config.status $@
+pym/Makefile: $(top_builddir)/config.status $(top_srcdir)/pym/Makefile.in
+	cd $(top_builddir) && $(SHELL) ./config.status $@
+cnf/Makefile: $(top_builddir)/config.status $(top_srcdir)/cnf/Makefile.in
+	cd $(top_builddir) && $(SHELL) ./config.status $@
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	$(am__remove_distdir)
+	test -d $(distdir) || mkdir $(distdir)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+	-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+	  ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
+	|| chmod -R a+r $(distdir)
+dist-gzip: distdir
+	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	$(am__remove_distdir)
+dist-bzip2: distdir
+	tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+	$(am__remove_distdir)
+
+dist-tarZ: distdir
+	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+	$(am__remove_distdir)
+
+dist-shar: distdir
+	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+	$(am__remove_distdir)
+
+dist-zip: distdir
+	-rm -f $(distdir).zip
+	zip -rq $(distdir).zip $(distdir)
+	$(am__remove_distdir)
+
+dist dist-all: distdir
+	tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+	$(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration.  Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+	case '$(DIST_ARCHIVES)' in \
+	*.tar.gz*) \
+	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+	*.tar.bz2*) \
+	  bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+	*.tar.Z*) \
+	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+	*.shar.gz*) \
+	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+	*.zip*) \
+	  unzip $(distdir).zip ;;\
+	esac
+	chmod -R a-w $(distdir); chmod a+w $(distdir)
+	mkdir $(distdir)/_build
+	mkdir $(distdir)/_inst
+	chmod a-w $(distdir)
+	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+	  && cd $(distdir)/_build \
+	  && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+	    $(DISTCHECK_CONFIGURE_FLAGS) \
+	  && $(MAKE) $(AM_MAKEFLAGS) \
+	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
+	  && $(MAKE) $(AM_MAKEFLAGS) check \
+	  && $(MAKE) $(AM_MAKEFLAGS) install \
+	  && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+	  && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+	  && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+	        distuninstallcheck \
+	  && chmod -R a-w "$$dc_install_base" \
+	  && ({ \
+	       (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+	            distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+	      } || { rm -rf "$$dc_destdir"; exit 1; }) \
+	  && rm -rf "$$dc_destdir" \
+	  && $(MAKE) $(AM_MAKEFLAGS) dist \
+	  && rm -rf $(DIST_ARCHIVES) \
+	  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+	$(am__remove_distdir)
+	@(echo "$(distdir) archives ready for distribution: "; \
+	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+	  sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
+distuninstallcheck:
+	@cd $(distuninstallcheck_dir) \
+	&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+	   || { echo "ERROR: files left after uninstall:" ; \
+	        if test -n "$(DESTDIR)"; then \
+	          echo "  (check DESTDIR support)"; \
+	        fi ; \
+	        $(distuninstallcheck_listfiles) ; \
+	        exit 1; } >&2
+distcleancheck: distclean
+	@if test '$(srcdir)' = . ; then \
+	  echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+	  exit 1 ; \
+	fi
+	@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+	  || { echo "ERROR: files left in build directory after distclean:" ; \
+	       $(distcleancheck_listfiles) ; \
+	       exit 1; } >&2
+check-am: all-am
+check: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+	-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+	-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-recursive
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-local \
+	distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
+	-rm -rf $(top_srcdir)/autom4te.cache
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+	install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am am--refresh check check-am clean clean-generic \
+	ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
+	dist-shar dist-tarZ dist-zip distcheck distclean \
+	distclean-generic distclean-local distclean-tags \
+	distcleancheck distdir distuninstallcheck dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
+	pdf-am ps ps-am tags tags-recursive uninstall uninstall-am
+
+
+subst-install: subst-install.vars
+
+#
+# shells vary interpreting backslash within single quote: echo '\\'
+# bourne shell: \
+#         bash: \\
+#
+subst-install.vars: subst-install.vars.in
+	@rm -f $@ \
+	; case `echo '\\'` in \
+	  \\) bss='\\\\\\\\';; \
+	  \\\\) bss='\\\\';; \
+	  *) echo "unknown shell escape behaviour"; exit 1 ;; \
+	  esac \
+	; { echo; sed -e "s,"'\\'"\",\",g" \
+			-e "s,\\\\,$${bss},g" \
+			-e "s,#,\\\\\\#,g" \
+			-e "s,\","'\\'"\",g" \
+		< subst-install.vars.in \
+	  ; echo "$@:" \
+	  ; echo "	@echo 'creating \$$@'" \
+	  ; echo "	@{ \\" \
+	  ; eval `grep '^all_configurevars=' $@.in` \
+	  ; for v in `echo $${all_configurevars}` all_configurevars \
+	  ; do echo "	echo $${v}='\"\$$($${v})\"' ; \\" \
+	  ; done \
+	  ; echo "	} > \$$@" \
+	; } \
+	| ${MAKE} -f - $@
+
+distclean-local:
+	rm -f subst-install.vars
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
Index: /vendor/prefix-portage/current/RELEASE-NOTES
===================================================================
--- /vendor/prefix-portage/current/RELEASE-NOTES	(revision 3489)
+++ /vendor/prefix-portage/current/RELEASE-NOTES	(revision 3489)
@@ -0,0 +1,64 @@
+Release Notes; upgrade information mainly.
+Features/major bugfixes are listed in NEWS
+
+portage-2.2
+==================================
+
+* The python namespace for portage has been sanitized, all portage related code
+  is now contained within the portage namespace. External script should be updated
+  accordingly, though links exist for backward compability.
+* The "save_summary" and "echo" elog modules are now enabled by default. Setting
+  PORTAGE_ELOG_SYSTEM in make.conf will override this, so if you don't want elog
+  set PORTAGE_ELOG_SYSTEM="" in make.conf
+* -* support in package.keywords was changed as it was inconsistent with 
+  ACCEPT_KEYWORDS behavior (also see http://dev.gentoo.org/~genone/docs/KEYWORDS.stupid).
+  Previously having -* in package.keywords matched packages with KEYWORDS="-*", 
+  now it resets the ACCEPT_KEYWORDS list for the given atom like it does when
+  used in ACCEPT_KEYWORDS.
+  For packages that don't specify any other KEYWORDS you can use the new ** token
+  as documented in portage(5) to disable KEYWORDS filtering completely.
+
+portage-2.1.2
+==================================
+
+* Depending on the number of packages installed, users may notice a difference
+  in the time taken for dependency calculations.  This performance penalty is
+  due to the addition of important new features which include the ability to
+  detect reverse blockers, the building of a complete dependency graph, and the
+  ability to use installed packages to satisify dependencies even after their
+  ebuilds have been removed from the portage tree.
+* emerge does not necessarily update build time dependencies that are not
+  strictly required.  See the --with-bdeps option in the emerge(1) man page.
+
+portage-2.1.1
+==================================
+
+* emerge --search doesn't use regular expressions now anymore by default, so
+  emerge --search dvd+rw-tools now works as expected. Regular expressions can be enabled
+  by prefixing the search string with %. 
+* emerge --depclean algorithm is much safer than the old one.
+* emerge --newuse detects changes in IUSE that previously went undetected.
+
+portage-2.1
+==================================
+
+* new cache framework, breaking all old cache modules.
+  If you're having problems with portage_db_cdb, this is likely the cause.
+* USE flag output ordering has changed.  The old ordering is now an option
+  by the name of --alphabetical.  Adding the option to EMERGE_DEFAULT_OPTS
+  in make.conf will restore the old behaviour permanently.
+* The deprecated --inject has been removed, use /etc/portage/profile/package.provided
+* The deprecated --upgradeonly has been removed, use /etc/portage/package.* 
+  instead.
+* 'emerge sync' has been deprecated, use 'emerge --sync' instead (same 
+  for other actions)
+* Tools that call emerge should override the EMERGE_DEFAULT_OPTS environment
+  variable or use the emerge --ignore-default-opts option.
+* rsync option handling has been redesigned, instead of RSYNC_* variables
+  use PORTAGE_RSYNC_EXTRA_OPTS from now on.
+* autouse (use.defaults) has been deprecated by specifying USE_ORDER in make.defaults
+  Users may still turn this back on by specifying USE_ORDER="env:pkg:conf:auto:defaults"
+  in make.conf.  Interested in figuring out what use flags were turned off?  Check out
+  /usr/portage/profiles/base/use.defaults and other use.defaults files that correspond 
+  to your profile.
+
Index: /vendor/prefix-portage/current/TEST-NOTES
===================================================================
--- /vendor/prefix-portage/current/TEST-NOTES	(revision 3489)
+++ /vendor/prefix-portage/current/TEST-NOTES	(revision 3489)
@@ -0,0 +1,45 @@
+UnitTests
+---------
+
+Portage has some tests that use the unittest framework that ships with python (2.3-2.4ish)
+Tests have a specific naming convention.
+
+in pym/portage/tests/ there is a runTest script that invokes pym/portage/tests/__init__.py
+
+This init looks at a hardcoded list of test dirs to search for tests.
+If you add a new dir and don't see your new tests, make sure that the dir is in this list.
+
+On the subject of adding more directories; the layout is basically 1 directory per portage
+file at this point (we have few files, and even fewer large files).  Inside of the dir
+you should have files of the form test_${function}.py.
+
+So if I was to write a vercmp test, and vercmp is in portage_versions.
+
+pym/portage/tests/portage_versions/test_vercmp.py
+
+would be the filename.
+
+The __init__.py file now does recursive tests, but you need to tell it so.  For example, if
+you had cache tests the dir format would be something like...
+
+pym/portage/tests/cache/flat_hash/test_foo.py
+
+and you would put "cache/flat_hash" into the testDirs variable in __init__.py.
+
+
+Skipping
+--------
+
+Please use the portage.tests.* classes as they support throwing a SkipException for
+tests that are known to fail.  Normally one uses testing to do Test Driven Development
+(TDD); however we do not do that here.  Therefore there are times when legitimate tests
+exist but fail due to code in trunk.  We would still like the suite to pass in some instances
+because the suite is built around two things, testing functionality in the current code as
+well as poking holes in the current code (isvalidatom is an example).  So sometimes we desire
+a test to point out that "this needs fixing" but it doesn't affect portage's overall
+functionality.  You should raise portage.tests.SkipException in that case.
+
+emerge
+------
+
+The emerge namespace currently has 0 tests (and no runner)
Index: /vendor/prefix-portage/current/acinclude.m4
===================================================================
--- /vendor/prefix-portage/current/acinclude.m4	(revision 3489)
+++ /vendor/prefix-portage/current/acinclude.m4	(revision 3489)
@@ -0,0 +1,85 @@
+dnl acinclude.m4 generated automatically by ac-archive's acinclude 0.5.63
+
+dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+dnl PARTICULAR PURPOSE.
+
+dnl ______  ______
+
+dnl GENTOO_PATH_PYTHON([minimum-version], [path])
+dnl author: Fabian Groffen <grobian a gentoo.org>
+AC_DEFUN([GENTOO_PATH_PYTHON],
+[
+  AC_PATH_PROG([PYTHON], [python], no, $2)
+
+  dnl is is there at all?
+  if test "$PYTHON" = "no" ; then
+    AC_MSG_ERROR([no python found in your path])
+  fi
+
+  dnl is it the version we want?
+  ver=`$PYTHON -c 'import sys; print sys.version.split(" ")[[0]]'`
+  AC_MSG_CHECKING([whether $PYTHON $ver >= $1])
+  cmp=`$PYTHON -c 'import sys; print sys.version.split(" ")[[0]] >= "$1"'`
+  if test "$cmp" = "True" ; then
+    AC_MSG_RESULT([yes])
+  else
+    AC_MSG_ERROR([need at least version $1 of python])
+  fi
+])
+
+dnl GENTOO_PATH_XCU_ID([path])
+dnl author: Fabian Groffen <grobian a gentoo.org>
+dnl         based on the original work by
+dnl         Michael Haubenwallner <mhaubi at users dot sourceforge dot net>
+AC_DEFUN([GENTOO_PATH_XCU_ID],
+[
+  AC_PATH_PROG([XCU_ID], [id], no, $1)
+
+  dnl is is there at all?
+  if test "$PYTHON" = "no" ; then
+    AC_MSG_ERROR([no python found in your path])
+  fi
+
+  dnl does it support all the bells and whistles we need?
+  AC_MSG_CHECKING([whether $XCU_ID is good enough])
+  for a in '' '-G' '-Gn' '-g' '-gn' '-gr' '-gnr' '-u' '-un' '-ur' '-unr' ; do
+    "$XCU_ID" $a >/dev/null 2>&1 || { XCU_ID=no ; break ; }
+  done
+  if test "$XCU_ID" != "no" ; then
+    AC_MSG_RESULT([yes])
+  else
+    AC_MSG_ERROR([$XCU_ID doesn't understand $a])
+  fi
+])dnl
+
+dnl GENTOO_PATH_GNUPROG([variable], [prog-to-check-for], [path])
+dnl author: Fabian Groffen <grobian a gentoo.org>
+AC_DEFUN([GENTOO_PATH_GNUPROG],
+[
+  AC_PATH_PROG([$1], [$2], no, $3)
+
+  dnl is is there at all?
+  tool="`eval echo \$$1`"
+  if test "$tool" = "no" ; then
+    AC_MSG_ERROR([$1 was not found in your path])
+  fi
+
+  dnl is it a GNU version?
+  AC_MSG_CHECKING([whether $tool is GNU $2])
+  ver=`$tool --version 2>/dev/null | head -n 1`
+  case $ver in
+    *GNU*)
+      AC_MSG_RESULT([yes])
+    ;;
+    *)
+      AC_MSG_ERROR([no])
+    ;;
+  esac
+])
Index: /vendor/prefix-portage/current/aclocal.m4
===================================================================
--- /vendor/prefix-portage/current/aclocal.m4	(revision 3489)
+++ /vendor/prefix-portage/current/aclocal.m4	(revision 3489)
@@ -0,0 +1,863 @@
+# generated automatically by aclocal 1.10 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006  Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+m4_if(m4_PACKAGE_VERSION, [2.61],,
+[m4_fatal([this file was generated for autoconf 2.61.
+You have another version of autoconf.  If you want to use that,
+you should regenerate the build system entirely.], [63])])
+
+# Copyright (C) 2002, 2003, 2005, 2006  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+# (This private macro should not be called outside this file.)
+AC_DEFUN([AM_AUTOMAKE_VERSION],
+[am__api_version='1.10'
+dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+dnl require some minimum version.  Point them to the right macro.
+m4_if([$1], [1.10], [],
+      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+])
+
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too.  Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+[AM_AUTOMAKE_VERSION([1.10])dnl
+_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)])
+
+# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory.  The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run.  This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+#    fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+#    fails if $ac_aux_dir is absolute,
+#    fails when called from a subdirectory in a VPATH build with
+#          a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir.  In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
+#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+#   MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH.  The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL                                            -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+if $2; then
+  $1_TRUE=
+  $1_FALSE='#'
+else
+  $1_TRUE='#'
+  $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+  AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 9
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery.  Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
+       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
+       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
+       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
+                   [depcc="$$1"   am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+               [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_$1_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_$1_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+])
+
+# Generate code to set up dependency tracking.              -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+#serial 3
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # Grep'ing the whole file is not good either: AIX grep has a line
+  # limit of 2048, but all sed's we know have understand at least 4000.
+  if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then
+    dirpart=`AS_DIRNAME("$mf")`
+  else
+    continue
+  fi
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n 's/^U = //p' < "$mf"`
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`AS_DIRNAME(["$file"])`
+    AS_MKDIR_P([$dirpart/$fdir])
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled.  FIXME.  This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Do all the work for Automake.                             -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 12
+
+# This macro actually does too much.  Some checks are only needed if
+# your package does certain things.  But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out.  PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition.  After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.60])dnl
+dnl Autoconf wants to disallow AM_ names.  We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+  # is not polluted with repeated "-I."
+  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
+  # test to see if srcdir already configured
+  if test -f $srcdir/config.status; then
+    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+  fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
+m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
+  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+	      		     [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+                  [_AM_DEPENDENCIES(CC)],
+                  [define([AC_PROG_CC],
+                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+                  [_AM_DEPENDENCIES(CXX)],
+                  [define([AC_PROG_CXX],
+                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJC],
+                  [_AM_DEPENDENCIES(OBJC)],
+                  [define([AC_PROG_OBJC],
+                          defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated.  The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $1 | $1:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot.  For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Check to see how 'make' treats includes.	            -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+	@echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([missing])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check for `mkdir -p'.
+AC_DEFUN([AM_PROG_MKDIR_P],
+[AC_PREREQ([2.60])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
+dnl while keeping a definition of mkdir_p for backward compatibility.
+dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
+dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
+dnl Makefile.ins that do not define MKDIR_P, so we do our own
+dnl adjustment using top_builddir (which is defined more often than
+dnl MKDIR_P).
+AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
+case $mkdir_p in
+  [[\\/$]]* | ?:[[\\/]]*) ;;
+  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+])
+
+# Helper functions for option handling.                     -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME.  Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$[*]" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$[*]" != "X $srcdir/configure conftest.file" \
+      && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+alias in your environment])
+   fi
+
+   test "$[2]" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries.  This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+  AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Copyright (C) 2006  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# Check how to create a tarball.                            -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+#     tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+#     $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+     [m4_case([$1], [ustar],, [pax],,
+              [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+  case $_am_tool in
+  gnutar)
+    for _am_tar in tar gnutar gtar;
+    do
+      AM_RUN_LOG([$_am_tar --version]) && break
+    done
+    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+    am__untar="$_am_tar -xf -"
+    ;;
+  plaintar)
+    # Must skip GNU tar: if it does not support --format= it doesn't create
+    # ustar tarball either.
+    (tar --version) >/dev/null 2>&1 && continue
+    am__tar='tar chf - "$$tardir"'
+    am__tar_='tar chf - "$tardir"'
+    am__untar='tar xf -'
+    ;;
+  pax)
+    am__tar='pax -L -x $1 -w "$$tardir"'
+    am__tar_='pax -L -x $1 -w "$tardir"'
+    am__untar='pax -r'
+    ;;
+  cpio)
+    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+    am__untar='cpio -i -H $1 -d'
+    ;;
+  none)
+    am__tar=false
+    am__tar_=false
+    am__untar=false
+    ;;
+  esac
+
+  # If the value was cached, stop now.  We just wanted to have am__tar
+  # and am__untar set.
+  test -n "${am_cv_prog_tar_$1}" && break
+
+  # tar/untar a dummy directory, and stop if the command works
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  echo GrepMe > conftest.dir/file
+  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+  rm -rf conftest.dir
+  if test -s conftest.tar; then
+    AM_RUN_LOG([$am__untar <conftest.tar])
+    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+  fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
+m4_include([acinclude.m4])
Index: /vendor/prefix-portage/current/bin/Makefile.in
===================================================================
--- /vendor/prefix-portage/current/bin/Makefile.in	(revision 3489)
+++ /vendor/prefix-portage/current/bin/Makefile.in	(revision 3489)
@@ -0,0 +1,95 @@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+sysconfdir = @sysconfdir@
+libdir = @libdir@
+
+srcdir=@srcdir@
+top_builddir=@top_builddir@
+
+portageuser = @portageuser@
+portagegroup = @portagegroup@
+
+PORTAGE_BIN = @PORTAGE_BASE@/bin
+LN_S = @LN_S@
+INSTALL = @INSTALL@
+INSTALL_script = @INSTALL_PROGRAM@ -o $(portageuser) -g $(portagegroup) -m 755
+INSTALL_scriptsubst = $(SHELL) ${top_builddir}/subst-install --installcmd='${INSTALL_script}'
+
+user_binprogs = \
+	ebuild \
+	emerge \
+	portageq \
+	quickpkg \
+	repoman \
+	tbz2tool \
+	xpak
+
+user_sbinprogs = \
+	archive-conf \
+	dispatch-conf \
+	ebuild \
+	ebuild.sh \
+	env-update \
+	etc-update \
+	fixpackages \
+	regenworld
+
+list_sourcedir = \
+	  ( cd ${srcdir} && find . -name 'CVS' -prune -o -name '.\#*' -prune -o -name 'Makefile*' -prune \
+	  -o -name '.svn' -prune -o -type f -print )
+
+all:
+
+install:
+	$(INSTALL) -d -m 755 -o $(portageuser) -g $(portagegroup) $(DESTDIR)$(PORTAGE_BIN)
+	$(list_sourcedir) | while read f \
+	; do echo "$(INSTALL_scriptsubst) ${srcdir}/$${f} $(DESTDIR)$(PORTAGE_BIN)/$${f}" \
+	   ; $(INSTALL_scriptsubst) ${srcdir}/$${f} $(DESTDIR)$(PORTAGE_BIN)/$${f} \
+	; done
+	$(INSTALL) -d -m 755 -o $(portageuser) -g $(portagegroup) $(DESTDIR)$(prefix)/bin
+	cd $(DESTDIR)$(prefix)/bin \
+	; for p in $(user_binprogs) \
+	; do test -f $(DESTDIR)$(PORTAGE_BIN)/$${p} \
+		 || { echo "$(DESTDIR)$(PORTAGE_BIN)/$${p} does not exist" ; exit 1 ; } \
+	   ; echo "rm -f $(DESTDIR)$(prefix)/bin/$${p}" \
+	   ; rm -f $(DESTDIR)$(prefix)/bin/$${p} \
+	   ; echo "$(LN_S) ../lib/portage/bin/$${p} $${p}" \
+	   ; $(LN_S) ../lib/portage/bin/$${p} $${p} || exit 1 \
+	; done
+	$(INSTALL) -d -m 755 -o $(portageuser) -g $(portagegroup) $(DESTDIR)$(prefix)/sbin
+	cd $(DESTDIR)$(prefix)/sbin \
+	; for p in $(user_sbinprogs) \
+	; do test -f $(DESTDIR)$(PORTAGE_BIN)/$${p} \
+		 || { echo "$(DESTDIR)$(PORTAGE_BIN)/$${p} does not exist" ; exit 1 ; } \
+	   ; echo "rm -f $(DESTDIR)$(prefix)/sbin/$${p}" \
+	   ; rm -f $(DESTDIR)$(prefix)/sbin/$${p} \
+	   ; echo "$(LN_S) ../lib/portage/bin/$${p} $${p}" \
+	   ; $(LN_S) ../lib/portage/bin/$${p} $${p} || exit 1 \
+	; done
+
+uninstall:
+	$(list_sourcedir) | while read f \
+	; do echo "rm -f $(DESTDIR)$(PORTAGE_BIN)/$${f}" \
+	   ; rm -f $(DESTDIR)$(PORTAGE_BIN)/$${f} \
+	; done
+	for p in $(user_binprogs) \
+	; do echo "rm -f $(DESTDIR)$(prefix)/bin/$${p}" \
+	   ; rm -f $(DESTDIR)$(prefix)/bin/$${p} \
+	; done
+	for p in $(user_sbinprogs) \
+	; do echo "rm -f $(DESTDIR)$(prefix)/sbin/$${p}" \
+	   ; rm -f $(DESTDIR)$(prefix)/sbin/$${p} \
+	; done
+
+distdir:
+	$(list_sourcedir) | while read f \
+	; do echo "$(INSTALL_script) ${srcdir}/$${f} $(distdir)/$${f}" \
+	   ; $(INSTALL_script) ${srcdir}/$${f} $(distdir)/$${f} \
+	; done
+
+all dvi check installcheck:
+clean distclean maintainer-clean:
+
+.PHONY: all install distdir uninstall
+.PHONY: dvi check installcheck
+.PHONY: clean distclean maintainer-clean
Index: /vendor/prefix-portage/current/bin/archive-conf
===================================================================
--- /vendor/prefix-portage/current/bin/archive-conf	(revision 3489)
+++ /vendor/prefix-portage/current/bin/archive-conf	(revision 3489)
@@ -0,0 +1,108 @@
+#!@PYTHON@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/archive-conf,v 1.7 2004/10/04 13:57:36 vapier Exp $
+
+#
+# archive-conf -- save off a config file in the dispatch-conf archive dir
+#
+#  Written by Wayne Davison <gentoo@blorf.net> with code snagged from
+#  Jeremy Wohl's dispatch-conf script and the portage chkcontents script.
+#
+
+import os, sys
+try:
+    import portage
+except ImportError:
+	from os import path as osp
+	sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
+	import portage
+
+import dispatch_conf
+
+FIND_EXTANT_CONTENTS  = "find %s -name CONTENTS"
+
+MANDATORY_OPTS  = [ 'archive-dir' ]
+
+try:
+    import fchksum
+    def perform_checksum(filename): return fchksum.fmd5t(filename)
+except ImportError:
+    import md5
+    def md5_to_hex(md5sum):
+        hexform = ""
+        for ix in xrange(len(md5sum)):
+            hexform = hexform + "%02x" % ord(md5sum[ix])
+        return hexform.lower()
+    
+    def perform_checksum(filename):
+        f = open(filename, 'rb')
+        blocksize=32768
+        data = f.read(blocksize)
+        size = 0L
+        sum = md5.new()
+        while data:
+            sum.update(data)
+            size = size + len(data)
+            data = f.read(blocksize)
+        return (md5_to_hex(sum.digest()),size)
+
+def archive_conf():
+    args = []
+    content_files = []
+    md5_match_hash = {}
+
+    options = portage.dispatch_conf.read_config(MANDATORY_OPTS)
+
+    for conf in sys.argv[1:]:
+        if not os.path.isabs(conf):
+            conf = os.path.abspath(conf)
+        args += [ conf ]
+        md5_match_hash[conf] = ''
+
+    # Find all the CONTENT files in VDB_PATH.
+    content_files += os.popen(FIND_EXTANT_CONTENTS % (portage.root+portage.VDB_PATH)).readlines()
+
+    # Search for the saved md5 checksum of all the specified config files
+    # and see if the current file is unmodified or not.
+    try:
+        todo_cnt = len(args)
+        for file in content_files:
+            file = file.rstrip()
+            try:
+                contents = open(file, "r")
+            except IOError, e:
+                print >> sys.stderr, 'archive-conf: Unable to open %s: %s' % (file, e)
+                sys.exit(1)
+            lines = contents.readlines()
+            for line in lines:
+                items = line.split()
+                if items[0] == 'obj':
+                    for conf in args:
+                        if items[1] == conf:
+                            stored = items[2].lower()
+                            real = perform_checksum(conf)[0].lower()
+                            if stored == real:
+                                md5_match_hash[conf] = conf
+                            todo_cnt -= 1
+                            if todo_cnt == 0:
+                                raise "Break"
+    except "Break":
+        pass
+
+    for conf in args:
+        archive = os.path.join(options['archive-dir'], conf.lstrip('/'))
+        if options['use-rcs'] == 'yes':
+            portage.dispatch_conf.rcs_archive(archive, conf, md5_match_hash[conf], '')
+            if md5_match_hash[conf]:
+                portage.dispatch_conf.rcs_archive_post_process(archive)
+        else:
+            portage.dispatch_conf.file_archive(archive, conf, md5_match_hash[conf], '')
+            if md5_match_hash[conf]:
+                portage.dispatch_conf.file_archive_post_process(archive)
+
+# run
+if len(sys.argv) > 1:
+    archive_conf()
+else:
+    print >> sys.stderr, 'Usage: archive-conf /CONFIG/FILE [/CONFIG/FILE...]'
Index: /vendor/prefix-portage/current/bin/check-implicit-pointer-usage.py
===================================================================
--- /vendor/prefix-portage/current/bin/check-implicit-pointer-usage.py	(revision 3489)
+++ /vendor/prefix-portage/current/bin/check-implicit-pointer-usage.py	(revision 3489)
@@ -0,0 +1,56 @@
+#!@PYTHON@ -O
+
+# Ripped from HP and updated from Debian
+# Update by Gentoo to support unicode output
+
+#
+# Copyright (c) 2004 Hewlett-Packard Development Company, L.P.
+#	David Mosberger <davidm@hpl.hp.com>
+#
+# Scan standard input for GCC warning messages that are likely to
+# source of real 64-bit problems.  In particular, see whether there
+# are any implicitly declared functions whose return values are later
+# interpreted as pointers.  Those are almost guaranteed to cause
+# crashes.
+#
+import re
+import sys
+
+implicit_pattern = re.compile("([^:]*):(\d+): warning: implicit declaration "
+                              + "of function `([^']*)'")
+pointer_pattern = re.compile(
+    "([^:]*):(\d+): warning: "
+    + "("
+    +  "(assignment"
+    +  "|initialization"
+    +  "|return"
+    +  "|passing arg \d+ of `[^']*'"
+    +  "|passing arg \d+ of pointer to function"
+    +  ") makes pointer from integer without a cast"
+    + "|"
+    + "cast to pointer from integer of different size)")
+last_implicit_filename = ""
+last_implicit_linenum = -1
+last_implicit_func = ""
+
+while True:
+    line = sys.stdin.readline()
+    if line == '':
+        break
+    # translate unicode open/close quotes to ascii ones
+    line = line.replace("\xE2\x80\x98", "`").replace("\xE2\x80\x99", "'")
+    m = implicit_pattern.match(line)
+    if m:
+        last_implicit_filename = m.group(1)
+        last_implicit_linenum = int(m.group(2))
+        last_implicit_func = m.group(3)
+    else:
+        m = pointer_pattern.match(line)
+        if m:
+            pointer_filename = m.group(1)
+            pointer_linenum = int(m.group(2))
+            if (last_implicit_filename == pointer_filename
+                and last_implicit_linenum == pointer_linenum):
+                print "Function `%s' implicitly converted to pointer at " \
+                      "%s:%d" % (last_implicit_func, last_implicit_filename,
+                                 last_implicit_linenum)
Index: /vendor/prefix-portage/current/bin/chkcontents
===================================================================
--- /vendor/prefix-portage/current/bin/chkcontents	(revision 3489)
+++ /vendor/prefix-portage/current/bin/chkcontents	(revision 3489)
@@ -0,0 +1,66 @@
+#!@PYTHON@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/chkcontents,v 1.11 2004/10/04 13:56:50 vapier Exp $
+
+# Very simple program to compare the md5sums of a package as listed
+# in VDB_PATH/category/package/CONTENTS with the md5sums of the
+# actual programs on the system (and makes sure that symlinks point to
+# the right files).
+
+import os.path, os, sys
+try:
+	import portage
+except ImportError:
+	from os import path as osp
+	sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
+	import portage
+
+def CONTENTScheck(path):
+	try:
+		contents = open(path, "r")
+	except IOError, e:
+		print "Unable to open %s: %s" % (path, e)
+		sys.exit(1)
+	lines = contents.readlines()
+	for line in lines:
+		items = line.split()
+		# items is a list w/ size depending on the type of item listed in item[0]
+		# if items[0] = 'dir' then items[1] is the path of a directory
+		# if items[0] = 'obj' then items[1] is the path of a file,
+		#                          items[2] is the file's md5sum,
+		#                          items[3] is the file's size
+		# if items[0] = 'sym' then items[1] is the path of a symbolic link,
+		#                          items[2] is '->'
+		#                          items[3] is the file the symlink should point to
+		#                          items[4] is the symlink mtime 
+		if (items[0] == 'obj'):
+			md5stored = items[2].lower()
+			# fchksum.fmdft(file) returns the file's md5sum and the file's size
+			md5real = portage.perform_checksum(items[1])[0].lower()
+			if (md5stored != md5real):
+				if md5real:
+					print "%s has md5sum of %s instead of %s" % (items[1], md5real, md5stored)
+				else:
+					print "%s is missing!" % items[1]
+		elif (items[0] == 'sym'):
+			link = items[1]
+			target = items[3]
+			if (not os.path.islink(link)):
+				print "%s is not a symbolic link" % link
+				continue
+			actualtarget = os.readlink(link)
+			if (os.path.normpath(actualtarget) != os.path.normpath(target)):
+				print "%s points to %s, not %s" % (link, actualtarget, target)
+
+
+if __name__ == '__main__':
+	import sys
+	if (len(sys.argv) != 2 or sys.argv[1] == "--help"):
+		print "This program compares md5sums in the file VDB_PATH/category/package/CONTENTS"
+		print "with the md5sums of the actual files on the filesystem"
+		print "(and makes sure that symlinks point to the right files)."
+		print "\nUsage: chkcontents path/to/CONTENTS"
+		sys.exit(1)
+	CONTENTScheck(sys.argv[1])
+
Index: /vendor/prefix-portage/current/bin/clean_locks
===================================================================
--- /vendor/prefix-portage/current/bin/clean_locks	(revision 3489)
+++ /vendor/prefix-portage/current/bin/clean_locks	(revision 3489)
@@ -0,0 +1,46 @@
+#!@PYTHON@ -O
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: clean_locks 5784 2007-01-25 17:25:47Z genone $
+
+import os,sys,errno
+try:
+	import portage.locks
+except ImportError:
+	from os import path as osp
+	sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
+	import portage.locks
+
+from portage.const import EPREFIX
+
+if not sys.argv[1:] or "--help" in sys.argv or "-h" in sys.argv:
+	import portage
+	print
+	print "You must specify directories with hardlink-locks to clean."
+	print "You may optionally specify --force, which will remove all"
+	print "of the locks, even if we can't establish if they are in use."
+	print "Please attempt cleaning without force first."
+	print
+	print "%s %s/.locks" % (sys.argv[0], portage.settings["DISTDIR"])
+	print "%s --force %s/.locks" % (sys.argv[0], portage.settings["DISTDIR"])
+	print
+	sys.exit(1)
+	
+force = False
+if "--force" in sys.argv[1:]:
+	force=True
+	
+for x in sys.argv[1:]:
+	if x == "--force":
+		continue
+	try:
+		for y in portage.locks.hardlock_cleanup(x, remove_all_locks=force):
+			print y
+		print
+		
+	except OSError, e:
+		if e.errno in (errno.ENOENT, errno.ENOTDIR):
+			print "!!! %s is not a directory or does not exist" % x
+		else:
+			raise
+		sys.exit(e.errno)
Index: /vendor/prefix-portage/current/bin/dispatch-conf
===================================================================
--- /vendor/prefix-portage/current/bin/dispatch-conf	(revision 3489)
+++ /vendor/prefix-portage/current/bin/dispatch-conf	(revision 3489)
@@ -0,0 +1,377 @@
+#!@PYTHON@ -O
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: $
+
+#
+# dispatch-conf -- Integrate modified configs, post-emerge
+#
+#  Jeremy Wohl (http://igmus.org)
+#
+# TODO
+#  dialog menus
+#
+
+if not hasattr(__builtins__, "set"):
+	from sets import Set as set
+
+from stat import *
+from random import *
+import atexit, commands, os, re, shutil, stat, sys
+try:
+	import portage
+except ImportError:
+	from os import path as osp
+	sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
+	import portage
+
+from portage import dispatch_conf, const
+from portage.process import find_binary
+
+FIND_EXTANT_CONFIGS  = "find '%s' %s -iname '._cfg????_%s' ! -iname '.*~' ! -iname '.*.bak'"
+DIFF_CONTENTS        = 'diff -Nu %s %s'
+DIFF_CVS_INTERP      = 'diff -Nu %s %s | grep "^[+-][^+-]" | grep -v "# .Header:.*"'
+DIFF_WSCOMMENTS      = 'diff -Nu %s %s | grep "^[+-][^+-]" | grep -v "^[-+]#" | grep -v "^[-+][:space:]*$"'
+
+# We need a secure scratch dir and python does silly verbose errors on the use of tempnam
+oldmask = os.umask(0077)
+SCRATCH_DIR = None
+while SCRATCH_DIR is None:
+	try:
+		mydir = portage.const.EPREFIX+"/var/tmp/dispatch-conf."
+		for x in range(0,8):
+			if int(random() * 3) == 0:
+				mydir += chr(int(65+random()*26.0))
+			elif int(random() * 2) == 0:
+				mydir += chr(int(97+random()*26.0))
+			else:
+				mydir += chr(int(48+random()*10.0))
+		if os.path.exists(mydir):
+			continue
+		os.mkdir(mydir)
+		SCRATCH_DIR = mydir
+	except OSError, e:
+		if e.errno != 17:
+			raise
+os.umask(oldmask)
+
+# Ensure the scratch dir is deleted
+def cleanup(mydir=SCRATCH_DIR):
+	shutil.rmtree(mydir)
+atexit.register(cleanup)
+
+MANDATORY_OPTS  = [ 'archive-dir', 'diff', 'replace-cvs', 'replace-wscomments', 'merge' ]
+
+class dispatch:
+	options = {}
+
+	def grind (self, config_paths):
+		confs = []
+		count = 0
+
+
+		self.options = portage.dispatch_conf.read_config(MANDATORY_OPTS)
+
+		if self.options.has_key("log-file"):
+			if os.path.isfile(self.options["log-file"]):
+				shutil.copy(self.options["log-file"], self.options["log-file"] + '.old')
+			if os.path.isfile(self.options["log-file"]) \
+					or not os.path.exists(self.options["log-file"]):
+				open(self.options["log-file"], 'w').close() # Truncate it
+				os.chmod(self.options["log-file"], 0600)
+		else:
+			self.options["log-file"] = "/dev/null"
+
+		#
+		# Build list of extant configs
+		#
+
+		for path in config_paths.split ():
+			path = portage.normalize_path(portage.const.EPREFIX + path)
+			try:
+				mymode = os.stat(path).st_mode
+			except OSError:
+				continue
+			basename = "*"
+			find_opts = ""
+			if not stat.S_ISDIR(mymode):
+				path, basename = os.path.split(path)
+				find_opts = "-maxdepth 1"
+
+			confs += self.massage(os.popen(FIND_EXTANT_CONFIGS % (path, find_opts, basename)).readlines())
+
+		if self.options['use-rcs'] == 'yes' and ((os.system( "which rcs >/dev/null 2>&1" ) == 256)
+												 or (os.system( "which ci >/dev/null 2>&1" ) == 256)
+												 or (os.system( "which co >/dev/null 2>&1" ) == 256) 
+												 or (os.system( "which rcsmerge >/dev/null 2>&1" ) == 256)):
+			print >> sys.stderr, 'dispatch-conf: Error finding all RCS utils and use-rcs=yes in config; fatal'
+			return False
+
+
+		# config file freezing support
+		frozen_files = set(self.options.get("frozen-files", "").split())
+		auto_zapped = []
+
+		#
+		# Remove new configs identical to current
+		#				  and
+		# Auto-replace configs a) whose differences are simply CVS interpolations,
+		#				  or  b) whose differences are simply ws or comments,
+		#				  or  c) in paths now unprotected by CONFIG_PROTECT_MASK,
+		#
+
+		def f (conf):
+			mrgconf = re.sub(r'\._cfg', '._mrg', conf['new'])
+			archive = os.path.join(self.options['archive-dir'], conf['current'].lstrip('/'))
+			if self.options['use-rcs'] == 'yes':
+				mrgfail = portage.dispatch_conf.rcs_archive(archive, conf['current'], conf['new'], mrgconf)
+			else:
+				mrgfail = portage.dispatch_conf.file_archive(archive, conf['current'], conf['new'], mrgconf)
+			if os.path.exists(archive + '.dist'):
+				unmodified = len(commands.getoutput(DIFF_CONTENTS % (conf['current'], archive + '.dist'))) == 0
+			else:
+				unmodified = 0
+			if os.path.exists(mrgconf):
+				if mrgfail or len(commands.getoutput(DIFF_CONTENTS % (conf['new'], mrgconf))) == 0:
+					os.unlink(mrgconf)
+					newconf = conf['new']
+				else:
+					newconf = mrgconf
+			else:
+				newconf = conf['new']
+
+			if newconf == mrgconf and \
+				self.options.get('ignore-previously-merged') != 'yes' and \
+				os.path.exists(archive+'.dist') and \
+				len(commands.getoutput(DIFF_CONTENTS % (archive+'.dist', conf['new']))) == 0:
+				# The current update is identical to the archived .dist
+				# version that has previously been merged.
+				os.unlink(mrgconf)
+				newconf = conf['new']
+
+			mystatus, myoutput = commands.getstatusoutput(
+				DIFF_CONTENTS  % (conf ['current'], newconf))
+			same_file = 0 == len(myoutput)
+			if mystatus >> 8 == 2:
+				# Binary files differ
+				same_cvs = False
+				same_wsc = False
+			else:
+				same_cvs = 0 == len(commands.getoutput(
+					DIFF_CVS_INTERP % (conf ['current'], newconf)))
+				same_wsc = 0 == len(commands.getoutput(
+					DIFF_WSCOMMENTS % (conf ['current'], newconf)))
+
+			# Do options permit?
+			same_cvs = same_cvs and self.options['replace-cvs'] == 'yes'
+			same_wsc = same_wsc and self.options['replace-wscomments'] == 'yes'
+			unmodified = unmodified and self.options['replace-unmodified'] == 'yes'
+
+			if same_file:
+				os.unlink (conf ['new'])
+				self.post_process(conf['current'])
+				if os.path.exists(mrgconf):
+					os.unlink(mrgconf)
+				return False
+			elif conf['current'] in frozen_files:
+				"""Frozen files are automatically zapped. The new config has
+				already been archived with a .new suffix.  When zapped, it is
+				left with the .new suffix (post_process is skipped), since it
+				hasn't been merged into the current config."""
+				auto_zapped.append(conf['current'])
+				os.unlink(conf['new'])
+				try:
+					os.unlink(mrgconf)
+				except OSError:
+					pass
+				return False
+			elif unmodified or same_cvs or same_wsc or conf ['dir'] in portage.settings ['CONFIG_PROTECT_MASK'].split ():
+				self.replace(newconf, conf['current'])
+				self.post_process(conf['current'])
+				if newconf == mrgconf:
+					os.unlink(conf['new'])
+				elif os.path.exists(mrgconf):
+					os.unlink(mrgconf)
+				return False
+			else:
+				return True
+
+		confs = filter (f, confs)
+
+		#
+		# Interactively process remaining
+		#
+
+		for conf in confs:
+			count = count + 1
+
+			newconf = conf['new']
+			mrgconf = re.sub(r'\._cfg', '._mrg', newconf)
+			if os.path.exists(mrgconf):
+				newconf = mrgconf
+			show_new_diff = 0
+
+			while 1:
+				if show_new_diff:
+					os.system((self.options['diff']) % (conf['new'], mrgconf))
+					show_new_diff = 0
+				else:
+					os.system((self.options['diff']) % (conf['current'], newconf))
+
+				print
+				print '>> (%i of %i) -- %s' % (count, len(confs), conf ['current'])
+				print '>> q quit, h help, n next, e edit-new, z zap-new, u use-new\n   m merge, t toggle-merge, l look-merge: ',
+
+				c = getch ()
+
+				if c == 'q':
+					sys.exit (0)
+				if c == 'h':
+					self.do_help ()
+					continue
+				elif c == 't':
+					if newconf == mrgconf:
+						newconf = conf['new']
+					elif os.path.exists(mrgconf):
+						newconf = mrgconf
+					continue
+				elif c == 'n':
+					break
+				elif c == 'm':
+					merged = SCRATCH_DIR+"/"+os.path.basename(conf['current'])
+					print
+					ret = os.system (self.options['merge'] % (merged, conf ['current'], newconf))
+					if ret:
+						print "Failure running 'merge' command"
+						continue
+					shutil.copyfile(merged, mrgconf)
+					os.remove(merged)
+					mystat = os.lstat(conf['new'])
+					os.chmod(mrgconf, mystat[ST_MODE])
+					os.chown(mrgconf, mystat[ST_UID], mystat[ST_GID])
+					newconf = mrgconf
+					continue
+				elif c == 'l':
+					show_new_diff = 1
+					continue
+				elif c == 'e':
+					if not os.environ.has_key('EDITOR'):
+						os.environ['EDITOR']='nano'
+					os.system(os.environ['EDITOR'] + ' ' + newconf)
+					continue
+				elif c == 'z':
+					os.unlink(conf['new'])
+					if os.path.exists(mrgconf):
+						os.unlink(mrgconf)
+					break
+				elif c == 'u':
+					self.replace(newconf, conf ['current'])
+					self.post_process(conf['current'])
+					if newconf == mrgconf:
+						os.unlink(conf['new'])
+					elif os.path.exists(mrgconf):
+						os.unlink(mrgconf)
+					break
+				else:
+					continue
+
+		if auto_zapped:
+			print
+			print " One or more updates are frozen and have been automatically zapped:"
+			print
+			for frozen in auto_zapped:
+				print "  * '%s'" % frozen
+			print
+
+	def replace (self, newconf, curconf):
+		"""Replace current config with the new/merged version.  Also logs
+		the diff of what changed into the configured log file."""
+		os.system((DIFF_CONTENTS % (curconf, newconf)) + '>>' + self.options["log-file"])
+		try:
+			shutil.copyfile(newconf, curconf)
+			os.remove(newconf)
+		except (IOError, os.error), why:
+			print >> sys.stderr, 'dispatch-conf: Error renaming %s to %s: %s; fatal' % \
+				  (newconf, curconf, str(why))
+
+
+	def post_process(self, curconf):
+		archive = os.path.join(self.options['archive-dir'], curconf.lstrip('/'))
+		if self.options['use-rcs'] == 'yes':
+			portage.dispatch_conf.rcs_archive_post_process(archive)
+		else:
+			portage.dispatch_conf.file_archive_post_process(archive)
+
+
+	def massage (self, newconfigs):
+		"""Sort, rstrip, remove old versions, break into triad hash.
+
+		Triad is dictionary of current (/etc/make.conf), new (/etc/._cfg0003_make.conf)
+		and dir (/etc).
+
+		We keep ._cfg0002_conf over ._cfg0001_conf and ._cfg0000_conf.
+		"""
+		h = {}
+
+		newconfigs.sort ()
+
+		for nconf in newconfigs:
+			nconf = nconf.rstrip ()
+			conf  = re.sub (r'\._cfg\d+_', '', nconf)
+			dir   = re.match (r'^(.+)/', nconf).group (1)
+
+			if h.has_key (conf):
+				mrgconf = re.sub(r'\._cfg', '._mrg', h[conf]['new'])
+				if os.path.exists(mrgconf):
+					os.unlink(mrgconf)
+				os.unlink(h[conf]['new'])
+
+			h [conf] = { 'current' : conf, 'dir' : dir, 'new' : nconf }
+
+		configs = h.values ()
+		configs.sort (lambda a, b: cmp(a ['current'], b ['current']))
+
+		return configs
+
+
+	def do_help (self):
+		print; print
+
+		print '  u -- update current config with new config and continue'
+		print '  z -- zap (delete) new config and continue'
+		print '  n -- skip to next config, leave all intact'
+		print '  e -- edit new config'
+		print '  m -- interactively merge current and new configs'
+		print '  l -- look at diff between pre-merged and merged configs'
+		print '  t -- toggle new config between merged and pre-merged state'
+		print '  h -- this screen'
+		print '  q -- quit'
+
+		print; print 'press any key to return to diff...',
+
+		getch ()
+
+
+def getch ():
+	# from ASPN - Danny Yoo
+	#
+	import sys, tty, termios
+
+	fd = sys.stdin.fileno()
+	old_settings = termios.tcgetattr(fd)
+	try:
+		tty.setraw(sys.stdin.fileno())
+		ch = sys.stdin.read(1)
+	finally:
+		termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
+	return ch
+
+
+# run
+d = dispatch ()
+
+if len(sys.argv) > 1:
+	# for testing
+	d.grind (" ".join(sys.argv[1:]))
+else:
+	d.grind (portage.settings ['CONFIG_PROTECT'])
Index: /vendor/prefix-portage/current/bin/dobin
===================================================================
--- /vendor/prefix-portage/current/bin/dobin	(revision 3489)
+++ /vendor/prefix-portage/current/bin/dobin	(revision 3489)
@@ -0,0 +1,29 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: $
+
+source "${PORTAGE_BIN_PATH:-${EPREFIX}/usr/lib/portage/bin}"/isolated-functions.sh
+
+if [[ $# -lt 1 ]] ; then
+	vecho "$0: at least one argument needed" 1>&2
+	exit 1
+fi
+
+if [[ ! -d ${ED}${DESTTREE}/bin ]] ; then
+	install -d "${ED}${DESTTREE}/bin" || exit 2
+fi
+
+ret=0
+
+for x in "$@" ; do
+	if [[ -e ${x} ]] ; then
+		install -m 0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${ED}${DESTTREE}/bin"
+	else
+		vecho "!!! ${0##*/}: ${x} does not exist" 1>&2
+		false
+	fi
+	((ret+=$?))
+done
+
+exit ${ret}
Index: /vendor/prefix-portage/current/bin/doconfd
===================================================================
--- /vendor/prefix-portage/current/bin/doconfd	(revision 3489)
+++ /vendor/prefix-portage/current/bin/doconfd	(revision 3489)
@@ -0,0 +1,14 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/doconfd,v 1.2.2.1 2005/01/13 04:51:56 vapier Exp $
+
+if [[ $# -lt 1 ]] ; then
+	echo "$0: at least one argument needed" 1>&2
+	exit 1
+fi
+
+exec \
+env \
+INSDESTTREE="/etc/conf.d/" \
+doins "$@"
Index: /vendor/prefix-portage/current/bin/dodir
===================================================================
--- /vendor/prefix-portage/current/bin/dodir	(revision 3489)
+++ /vendor/prefix-portage/current/bin/dodir	(revision 3489)
@@ -0,0 +1,6 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+exec install -d ${DIROPTIONS} "${@/#/${ED}/}"
Index: /vendor/prefix-portage/current/bin/dodoc
===================================================================
--- /vendor/prefix-portage/current/bin/dodoc	(revision 3489)
+++ /vendor/prefix-portage/current/bin/dodoc	(revision 3489)
@@ -0,0 +1,27 @@
+#!@BASH@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+if [ $# -lt 1 ] ; then
+	vecho "${0##*/}: at least one argument needed" 1>&2
+	exit 1 	
+fi
+
+dir="${ED}/usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
+if [ ! -d "${dir}" ] ; then
+	install -d "${dir}"
+fi
+
+ret=0
+for x in "$@" ; do
+	if [ -s "${x}" ] ; then
+		install -m0644 "${x}" "${dir}"
+		ecompress --queue "${dir}/${x##*/}"
+	elif [ ! -e "${x}" ] ; then
+		echo "dodoc: ${x} does not exist" 1>&2
+		((++ret))
+	fi
+done
+
+exit ${ret}
Index: /vendor/prefix-portage/current/bin/doenvd
===================================================================
--- /vendor/prefix-portage/current/bin/doenvd	(revision 3489)
+++ /vendor/prefix-portage/current/bin/doenvd	(revision 3489)
@@ -0,0 +1,14 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/doenvd,v 1.2.2.1 2005/01/13 04:51:56 vapier Exp $
+
+if [[ $# -lt 1 ]] ; then
+	echo "$0: at least one argument needed" 1>&2
+	exit 1
+fi
+
+exec \
+env \
+INSDESTTREE="/etc/env.d/" \
+doins "$@"
Index: /vendor/prefix-portage/current/bin/doexe
===================================================================
--- /vendor/prefix-portage/current/bin/doexe	(revision 3489)
+++ /vendor/prefix-portage/current/bin/doexe	(revision 3489)
@@ -0,0 +1,28 @@
+#!@BASH@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: $
+
+source "${PORTAGE_BIN_PATH:-${EPREFIX}/usr/lib/portage/bin}"/isolated-functions.sh
+
+if [[ $# -lt 1 ]] ; then
+	echo "$0: at least one argument needed" 1>&2
+	exit 1
+fi
+
+if [[ ! -d ${ED}${_E_EXEDESTTREE_} ]] ; then
+	install -d "${ED}${_E_EXEDESTTREE_}"
+fi
+
+for x in "$@" ; do
+	if [ -L "${x}" ] ; then
+		cp "${x}" "${T}"
+		mysrc="${T}"/$(basename "${x}")
+	elif [ -d "${x}" ] ; then
+		vecho "doexe: warning, skipping directory ${x}"
+		continue
+	else
+		mysrc="${x}"
+	fi
+	install ${EXEOPTIONS} "${mysrc}" "${ED}${_E_EXEDESTTREE_}"
+done
Index: /vendor/prefix-portage/current/bin/dohard
===================================================================
--- /vendor/prefix-portage/current/bin/dohard	(revision 3489)
+++ /vendor/prefix-portage/current/bin/dohard	(revision 3489)
@@ -0,0 +1,14 @@
+#!@BASH@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: $
+
+if [[ $# -ne 2 ]] ; then
+	echo "$0: two arguments needed" 1>&2
+	exit 1
+fi
+
+destdir=${2%/*}
+[[ ! -d ${ED}${destdir} ]] && dodir "${destdir}"
+
+exec ln -f "${ED}$1" "${ED}$2"
Index: /vendor/prefix-portage/current/bin/dohtml
===================================================================
--- /vendor/prefix-portage/current/bin/dohtml	(revision 3489)
+++ /vendor/prefix-portage/current/bin/dohtml	(revision 3489)
@@ -0,0 +1,172 @@
+#!@PYTHON@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/dohtml,v 1.14.2.1 2004/10/27 14:39:29 jstubbs Exp $
+
+#
+# Typical usage:
+# dohtml -r docs/*
+#  - put all files and directories in docs into /usr/share/doc/${PF}/html
+# dohtml foo.html
+#  - put foo.html into /usr/share/doc/${PF}/html
+#
+#
+# Detailed usage:
+# dohtml <list-of-files> 
+#  - will install the files in the list of files (space-separated list) into 
+#    /usr/share/doc/${PF}/html, provided the file ends in .html, .png, .jpg 
+#     or .css
+# dohtml -r <list-of-files-and-directories>
+#  - will do as 'dohtml', but recurse into all directories, as long as the 
+#    directory name is not CVS
+# dohtml -A jpe,java [-r] <list-of-files[-and-directories]>
+#  - will do as 'dohtml' but add .jpe,.java (default filter list is
+#    added to your list)
+# dohtml -a png,gif,html,htm [-r] <list-of-files[-and-directories]>
+#  - will do as 'dohtml' but filter on .png,.gif,.html,.htm (default filter 
+#    list is ignored)
+# dohtml -x CVS,SCCS,RCS -r <list-of-files-and-directories>
+#  - will do as 'dohtml -r', but ignore directories named CVS, SCCS, RCS
+#
+
+import os
+import sys
+import types
+
+def dodir(path):
+	os.system("install -d '%s'" % path)
+
+def dofile(src,dst):
+
+	os.system("install -m 0644 '%s' '%s'" % (src, dst))
+
+def install(basename, dirname, options, prefix=""):
+
+	fullpath = basename
+	if prefix: fullpath = prefix + "/" + fullpath
+	if dirname: fullpath = dirname + "/" + fullpath
+
+	if options.DOCDESTTREE:
+		destdir = options.ED + "/usr/share/doc/" + options.PF + "/" + options.DOCDESTTREE + "/" + options.doc_prefix + "/" + prefix
+	else:
+		destdir = options.ED + "/usr/share/doc/" + options.PF + "/html/" + options.doc_prefix + "/" + prefix
+
+	if os.path.isfile(fullpath):
+		ext = os.path.splitext(basename)[1]
+		if (len(ext) and ext[1:] in options.allowed_exts) or basename in options.allowed_files:
+			dodir(destdir)
+			dofile(fullpath, destdir + "/" + basename)
+	elif options.recurse and os.path.isdir(fullpath) and \
+	     basename not in options.disallowed_dirs:
+		for i in os.listdir(fullpath):
+			pfx = basename
+			if prefix: pfx = prefix + "/" + pfx
+			install(i, dirname, options, pfx)
+	else:
+		return False
+	return True
+
+
+class OptionsClass:
+	def __init__(self):
+		self.PF = ""
+		self.ED = ""
+		self.DOCDESTTREE = ""
+		
+		if os.environ.has_key("PF"):
+			self.PF = os.environ["PF"]
+		if os.environ.has_key("ED"):
+			self.ED = os.environ["ED"]
+		if os.environ.has_key("_E_DOCDESTTREE_"):
+			self.DOCDESTTREE = os.environ["_E_DOCDESTTREE_"]
+		
+		self.allowed_exts = [ 'png', 'gif', 'html', 'htm', 'jpg', 'css', 'js' ]
+		self.allowed_files = []
+		self.disallowed_dirs = [ 'CVS' ]
+		self.recurse = False
+		self.verbose = False
+		self.doc_prefix = ""
+
+def print_help():
+	opts = OptionsClass()
+
+	print "dohtml [-a .foo,.bar] [-A .foo,.bar] [-f foo,bar] [-x foo,bar]"
+	print "       [-r] [-V] <file> [file ...]"
+	print
+	print " -a   Set the list of allowed to those that are specified."
+	print "      Default:", ",".join(opts.allowed_exts)
+	print " -A   Extend the list of allowed file types."
+	print " -f   Set list of allowed extensionless file names."
+	print " -x   Set directories to be excluded from recursion."
+	print "      Default:", ",".join(opts.disallowed_dirs)
+	print " -r   Install files and directories recursively."
+	print " -V   Be verbose."
+	print
+
+def parse_args():
+	options = OptionsClass()
+	args = []
+	
+	x = 1
+	while x < len(sys.argv):
+		arg = sys.argv[x]
+		if arg in ["-h","-r","-V"]:
+			if arg == "-h":
+				print_help()
+				sys.exit(0)
+			elif arg == "-r":
+				options.recurse = True
+			elif arg == "-V":
+				options.verbose = True
+		elif sys.argv[x] in ["-A","-a","-f","-x","-p"]:
+			x += 1
+			if x == len(sys.argv):
+				print_help()
+				sys.exit(0)
+			elif arg == "-p":
+				options.doc_prefix = sys.argv[x]
+			else:
+				values = sys.argv[x].split(",")
+				if arg == "-A":
+					options.allowed_exts.extend(values)
+				elif arg == "-a":
+					options.allowed_exts = values
+				elif arg == "-f":
+					options.allowed_files = values
+				elif arg == "-x":
+					options.disallowed_dirs = values
+		else:
+			args.append(sys.argv[x])
+		x += 1
+	
+	return (options, args)
+
+def main():
+
+	(options, args) = parse_args()
+
+	if type(options.allowed_exts) == types.StringType:
+		options.allowed_exts = options.allowed_exts.split(",")
+
+	if options.verbose:
+		print "Allowed extensions:", options.allowed_exts
+		print "Document prefix : '" + options.doc_prefix	 + "'"
+		print "Allowed files :", options.allowed_files
+
+	success = True
+	
+	for x in args:
+		basename = os.path.basename(x)
+		dirname  = os.path.dirname(x)
+		if not install(basename, dirname, options):
+			success = False
+	
+	if success:
+		retcode = 0
+	else:
+		retcode = 1
+	
+	sys.exit(retcode)
+
+if __name__ == "__main__":
+	main()
Index: /vendor/prefix-portage/current/bin/doinfo
===================================================================
--- /vendor/prefix-portage/current/bin/doinfo	(revision 3489)
+++ /vendor/prefix-portage/current/bin/doinfo	(revision 3489)
@@ -0,0 +1,15 @@
+#!@BASH@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/doinfo,v 1.7 2004/10/04 13:56:50 vapier Exp $
+
+if [[ -z $1 ]] ; then
+	vecho "${0##*/}: at least one argument needed"
+	exit 1 	
+fi
+
+if [[ ! -d ${ED}usr/share/info ]] ; then
+	install -d "${ED}usr/share/info" || exit 1
+fi
+
+exec install -m0644 "$@" "${ED}usr/share/info"
Index: /vendor/prefix-portage/current/bin/doinitd
===================================================================
--- /vendor/prefix-portage/current/bin/doinitd	(revision 3489)
+++ /vendor/prefix-portage/current/bin/doinitd	(revision 3489)
@@ -0,0 +1,14 @@
+#!@BASH@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/doinitd,v 1.2.2.1 2005/01/13 04:51:56 vapier Exp $
+
+if [[ $# -lt 1 ]] ; then
+	echo "$0: at least one argument needed" 1>&2
+	exit 1
+fi
+
+exec \
+env \
+_E_EXEDESTTREE_="/etc/init.d/" \
+doexe "$@"
Index: /vendor/prefix-portage/current/bin/doins
===================================================================
--- /vendor/prefix-portage/current/bin/doins	(revision 3489)
+++ /vendor/prefix-portage/current/bin/doins	(revision 3489)
@@ -0,0 +1,61 @@
+#!@BASH@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: $
+
+if [ $# -lt 1 ] ; then
+	echo "${0##*/}: at least one argument needed" 1>&2
+	exit 1
+fi
+
+if [[ "$1" == "-r" ]] ; then
+	DOINSRECUR=y
+	shift
+else
+	DOINSRECUR=n
+fi
+[[ -z ${INSDEPTH} ]] && declare -i INSDEPTH=0
+if [[ ${INSDEPTH} -gt 30 ]] ; then
+	echo "${0##*/}: sanity check ... 30 directories is too much :(" 2>&1
+	exit 1
+fi
+
+if [[ ${INSDESTTREE#${D}} != "${INSDESTTREE}" ]]; then
+	vecho "-------------------------------------------------------" 1>&2
+	vecho "You should not use \${D} or \${ED} with helpers." 1>&2
+	vecho "  --> ${INSDESTTREE}" 1>&2
+	vecho "-------------------------------------------------------" 1>&2
+	exit 1
+fi
+
+if [[ ${INSDESTTREE#${EPREFIX}} != "${INSDESTTREE}" ]]; then
+	vecho "-------------------------------------------------------" 1>&2
+	vecho "You should not use \${EPREFIX} with helpers." 1>&2
+	vecho "  --> ${INSDESTTREE}" 1>&2
+	vecho "-------------------------------------------------------" 1>&2
+	exit 1
+fi
+
+[[ ! -d ${ED}${INSDESTTREE} ]] && dodir "${INSDESTTREE}"
+
+for x in "$@" ; do
+	if [ -L "$x" ] ; then
+		cp "$x" "${T}"
+		mysrc="${T}/$(basename "${x}")"
+	elif [ -d "$x" ] ; then
+		if [ "${DOINSRECUR}" == "n" ] ; then
+			continue
+		fi
+
+		mydir="${INSDESTTREE}/$(basename "${x}")"
+		find "${x}" -mindepth 1 -maxdepth 1 -exec \
+			env \
+				INSDESTTREE="${mydir}" \
+				INSDEPTH=$((INSDEPTH+1)) \
+				doins -r {} \;
+		continue
+	else
+		mysrc="${x}"
+	fi
+	install ${INSOPTIONS} "${mysrc}" "${ED}${INSDESTTREE}"
+done
Index: /vendor/prefix-portage/current/bin/dolib
===================================================================
--- /vendor/prefix-portage/current/bin/dolib	(revision 3489)
+++ /vendor/prefix-portage/current/bin/dolib	(revision 3489)
@@ -0,0 +1,41 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/dolib,v 1.8.2.2 2005/01/12 02:07:15 carpaski Exp $
+
+# Setup ABI cruft
+LIBDIR_VAR="LIBDIR_${ABI}"
+if [[ -n ${ABI} && -n ${!LIBDIR_VAR} ]] ; then
+	CONF_LIBDIR=${!LIBDIR_VAR}
+fi
+unset LIBDIR_VAR
+# we need this to default to lib so that things dont break
+CONF_LIBDIR=${CONF_LIBDIR:-lib}
+libdir="${ED}${DESTTREE}/${CONF_LIBDIR}"
+
+
+if [[ $# -lt 1 ]] ; then
+	echo "$0: at least one argument needed" 1>&2
+	exit 1
+fi
+if [[ ! -d ${libdir} ]] ; then
+	install -d "${libdir}" || exit 1
+fi
+
+ret=0
+
+for x in "$@" ; do
+	if [[ -e ${x} ]] ; then
+		if [[ ! -L ${x} ]] ; then
+			install ${LIBOPTIONS} "${x}" "${libdir}"
+		else
+			ln -s "$(readlink "${x}")" "${libdir}/${x##*/}"
+		fi
+	else
+		echo "!!! ${0##*/}: ${x} does not exist" 1>&2
+		false
+	fi
+	((ret+=$?))
+done
+
+exit ${ret}
Index: /vendor/prefix-portage/current/bin/doman
===================================================================
--- /vendor/prefix-portage/current/bin/doman	(revision 3489)
+++ /vendor/prefix-portage/current/bin/doman	(revision 3489)
@@ -0,0 +1,54 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+source "${PORTAGE_BIN_PATH:-${EPREFIX}/usr/lib/portage/bin}"/isolated-functions.sh
+
+if [[ $# -lt 1 ]] ; then
+	echo "$0: at least one argument needed" 1>&2
+	exit 1
+fi
+
+i18n=""
+
+ret=0
+
+for x in "$@" ; do
+	if [[ ${x:0:6} == "-i18n=" ]] ; then
+		i18n=${x:6}/
+		continue
+	fi
+	if [[ ${x:0:6} == ".keep_" ]] ; then
+		continue
+	fi
+
+	suffix=${x##*.}
+
+	# These will be automatically decompressed by ecompressdir.
+	if hasq ${suffix} Z gz bz2 ; then
+		realname=${x%.*}
+		suffix=${realname##*.}
+	fi
+
+	mandir=${i18n}man${suffix:0:1}
+
+	if echo ${mandir} | @EGREP@ -q 'man[0-9n](|f|p|pm)$' -; then
+		if [[ -s ${x} ]] ; then
+			if [[ ! -d ${ED}/usr/share/man/${mandir} ]] ; then
+				install -d "${ED}/usr/share/man/${mandir}"
+			fi
+
+			install -m0644 "${x}" "${ED}/usr/share/man/${mandir}"
+			((ret+=$?))
+		elif [[ ! -e ${x} ]] ; then
+			vecho "doman: ${x} does not exist" 1>&2
+			((++ret))
+		fi
+	else
+		vecho "doman: '${x}' is probably not a man page; skipping" 1>&2
+		((++ret))
+	fi
+done
+
+exit ${ret}
Index: /vendor/prefix-portage/current/bin/domo
===================================================================
--- /vendor/prefix-portage/current/bin/domo	(revision 3489)
+++ /vendor/prefix-portage/current/bin/domo	(revision 3489)
@@ -0,0 +1,26 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/domo,v 1.6 2004/10/04 13:56:50 vapier Exp $
+
+mynum=${#}
+if [ ${mynum} -lt 1 ] ; then
+	echo "${0}: at least one argument needed"
+	exit 1
+fi
+if [ ! -d "${ED}${DESTTREE}/share/locale" ] ; then
+	install -d "${ED}${DESTTREE}/share/locale/"
+fi
+
+for x in "$@" ; do
+	if [ -e "${x}" ] ; then
+		mytiny="${x##*/}"
+		mydir="${ED}${DESTTREE}/share/locale/${mytiny%.*}/LC_MESSAGES"
+		if [ ! -d "${mydir}" ] ; then
+			install -d "${mydir}"
+		fi
+		install -m0644 "${x}" "${mydir}/${MOPREFIX}.mo"
+	else
+		echo "${0}: ${x} does not exist"
+	fi
+done
Index: /vendor/prefix-portage/current/bin/dosbin
===================================================================
--- /vendor/prefix-portage/current/bin/dosbin	(revision 3489)
+++ /vendor/prefix-portage/current/bin/dosbin	(revision 3489)
@@ -0,0 +1,27 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/dosbin,v 1.11 2004/10/04 13:56:50 vapier Exp $
+
+if [[ $# -lt 1 ]] ; then
+	echo "$0: at least one argument needed" 1>&2
+	exit 1
+fi
+
+if [[ ! -d ${ED}${DESTTREE}/sbin ]] ; then
+	install -d "${ED}${DESTTREE}/sbin" || exit 2
+fi
+
+ret=0
+
+for x in "$@" ; do
+	if [[ -e ${x} ]] ; then
+		install -m 0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${ED}${DESTTREE}/sbin"
+	else
+		echo "!!! ${0##*/}: ${x} does not exist" 1>&2
+		false
+	fi
+	((ret+=$?))
+done
+
+exit ${ret}
Index: /vendor/prefix-portage/current/bin/dosed
===================================================================
--- /vendor/prefix-portage/current/bin/dosed	(revision 3489)
+++ /vendor/prefix-portage/current/bin/dosed	(revision 3489)
@@ -0,0 +1,20 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/dosed,v 1.7 2004/10/04 13:56:50 vapier Exp $
+
+mysed="s:${ED}::g"
+
+for x in "$@" ; do
+	y="${ED}${x}"
+	if [ -e "${y}" ] ; then
+		if [ -f "${y}" ] ; then
+			sed -i -e "${mysed}" "${y}"
+		else
+			echo "${y} is not a regular file!"
+			exit 1
+		fi
+	else
+		mysed="${x}"
+	fi
+done
Index: /vendor/prefix-portage/current/bin/dosym
===================================================================
--- /vendor/prefix-portage/current/bin/dosym	(revision 3489)
+++ /vendor/prefix-portage/current/bin/dosym	(revision 3489)
@@ -0,0 +1,15 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/dosym,v 1.7 2004/10/04 13:56:50 vapier Exp $
+
+if [[ $# -ne 2 ]] ; then
+	echo "$0: two arguments needed" 1>&2
+	exit 1
+fi
+
+target="${1}"
+linkname="${2}"
+[[ ${target:0:1} == "/" ]] && target="${EPREFIX}${target}"
+exec ln -snf "${target}" "${ED}/${linkname}"
+
Index: /vendor/prefix-portage/current/bin/ebuild
===================================================================
--- /vendor/prefix-portage/current/bin/ebuild	(revision 3489)
+++ /vendor/prefix-portage/current/bin/ebuild	(revision 3489)
@@ -0,0 +1,157 @@
+#!@PYTHON@ -O
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-src/portage/bin/ebuild,v 1.18.2.3 2005/05/07 04:32:59 ferringb Exp $
+
+import getopt, os, sys
+
+if len(sys.argv) <= 2:
+	print "Usage: ebuild <ebuild file> <command> [command] ..."
+	print ""
+	print "See the ebuild(1) man page for more info"
+	sys.exit(1)
+
+
+try:
+	opts, pargs = getopt.getopt(sys.argv[1:], '', ['debug', 'force'])
+except getopt.GetoptError, e:
+	print e
+	sys.exit(1)
+debug = ("--debug",'') in opts
+force = ("--force",'') in opts
+
+if "merge" in pargs:
+	print "Disabling noauto in features... merge disables it. (qmerge doesn't)"
+	os.environ["FEATURES"] = os.environ.get("FEATURES", "") + " -noauto"
+
+os.environ["PORTAGE_CALLER"]="ebuild"
+try:
+	import portage
+except ImportError:
+	from os import path as osp
+	sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
+	import portage
+
+import portage.util, portage.const
+import portage.dep
+portage.dep._dep_check_strict = True
+
+# do this _after_ 'import portage' to prevent unnecessary tracing
+if debug and "python-trace" in portage.features:
+	import portage.debug
+	portage.debug.set_trace(True)
+
+if portage.settings["NOCOLOR"] in ("yes","true") or not sys.stdout.isatty():
+	portage.output.nocolor()
+
+ebuild = pargs.pop(0)
+if not os.path.isabs(ebuild):
+	mycwd = os.getcwd()
+	# Try to get the non-canonical path from the PWD evironment variable, since
+	# the canonical path returned from os.getcwd() may may be unusable in
+	# cases where the directory stucture is built from symlinks.
+	if "PWD" in os.environ and os.environ["PWD"] != mycwd and \
+		os.path.realpath(os.environ["PWD"]) == mycwd:
+		mycwd = portage.normalize_path(os.environ["PWD"])
+	ebuild = os.path.join(mycwd, ebuild)
+ebuild = portage.normalize_path(ebuild)
+# portdbapi uses the canonical path for the base of the portage tree, but
+# subdirectories of the base can be built from symlinks (like crossdev does).
+ebuild_portdir = os.path.realpath(os.path.dirname(os.path.dirname(ebuild)))
+ebuild = os.path.join(ebuild_portdir, *ebuild.split(os.path.sep)[-2:])
+
+if not os.path.exists(ebuild):
+	print "'%s' does not exist." % ebuild
+	sys.exit(1)
+
+ebuild_split = ebuild.split("/")
+del ebuild_split[-2]
+cpv = "/".join(ebuild_split[-2:])[:-7]
+
+if not portage.catpkgsplit(cpv):
+	print "!!! %s does not follow correct package syntax." % (cpv)
+	sys.exit(1)
+
+if ebuild.startswith(portage.root + portage.const.VDB_PATH):
+	mytree = "vartree"
+
+	portage_ebuild = portage.db[portage.root][mytree].dbapi.findname(cpv)
+
+	if os.path.realpath(portage_ebuild) != ebuild:
+		print "!!! Portage seems to think that %s is at %s" % (cpv, portage_ebuild)
+		sys.exit(1)
+
+else:
+	mytree = "porttree"
+
+	portage_ebuild = portage.portdb.findname(cpv)
+
+	if not portage_ebuild or portage_ebuild != ebuild:
+		overlay = "/".join(ebuild_split[:-2])
+		os.environ["PORTDIR_OVERLAY"] = os.environ.get("PORTDIR_OVERLAY","") + " " + overlay
+		print "Appending %s to PORTDIR_OVERLAY..." % overlay
+		portage.close_portdbapi_caches()
+		reload(portage)
+		portage_ebuild = portage.portdb.findname(cpv)
+
+		if not portage_ebuild or portage_ebuild != ebuild:
+			print "!!! %s does not seem to have a valid PORTDIR structure." % overlay
+			sys.exit(1)
+
+
+if len(pargs) > 1 and "config" in pargs:
+	print "config must be called on it's own, not combined with any other phase"
+	sys.exit(1)
+
+def discard_digests(myebuild, mysettings, mydbapi):
+	"""Discard all distfiles digests for the given ebuild.  This is useful when
+	upstream has changed the identity of the distfiles and the user would
+	otherwise have to manually remove the Manifest and files/digest-* files in
+	order to ensure correct results."""
+	try:
+		portage._doebuild_manifest_exempt_depend += 1
+		pkgdir = os.path.dirname(myebuild)
+		fetchlist_dict = portage.FetchlistDict(pkgdir, mysettings, mydbapi)
+		cat, pkg = pkgdir.split(os.sep)[-2:]
+		cpv = cat + "/" + os.path.basename(myebuild)[:-7]
+		from portage.manifest import Manifest
+		mf = Manifest(pkgdir, mysettings["DISTDIR"],
+			fetchlist_dict=fetchlist_dict)
+		mf.create(requiredDistfiles=None,
+			assumeDistHashesSometimes=True, assumeDistHashesAlways=True)
+		distfiles = fetchlist_dict[cpv]
+		for myfile in distfiles:
+			try:
+				del mf.fhashdict["DIST"][myfile]
+			except KeyError:
+				pass
+		mf.write()
+	finally:
+		portage._doebuild_manifest_exempt_depend -= 1
+
+tmpsettings = portage.config(clone=portage.settings)
+if "test" in pargs and "test" not in tmpsettings.features:
+	print "Forcing test."
+	tmpsettings["EBUILD_FORCE_TEST"] = "1"
+	tmpsettings.backup_changes("EBUILD_FORCE_TEST")
+	tmpsettings.features.append("test")
+	tmpsettings["FEATURES"] = " ".join(tmpsettings.features)
+	tmpsettings.backup_changes("FEATURES")
+
+for arg in pargs:
+	try:
+		if arg == "digest" and force:
+			discard_digests(ebuild, tmpsettings, portage.portdb)
+		a = portage.doebuild(ebuild, arg, portage.root, tmpsettings,
+			debug=debug, tree=mytree)
+	except KeyboardInterrupt:
+		print "Interrupted."
+		a = 1
+	except KeyError:
+		# aux_get error
+		a = 1
+	if a == None:
+		print "Could not run the required binary?"
+		a = 127
+	if a:
+		sys.exit(a)
Index: /vendor/prefix-portage/current/bin/ebuild.sh
===================================================================
--- /vendor/prefix-portage/current/bin/ebuild.sh	(revision 3489)
+++ /vendor/prefix-portage/current/bin/ebuild.sh	(revision 3489)
@@ -0,0 +1,1661 @@
+#!@BASH@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+PORTAGE_BIN_PATH="${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"
+PORTAGE_PYM_PATH="${PORTAGE_PYM_PATH:-@PORTAGE_BASE@/pym}"
+declare -rx PORTAGE_BIN_PATH PORTAGE_PYM_PATH
+
+SANDBOX_PREDICT="${SANDBOX_PREDICT}:/proc/self/maps:/dev/console:/dev/random"
+export SANDBOX_PREDICT="${SANDBOX_PREDICT}:${PORTAGE_PYM_PATH}:${PORTAGE_DEPCACHEDIR}"
+export SANDBOX_WRITE="${SANDBOX_WRITE}:/dev/shm:/dev/stdout:/dev/stderr:${PORTAGE_TMPDIR}"
+export SANDBOX_READ="${SANDBOX_READ}:/dev/shm:/dev/stdin:${PORTAGE_TMPDIR}"
+
+if [ ! -z "${PORTAGE_GPG_DIR}" ]; then
+	SANDBOX_PREDICT="${SANDBOX_PREDICT}:${PORTAGE_GPG_DIR}"
+fi
+
+declare -rx EBUILD_PHASE
+
+if [ "$*" != "depend" ] && [ "$*" != "clean" ] && [ "$*" != "nofetch" ]; then
+	if [ -f "${T}/environment" ]; then
+		source "${T}/environment" >& /dev/null
+	fi
+fi
+
+# These two functions wrap sourcing and calling respectively.  At present they
+# perform a qa check to make sure eclasses and ebuilds and profiles don't mess
+# with shell opts (shopts).  Ebuilds/eclasses changing shopts should reset them 
+# when they are done.  Note:  For now these shoudl always return success.
+
+qa_source() {
+	local shopts=$(shopt) OLDIFS="$IFS"
+	source "$@" || return 1
+	[[ $shopts != $(shopt) ]] &&
+		eqawarn "QA Notice: Global shell options changed and were not restored while sourcing '$*'"
+	[[ "$IFS" != "$OLDIFS" ]] &&
+		eqawarn "QA Notice: Global IFS changed and was not restored while sourcing '$*'"
+	return 0
+}
+
+qa_call() {
+	local shopts=$(shopt) OLDIFS="$IFS"
+	"$@" || return 1
+	[[ $shopts != $(shopt) ]] &&
+		eqawarn "QA Notice: Global shell options changed and were not restored while calling '$*'"
+	[[ "$IFS" != "$OLDIFS" ]] &&
+		eqawarn "QA Notice: Global IFS changed and was not restored while calling '$*'"
+	return 0
+}
+
+# subshell die support
+EBUILD_MASTER_PID=$$
+trap 'exit 1' SIGTERM
+
+EBUILD_SH_ARGS="$*"
+
+shift $#
+
+# Prevent aliases from causing portage to act inappropriately.
+# Make sure it's before everything so we don't mess aliases that follow.
+unalias -a
+
+# Unset some variables that break things.
+unset GZIP BZIP BZIP2 CDPATH GREP_OPTIONS GREP_COLOR GLOBIGNORE
+
+export PATH="${DEFAULT_PATH}:${PORTAGE_BIN_PATH}:${ROOTPATH}"
+[ ! -z "$PREROOTPATH" ] && export PATH="${PREROOTPATH%%:}:$PATH"
+
+source "@PORTAGE_BASE@"/bin/isolated-functions.sh &>/dev/null
+
+OCC="$CC"
+OCXX="$CXX"
+
+[[ $PORTAGE_QUIET != "" ]] && export PORTAGE_QUIET
+
+# the sandbox is disabled by default except when overridden in the relevant stages
+export SANDBOX_ON="0"
+
+# sandbox support functions; defined prior to profile.bashrc srcing, since the profile might need to add a default exception (/usr/lib64/conftest fex)
+addread() {
+	[[ -z $1 || -n $2 ]] && die "Usage: addread <colon-delimited list of paths>"
+	export SANDBOX_READ="$SANDBOX_READ:$1"
+}
+
+addwrite() {
+	[[ -z $1 || -n $2 ]] && die "Usage: addwrite <colon-delimited list of paths>"
+	export SANDBOX_WRITE="$SANDBOX_WRITE:$1"
+}
+
+adddeny() {
+	[[ -z $1 || -n $2 ]] && die "Usage: adddeny <colon-delimited list of paths>"
+	export SANDBOX_DENY="$SANDBOX_DENY:$1"
+}
+
+addpredict() {
+	[[ -z $1 || -n $2 ]] && die "Usage: addpredict <colon-delimited list of paths>"
+	export SANDBOX_PREDICT="$SANDBOX_PREDICT:$1"
+}
+
+lchown() {
+	chown -h "$@"
+}
+
+lchgrp() {
+	chgrp -h "$@"
+}
+
+# source the existing profile.bashrc's.
+save_IFS
+IFS=$'\n'
+for dir in ${PROFILE_PATHS}; do
+	# Must unset it so that it doesn't mess up assumptions in the RCs.
+	unset IFS
+	if [ -f "${dir}/profile.bashrc" ]; then
+		qa_source "${dir}/profile.bashrc"
+	fi
+done
+restore_IFS
+
+# We assume if people are changing shopts in their bashrc they do so at their
+# own peril.  This is the ONLY non-portage bit of code that can change shopts
+# without a QA violation.
+if [ -f "${PORTAGE_BASHRC}" ]; then
+	# If $- contains x, then tracing has already enabled elsewhere for some
+	# reason.  We preserve it's state so as not to interfere.
+	if [ "$PORTAGE_DEBUG" != "1" ] || [ "${-/x/}" != "$-" ]; then
+		source "${PORTAGE_BASHRC}"
+	else
+		set -x
+		source "${PORTAGE_BASHRC}"
+		set +x
+	fi
+fi
+
+[ ! -z "$OCC" ] && export CC="$OCC"
+[ ! -z "$OCXX" ] && export CXX="$OCXX"
+
+esyslog() {
+	# Custom version of esyslog() to take care of the "Red Star" bug.
+	# MUST follow functions.sh to override the "" parameter problem.
+	return 0
+}
+
+use() {
+	useq ${1}
+}
+
+usev() {
+	if useq ${1}; then
+		echo "${1}"
+		return 0
+	fi
+	return 1
+}
+
+useq() {
+	local u=$1
+	local found=0
+
+	# if we got something like '!flag', then invert the return value
+	if [[ ${u:0:1} == "!" ]] ; then
+		u=${u:1}
+		found=1
+	fi
+
+	# Make sure we have this USE flag in IUSE
+	if ! hasq "${u}" ${IUSE} ${E_IUSE} && ! hasq "${u}" ${PORTAGE_ARCHLIST} selinux; then
+		eqawarn "QA Notice: USE Flag '${u}' not in IUSE for ${CATEGORY}/${PF}"
+	fi
+
+	if hasq ${u} ${USE} ; then
+		return ${found}
+	else
+		return $((!found))
+	fi
+}
+
+has_version() {
+	if [ "${EBUILD_PHASE}" == "depend" ]; then
+		die "portageq calls (has_version calls portageq) are not allowed in the global scope"
+	fi
+	# return shell-true/shell-false if exists.
+	# Takes single depend-type atoms.
+	if "@PORTAGE_BASE@"/bin/portageq 'has_version' "${ROOT}" "$1"; then
+		return 0
+	else
+		return 1
+	fi
+}
+
+portageq() {
+	if [ "${EBUILD_PHASE}" == "depend" ]; then
+		die "portageq calls are not allowed in the global scope"
+	fi
+	"@PORTAGE_BASE@"/bin/portageq "$@"
+}
+
+
+# ----------------------------------------------------------------------------
+# ----------------------------------------------------------------------------
+# ----------------------------------------------------------------------------
+
+
+best_version() {
+	if [ "${EBUILD_PHASE}" == "depend" ]; then
+		die "portageq calls (best_version calls portageq) are not allowed in the global scope"
+	fi
+	# returns the best/most-current match.
+	# Takes single depend-type atoms.
+	"@PORTAGE_BASE@"/bin/portageq 'best_version' "${ROOT}" "$1"
+}
+
+use_with() {
+	if [ -z "$1" ]; then
+		echo "!!! use_with() called without a parameter." >&2
+		echo "!!! use_with <USEFLAG> [<flagname> [value]]" >&2
+		return 1
+	fi
+
+	local UW_SUFFIX=""
+	if [ ! -z "${3}" ]; then
+		UW_SUFFIX="=${3}"
+	fi
+
+	local UWORD="$2"
+	if [ -z "${UWORD}" ]; then
+		UWORD="$1"
+	fi
+
+	if useq $1; then
+		echo "--with-${UWORD}${UW_SUFFIX}"
+	else
+		echo "--without-${UWORD}"
+	fi
+	return 0
+}
+
+use_enable() {
+	if [ -z "$1" ]; then
+		echo "!!! use_enable() called without a parameter." >&2
+		echo "!!! use_enable <USEFLAG> [<flagname> [value]]" >&2
+		return 1
+	fi
+
+	local UE_SUFFIX=""
+	if [ ! -z "${3}" ]; then
+		UE_SUFFIX="=${3}"
+	fi
+
+	local UWORD="$2"
+	if [ -z "${UWORD}" ]; then
+		UWORD="$1"
+	fi
+
+	if useq $1; then
+		echo "--enable-${UWORD}${UE_SUFFIX}"
+	else
+		echo "--disable-${UWORD}"
+	fi
+	return 0
+}
+
+register_die_hook() {
+	export EBUILD_DEATH_HOOKS="${EBUILD_DEATH_HOOKS} $*"
+}
+
+#if no perms are specified, dirs/files will have decent defaults
+#(not secretive, but not stupid)
+umask 022
+export DESTTREE=/usr
+export INSDESTTREE=""
+export _E_EXEDESTTREE_=""
+export _E_DOCDESTTREE_=""
+export INSOPTIONS="-m0644"
+export EXEOPTIONS="-m0755"
+export LIBOPTIONS="-m0644"
+export DIROPTIONS="-m0755"
+export MOPREFIX=${PN}
+
+check_KV() {
+	if [ -z "${KV}" ]; then
+		eerror ""
+		eerror "Could not determine your kernel version."
+		eerror "Make sure that you have a /usr/src/linux symlink,"
+		eerror "and that the indicated kernel has been configured."
+		eerror "You can also simply run the following command"
+		eerror "in the directory referenced by /usr/src/linux:"
+		eerror " make include/linux/version.h"
+		eerror ""
+		die
+	fi
+}
+
+# adds ".keep" files so that dirs aren't auto-cleaned
+keepdir() {
+	dodir "$@"
+	local x
+	if [ "$1" == "-R" ] || [ "$1" == "-r" ]; then
+		shift
+		find "$@" -type d -printf "${ED}/%p/.keep_${CATEGORY}_${PN}-${SLOT}\n" | tr "\n" "\0" | $XARGS -0 -n100 touch || die "Failed to recursively create .keep files"
+	else
+		for x in "$@"; do
+			touch "${ED}/${x}/.keep_${CATEGORY}_${PN}-${SLOT}" || die "Failed to create .keep in ${ED}/${x}"
+		done
+	fi
+}
+
+unpack() {
+	local x
+	local y
+	local myfail
+	local tar_opts=""
+	[ -z "$*" ] && die "Nothing passed to the 'unpack' command"
+
+	for x in "$@"; do
+		vecho ">>> Unpacking ${x} to ${PWD}"
+		y=${x%.*}
+		y=${y##*.}
+
+		myfail="${x} does not exist"
+		if [ "${x:0:2}" = "./" ] ; then
+			srcdir=""
+		else
+			srcdir="${DISTDIR}/"
+		fi
+		[[ ${x} == ${DISTDIR}* ]] && \
+			die "Arguments to unpack() should not begin with \${DISTDIR}."
+		[ ! -s "${srcdir}${x}" ] && die "$myfail"
+
+		myfail="failure unpacking ${x}"
+		case "${x##*.}" in
+			tar)
+				tar xof "${srcdir}${x}" ${tar_opts} || die "$myfail"
+				;;
+			tgz)
+				tar xozf "${srcdir}${x}" ${tar_opts} || die "$myfail"
+				;;
+			tbz|tbz2)
+				bzip2 -dc "${srcdir}${x}" | tar xof - ${tar_opts}
+				assert "$myfail"
+				;;
+			ZIP|zip|jar)
+				unzip -qo "${srcdir}${x}" || die "$myfail"
+				;;
+			gz|Z|z)
+				if [ "${y}" == "tar" ]; then
+					tar zoxf "${srcdir}${x}" ${tar_opts} || die "$myfail"
+				else
+					gzip -dc "${srcdir}${x}" > ${x%.*} || die "$myfail"
+				fi
+				;;
+			bz2|bz)
+				if [ "${y}" == "tar" ]; then
+					bzip2 -dc "${srcdir}${x}" | tar xof - ${tar_opts}
+					assert "$myfail"
+				else
+					bzip2 -dc "${srcdir}${x}" > ${x%.*} || die "$myfail"
+				fi
+				;;
+			7Z|7z)
+				local my_output
+				my_output="$(7z x -y "${srcdir}/${x}")"
+				if [ $? -ne 0 ]; then
+					echo "${my_output}" >&2
+					die "$myfail"
+				fi
+				;;
+			RAR|rar)
+				unrar x -idq -o+ "${srcdir}/${x}" || die "$myfail"
+				;;
+			LHa|LHA|lha|lzh)
+				lha xqf "${srcdir}/${x}" || die "$myfail"
+				;;
+			deb)
+				# Unpacking .deb archives can not always be done with
+				# `ar`.  For instance on AIX this doesn't work out.  If
+				# we have `deb2targz` installed, prefer it over `ar` for
+				# that reason.  We just make sure on AIX `deb2targz` is
+				# installed.
+				if type -P deb2targz > /dev/null; then
+					deb2targz "${srcdir}/${x}" || die "$myfail"
+					mv "${srcdir}/${x/.deb/.tar.gz}" data.tar.gz
+				else
+					ar x "${srcdir}/${x}" || die "$myfail"
+				fi
+				;;
+			a)
+				ar x "${srcdir}/${x}" || die "$myfail"
+				;;
+			*)
+				vecho "unpack ${x}: file format not recognized. Ignoring."
+				;;
+		esac
+	done
+	# Do not chmod '.' since it's probably ${WORKDIR} and PORTAGE_WORKDIR_MODE
+	# should be preserved.
+	find . -mindepth 1 -maxdepth 1 ! -type l -print0 | \
+		${XARGS} -0 chmod -fR a+rX,u+w,g-w,o-w
+}
+
+strip_duplicate_slashes() {
+	if [[ -n $1 ]] ; then
+		local removed=$1
+		while [[ ${removed} == *//* ]] ; do
+			removed=${removed//\/\///}
+		done
+		echo ${removed}
+	fi
+}
+
+econf() {
+	local x
+	local LOCAL_EXTRA_ECONF="${EXTRA_ECONF}"
+
+	if [ -z "${ECONF_SOURCE}" ]; then
+		ECONF_SOURCE="."
+	fi
+	if [ -x "${ECONF_SOURCE}/configure" ]; then
+		if [ -e "${EPREFIX}"/usr/share/gnuconfig/ ]; then
+			for x in $(find "${WORKDIR}" -type f '(' -name config.guess -o -name config.sub ')') ; do
+				vecho " * econf: updating ${x/${WORKDIR}\/} with ${EPREFIX}/usr/share/gnuconfig/${x##*/}"
+				cp -f "${EPREFIX}"/usr/share/gnuconfig/${x##*/} ${x}
+			done
+		fi
+
+		if [ ! -z "${CBUILD}" ]; then
+			LOCAL_EXTRA_ECONF="--build=${CBUILD} ${LOCAL_EXTRA_ECONF}"
+		fi
+
+		if [ ! -z "${CTARGET}" ]; then
+			LOCAL_EXTRA_ECONF="--target=${CTARGET} ${LOCAL_EXTRA_ECONF}"
+		fi
+
+		# if the profile defines a location to install libs to aside from default, pass it on.
+		# if the ebuild passes in --libdir, they're responsible for the conf_libdir fun.
+		LIBDIR_VAR="LIBDIR_${ABI}"
+		if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then
+			CONF_LIBDIR="${!LIBDIR_VAR}"
+		fi
+		unset LIBDIR_VAR
+		if [ -n "${CONF_LIBDIR}" ] && [ "${*/--libdir}" == "$*" ]; then
+			if [ "${*/--exec-prefix}" != "$*" ]; then
+				local args="$(echo $*)"
+				local -a pref=($(echo ${args/*--exec-prefix[= ]}))
+				CONF_PREFIX=${pref}
+				[ "${CONF_PREFIX:0:1}" != "/" ] && CONF_PREFIX="/${CONF_PREFIX}"
+			elif [ "${*/--prefix}" != "$*" ]; then
+				local args="$(echo $*)"
+				local -a pref=($(echo ${args/*--prefix[= ]}))
+				CONF_PREFIX=${pref}
+				[ "${CONF_PREFIX:0:1}" != "/" ] && CONF_PREFIX="/${CONF_PREFIX}"
+			else
+				CONF_PREFIX="${EPREFIX}/usr"
+			fi
+			export CONF_PREFIX
+			[ "${CONF_LIBDIR:0:1}" != "/" ] && CONF_LIBDIR="/${CONF_LIBDIR}"
+
+			CONF_LIBDIR_RESULT="$(strip_duplicate_slashes ${CONF_PREFIX}${CONF_LIBDIR})"
+
+			LOCAL_EXTRA_ECONF="--libdir=${CONF_LIBDIR_RESULT} ${LOCAL_EXTRA_ECONF}"
+		fi
+
+		local TMP_CONFCACHE_DIR CONFCACHE_ARG
+		if hasq confcache $FEATURES && ! hasq confcache $RESTRICT; then
+			CONFCACHE="$(type -P confcache)"
+			if [ -z "${CONFCACHE}" ]; then
+				ewarn "disabling confcache, binary cannot be found"
+			else
+				CONFCACHE="${CONFCACHE/ /\ }"
+				TMP_CONFCACHE_DIR="${CONFCACHE:+${CONFCACHE_DIR:-${PORTAGE_TMPDIR}/confcache}}"
+				TMP_CONFCACHE_DIR="${TMP_CONFCACHE_DIR/ /\ }"
+				CONFCACHE_ARG="--confcache-dir"
+				local s
+				if [ -n "$CCACHE_DIR" ]; then
+					s="$CCACHE_DIR"
+				fi
+				if [ -n "$DISTCC_DIR" ]; then
+					s="${s:+${s}:}$DISTCC_DIR"
+				fi
+				if [ -n "$s" ]; then
+					CONFCACHE_ARG="--confcache-ignore $s $CONFCACHE_ARG"
+				fi
+			fi
+		else
+			CONFCACHE=
+		fi
+
+		vecho ${CONFCACHE} ${CONFCACHE_ARG} ${TMP_CONFCACHE_DIR} "${ECONF_SOURCE}/configure" \
+			--prefix="${EPREFIX}"/usr \
+			--host=${CHOST} \
+			--mandir="${EPREFIX}"/usr/share/man \
+			--infodir="${EPREFIX}"/usr/share/info \
+			--datadir="${EPREFIX}"/usr/share \
+			--sysconfdir="${EPREFIX}"/etc \
+			--localstatedir="${EPREFIX}"/var/lib \
+			"$@" \
+			${LOCAL_EXTRA_ECONF}
+
+		if ! ${CONFCACHE} ${CONFCACHE_ARG} ${TMP_CONFCACHE_DIR} "${ECONF_SOURCE}/configure" \
+			--prefix="${EPREFIX}"/usr \
+			--host="${CHOST}" \
+			--mandir="${EPREFIX}"/usr/share/man \
+			--infodir="${EPREFIX}"/usr/share/info \
+			--datadir="${EPREFIX}"/usr/share \
+			--sysconfdir="${EPREFIX}"/etc \
+			--localstatedir="${EPREFIX}"/var/lib \
+			"$@"  \
+			${LOCAL_EXTRA_ECONF}; then
+
+			if [ -s config.log ]; then
+				echo
+				echo "!!! Please attach the following file when seeking support:"
+				echo "!!! ${PWD}/config.log"
+			fi
+			die "econf failed"
+		fi
+	elif [ -f "${ECONF_SOURCE:-.}/configure" ]; then
+		die "configure is not executable"
+	else
+		die "no configure script found"
+	fi
+}
+
+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}"
+	fi
+	unset LIBDIR_VAR
+	if [ -n "${CONF_LIBDIR}" ] && [ "${CONF_PREFIX:-unset}" != "unset" ]; then
+		EI_DESTLIBDIR="${D}/${CONF_PREFIX}/${CONF_LIBDIR}"
+		EI_DESTLIBDIR="$(strip_duplicate_slashes ${EI_DESTLIBDIR})"
+		LOCAL_EXTRA_EINSTALL="libdir=${EI_DESTLIBDIR} ${LOCAL_EXTRA_EINSTALL}"
+		unset EI_DESTLIBDIR
+	fi
+
+	if [ -f ./[mM]akefile -o -f ./GNUmakefile ] ; then
+		if [ "${PORTAGE_DEBUG}" == "1" ]; then
+			make -n prefix="${ED}/usr" \
+				datadir="${ED}/usr/share" \
+				infodir="${ED}/usr/share/info" \
+				localstatedir="${ED}/var/lib" \
+				mandir="${ED}/usr/share/man" \
+				sysconfdir="${ED}/etc" \
+				${LOCAL_EXTRA_EINSTALL} \
+				"$@" install
+		fi
+		make prefix="${ED}/usr" \
+			datadir="${ED}/usr/share" \
+			infodir="${ED}/usr/share/info" \
+			localstatedir="${ED}/var/lib" \
+			mandir="${ED}/usr/share/man" \
+			sysconfdir="${ED}/etc" \
+			${LOCAL_EXTRA_EINSTALL} \
+			"$@" install || die "einstall failed"
+	else
+		die "no Makefile found"
+	fi
+}
+
+pkg_setup() {
+	return
+}
+
+pkg_nofetch() {
+	[ -z "${SRC_URI}" ] && return
+
+	echo "!!! The following are listed in SRC_URI for ${PN}:"
+	local x
+	for x in $(echo ${SRC_URI}); do
+		echo "!!!   ${x}"
+	done
+}
+
+src_unpack() {
+	[[ -n ${A} ]] && unpack ${A}
+}
+
+src_compile() {
+	if [ "${EAPI:-0}" == 0 ] ; then
+		[ -x ./configure ] && econf
+	elif [ -x "${ECONF_SOURCE:-.}/configure" ] ; then
+		econf
+	fi
+	if [ -f Makefile ] || [ -f GNUmakefile ] || [ -f makefile ]; then
+		emake || die "emake failed"
+	fi
+}
+
+src_test() {
+	if emake -j1 check -n &> /dev/null; then
+		vecho ">>> Test phase [check]: ${CATEGORY}/${PF}"
+		if ! emake -j1 check; then
+			hasq test $FEATURES && die "Make check failed. See above for details."
+			hasq test $FEATURES || eerror "Make check failed. See above for details."
+		fi
+	elif emake -j1 test -n &> /dev/null; then
+		vecho ">>> Test phase [test]: ${CATEGORY}/${PF}"
+		if ! emake -j1 test; then
+			hasq test $FEATURES && die "Make test failed. See above for details."
+			hasq test $FEATURES || eerror "Make test failed. See above for details."
+		fi
+	else
+		vecho ">>> Test phase [none]: ${CATEGORY}/${PF}"
+	fi
+}
+
+src_install() {
+	# this avoids misc errors in prefix because it doesn't exist
+	# by default
+	mkdir -p "${ED}"
+	return
+}
+
+pkg_preinst() {
+	return
+}
+
+pkg_postinst() {
+	return
+}
+
+pkg_prerm() {
+	return
+}
+
+pkg_postrm() {
+	return
+}
+
+pkg_config() {
+	eerror "This ebuild does not have a config function."
+}
+
+# Used to generate the /lib/cpp and /usr/bin/cc wrappers
+gen_wrapper() {
+	cat > "$1" <<-EOF
+	#!${EPREFIX}/bin/sh
+	exec $2 "\$@"
+	EOF
+	chmod 0755 "$1"
+}
+
+dyn_setup() {
+	[ "$(type -t pre_pkg_setup)" == "function" ] && qa_call pre_pkg_setup
+	qa_call pkg_setup
+	[ "$(type -t post_pkg_setup)" == "function" ] && qa_call post_pkg_setup
+}
+
+dyn_unpack() {
+	[ "$(type -t pre_src_unpack)" == "function" ] && qa_call pre_src_unpack
+	local newstuff="no"
+	if [ -e "${WORKDIR}" ]; then
+		local x
+		local checkme
+		for x in ${AA}; do
+			vecho ">>> Checking ${x}'s mtime..."
+			if [ "${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/${x}" -nt "${WORKDIR}" ]; then
+				vecho ">>> ${x} has been updated; recreating WORKDIR..."
+				newstuff="yes"
+				break
+			fi
+		done
+		if [ "${EBUILD}" -nt "${WORKDIR}" ] && ! hasq keepwork ${FEATURES} ; then
+			vecho ">>> ${EBUILD} has been updated; recreating WORKDIR..."
+			newstuff="yes"
+		elif [ ! -f "${PORTAGE_BUILDDIR}/.unpacked" ]; then
+			vecho ">>> Not marked as unpacked; recreating WORKDIR..."
+			newstuff="yes"
+		fi
+	fi
+	if [ "${newstuff}" == "yes" ]; then
+		# We don't necessarily have privileges to do a full dyn_clean here.
+		rm -rf "${WORKDIR}"
+		if [ -d "${T}" ] && ! hasq keeptemp ${FEATURES} ; then
+			rm -rf "${T}" && mkdir "${T}"
+		else
+			[ -e "${T}/environment" ] && \
+				mv "${T}/environment" "${T}/environment.keeptemp"
+		fi
+	fi
+	if [ -e "${WORKDIR}" ]; then
+		if [ "$newstuff" == "no" ]; then
+			vecho ">>> WORKDIR is up-to-date, keeping..."
+			[ "$(type -t post_src_unpack)" == "function" ] && qa_call post_src_unpack
+			return 0
+		fi
+	fi
+
+	if [ ! -d "${WORKDIR}" ]; then
+		install -m${PORTAGE_WORKDIR_MODE:-0700} -d "${WORKDIR}" || die "Failed to create dir '${WORKDIR}'"
+	fi
+	cd "${WORKDIR}" || die "Directory change failed: \`cd '${WORKDIR}'\`"
+	vecho ">>> Unpacking source..."
+	qa_call src_unpack
+	touch "${PORTAGE_BUILDDIR}/.unpacked" || die "IO Failure -- Failed 'touch .unpacked' in ${PORTAGE_BUILDDIR}"
+	vecho ">>> Source unpacked."
+	cd "${PORTAGE_BUILDDIR}"
+
+	[ "$(type -t post_src_unpack)" == "function" ] && qa_call post_src_unpack
+}
+
+dyn_clean() {
+	if [ -z "${PORTAGE_BUILDDIR}" ]; then
+		echo "Aborting clean phase because PORTAGE_BUILDDIR is unset!"
+		return 1
+	fi
+
+	if type -P chflags > /dev/null ; then
+		chflags -R noschg,nouchg,nosappnd,nouappnd "${PORTAGE_BUILDDIR}"
+		chflags -R nosunlnk,nouunlnk "${PORTAGE_BUILDDIR}" 2>/dev/null
+	fi
+
+	rm -rf "${PORTAGE_BUILDDIR}/image" "${PORTAGE_BUILDDIR}/homedir"
+
+	if ! hasq keeptemp $FEATURES; then
+		rm -rf "${T}"
+	else
+		[ -e "${T}/environment" ] && mv "${T}/environment" "${T}/environment.keeptemp"
+	fi
+
+	if ! hasq keepwork $FEATURES; then
+		rm -rf "${PORTAGE_BUILDDIR}/.logid"
+		rm -rf "${PORTAGE_BUILDDIR}/.unpacked"
+		rm -rf "${PORTAGE_BUILDDIR}/.compiled"
+		rm -rf "${PORTAGE_BUILDDIR}/.tested"
+		rm -rf "${PORTAGE_BUILDDIR}/.installed"
+		rm -rf "${PORTAGE_BUILDDIR}/.packaged"
+		rm -rf "${PORTAGE_BUILDDIR}/build-info"
+		rm -rf "${WORKDIR}"
+	fi
+
+	if [ -f "${PORTAGE_BUILDDIR}/.unpacked" ]; then
+		find "${PORTAGE_BUILDDIR}" -type d ! -regex "^${WORKDIR}" | sort -r | tr "\n" "\0" | $XARGS -0 rmdir &>/dev/null
+	fi
+
+	# do not bind this to doebuild defined DISTDIR; don't trust doebuild, and if mistakes are made it'll
+	# result in it wiping the users distfiles directory (bad).
+	rm -rf "${PORTAGE_BUILDDIR}/distdir"
+
+	if [ -z "$(find "${PORTAGE_BUILDDIR}" -mindepth 1 -maxdepth 1)" ]; then
+		rmdir "${PORTAGE_BUILDDIR}"
+	fi
+
+	true
+}
+
+into() {
+	if [ "$1" == "/" ]; then
+		export DESTTREE=""
+	else
+		export DESTTREE=$1
+		if [ ! -d "${ED}${DESTTREE}" ]; then
+			install -d "${ED}${DESTTREE}"
+		fi
+	fi
+}
+
+insinto() {
+	if [ "$1" == "/" ]; then
+		export INSDESTTREE=""
+	else
+		export INSDESTTREE=$1
+		if [ ! -d "${ED}${INSDESTTREE}" ]; then
+			install -d "${ED}${INSDESTTREE}"
+		fi
+	fi
+}
+
+exeinto() {
+	if [ "$1" == "/" ]; then
+		export _E_EXEDESTTREE_=""
+	else
+		export _E_EXEDESTTREE_="$1"
+		if [ ! -d "${ED}${_E_EXEDESTTREE_}" ]; then
+			install -d "${ED}${_E_EXEDESTTREE_}"
+		fi
+	fi
+}
+
+docinto() {
+	if [ "$1" == "/" ]; then
+		export _E_DOCDESTTREE_=""
+	else
+		export _E_DOCDESTTREE_="$1"
+		if [ ! -d "${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" ]; then
+			install -d "${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
+		fi
+	fi
+}
+
+insopts() {
+	export INSOPTIONS="$@"
+
+	# `install` should never be called with '-s' ...
+	hasq -s ${INSOPTIONS} && die "Never call insopts() with -s"
+}
+
+diropts() {
+	export DIROPTIONS="$@"
+}
+
+exeopts() {
+	export EXEOPTIONS="$@"
+
+	# `install` should never be called with '-s' ...
+	hasq -s ${EXEOPTIONS} && die "Never call exeopts() with -s"
+}
+
+libopts() {
+	export LIBOPTIONS="$@"
+
+	# `install` should never be called with '-s' ...
+	hasq -s ${LIBOPTIONS} && die "Never call libopts() with -s"
+}
+
+abort_handler() {
+	local msg
+	if [ "$2" != "fail" ]; then
+		msg="${EBUILD}: ${1} aborted; exiting."
+	else
+		msg="${EBUILD}: ${1} failed; exiting."
+	fi
+	echo
+	echo "$msg"
+	echo
+	eval ${3}
+	#unset signal handler
+	trap SIGINT SIGQUIT
+}
+
+abort_compile() {
+	abort_handler "src_compile" $1
+	rm -f "${PORTAGE_BUILDDIR}/.compiled"
+	exit 1
+}
+
+abort_test() {
+	abort_handler "dyn_test" $1
+	rm -f "${PORTAGE_BUILDDIR}/.tested"
+	exit 1
+}
+
+abort_install() {
+	abort_handler "src_install" $1
+	rm -rf "${PORTAGE_BUILDDIR}/image"
+	exit 1
+}
+
+dyn_compile() {
+	trap "abort_compile" SIGINT SIGQUIT
+
+	[ "$(type -t pre_src_compile)" == "function" ] && qa_call pre_src_compile
+
+	[ "${CFLAGS-unset}"      != "unset" ] && export CFLAGS
+	[ "${CXXFLAGS-unset}"    != "unset" ] && export CXXFLAGS
+	[ "${LIBCFLAGS-unset}"   != "unset" ] && export LIBCFLAGS
+	[ "${LIBCXXFLAGS-unset}" != "unset" ] && export LIBCXXFLAGS
+	[ "${LDFLAGS-unset}"     != "unset" ] && export LDFLAGS
+	[ "${ASFLAGS-unset}"     != "unset" ] && export ASFLAGS
+
+	[ "${CCACHE_DIR-unset}"  != "unset" ] && export CCACHE_DIR
+	[ "${CCACHE_SIZE-unset}" != "unset" ] && export CCACHE_SIZE
+
+	[ "${DISTCC_DIR-unset}"  == "unset" ] && export DISTCC_DIR="${PORTAGE_TMPDIR}/.distcc"
+	[ ! -z "${DISTCC_DIR}" ] && addwrite "${DISTCC_DIR}"
+
+	LIBDIR_VAR="LIBDIR_${ABI}"
+	if [ -z "${PKG_CONFIG_PATH}" -a -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then
+		export PKG_CONFIG_PATH="${EPREFIX}/usr/${!LIBDIR_VAR}/pkgconfig"
+	fi
+	unset LIBDIR_VAR
+
+	if hasq noauto $FEATURES && [ ! -f ${PORTAGE_BUILDDIR}/.unpacked ]; then
+		echo
+		echo "!!! We apparently haven't unpacked... This is probably not what you"
+		echo "!!! want to be doing... You are using FEATURES=noauto so I'll assume"
+		echo "!!! that you know what you are doing... You have 5 seconds to abort..."
+		echo
+
+		local x
+		for x in 1 2 3 4 5 6 7 8; do
+			echo -ne "\a"
+			LC_ALL=C sleep 0.25
+		done
+
+		sleep 3
+	fi
+
+	local srcdir=${PORTAGE_BUILDDIR}
+	cd "${PORTAGE_BUILDDIR}"
+	if [ ! -e "build-info" ]; then
+		mkdir build-info
+	fi
+	cp "${EBUILD}" "build-info/${PF}.ebuild"
+
+	if [[ ${PORTAGE_BUILDDIR}/.compiled -nt ${WORKDIR} ]] ; then
+		vecho ">>> It appears that '${PF}' is already compiled; skipping."
+		vecho ">>> Remove '${PORTAGE_BUILDDIR}/.compiled' to force compilation."
+		trap SIGINT SIGQUIT
+		[ "$(type -t post_src_compile)" == "function" ] && qa_call post_src_compile
+		return
+	fi
+	if [ -d "${S}" ]; then
+		srcdir=${S}
+		cd "${S}"
+	fi
+	#our custom version of libtool uses $S and $ED to fix
+	#invalid paths in .la files
+	export S ED
+	#some packages use an alternative to $S to build in, cause
+	#our libtool to create problematic .la files
+	export PWORKDIR="$WORKDIR"
+	vecho ">>> Compiling source in ${srcdir} ..."
+	qa_call src_compile
+	vecho ">>> Source compiled."
+	#|| abort_compile "fail"
+	cd "${PORTAGE_BUILDDIR}"
+	touch .compiled
+	cd build-info
+
+	set -f
+	for f in ASFLAGS CATEGORY CBUILD CC CFLAGS CHOST CTARGET CXX \
+		CXXFLAGS DEPEND EXTRA_ECONF EXTRA_EINSTALL EXTRA_MAKE \
+		FEATURES INHERITED IUSE LDFLAGS LIBCFLAGS LIBCXXFLAGS \
+		LICENSE PDEPEND PF PKGUSE PROVIDE RDEPEND RESTRICT SLOT \
+		KEYWORDS HOMEPAGE SRC_URI DESCRIPTION; do
+		[ -n "${!f}" ] && echo $(echo "${!f}" | tr '\n,\r,\t' ' , , ' | sed s/'  \+'/' '/g) > ${f}
+	done
+	echo "${USE}"		> USE
+	echo "${EAPI:-0}"	> EAPI
+	set +f
+	set                     >  environment
+	export | sed 's:^declare -rx:declare -x:' >> environment
+	bzip2 -f9 environment
+
+	cp "${EBUILD}" "${PF}.ebuild"
+	if hasq nostrip ${FEATURES} ${RESTRICT} || hasq strip ${RESTRICT}
+	then
+		touch DEBUGBUILD
+	fi
+
+	[ "$(type -t post_src_compile)" == "function" ] && qa_call post_src_compile
+
+	trap SIGINT SIGQUIT
+}
+
+dyn_test() {
+	if [ "${EBUILD_FORCE_TEST}" == "1" ] ; then
+		rm -f "${PORTAGE_BUILDDIR}/.tested"
+		# If USE came from ${T}/environment then it might not have USE=test
+		# like it's supposed to here.
+		! hasq test ${USE} && export USE="${USE} test"
+	fi
+	[ "$(type -t pre_src_test)" == "function" ] && qa_call pre_src_test
+	if [ "${PORTAGE_BUILDDIR}/.tested" -nt "${WORKDIR}" ]; then
+		vecho ">>> It appears that ${PN} has already been tested; skipping."
+		[ "$(type -t post_src_test)" == "function" ] && qa_call post_src_test
+		return
+	fi
+	trap "abort_test" SIGINT SIGQUIT
+	if [ -d "${S}" ]; then
+		cd "${S}"
+	fi
+	if ! hasq test $FEATURES && [ "${EBUILD_FORCE_TEST}" != "1" ]; then
+		vecho ">>> Test phase [not enabled]: ${CATEGORY}/${PF}"
+	elif ! hasq test ${USE} && [ "${EBUILD_FORCE_TEST}" != "1" ]; then
+		ewarn "Skipping make test/check since USE=test is masked."
+		vecho ">>> Test phase [explicitly disabled]: ${CATEGORY}/${PF}"
+	elif hasq test $RESTRICT; then
+		ewarn "Skipping make test/check due to ebuild restriction."
+		vecho ">>> Test phase [explicitly disabled]: ${CATEGORY}/${PF}"
+	else
+		addpredict /
+		qa_call src_test
+		SANDBOX_PREDICT="${SANDBOX_PREDICT%:/}"
+	fi
+
+	cd "${PORTAGE_BUILDDIR}"
+	touch .tested || die "Failed to 'touch .tested' in ${PORTAGE_BUILDDIR}"
+	[ "$(type -t post_src_test)" == "function" ] && qa_call post_src_test
+	trap SIGINT SIGQUIT
+}
+
+dyn_install() {
+	[ -z "$PORTAGE_BUILDDIR" ] && die "${FUNCNAME}: PORTAGE_BUILDDIR is unset"
+	if hasq noauto $FEATURES ; then
+		rm -f "${PORTAGE_BUILDDIR}/.installed"
+	elif [[ ${PORTAGE_BUILDDIR}/.installed -nt ${WORKDIR} ]] ; then
+		vecho ">>> It appears that '${PF}' is already installed; skipping."
+		vecho ">>> Remove '${PORTAGE_BUILDDIR}/.installed' to force install."
+		return 0
+	fi
+	trap "abort_install" SIGINT SIGQUIT
+	[ "$(type -t pre_src_install)" == "function" ] && qa_call pre_src_install
+	rm -rf "${PORTAGE_BUILDDIR}/image"
+	mkdir "${PORTAGE_BUILDDIR}/image"
+	if [ -d "${S}" ]; then
+		cd "${S}"
+	fi
+	vecho
+	vecho ">>> Install ${PF} into ${ED} category ${CATEGORY}"
+	#our custom version of libtool uses $S and $ED to fix
+	#invalid paths in .la files
+	export S ED
+	#some packages uses an alternative to $S to build in, cause
+	#our libtool to create problematic .la files
+	export PWORKDIR="$WORKDIR"
+	qa_call src_install
+	touch "${PORTAGE_BUILDDIR}/.installed"
+	vecho ">>> Completed installing ${PF} into ${ED}"
+	vecho
+	cd ${PORTAGE_BUILDDIR}
+	[ "$(type -t post_src_install)" == "function" ] && qa_call post_src_install
+	trap SIGINT SIGQUIT
+}
+
+dyn_preinst() {
+	if [ -z "$IMAGE" ]; then
+		eerror "${FUNCNAME}: IMAGE is unset"
+		return 1
+	fi
+
+	[ "$(type -t pre_pkg_preinst)" == "function" ] && qa_call pre_pkg_preinst
+
+	declare -r D=${IMAGE}
+	pkg_preinst
+
+	[ "$(type -t post_pkg_preinst)" == "function" ] && qa_call post_pkg_preinst
+}
+
+dyn_help() {
+	echo
+	echo "Portage"
+	echo "Copyright 1999-2006 Gentoo Foundation"
+	echo
+	echo "How to use the ebuild command:"
+	echo
+	echo "The first argument to ebuild should be an existing .ebuild file."
+	echo
+	echo "One or more of the following options can then be specified.  If more"
+	echo "than one option is specified, each will be executed in order."
+	echo
+	echo "  help        : show this help screen"
+	echo "  setup       : execute package specific setup actions"
+	echo "  fetch       : download source archive(s) and patches"
+	echo "  digest      : create a digest and a manifest file for the package"
+	echo "  manifest    : create a manifest file for the package"
+	echo "  unpack      : unpack/patch sources (auto-fetch if needed)"
+	echo "  compile     : compile sources (auto-fetch/unpack if needed)"
+	echo "  test        : test package (auto-fetch/unpack/compile if needed)"
+	echo "  preinst     : execute pre-install instructions"
+	echo "  postinst    : execute post-install instructions"
+	echo "  install     : install the package to the temporary install directory"
+	echo "  qmerge      : merge image into live filesystem, recording files in db"
+	echo "  merge       : do fetch, unpack, compile, install and qmerge"
+	echo "  prerm       : execute pre-removal instructions"
+	echo "  postrm      : execute post-removal instructions"
+	echo "  unmerge     : remove package from live filesystem"
+	echo "  config      : execute package specific configuration actions"
+	echo "  package     : create a tarball package in ${PKGDIR}/All"
+	echo "  rpm         : build a RedHat RPM package"
+	echo "  clean       : clean up all source and temporary files"
+	echo
+	echo "The following settings will be used for the ebuild process:"
+	echo
+	echo "  package     : ${PF}"
+	echo "  slot        : ${SLOT}"
+	echo "  category    : ${CATEGORY}"
+	echo "  description : ${DESCRIPTION}"
+	echo "  system      : ${CHOST}"
+	echo "  c flags     : ${CFLAGS}"
+	echo "  c++ flags   : ${CXXFLAGS}"
+	echo "  make flags  : ${MAKEOPTS}"
+	echo -n "  build mode  : "
+	if hasq nostrip ${FEATURES} ${RESTRICT} || hasq strip ${RESTRICT} ;
+	then
+		echo "debug (large)"
+	else
+		echo "production (stripped)"
+	fi
+	echo "  merge to    : ${ROOT}"
+	echo
+	if [ -n "$USE" ]; then
+		echo "Additionally, support for the following optional features will be enabled:"
+		echo
+		echo "  ${USE}"
+	fi
+	echo
+}
+
+# debug-print() gets called from many places with verbose status information useful
+# for tracking down problems. The output is in $T/eclass-debug.log.
+# You can set ECLASS_DEBUG_OUTPUT to redirect the output somewhere else as well.
+# The special "on" setting echoes the information, mixing it with the rest of the
+# emerge output.
+# You can override the setting by exporting a new one from the console, or you can
+# set a new default in make.*. Here the default is "" or unset.
+
+# in the future might use e* from /etc/init.d/functions.sh if i feel like it
+debug-print() {
+	# if $T isn't defined, we're in dep calculation mode and
+	# shouldn't do anything
+	[ ! -d "$T" ] && return 0
+
+	while [ "$1" ]; do
+
+		# extra user-configurable targets
+		if [ "$ECLASS_DEBUG_OUTPUT" == "on" ]; then
+			echo "debug: $1"
+		elif [ -n "$ECLASS_DEBUG_OUTPUT" ]; then
+			echo "debug: $1" >> $ECLASS_DEBUG_OUTPUT
+		fi
+
+		# default target
+		echo "$1" >> "${T}/eclass-debug.log"
+		# let the portage user own/write to this file
+		chmod g+w "${T}/eclass-debug.log" &>/dev/null
+
+		shift
+	done
+}
+
+# The following 2 functions are debug-print() wrappers
+
+debug-print-function() {
+	str="$1: entering function"
+	shift
+	debug-print "$str, parameters: $*"
+}
+
+debug-print-section() {
+	debug-print "now in section $*"
+}
+
+# Sources all eclasses in parameters
+declare -ix ECLASS_DEPTH=0
+inherit() {
+	ECLASS_DEPTH=$(($ECLASS_DEPTH + 1))
+	if [[ ${ECLASS_DEPTH} > 1 ]]; then
+		debug-print "*** Multiple Inheritence (Level: ${ECLASS_DEPTH})"
+	fi
+
+	local location
+	local olocation
+	local PECLASS
+
+	local B_IUSE
+	local B_DEPEND
+	local B_RDEPEND
+	local B_PDEPEND
+	while [ "$1" ]; do
+		location="${ECLASSDIR}/${1}.eclass"
+		olocation=""
+
+		# PECLASS is used to restore the ECLASS var after recursion.
+		PECLASS="$ECLASS"
+		export ECLASS="$1"
+
+		if [ "${EBUILD_PHASE}" != "depend" ] && \
+			[[ ${EBUILD_PHASE} != *rm ]] && \
+			[[ ${EMERGE_FROM} != "binary" ]] ; then
+			# This is disabled in the *rm phases because they frequently give
+			# false alarms due to INHERITED in /var/db/pkg being outdated
+			# in comparison the the eclasses from the portage tree.
+			if ! hasq $ECLASS $INHERITED; then
+				eqawarn "QA Notice: ECLASS '$ECLASS' inherited illegally in $CATEGORY/$PF"
+			fi
+		fi
+
+		# any future resolution code goes here
+		if [ -n "$PORTDIR_OVERLAY" ]; then
+			local overlay
+			for overlay in ${PORTDIR_OVERLAY}; do
+				olocation="${overlay}/eclass/${1}.eclass"
+				if [ -e "$olocation" ]; then
+					location="${olocation}"
+					debug-print "  eclass exists: ${location}"
+				fi
+			done
+		fi
+		debug-print "inherit: $1 -> $location"
+		[ ! -e "$location" ] && die "${1}.eclass could not be found by inherit()"
+
+		if [ "${location}" == "${olocation}" ] && \
+			! hasq "${location}" ${EBUILD_OVERLAY_ECLASSES} ; then
+				EBUILD_OVERLAY_ECLASSES="${EBUILD_OVERLAY_ECLASSES} ${location}"
+		fi
+
+		#We need to back up the value of DEPEND and RDEPEND to B_DEPEND and B_RDEPEND
+		#(if set).. and then restore them after the inherit call.
+
+		#turn off glob expansion
+		set -f
+
+		# Retain the old data and restore it later.
+		unset B_IUSE B_DEPEND B_RDEPEND B_PDEPEND
+		[ "${IUSE-unset}"    != "unset" ] && B_IUSE="${IUSE}"
+		[ "${DEPEND-unset}"  != "unset" ] && B_DEPEND="${DEPEND}"
+		[ "${RDEPEND-unset}" != "unset" ] && B_RDEPEND="${RDEPEND}"
+		[ "${PDEPEND-unset}" != "unset" ] && B_PDEPEND="${PDEPEND}"
+		unset IUSE DEPEND RDEPEND PDEPEND
+		#turn on glob expansion
+		set +f
+
+		qa_source "$location" || die "died sourcing $location in inherit()"
+		
+		#turn off glob expansion
+		set -f
+
+		# If each var has a value, append it to the global variable E_* to
+		# be applied after everything is finished. New incremental behavior.
+		[ "${IUSE-unset}"    != "unset" ] && export E_IUSE="${E_IUSE} ${IUSE}"
+		[ "${DEPEND-unset}"  != "unset" ] && export E_DEPEND="${E_DEPEND} ${DEPEND}"
+		[ "${RDEPEND-unset}" != "unset" ] && export E_RDEPEND="${E_RDEPEND} ${RDEPEND}"
+		[ "${PDEPEND-unset}" != "unset" ] && export E_PDEPEND="${E_PDEPEND} ${PDEPEND}"
+
+		[ "${B_IUSE-unset}"    != "unset" ] && IUSE="${B_IUSE}"
+		[ "${B_IUSE-unset}"    != "unset" ] || unset IUSE
+
+		[ "${B_DEPEND-unset}"  != "unset" ] && DEPEND="${B_DEPEND}"
+		[ "${B_DEPEND-unset}"  != "unset" ] || unset DEPEND
+
+		[ "${B_RDEPEND-unset}" != "unset" ] && RDEPEND="${B_RDEPEND}"
+		[ "${B_RDEPEND-unset}" != "unset" ] || unset RDEPEND
+
+		[ "${B_PDEPEND-unset}" != "unset" ] && PDEPEND="${B_PDEPEND}"
+		[ "${B_PDEPEND-unset}" != "unset" ] || unset PDEPEND
+
+		#turn on glob expansion
+		set +f
+
+		hasq $1 $INHERITED || export INHERITED="$INHERITED $1"
+
+		export ECLASS="$PECLASS"
+
+		shift
+	done
+	((--ECLASS_DEPTH)) # Returns 1 when ECLASS_DEPTH reaches 0.
+	return 0
+}
+
+# Exports stub functions that call the eclass's functions, thereby making them default.
+# For example, if ECLASS="base" and you call "EXPORT_FUNCTIONS src_unpack", the following
+# code will be eval'd:
+# src_unpack() { base_src_unpack; }
+EXPORT_FUNCTIONS() {
+	if [ -z "$ECLASS" ]; then
+		echo "EXPORT_FUNCTIONS without a defined ECLASS" >&2
+		exit 1
+	fi
+	while [ "$1" ]; do
+		debug-print "EXPORT_FUNCTIONS: ${1} -> ${ECLASS}_${1}"
+		eval "$1() { ${ECLASS}_$1 "\$@" ; }" > /dev/null
+		shift
+	done
+}
+
+# adds all parameters to E_DEPEND and E_RDEPEND, which get added to DEPEND
+# and RDEPEND after the ebuild has been processed. This is important to
+# allow users to use DEPEND="foo" without frying dependencies added by an
+# earlier inherit. It also allows RDEPEND to work properly, since a lot
+# of ebuilds assume that an unset RDEPEND gets its value from DEPEND.
+# Without eclasses, this is true. But with them, the eclass may set
+# RDEPEND itself (or at least used to) which would prevent RDEPEND from
+# getting its value from DEPEND. This is a side-effect that made eclasses
+# have unreliable dependencies.
+
+newdepend() {
+	debug-print-function newdepend $*
+	debug-print "newdepend: E_DEPEND=$E_DEPEND E_RDEPEND=$E_RDEPEND"
+
+	while [ -n "$1" ]; do
+		case $1 in
+		"/autotools")
+			do_newdepend DEPEND sys-devel/autoconf sys-devel/automake sys-devel/make
+			;;
+		"/c")
+			do_newdepend DEPEND sys-devel/gcc virtual/libc
+			do_newdepend RDEPEND virtual/libc
+			;;
+		*)
+			do_newdepend DEPEND $1
+			;;
+		esac
+		shift
+	done
+}
+
+newrdepend() {
+	debug-print-function newrdepend $*
+	do_newdepend RDEPEND $1
+}
+
+newpdepend() {
+	debug-print-function newpdepend $*
+	do_newdepend PDEPEND $1
+}
+
+do_newdepend() {
+	# This function does a generic change determining whether we're in an
+	# eclass or not. If we are, we change the E_* variables for deps.
+	debug-print-function do_newdepend $*
+	[ -z "$1" ] && die "do_newdepend without arguments"
+
+	# Grab what we're affecting... Figure out if we're affecting eclasses.
+	[[ ${ECLASS_DEPTH} > 0 ]] && TARGET="E_$1"
+	[[ ${ECLASS_DEPTH} > 0 ]] || TARGET="$1"
+	shift # $1 was a variable name.
+
+	while [ -n "$1" ]; do
+		# This bit of evil takes TARGET and uses it to evaluate down to a
+		# variable. This is a sneaky way to make this infinately expandable.
+		# The normal translation of this would look something like this:
+		# E_DEPEND="${E_DEPEND} $1"  ::::::  Cool, huh? :)
+		eval export ${TARGET}=\"\${${TARGET}} \$1\"
+		shift
+	done
+}
+
+# this is a function for removing any directory matching a passed in pattern from
+# PATH
+remove_path_entry() {
+	save_IFS
+	IFS=":"
+	stripped_path="${PATH}"
+	while [ -n "$1" ]; do
+		cur_path=""
+		for p in ${stripped_path}; do
+			if [ "${p/${1}}" == "${p}" ]; then
+				cur_path="${cur_path}:${p}"
+			fi
+		done
+		stripped_path="${cur_path#:*}"
+		shift
+	done
+	restore_IFS
+	PATH="${stripped_path}"
+}
+
+# === === === === === === === === === === === === === === === === === ===
+# === === === === === functions end, main part begins === === === === ===
+# === === === === === functions end, main part begins === === === === ===
+# === === === === === functions end, main part begins === === === === ===
+# === === === === === === === === === === === === === === === === === ===
+
+if [[ ${EBUILD_SH_ARGS} != "depend" ]] && [[ ${EBUILD_SH_ARGS}  != "clean" ]] && [[ ${EBUILD_SH_ARGS} != "setup" ]]; then
+	cd ${PORTAGE_TMPDIR} &> /dev/null
+	cd ${BUILD_PREFIX} &> /dev/null
+
+	if [ "$(id -nu)" == "portage" ] ; then
+		export USER=portage
+	fi
+
+	if hasq distcc ${FEATURES} ; then
+		if [ -d "${EPREFIX}"/usr/lib/distcc/bin ]; then
+			#We can enable distributed compile support
+			if [ -z "${PATH/*distcc*/}" ]; then
+				# Remove the other reference.
+				remove_path_entry "distcc"
+			fi
+			export PATH="${EPREFIX}/usr/lib/distcc/bin:${PATH}"
+			[ ! -z "${DISTCC_LOG}" ] && addwrite "$(dirname ${DISTCC_LOG})"
+		elif which distcc &>/dev/null; then
+			if ! hasq distcc $CC; then
+				export CC="distcc $CC"
+			fi
+			if ! hasq distcc $CXX; then
+				export CXX="distcc $CXX"
+			fi
+		fi
+	fi
+
+	if hasq ccache ${FEATURES} ; then
+		#We can enable compiler cache support
+		if [ -z "${PATH/*ccache*/}" ]; then
+			# Remove the other reference.
+			remove_path_entry "ccache"
+		fi
+
+		if [ -d "${EPREFIX}"/usr/lib/ccache/bin ]; then
+			export PATH="${EPREFIX}/usr/lib/ccache/bin:${PATH}"
+		elif [ -d "${EPREFIX}"/usr/bin/ccache ]; then
+			export PATH="${EPREFIX}/usr/bin/ccache:${PATH}"
+		fi
+
+		[ -z "${CCACHE_DIR}" ] && export CCACHE_DIR="${EPREFIX}/var/tmp/ccache"
+
+		addread "${CCACHE_DIR}"
+		addwrite "${CCACHE_DIR}"
+
+		[ -n "${CCACHE_SIZE}" ] && ccache -M ${CCACHE_SIZE} &> /dev/null
+	else
+		# Force configure scripts that automatically detect ccache to respect
+		# FEATURES="-ccache"
+		export CCACHE_DISABLE=1
+	fi
+
+	# XXX: Load up the helper functions.
+#	for X in @PORTAGE_BASE@/bin/functions/*.sh; do
+#		source ${X} || die "Failed to source ${X}"
+#	done
+
+else
+
+killparent() {
+	trap INT
+	kill ${PORTAGE_MASTER_PID}
+}
+trap "killparent" INT
+
+fi # "$*"!="depend" && "$*"!="clean" && "$*" != "setup"
+
+export SANDBOX_ON="1"
+export S=${WORKDIR}/${P}
+
+unset E_IUSE E_DEPEND E_RDEPEND E_PDEPEND
+
+for x in T P PN PV PVR PR CATEGORY A EBUILD EMERGE_FROM O PPID FILESDIR PORTAGE_TMPDIR; do
+	[[ ${!x-UNSET_VAR} != UNSET_VAR ]] && declare -r ${x}
+done
+# Need to be able to change D in dyn_preinst due to the IMAGE stuff
+[[ ${EBUILD_SH_ARGS} != "preinst" ]] && declare -r D
+unset x
+
+# Turn of extended glob matching so that g++ doesn't get incorrectly matched.
+shopt -u extglob
+
+QA_INTERCEPTORS="javac java-config python python-config perl grep egrep fgrep sed gcc g++ cc bash awk nawk gawk pkg-config"
+# level the QA interceptors if we're in depend
+if hasq "depend" "${EBUILD_SH_ARGS}"; then
+	for BIN in ${QA_INTERCEPTORS}; do
+		BIN_PATH=$(type -Pf ${BIN})
+		if [ "$?" != "0" ]; then
+			BODY="echo \"*** missing command: ${BIN}\" >&2; return 127"
+		else
+			BODY="${BIN_PATH} \"\$@\"; return \$?"
+		fi
+		FUNC_SRC="${BIN}() {
+		if [ \$ECLASS_DEPTH -gt 0 ]; then
+			eqawarn \"QA Notice: '${BIN}' called in global scope: eclass \${ECLASS}\"
+		else
+			eqawarn \"QA Notice: '${BIN}' called in global scope: \${CATEGORY}/\${PF}\"
+		fi
+		${BODY}
+		}";
+		eval "$FUNC_SRC" || echo "error creating QA interceptor ${BIN}" >&2
+	done
+	unset BIN_PATH BIN BODY FUNC_SRC
+fi
+
+# reset the EBUILD_DEATH_HOOKS so they don't multiple due to stable's re-sourcing of env.
+# this can be left out of ebd variants, since they're unaffected.
+unset EBUILD_DEATH_HOOKS
+
+# *DEPEND and IUSE will be set during the sourcing of the ebuild.  In order to
+# ensure correct interaction between ebuilds and eclasses, they need to be
+# unset before this process of interaction begins.
+unset DEPEND RDEPEND PDEPEND IUSE
+
+source ${EBUILD} || die "error sourcing ebuild"
+if ! hasq depend $EBUILD_PHASE; then
+	RESTRICT="${PORTAGE_RESTRICT}"
+	unset PORTAGE_RESTRICT
+fi
+
+# Expand KEYWORDS
+# We need to turn off pathname expansion for -* in KEYWORDS and
+# we need to escape ~ to avoid tilde expansion
+set -f
+KEYWORDS=$(eval echo ${KEYWORDS//~/\\~})
+set +f
+
+if hasq nostrip ${FEATURES} ${RESTRICT} || hasq strip ${RESTRICT}
+then
+	export DEBUGBUILD=1
+fi
+
+#a reasonable default for $S
+if [ "$S" = "" ]; then
+	export S=${WORKDIR}/${P}
+fi
+
+#wipe the interceptors.  we don't want saved.
+if hasq "depend" "${EBUILD_SH_ARGS}"; then
+	unset -f $QA_INTERCEPTORS
+	unset QA_INTERCEPTORS
+fi
+
+#some users have $TMP/$TMPDIR to a custom dir in their home ...
+#this will cause sandbox errors with some ./configure
+#scripts, so set it to $T.
+export TMP="${T}"
+export TMPDIR="${T}"
+
+# Note: this next line is not the same as export RDEPEND=${RDEPEND:-${DEPEND}}
+# That will test for unset *or* NULL ("").  We want just to set for unset...
+
+#turn off glob expansion from here on in to prevent *'s and ? in the DEPEND
+#syntax from getting expanded :)
+#check eclass rdepends also.
+set -f
+if [ "${RDEPEND-unset}" == "unset" ] ; then
+	export RDEPEND=${DEPEND}
+	debug-print "RDEPEND: not set... Setting to: ${DEPEND}"
+fi
+
+#add in dependency info from eclasses
+IUSE="$IUSE $E_IUSE"
+DEPEND="$DEPEND $E_DEPEND"
+RDEPEND="$RDEPEND $E_RDEPEND"
+PDEPEND="$PDEPEND $E_PDEPEND"
+
+unset E_IUSE E_DEPEND E_RDEPEND E_PDEPEND
+
+if [ "${EBUILD_PHASE}" != "depend" ]; then
+	# Make IUSE defaults backward compatible with all the old shell code.
+	iuse_temp=""
+	for x in ${IUSE} ; do
+		if [[ ${x} == +* ]] || [[ ${x} == -* ]] ; then
+			iuse_temp="${iuse_temp} ${x:1}"
+		else
+			iuse_temp="${iuse_temp} ${x}"
+		fi
+	done
+	export IUSE=${iuse_temp}
+	unset iuse_temp
+	# unset USE_EXPAND variables that contain only the special "*" token
+	for x in ${USE_EXPAND} ; do
+		[ "${!x}" == "*" ] && unset ${x}
+	done
+	unset x
+	# Lock the dbkey variables after the global phase
+	declare -r DEPEND RDEPEND SLOT SRC_URI RESTRICT HOMEPAGE LICENSE DESCRIPTION
+	declare -r KEYWORDS INHERITED IUSE PDEPEND PROVIDE
+fi
+
+set +f
+
+for myarg in ${EBUILD_SH_ARGS} ; do
+	case $myarg in
+	nofetch)
+		qa_call pkg_nofetch
+		exit 1
+		;;
+	prerm|postrm|postinst|config)
+		export SANDBOX_ON="0"
+		if [ "$PORTAGE_DEBUG" != "1" ]; then
+			[ "$(type -t pre_pkg_${myarg})" == "function" ] && qa_call pre_pkg_${myarg}
+			qa_call pkg_${myarg}
+			[ "$(type -t post_pkg_${myarg})" == "function" ] && qa_call post_pkg_${myarg}
+			#Allow non-zero return codes since they can be caused by &&
+		else
+			set -x
+			[ "$(type -t pre_pkg_${myarg})" == "function" ] && qa_call pre_pkg_${myarg}
+			qa_call pkg_${myarg}
+			[ "$(type -t post_pkg_${myarg})" == "function" ] && qa_call post_pkg_${myarg}
+			#Allow non-zero return codes since they can be caused by &&
+			set +x
+		fi
+		;;
+	unpack|compile|test|clean|install)
+		if [ "${SANDBOX_DISABLED="0"}" == "0" ]; then
+			export SANDBOX_ON="1"
+		else
+			export SANDBOX_ON="0"
+		fi
+		if [ "$PORTAGE_DEBUG" != "1" ]; then
+			dyn_${myarg}
+			#Allow non-zero return codes since they can be caused by &&
+		else
+			set -x
+			dyn_${myarg}
+			#Allow non-zero return codes since they can be caused by &&
+			set +x
+		fi
+		export SANDBOX_ON="0"
+		;;
+	help|setup|preinst)
+		#pkg_setup needs to be out of the sandbox for tmp file creation;
+		#for example, awking and piping a file in /tmp requires a temp file to be created
+		#in /etc.  If pkg_setup is in the sandbox, both our lilo and apache ebuilds break.
+		export SANDBOX_ON="0"
+		if [ "$PORTAGE_DEBUG" != "1" ]; then
+			dyn_${myarg}
+		else
+			set -x
+			dyn_${myarg}
+			set +x
+		fi
+		;;
+	depend)
+		export SANDBOX_ON="0"
+		set -f
+
+		if [ -n "${dbkey}" ] ; then
+			if [ ! -d "${dbkey%/*}" ]; then
+				install -d -g ${PORTAGE_GID} -m2775 "${dbkey%/*}"
+			fi
+			# Make it group writable. 666&~002==664
+			umask 002
+		fi
+
+		auxdbkeys="DEPEND RDEPEND SLOT SRC_URI RESTRICT HOMEPAGE LICENSE
+			DESCRIPTION KEYWORDS INHERITED IUSE CDEPEND PDEPEND PROVIDE EAPI
+			UNUSED_01 UNUSED_02 UNUSED_03 UNUSED_04 UNUSED_05 UNUSED_06
+			UNUSED_07"
+
+		#the extra $(echo) commands remove newlines
+		unset CDEPEND
+		[ -n "${EAPI}" ] || EAPI=0
+		if [ -n "${dbkey}" ] ; then
+			> "${dbkey}"
+			for f in ${auxdbkeys} ; do
+				echo $(echo ${!f}) >> "${dbkey}" || exit $?
+			done
+		else
+			for f in ${auxdbkeys} ; do
+				echo $(echo ${!f}) 1>&9 || exit $?
+			done
+			9>&-
+		fi
+		set +f
+		#make sure it is writable by our group:
+		exit 0
+		;;
+	*)
+		export SANDBOX_ON="1"
+		echo "Please specify a valid command."
+		echo
+		dyn_help
+		exit 1
+		;;
+	esac
+
+	#if [ $? -ne 0 ]; then
+	#	exit 1
+	#fi
+done
+
+# Save the env only for relevant phases.
+if [ -n "${myarg}" ] && \
+	[ "${myarg}" != "clean" ] && \
+	[ "${myarg}" != "help" ] ; then
+	# Do not save myarg in the env, or else the above [ -n "$myarg" ] test will
+	# give a false positive when ebuild.sh is sourced.
+	unset myarg
+	# Save current environment and touch a success file. (echo for success)
+	umask 002
+	set | @EGREP@ -v "^SANDBOX_" > "${T}/environment" 2>/dev/null
+	export | @EGREP@ -v "^declare -x SANDBOX_" | \
+		@SED@ 's:^declare -rx:declare -x:' >> "${T}/environment" 2>/dev/null
+	chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} "${T}/environment" &>/dev/null
+	chmod g+w "${T}/environment" &>/dev/null
+fi
+
+# Do not exit when ebuild.sh is sourced by other scripts.
+true
Index: /vendor/prefix-portage/current/bin/ecompress
===================================================================
--- /vendor/prefix-portage/current/bin/ecompress	(revision 3489)
+++ /vendor/prefix-portage/current/bin/ecompress	(revision 3489)
@@ -0,0 +1,71 @@
+#!@BASH@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: prepman 5507 2007-01-10 04:22:27Z zmedico $
+
+source "${PORTAGE_BIN_PATH:-${EPREFIX}/usr/lib/portage/bin}"/isolated-functions.sh
+
+if [[ -z $1 ]] ; then
+	vecho "${0##*/}: at least one argument needed" 1>&2
+	exit 1
+fi
+
+# setup compression stuff
+PORTAGE_COMPRESS=${PORTAGE_COMPRESS-bzip2}
+[[ -z ${PORTAGE_COMPRESS} ]] && exit 0
+
+if [[ ${PORTAGE_COMPRESS_FLAGS+set} != "set" ]] ; then
+	case ${PORTAGE_COMPRESS} in
+		bzip2|gzip)  PORTAGE_COMPRESS_FLAGS="-9";;
+	esac
+fi
+
+case $1 in
+	--suffix)
+		[[ -n $2 ]] && vecho "${0##*/}: --suffix takes no additional arguments" 1>&2
+
+		set -e
+		tmpdir="${T}"/.ecompress$$.${RANDOM}
+		mkdir "${tmpdir}"
+		cd "${tmpdir}"
+		# we have to fill the file enough so that there is something
+		# to compress as some programs will refuse to do compression
+		# if it cannot actually compress the file
+		echo {0..1000} > compressme
+		${PORTAGE_COMPRESS} ${PORTAGE_COMPRESS_FLAGS} compressme > /dev/null
+		suffix=$(ls compressme*)
+		suffix=${suffix#compressme}
+		cd /
+		rm -rf "${tmpdir}"
+		echo "${suffix}"
+		;;
+	--bin)
+		[[ -n $2 ]] && vecho "${0##*/}: --bin takes no additional arguments" 1>&2
+
+		echo "${PORTAGE_COMPRESS} ${PORTAGE_COMPRESS_FLAGS}"
+		;;
+	--queue)
+		shift
+		exec touch "${@/%/.ecompress.file}"
+		;;
+	--dequeue)
+		[[ -n $2 ]] && vecho "${0##*/}: --dequeue takes no additional arguments" 1>&2
+		find "${ED}" -name '*.ecompress.file' -print0 \
+			| sed -e 's:\.ecompress\.file::g' \
+			| ${XARGS} -0 ecompress
+		find "${ED}" -name '*.ecompress.file' -print0 | ${XARGS} -0 rm -f
+		;;
+	--*)
+		vecho "${0##*/}: unknown arguments '$*'" 1>&2
+		exit 1
+		;;
+	*)
+		# If a compressed version of the file already exists, simply
+		# delete it so that the compressor doesn't whine (bzip2 will
+		# complain and skip, gzip will prompt for input)
+		suffix=$(ecompress --suffix)
+		[[ -n ${suffix} ]] && rm -f "${@/%/${suffix}}"
+		# Finally, let's actually do some real work
+		exec "${PORTAGE_COMPRESS}" ${PORTAGE_COMPRESS_FLAGS} "$@"
+		;;
+esac
Index: /vendor/prefix-portage/current/bin/ecompressdir
===================================================================
--- /vendor/prefix-portage/current/bin/ecompressdir	(revision 3489)
+++ /vendor/prefix-portage/current/bin/ecompressdir	(revision 3489)
@@ -0,0 +1,135 @@
+#!@BASH@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: prepalldocs 3483 2006-06-10 21:40:40Z genone $
+
+source "${PORTAGE_BIN_PATH:-${EPREFIX}/usr/lib/portage/bin}"/isolated-functions.sh
+
+if [[ -z $1 ]] ; then
+	vecho "${0##*/}: at least one argument needed" 1>&2
+	exit 1
+fi
+
+case $1 in
+	--ignore)
+		shift
+		for skip in "$@" ; do
+			[[ -d ${ED}${skip} ]] && touch "${ED}${skip}.ecompress.skip"
+		done
+		exit 0
+		;;
+	--queue)
+		shift
+		set -- "${@/%/.ecompress.dir}"
+		set -- "${@/#/${ED}}"
+		exec touch "$@"
+		;;
+	--dequeue)
+		[[ -n $2 ]] && vecho "${0##*/}: --dequeue takes no additional arguments" 1>&2
+		find "${ED}" -name '*.ecompress.dir' -print0 \
+			| sed -e 's:\.ecompress\.dir::g' -e "s:${ED}:/:g" \
+			| ${XARGS} -0 ecompressdir
+		find "${ED}" -name '*.ecompress.skip' -print0 | ${XARGS} -0 rm -f
+		exit 0
+		;;
+	--*)
+		vecho "${0##*/}: unknown arguments '$*'"
+		exit 1
+		;;
+esac
+
+# figure out the new suffix
+suffix=$(ecompress --suffix)
+
+# funk_up_dir(action, suffix, binary)
+#	- action: compress or decompress
+#	- suffix: the compression suffix to work with
+#	- binary: the program to execute that'll compress/decompress
+# The directory we act on is implied in the ${dir} variable
+funk_up_dir() {
+	local act=$1 suffix=$2 binary=$3
+
+	local negate=""
+	[[ ${act} == "compress" ]] && negate="!"
+
+	# first we act on all the files
+	find "${dir}" -type f ${negate} -iname '*'${suffix} -print0 | ${XARGS} -0 ${binary}
+	((ret+=$?))
+
+	find "${dir}" -type l -print0 | \
+	while read -d $'\0' brokenlink ; do
+		[[ -e ${brokenlink} ]] && continue
+		olddest=$(readlink "${brokenlink}")
+		[[ ${act} == "compress" ]] \
+			&& newdest="${olddest}${suffix}" \
+			|| newdest="${olddest%${suffix}}"
+		rm -f "${brokenlink}"
+		[[ ${act} == "compress" ]] \
+			&& ln -snf "${newdest}" "${brokenlink}${suffix}" \
+			|| ln -snf "${newdest}" "${brokenlink%${suffix}}"
+		((ret+=$?))
+	done
+}
+
+# _relocate_skip_dirs(srctree, dsttree)
+# Move all the directories we want to skip running compression
+# on from srctree to dsttree.
+_relocate_skip_dirs() {
+	local srctree="$1" dsttree="$2"
+
+	[[ -d ${srctree} ]] || return 0
+
+	find "${srctree}" -name '*.ecompress.skip' -print0 | \
+	while read -d $'\0' src ; do
+		src=${src%.ecompress.skip}
+		dst="${dsttree}${src#${srctree}}"
+		parent=${dst%/*}
+		mkdir -p "${parent}"
+		mv "${src}" "${dst}"
+		mv "${src}.ecompress.skip" "${dst}.ecompress.skip"
+	done
+}
+hide_skip_dirs()    { _relocate_skip_dirs "${ED}" "${T}"/ecompress-skip/ ; }
+restore_skip_dirs() { _relocate_skip_dirs "${T}"/ecompress-skip/ "${ED}" ; }
+
+ret=0
+
+rm -rf "${T}"/ecompress-skip
+
+for dir in "$@" ; do
+	dir="${ED}${dir}"
+	if [[ ! -d ${dir} ]] ; then
+		vecho "${0##*/}: ${dir#${ED}} does not exist!"
+		continue
+	fi
+	cd "${dir}"
+	actual_dir=${dir}
+	dir=. # use relative path to avoid 'Argument list too long' errors
+
+	# hide all the stuff we want to skip
+	hide_skip_dirs "${dir}"
+
+	# since we've been requested to compress the whole dir,
+	# delete any individual queued requests
+	rm -f "${actual_dir}.ecompress.dir"
+	find "${dir}" -type f -name '*.ecompress.file' -print0 | ${XARGS} -0 rm -f
+
+	# not uncommon for packages to compress doc files themselves
+	funk_up_dir "decompress" ".Z" "gunzip -f"
+	funk_up_dir "decompress" ".gz" "gunzip -f"
+	funk_up_dir "decompress" ".bz2" "bunzip2 -f"
+
+	# forcibly break all hard links as some compressors whine about it
+	find "${dir}" -type f -links +1 -exec env file="{}" sh -c \
+		'cp -p "${file}" "${file}.ecompress.break" ; mv -f "${file}.ecompress.break" "${file}"' \;
+
+	# now lets do our work
+	[[ -z ${suffix} ]] && continue
+	vecho "${0##*/}: $(ecompress --bin) ${actual_dir#${D}}"
+	funk_up_dir "compress" "${suffix}" "ecompress"
+
+	# finally, restore the skipped stuff
+	restore_skip_dirs
+done
+
+exit ${ret}
Index: /vendor/prefix-portage/current/bin/emaint
===================================================================
--- /vendor/prefix-portage/current/bin/emaint	(revision 3489)
+++ /vendor/prefix-portage/current/bin/emaint	(revision 3489)
@@ -0,0 +1,438 @@
+#!@PYTHON@ -O
+
+import sys, os, time, signal
+from optparse import OptionParser, OptionValueError
+if not hasattr(__builtins__, "set"):
+	from sets import Set as set
+import re
+try:
+	import portage
+except ImportError:
+	from os import path as osp
+	sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
+	import portage
+
+import portage.const, portage.exception, portage.output
+class WorldHandler(object):
+
+	def name():
+		return "world"
+	name = staticmethod(name)
+
+	def __init__(self):
+		self.invalid = []
+		self.not_installed = []
+		self.invalid_category = []
+		self.okay = []
+
+	def _check_world(self, onProgress):
+		categories = set(portage.settings.categories)
+		myroot = portage.settings["ROOT"]
+		self.world_file = os.path.join(myroot, portage.const.WORLD_FILE)
+		self.found = os.access(self.world_file, os.R_OK)
+		vardb = portage.db[myroot]["vartree"].dbapi
+
+		world_atoms = open(self.world_file).read().split()
+		maxval = len(world_atoms)
+		if onProgress:
+			onProgress(maxval, 0)
+		for i, atom in enumerate(world_atoms):
+			if not portage.isvalidatom(atom):
+				self.invalid.append(atom)
+				if onProgress:
+					onProgress(maxval, i+1)
+				continue
+			okay = True
+			if not vardb.match(atom):
+				self.not_installed.append(atom)
+				okay = False
+			if portage.catsplit(atom)[0] not in categories:
+				self.invalid_category.append(atom)
+				okay = False
+			if okay:
+				self.okay.append(atom)
+			if onProgress:
+				onProgress(maxval, i+1)
+
+	def check(self, onProgress=None):
+		self._check_world(onProgress)
+		errors = []
+		if self.found:
+			errors += map(lambda x: "'%s' is not a valid atom" % x, self.invalid)
+			errors += map(lambda x: "'%s' is not installed" % x, self.not_installed)
+			errors += map(lambda x: "'%s' has a category that is not listed in /etc/portage/categories" % x, self.invalid_category)
+		else:
+			errors.append(self.world_file + " could not be opened for reading")
+		return errors
+
+	def fix(self, onProgress=None):
+		self._check_world(onProgress)
+		errors = []
+		try:
+			portage.write_atomic(self.world_file, "\n".join(self.okay))
+		except portage.exception.PortageException:
+			errors.append(self.world_file + " could not be opened for writing")
+		return errors
+
+class BinhostHandler(object):
+
+	def name():
+		return "binhost"
+	name = staticmethod(name)
+
+	def __init__(self):
+		myroot = portage.settings["ROOT"]
+		self._bintree = portage.db[myroot]["bintree"]
+		self._bintree.populate()
+		self._pkgindex_file = os.path.join(self._bintree.pkgdir, "Packages")
+		from portage import getbinpkg
+		self._pkgindex = getbinpkg.PackageIndex()
+		f = open(self._pkgindex_file, 'r')
+		try:
+			self._pkgindex.read(f)
+		finally:
+			f.close()
+
+	def check(self, onProgress=None):
+		missing = []
+		cpv_all = self._bintree.dbapi.cpv_all()
+		cpv_all.sort()
+		maxval = len(cpv_all)
+		if onProgress:
+			onProgress(maxval, 0)
+		pkgindex = self._pkgindex
+		missing = []
+		for i, cpv in enumerate(cpv_all):
+			d = pkgindex.packages.get(cpv)
+			if not d or "MD5" not in d:
+				missing.append(cpv)
+			if onProgress:
+				onProgress(maxval, i+1)
+		errors = ["'%s' is not in Packages" % cpv for cpv in missing]
+		stale = set(pkgindex.packages).difference(cpv_all)
+		for cpv in stale:
+			errors.append("'%s' is not in the repository" % cpv)
+		return errors
+
+	def fix(self, onProgress=None):
+		bintree = self._bintree
+		cpv_all = self._bintree.dbapi.cpv_all()
+		cpv_all.sort()
+		missing = []
+		maxval = len(cpv_all)
+		if onProgress:
+			onProgress(maxval, 0)
+		pkgindex = self._pkgindex
+		missing = []
+		for i, cpv in enumerate(cpv_all):
+			d = pkgindex.packages.get(cpv)
+			if not d or "MD5" not in d:
+				bintree.inject(cpv)
+			if onProgress:
+				onProgress(maxval, i+1)
+		stale = set(pkgindex.packages).difference(cpv_all)
+		if stale:
+			from portage import locks
+			pkgindex_lock = locks.lockfile(
+				self._pkgindex_file, wantnewlockfile=1)
+			try:
+				from portage import getbinpkg
+				del pkgindex
+				self._pkgindex = getbinpkg.PackageIndex()
+				f = open(self._pkgindex_file, 'r')
+				try:
+					self._pkgindex.read(f)
+				finally:
+					f.close()
+				from portage.dbapi.bintree import binarytree
+				self._bintree = binarytree(bintree.root, bintree.pkgdir,
+					settings=bintree.settings)
+				del bintree
+				portage.db[self._bintree.root]["bintree"] = self._bintree
+				self._bintree._populate()
+				for cpv in set(self._pkgindex.packages).difference(
+					self._bintree.dbapi.cpv_all()):
+					del self._pkgindex.packages[cpv]
+				from portage.util import atomic_ofstream
+				f = atomic_ofstream(self._pkgindex_file)
+				try:
+					self._pkgindex.write(f)
+				finally:
+					f.close()
+			finally:
+				locks.unlockfile(pkgindex_lock)
+		return None
+
+class MoveHandler(object):
+
+	def __init__(self, tree):
+		self._tree = tree
+		self._portdir = tree.settings["PORTDIR"]
+		self._update_keys = ["DEPEND", "RDEPEND", "PDEPEND", "PROVIDE"]
+
+	def _grab_global_updates(self, portdir):
+		from portage.update import grab_updates, parse_updates
+		updpath = os.path.join(portdir, "profiles", "updates")
+		try:
+			rawupdates = grab_updates(updpath)
+		except portage.exception.DirectoryNotFound:
+			rawupdates = []
+		upd_commands = []
+		errors = []
+		for mykey, mystat, mycontent in rawupdates:
+			commands, errors = parse_updates(mycontent)
+			upd_commands.extend(commands)
+			errors.extend(errors)
+		return upd_commands, errors
+
+	def check(self, onProgress=None):
+		updates, errors = self._grab_global_updates(self._portdir)
+		# Matching packages and moving them is relatively fast, so the
+		# progress bar is updated in indeterminate mode.
+		match = self._tree.dbapi.match
+		aux_get = self._tree.dbapi.aux_get
+		if onProgress:
+			onProgress(0, 0)
+		for i, update_cmd in enumerate(updates):
+			if update_cmd[0] == "move":
+				origcp, newcp = update_cmd[1:]
+				for cpv in match(origcp):
+					errors.append("'%s' moved to '%s'" % (cpv, newcp))
+			elif update_cmd[0] == "slotmove":
+				pkg, origslot, newslot = update_cmd[1:]
+				for cpv in match(pkg):
+					slot = aux_get(cpv, ["SLOT"])[0]
+					if slot == origslot:
+						errors.append("'%s' slot moved from '%s' to '%s'" % \
+							(cpv, origslot, newslot))
+			if onProgress:
+				onProgress(0, 0)
+
+		# Searching for updates in all the metadata is relatively slow, so this
+		# is where the progress bar comes out of indeterminate mode.
+		cpv_all = self._tree.dbapi.cpv_all()
+		cpv_all.sort()
+		maxval = len(cpv_all)
+		aux_update = self._tree.dbapi.aux_update
+		update_keys = self._update_keys
+		from itertools import izip
+		from portage.update import update_dbentries
+		if onProgress:
+			onProgress(maxval, 0)
+		for i, cpv in enumerate(cpv_all):
+			metadata = dict(izip(update_keys, aux_get(cpv, update_keys)))
+			metadata_updates = update_dbentries(updates, metadata)
+			if metadata_updates:
+				errors.append("'%s' has outdated metadata" % cpv)
+			if onProgress:
+				onProgress(maxval, i+1)
+		return errors
+
+	def fix(self, onProgress=None):
+		updates, errors = self._grab_global_updates(self._portdir)
+		# Matching packages and moving them is relatively fast, so the
+		# progress bar is updated in indeterminate mode.
+		move = self._tree.dbapi.move_ent
+		slotmove = self._tree.dbapi.move_slot_ent
+		if onProgress:
+			onProgress(0, 0)
+		for i, update_cmd in enumerate(updates):
+			if update_cmd[0] == "move":
+				move(update_cmd)
+			elif update_cmd[0] == "slotmove":
+				slotmove(update_cmd)
+			if onProgress:
+				onProgress(0, 0)
+
+		# Searching for updates in all the metadata is relatively slow, so this
+		# is where the progress bar comes out of indeterminate mode.
+		self._tree.dbapi.update_ents(updates, onProgress=onProgress)
+		return errors
+
+class MoveInstalled(MoveHandler):
+	def name():
+		return "moveinst"
+	name = staticmethod(name)
+	def __init__(self):
+		myroot = portage.settings["ROOT"]
+		MoveHandler.__init__(self, portage.db[myroot]["vartree"])
+
+class MoveBinary(MoveHandler):
+	def name():
+		return "movebin"
+	name = staticmethod(name)
+	def __init__(self):
+		myroot = portage.settings["ROOT"]
+		MoveHandler.__init__(self, portage.db[myroot]["bintree"])
+
+class VdbKeyHandler(object):
+	def name():
+		return "vdbkeys"
+	name = staticmethod(name)
+
+	def __init__(self):
+		self.list = portage.db["/"]["vartree"].dbapi.cpv_all()
+		self.missing = []
+		self.keys = ["HOMEPAGE", "SRC_URI", "KEYWORDS", "DESCRIPTION"]
+		
+		for p in self.list:
+			mydir = os.path.join(os.sep, portage.settings["ROOT"], portage.const.VDB_PATH, p)+os.sep
+			ismissing = True
+			for k in self.keys:
+				if os.path.exists(mydir+k):
+					ismissing = False
+					break
+			if ismissing:
+				self.missing.append(p)
+		
+	def check(self):
+		return ["%s has missing keys" % x for x in self.missing]
+	
+	def fix(self):
+	
+		errors = []
+	
+		for p in self.missing:
+			mydir = os.path.join(os.sep, portage.settings["ROOT"], portage.const.VDB_PATH, p)+os.sep
+			if not os.access(mydir+"environment.bz2", os.R_OK):
+				errors.append("Can't access %s" % (mydir+"environment.bz2"))
+			elif not os.access(mydir, os.W_OK):
+				errors.append("Can't create files in %s" % mydir)
+			else:
+				env = os.popen("bzip2 -dcq "+mydir+"environment.bz2", "r")
+				envlines = env.read().split("\n")
+				env.close()
+				for k in self.keys:
+					s = [l for l in envlines if l.startswith(k+"=")]
+					if len(s) > 1:
+						errors.append("multiple matches for %s found in %senvironment.bz2" % (k, mydir))
+					elif len(s) == 0:
+						s = ""
+					else:
+						s = s[0].split("=",1)[1]
+						s = s.lstrip("$").strip("\'\"")
+						s = re.sub("(\\\\[nrt])+", " ", s)
+						s = " ".join(s.split()).strip()
+						if s != "":
+							try:
+								keyfile = open(mydir+os.sep+k, "w")
+								keyfile.write(s+"\n")
+								keyfile.close()
+							except (IOError, OSError), e:
+								errors.append("Could not write %s, reason was: %s" % (mydir+k, e))
+		
+		return errors
+
+class ProgressHandler(object):
+	def __init__(self):
+		self.curval = 0
+		self.maxval = 0
+		self.last_update = 0
+		self.min_display_latency = 0.2
+
+	def onProgress(self, maxval, curval):
+		self.maxval = maxval
+		self.curval = curval
+		cur_time = time.time()
+		if cur_time - self.last_update >= self.min_display_latency:
+			self.last_update = cur_time
+			self.display()
+
+	def display(self):
+		raise NotImplementedError(self)
+
+def emaint_main(myargv):
+
+	# TODO: Create a system that allows external modules to be added without
+	#       the need for hard coding.
+	modules = {
+		"world" : WorldHandler,
+		"binhost":BinhostHandler,
+		"moveinst":MoveInstalled,
+		"movebin":MoveBinary
+	}
+
+	module_names = modules.keys()
+	module_names.sort()
+	module_names.insert(0, "all")
+
+	def exclusive(option, *args, **kw):
+		var = kw.get("var", None)
+		if var is None:
+			raise ValueError("var not specified to exclusive()")
+		if getattr(parser, var, ""):
+			raise OptionValueError("%s and %s are exclusive options" % (getattr(parser, var), option))
+		setattr(parser, var, str(option))
+
+
+	usage = "usage: emaint [options] " + " | ".join(module_names)
+
+	usage+= "\n\nCurrently emaint can only check and fix problems with one's world\n"
+	usage+= "file.  Future versions will integrate other portage check-and-fix\n"
+	usage+= "tools and provide a single interface to system health checks."
+
+
+	parser = OptionParser(usage=usage)
+	parser.add_option("-c", "--check", help="check for problems",
+		action="callback", callback=exclusive, callback_kwargs={"var":"action"})
+	parser.add_option("-f", "--fix", help="attempt to fix problems",
+		action="callback", callback=exclusive, callback_kwargs={"var":"action"})
+	parser.action = None
+
+
+	(options, args) = parser.parse_args(args=myargv)
+	if len(args) != 1:
+		parser.error("Incorrect number of arguments")
+	if args[0] not in module_names:
+		parser.error("%s target is not a known target" % args[0])
+
+	if parser.action:
+		action = parser.action
+	else:
+		print "Defaulting to --check"
+		action = "-c/--check"
+
+	if args[0] == "all":
+		tasks = modules.values()
+	else:
+		tasks = [modules[args[0]]]
+
+
+	if action == "-c/--check":
+		status = "Checking %s for problems"
+		func = "check"
+	else:
+		status = "Attempting to fix %s"
+		func = "fix"
+
+	isatty = sys.stdout.isatty()
+	for task in tasks:
+		print status % task.name()
+		inst = task()
+		onProgress = None
+		if isatty:
+			progressBar = portage.output.TermProgressBar()
+			progressHandler = ProgressHandler()
+			onProgress = progressHandler.onProgress
+			def display():
+				progressBar.set(progressHandler.curval, progressHandler.maxval)
+			progressHandler.display = display
+			def sigwinch_handler(signum, frame):
+				lines, progressBar.term_columns = \
+					portage.output.get_term_size()
+			signal.signal(signal.SIGWINCH, sigwinch_handler)
+		result = getattr(inst, func)(onProgress=onProgress)
+		if isatty:
+			# make sure the final progress is displayed
+			progressHandler.display()
+			print
+			signal.signal(signal.SIGWINCH, signal.SIG_DFL)
+		if result:
+			print
+			print "\n".join(result)
+			print "\n"
+
+	print "Finished"
+
+if __name__ == "__main__":
+	emaint_main(sys.argv[1:])
Index: /vendor/prefix-portage/current/bin/emake
===================================================================
--- /vendor/prefix-portage/current/bin/emake	(revision 3489)
+++ /vendor/prefix-portage/current/bin/emake	(revision 3489)
@@ -0,0 +1,14 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/emake,v 1.9.2.1 2005/05/18 15:19:52 jstubbs Exp $
+#
+# emake: Supplies some default parameters to GNU make. At the moment the
+#        only parameter supplied is -jN, where N is a number of
+#        parallel processes that should be ideal for the running host
+#        (e.g. on a single-CPU machine, N=2).  The MAKEOPTS variable
+#        is set in /etc/make.globals.  We don't source
+#        /etc/make.globals here because emake is only called from an
+#        ebuild.
+
+exec ${MAKE:-make} ${MAKEOPTS} ${EXTRA_EMAKE} "$@"
Index: /vendor/prefix-portage/current/bin/emerge
===================================================================
--- /vendor/prefix-portage/current/bin/emerge	(revision 3489)
+++ /vendor/prefix-portage/current/bin/emerge	(revision 3489)
@@ -0,0 +1,16 @@
+#!@PYTHON@
+# Copyright Gentoo Foundation 2006
+# Portage Emerge bits
+# $Id$
+
+try:
+	from emerge import *
+except ImportError:
+	from os import path as osp
+	import sys
+	sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
+	from emerge import *
+
+if __name__ == "__main__":
+	import sys
+	sys.exit(emerge_main())
Index: /vendor/prefix-portage/current/bin/emerge-webrsync
===================================================================
--- /vendor/prefix-portage/current/bin/emerge-webrsync	(revision 3489)
+++ /vendor/prefix-portage/current/bin/emerge-webrsync	(revision 3489)
@@ -0,0 +1,164 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+# Author: Karl Trygve Kalleberg <karltk@gentoo.org>
+# Rewritten from the old, Perl-based emerge-webrsync script
+
+type portageq > /dev/null || exit $?
+eval $(portageq envvar -v FEATURES FETCHCOMMAND GENTOO_MIRRORS \
+	PORTAGE_BIN_PATH PORTAGE_INST_UID PORTAGE_INST_GID PORTAGE_NICENESS \
+	PORTAGE_TMPDIR PORTDIR PORTAGE_RSYNC_EXTRA_OPTS EPREFIX)
+DISTDIR="${PORTAGE_TMPDIR}/emerge-webrsync"
+
+# If PORTAGE_NICENESS is overriden via the env then it will
+# still pass through the portageq call and override properly.
+if [ -n "${PORTAGE_NICENESS}" ]; then
+	renice $PORTAGE_NICENESS $$ > /dev/null
+fi
+
+source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
+
+if [ ! -d $DISTDIR ] ; then
+	mkdir -p $DISTDIR
+fi
+
+cd "$DISTDIR"
+
+found=0
+if [ "$1" == "-v" ] ; then
+	wgetops=
+else	
+	#this sucks.  probably better to do 1> /dev/null
+	#that said, waiting on the refactoring.
+	if [ "${FETCHCOMMAND/wget}" != "${FETCHCOMMAND}" ]; then
+		wgetops="-q"
+	elif [ "${FETCHCOMMAND/curl}" != "${FETCHCOMMAND}" ]; then
+		wgetops="-s -f"
+	fi
+fi
+
+if type -P md5sum > /dev/null; then
+	md5_com='md5sum -c "${FILE}.md5sum"'
+elif type -P md5 > /dev/null; then
+	md5_com='[ "$(md5 -q ${FILE})" == "$(cut -d \  -f 1 ${FILE}.md5sum)" ]'
+else
+	echo "warning, unable to do md5 verification of the snapshot!"
+	echo "no suitable md5/md5sum binary was found!"
+	md5_com='true'
+fi
+
+sync_local() {
+	echo Syncing local tree...
+	if type -P tarsync &> /dev/null; then
+		# tarsync doesn't take numeric uid/gid so we need to convert them.
+		local inst_user="$(python -c "import pwd; print pwd.getpwuid(int('${PORTAGE_INST_UID:-0}'))[0]")"
+		local inst_group="$(python -c "import grp; print grp.getgrgid(int('${PORTAGE_INST_GID:-0}'))[0]")"
+		if ! tarsync "${FILE}" "${PORTDIR}" -v -s 1 -o ${inst_user} -g ${inst_group} -e /distfiles -e /packages -e /local; then
+			echo "tarsync failed; tarball is corrupt?"
+			exit 1;
+		fi
+		rm "${FILE}"
+	else
+		if ! tar jxf $FILE; then
+			echo "Tar failed to extract the image. Please review the output."
+			echo "Executed command: tar jxf $FILE"
+			exit 1
+		fi
+		rm -f $FILE
+		# Make sure user and group file ownership is ${PORTAGE_INST_UID}:${PORTAGE_INST_GID}
+		chown -R ${PORTAGE_INST_UID:-0}:${PORTAGE_INST_GID:-0} portage
+		cd portage
+		rsync -av --progress --stats --delete --delete-after \
+		--exclude='/distfiles' --exclude='/packages' \
+		--exclude='/local' ${PORTAGE_RSYNC_EXTRA_OPTS} . ${PORTDIR%%/}
+		cd ..
+		echo "cleaning up"
+		rm -rf portage
+	fi
+	if hasq metadata-transfer ${FEATURES} ; then
+		echo "transferring metadata/cache"
+		emerge --metadata
+	fi
+	[ -x "${EPREFIX}"/etc/portage/bin/post_sync ] && "${EPREFIX}"/etc/portage/bin/post_sync
+}
+
+echo "Fetching most recent snapshot"
+
+declare -i attempts=0
+while (( $attempts <  40 )) ; do
+	attempts=$(( attempts + 1 ))
+
+	# The snapshot for a given day is generated at 01:45 UTC on the following
+	# day, so the current day's snapshot (going by UTC time) hasn't been
+	# generated yet.  Therefore, always start by looking for the previous day's
+	# snapshot (for attempts=1, subtract 1 day from the current UTC time).
+	daysbefore=$(expr $(date -u +"%s") - 86400 \* ${attempts})
+	DATE_ARGS="-d @${daysbefore}"
+	# ${USERLAND} is unreliable since the portage tree might be empty, so test
+	# success of the -r option to distinguish between gnu and bsd date.
+	date -r ${daysbefore} >&/dev/null && DATE_ARGS="-r ${daysbefore}"
+	day=$(date ${DATE_ARGS} -u +"%d")
+	month=$(date ${DATE_ARGS} -u +"%m")
+	year=$(date ${DATE_ARGS} -u +"%Y")
+
+	FILE_ORIG="portage-${year}${month}${day}.tar.bz2"
+
+	echo "Attempting to fetch file dated: ${year}${month}${day}"
+		
+	got_md5=0
+
+	if [  ! -e "${FILE_ORIG}.md5sum" ]; then
+		FILE="${FILE_ORIG}.md5sum"
+		for i in $GENTOO_MIRRORS ; do 
+			URI="${i}/snapshots/${FILE}"
+			if (eval "$FETCHCOMMAND $wgetops") && [ -s "${FILE}" ]; then
+				got_md5=1
+				break
+			fi
+		done
+	else
+		got_md5=1
+	fi
+	FILE="${FILE_ORIG}"
+
+	if (($got_md5 == 0 )); then
+		echo " --- No md5sum present on the mirror. (Not yet available.)"
+		continue
+	elif [ -s "${FILE}" ]; then
+		if eval "$md5_com"; then
+			echo " === snapshot $FILE is correct, using it"
+			sync_local
+			echo
+			echo " === Snapshot has been sync'd"
+			echo
+			exit 0
+		else
+			rm $FILE
+		fi
+	fi
+	
+	for i in $GENTOO_MIRRORS ; do
+		URI="${i}/snapshots/$FILE"
+		rm -f "$FILE"
+		if (eval "$FETCHCOMMAND $wgetops") && [ -s "$FILE" ]; then
+			if ! eval "$md5_com"; then
+				echo "md5 failed on $FILE"
+				rm ${FILE}
+				continue
+			else
+				sync_local
+				echo
+				echo " *** Completed websync, please now perform a normal rsync if possible."
+				echo "     Update is current as of the of YYYYMMDD: ${year}${month}${day}"
+				echo
+				exit 0
+			fi
+		fi
+
+	done
+done
+
+rm -rf portage
+
+exit 1
Index: /vendor/prefix-portage/current/bin/env-update
===================================================================
--- /vendor/prefix-portage/current/bin/env-update	(revision 3489)
+++ /vendor/prefix-portage/current/bin/env-update	(revision 3489)
@@ -0,0 +1,39 @@
+#!@PYTHON@ -O
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/env-update,v 1.9 2004/10/04 13:56:50 vapier Exp $
+
+import os, sys, errno
+
+def usage(status):
+	print "Usage: env-update [--no-ldconfig]"
+	print ""
+	print "See the env-update(1) man page for more info"
+	sys.exit(status)
+
+if "-h" in sys.argv or "--help" in sys.argv:
+	usage(0)
+
+makelinks=1
+if "--no-ldconfig" in sys.argv:
+	makelinks=0
+	sys.argv.pop(sys.argv.index("--no-ldconfig"))
+
+if len(sys.argv) > 1:
+	print "!!! Invalid command line options!\n"
+	usage(1)
+
+try:
+	import portage
+except ImportError:
+	from os import path as osp
+	sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
+	import portage
+try:
+	portage.env_update(makelinks)
+except IOError, e:
+	if e.errno == errno.EACCES:
+		print "env-update: Need superuser access"
+		sys.exit(1)
+	else:
+		raise
Index: /vendor/prefix-portage/current/bin/env-update.sh
===================================================================
--- /vendor/prefix-portage/current/bin/env-update.sh	(revision 3489)
+++ /vendor/prefix-portage/current/bin/env-update.sh	(revision 3489)
@@ -0,0 +1,219 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/env-update.sh,v 1.2 2004/10/04 13:56:50 vapier Exp $
+
+############################################
+############################################
+# ENVIRONMENT SETUP
+############################################
+
+if [[ ${EUID} -ne 0 ]] ; then
+	echo "$0: must be root."
+	exit 1
+fi
+
+# Make sure our environment is sane
+if [[ ! -z "${MAKELINKS}" ]] ; then
+	export MAKELINKS=0
+else
+	export MAKELINKS=1
+fi
+export ROOT="${ROOT:=/}"
+[[ ${ROOT} == */ ]] || export ROOT="${ROOT}/"
+
+export ENVDIR="${EROOT}etc/env.d"
+mkdir -p ${ENVDIR}
+chmod 755 ${ENVDIR}
+specials="
+	KDEDIRS PATH CLASSPATH LDPATH MANPATH INFODIR INFOPATH ROOTPATH
+	CONFIG_PROTECT CONFIG_PROTECT_MASK PRELINK_PATH PYTHONPATH
+	PRELINK_PATH_MASK ADA_INCLUDE_PATH ADA_OBJECTS_PATH"
+colon_separated="
+	ADA_INCLUDE_PATH ADA_OBJECTS_PATH LDPATH PATH MANPATH ROOTPATH
+	PRELINK_PATH PRELINK_PATH_MASK PYTHON_PATH"
+
+export LDSOCONF="${EROOT}etc/ld.so.conf"
+
+export PRELINKCONF="${EROOT}etc/prelink.conf"
+defaultprelinkpaths=":/bin:/sbin:/usr/bin:/usr/sbin:/lib:/usr/lib"
+
+export PROFILEENV="${EROOT}etc/profile.env"
+export CSHENV="${EROOT}etc/csh.env"
+
+# make sure we aren't tricked with previous 'my_envd_' variables
+unset $(set | grep '^my_envd_' | cut -d= -f1)
+
+############################################
+############################################
+# ENV.D PARSING
+############################################
+
+do_has() {
+	local x
+	local me="$1"
+	shift
+
+	for x in "$@" ; do
+		[[ ${x} == ${me} ]] && return 0
+	done
+	return 1
+}
+has() {
+	local ret
+	local ifs="${IFS}"
+	unset IFS
+	do_has $1 ${!2}
+	ret=$?
+	export IFS="${ifs}"
+	return ${ret}
+}
+is_special() {
+	has $1 specials
+}
+is_colon_separated() {
+	has $1 colon_separated
+}
+
+for envd in $(ls ${ENVDIR} | sort) ; do
+	# make sure file is a vaild env'd entry and not a backup file
+	num="${envd:0:2}"
+	if [[ ! -z ${num//[0-9]} ]] ; then
+		continue
+	elif [[ ${envd} == *~ || ${envd} == *.bak ]] ; then
+		continue
+	fi
+
+	# use bash to make sure the file is valid
+	envd="${ENVDIR}/${envd}"
+	if ! (source "${envd}") ; then
+		echo "!!! Error parsing ${envd}!"
+		exit 1
+	fi
+
+	# parse env.d entries
+	cnfvars="$(grep '^[[:alpha:]_][[:alnum:]_]*=' "${envd}")"
+	export IFS=$'\n'
+	for cnfv in ${cnfvars} ; do
+		var="${cnfv/=*}"
+		val="${cnfv:${#var}+1}"
+		if [ "${val:0:1}" == "\"" ] ; then
+			val="${val:1:${#val}-2}"
+		fi
+		myvar="my_envd_${var}"
+		if is_special ${var} ; then
+			if [[ ! -z "${!myvar}" ]] ; then
+				if is_colon_separated ${var} ; then
+					sep=":"
+				else
+					sep=" "
+				fi
+			else
+				sep=""
+			fi
+			export ${myvar}="${!myvar}${sep}${val}"
+		else
+			export ${myvar}="${val}"
+		fi
+	done
+	unset IFS
+done
+
+############################################
+############################################
+# LD.SO.CONF HANDLING
+############################################
+
+# create a : sep list from ld.so.conf
+export OLD_LDPATH=""
+if [ -s "${LDSOCONF}" ] ; then
+	while read line ; do
+		if [[ "${line:0:1}" == "#" ]] ; then
+			continue
+		fi
+		export OLD_LDPATH="${OLD_LDPATH}:${line}"
+	done < ${LDSOCONF}
+	export OLD_LDPATH="${OLD_LDPATH:1}"
+fi
+
+# has the ldpath changed ?  if so, recreate
+if [[ "${OLD_LDPATH}" != "${my_envd_LDPATH}" ]] ; then
+	cat << EOF > ${LDSOCONF}
+# ld.so.conf autogenerated by env-update; make all changes to
+# contents of /etc/env.d directory
+${my_envd_LDPATH//:/
+}
+EOF
+fi
+
+############################################
+############################################
+# HANDLE PRELINK PATHS
+############################################
+
+if prelink --version >& /dev/null ; then
+	# we assume LDPATH and PATH aren't empty ... if they were, we got other problems
+	envdprelinkcheckpaths="${my_envd_LDPATH}:${my_envd_PATH}"
+	if [[ ! -z "${my_envd_PRELINK_PATH}" ]] ; then
+		envdprelinkcheckpaths="${envdprelinkcheckpaths}:${my_envd_PRELINK_PATH}"
+	fi
+
+	if [[ ! -z "${my_envd_PRELINK_PATH_MASK}" ]] ; then
+		export prelink_mask=":${PRELINK_PATH_MASK}:"
+		envdprelinkpaths=""
+		export IFS=":"
+		for dir in ${envdprelinkcheckpaths} ; do
+			if [[ ${dir:0-1} == / ]] ; then
+				noslashdir="${dir:0:${#dir}-1}"
+			else
+				dir="${dir}/"
+				noslashdir="${dir}"
+			fi
+			if [[ ${prelink_mask/:${dir}:/} == ${prelink_mask} \
+				&& ${prelink_mask/:${noslashdir}:/} == ${prelink_mask} ]] ; then
+				envdprelinkpaths="${envdprelinkpaths}:${dir}"
+			fi
+		done
+		unset IFS
+	else
+		envdprelinkpaths=":${envdprelinkcheckpaths}"
+	fi
+
+	cat << EOF > ${PRELINKCONF}
+# prelink.conf autogenerated by env-update; make all changes to
+# contents of /etc/env.d directory
+${defaultprelinkpaths//:/
+-l }
+${envdprelinkpaths//:/
+-h }
+EOF
+fi
+unset my_envd_LDPATH
+
+############################################
+############################################
+# RUN EXTERNAL PROGRAMS NOW
+############################################
+
+echo ">>> Regenerating ${EROOT}etc/ld.so.cache..."
+if [[ ${MAKELINKS} -eq 0 ]] ; then
+	(cd / ; ${EPREFIX}/sbin/ldconfig -X -r ${EROOT} >& /dev/null)
+else
+	(cd / ; ${EPREFIX}/sbin/ldconfig -r ${EROOT} >& /dev/null)
+fi
+
+cat << EOF > ${PROFILEENV}
+# THIS FILE IS AUTOMATICALLY GENERATED BY env-update.
+# DO NOT EDIT THIS FILE. CHANGES TO STARTUP PROFILES
+# GO INTO /etc/profile NOT /etc/profile.env
+
+$(set | grep '^my_envd_' | sed -e 's:^my_envd_:export :')
+EOF
+
+cat << EOF > ${CSHENV}
+# THIS FILE IS AUTOMATICALLY GENERATED BY env-update.
+# DO NOT EDIT THIS FILE. CHANGES TO STARTUP PROFILES
+# GO INTO /etc/csh.cshrc NOT /etc/csh.env
+
+$(set | grep '^my_envd_' | sed -e 's:^my_envd_\([[:alpha:]_][[:alnum:]_]*\)=:setenv \1 :')
+EOF
Index: /vendor/prefix-portage/current/bin/eprefixify
===================================================================
--- /vendor/prefix-portage/current/bin/eprefixify	(revision 3489)
+++ /vendor/prefix-portage/current/bin/eprefixify	(revision 3489)
@@ -0,0 +1,40 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: $
+
+# Fabian Groffen <grobian@gentoo.org>
+# replaces @GENTOO_PORTAGE_EPREFIX@ with EPREFIX for the given files
+
+if [[ $# -lt 1 ]] ; then
+	echo "$0: at least one argument needed" 1>&2
+	exit 1
+fi
+
+source "${PORTAGE_BIN_PATH}/isolated-functions.sh"
+case "${NOCOLOR:-false}" in
+	yes|true)
+		unset_colors
+		;;
+	no|false)
+		set_colors
+		;;
+esac
+
+ret=0
+
+einfo "Adjusting to prefix"
+for x in "$@" ; do
+	if [[ -e ${x} ]] ; then
+		ebegin "  ${x##*/}"
+		sed -i -e "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}|g" "${x}"
+		r=$?
+		eend $r
+		((ret+=$r))
+	else
+		eerror "${0##*/}: ${x} does not exist"
+		false
+	fi
+done
+
+exit ${ret}
Index: /vendor/prefix-portage/current/bin/etc-update
===================================================================
--- /vendor/prefix-portage/current/bin/etc-update	(revision 3489)
+++ /vendor/prefix-portage/current/bin/etc-update	(revision 3489)
@@ -0,0 +1,504 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# Author Brandon Low <lostlogic@gentoo.org>
+#
+# Previous version (from which I've borrowed a few bits) by:
+# Jochem Kossen <j.kossen@home.nl>
+# Leo Lipelis <aeoo@gentoo.org>
+# Karl Trygve Kalleberg <karltk@gentoo.org>
+
+if type -P gsed >/dev/null ; then
+	function sed() { gsed "$@"; }
+fi
+
+function get_config() {
+	item=$1
+
+	# First strip off comment lines, then grab the configuration
+	# item. If there's more than one of the same configuration item,
+	# then allow the last setting to take precedence.
+	local result
+	result=$(cut -d'#' -f1-1 ${PORTAGE_CONFIGROOT}etc/etc-update.conf | \
+		sed -ne "s/^ *$item *= *\([\"']\{0,1\}\)\(.*\)\1/\2/p" |sed -e '$p;d')
+	eval echo $result
+}
+
+function scan() {
+
+	echo "Scanning Configuration files..."
+	rm -rf ${TMP}/files > /dev/null 2>&1
+	mkdir ${TMP}/files || die "Failed mkdir command!" 1
+	count=0
+	input=0
+	local find_opts
+	local my_basename
+
+	# Sanity check to make sure diff exists and works
+	if ! diff -v &>/dev/null ; then
+		echo "ERROR: 'diff' does not seem to work, aborting"
+		exit 1
+	fi
+
+	for path in ${CONFIG_PROTECT} ; do
+		path="${EROOT}${path}"
+		find_opts="-iname ._cfg????_*"
+		if [ ! -d "${path}" ]; then
+			[ ! -f "${path}" ] && continue
+			my_basename="${path##*/}"
+			path="${path%/*}"
+			find_opts="-maxdepth 1 -iname ._cfg????_${my_basename}"
+		fi
+
+		ofile=""
+		# The below set -f turns off file name globbing in the ${find_opts} expansion.
+		for file in $(set -f; find ${path}/ ${find_opts} ! -iname '.*~' ! -iname '.*.bak' |
+			   sed -e "s:\(^.*/\)\(\._cfg[0-9]*_\)\(.*$\):\1\2\3\%\2\%\3:" |
+			   sort -t'%' -k3 -k2 | LANG=POSIX LC_ALL=POSIX cut -f1 -d'%'); do
+			rpath=$(echo "${file/\/\///}" | sed -e "s:/[^/]*$::")
+			rfile=$(echo "${file/\/\///}" | sed -e "s:^.*/::")
+			for mpath in ${CONFIG_PROTECT_MASK}; do
+				mpath="${EROOT}${mpath}"
+				mpath=$(echo "${mpath/\/\///}")
+				if [[ "${rpath}" == "${mpath}"* ]]; then
+					mv ${rpath}/${rfile} ${rpath}/${rfile:10}
+					break
+				fi
+			done
+			[ ! -f ${file} ] && continue
+
+
+			if [[ "${ofile:10}" != "${rfile:10}" ]] ||
+			   [[ ${opath} != ${rpath} ]]; then
+				MATCHES=0
+				if [[ "${EU_AUTOMERGE}" == "yes" ]]; then
+					if [ ! -e "${rpath}/${rfile}" ] || [ ! -e "${rpath}/${rfile:10}" ]; then
+						MATCHES=0
+					else
+						diff -Bbua ${rpath}/${rfile} ${rpath}/${rfile:10} | egrep '^[+-]' | egrep -v '^[+-][\t ]*#|^--- |^\+\+\+ ' | egrep -qv '^[-+][\t ]*$'
+						MATCHES=$?
+					fi
+				elif [[ -z $(diff -Nua ${rpath}/${rfile} ${rpath}/${rfile:10}|
+							  grep "^[+-][^+-]"|grep -v '# .Header:.*') ]]; then
+					MATCHES=1
+				fi
+				if [[ "${MATCHES}" == "1" ]]; then
+					echo "Automerging trivial changes in: ${rpath}/${rfile:10}"
+					mv ${rpath}/${rfile} ${rpath}/${rfile:10}
+					continue
+				else
+					count=${count}+1
+					echo "${rpath}/${rfile:10}" > ${TMP}/files/${count}
+					echo "${rpath}/${rfile}" >> ${TMP}/files/${count}
+					ofile="${rfile}"
+					opath="${rpath}"
+					continue
+				fi
+			fi
+
+			if [[ -z $(diff -Nua ${rpath}/${rfile} ${rpath}/${ofile}|
+					  grep "^[+-][^+-]"|grep -v '# .Header:.*') ]]; then
+				mv ${rpath}/${rfile} ${rpath}/${ofile}
+				continue
+			else
+				echo "${rpath}/${rfile}" >> ${TMP}/files/${count}
+				ofile="${rfile}"
+				opath="${rpath}"
+			fi
+		done
+	done
+
+}
+
+function sel_file() {
+	local -i isfirst=0
+	until [[ -f ${TMP}/files/${input} ]] || \
+	      [[ ${input} == -1 ]] || \
+	      [[ ${input} == -3 ]]
+	do
+		local numfiles=$(ls ${TMP}/files|wc -l)
+		local numwidth=${#numfiles}
+		for file in $(ls ${TMP}/files|sort -n); do
+			if [[ ${isfirst} == 0 ]] ; then
+				isfirst=${file}
+			fi
+			numshow=$(printf "%${numwidth}i${PAR} " ${file})
+			numupdates=$(( $(wc -l <${TMP}/files/${file}) - 1 ))
+			echo -n "${numshow}"
+			if [[ ${mode} == 0 ]] ; then
+				echo "$(head -n1 ${TMP}/files/${file}) (${numupdates})"
+			else
+				head -n1 ${TMP}/files/${file}
+			fi
+		done > ${TMP}/menuitems
+
+		if [ "${OVERWRITE_ALL}" == "yes" ]; then
+			input=0
+		elif [ "${DELETE_ALL}" == "yes" ]; then
+			input=0
+		else
+			if [[ ${mode} == 0 ]] ; then
+				echo "The following is the list of files which need updating, each
+configuration file is followed by a list of possible replacement files."
+			else
+				local my_title="Please select a file to update"
+			fi
+
+			if [[ ${mode} == 0 ]] ; then
+				cat ${TMP}/menuitems
+				echo    "Please select a file to edit by entering the corresponding number."
+				echo    "              (don't use -3, -5, -7 or -9 if you're unsure what to do)"
+				echo    "              (-1 to exit) (-3 to auto merge all remaining files)"
+				echo    "                           (-5 to auto-merge AND not use 'mv -i')"
+				echo    "                           (-7 to discard all updates)"
+				echo -n "                           (-9 to discard all updates AND not use 'rm -i'): "
+				input=$(read_int)
+			else
+				dialog --title "${title}" --menu "${my_title}" \
+					0 0 0 $(echo -e "-1 Exit\n$(<${TMP}/menuitems)") \
+					2> ${TMP}/input || die "User termination!" 0
+				input=$(<${TMP}/input)
+			fi
+			if [[ ${input} == -9 ]]; then
+				read -p "Are you sure that you want to delete all updates (type YES):" reply
+				if [[ ${reply} != "YES" ]]; then
+					continue
+				else
+					input=-7
+					export rm_opts=""
+				fi
+			fi
+			if [[ ${input} == -7 ]]; then
+				input=0
+				export DELETE_ALL="yes"
+			fi
+			if [[ ${input} == -5 ]] ; then
+				input=-3
+				export mv_opts=" ${mv_opts} "
+				mv_opts="${mv_opts// -i / }"
+			fi
+			if [[ ${input} == -3 ]] ; then
+				input=0
+				export OVERWRITE_ALL="yes"
+			fi
+		fi # -3 automerge
+		if [[ -z ${input} ]] || [[ ${input} == 0 ]] ; then
+			input=${isfirst}
+		fi
+	done
+}
+
+function user_special() {
+	if [ -r ${PORTAGE_CONFIGROOT}etc/etc-update.special ]; then
+		if [ -z "$1" ]; then
+			echo "ERROR: user_special() called without arguments"
+			return 1
+		fi
+		while read pat; do
+			echo ${1} | grep "${pat}" > /dev/null && return 0
+		done < ${PORTAGE_CONFIGROOT}etc/etc-update.special
+	fi
+	return 1
+}
+
+function read_int() {
+	# Read an integer from stdin.  Continously loops until a valid integer is
+	# read.  This is a workaround for odd behavior of bash when an attempt is
+	# made to store a value such as "1y" into an integer-only variable.
+	local my_input
+	while true; do
+		read my_input
+		# failed integer conversions will break a loop unless they're enclosed
+		# in a subshell.
+		echo "${my_input}" | ( declare -i x; read x) && break
+	done
+	echo ${my_input}
+}
+
+function do_file() {
+	echo
+	local -i my_input
+	local -i fcount=0
+	until (( $(wc -l < ${TMP}/files/${input}) < 2 )); do
+		my_input=0
+		if (( $(wc -l < ${TMP}/files/${input}) == 2 )); then
+			my_input=1
+		fi
+		until (( ${my_input} > 0 )) && (( ${my_input} < $(wc -l < ${TMP}/files/${input}) )); do
+			fcount=0
+
+			if [ "${OVERWRITE_ALL}" == "yes" ]; then
+				my_input=0
+			elif [ "${DELETE_ALL}" == "yes" ]; then
+				my_input=0
+			else
+				for line in $(<${TMP}/files/${input}); do
+					if (( ${fcount} > 0 )); then
+						echo -n "${fcount}${PAR} "
+						echo "${line}"
+					else
+						if [[ ${mode} == 0 ]] ; then
+							echo "Below are the new config files for ${line}:"
+						else
+							local my_title="Please select a file to process for ${line}"
+						fi
+					fi
+					fcount=${fcount}+1
+				done > ${TMP}/menuitems
+
+				if [[ ${mode} == 0 ]] ; then
+					cat ${TMP}/menuitems
+					echo -n "Please select a file to process (-1 to exit this file): "
+					my_input=$(read_int)
+				else
+					dialog --title "${title}" --menu "${my_title}" \
+						0 0 0 $(echo -e "$(<${TMP}/menuitems)\n${fcount} Exit") \
+						2> ${TMP}/input || die "User termination!" 0
+					my_input=$(<${TMP}/input)
+				fi
+			fi # OVERWRITE_ALL
+
+			if [[ ${my_input} == 0 ]] ; then
+				my_input=1
+			elif [[ ${my_input} == -1 ]] ; then
+				input=0
+				return
+			elif [[ ${my_input} == ${fcount} ]] ; then
+				break
+			fi
+		done
+		if [[ ${my_input} == ${fcount} ]] ; then
+			break
+		fi
+
+		fcount=${my_input}+1
+
+		file=$(sed -e "${fcount}p;d" ${TMP}/files/${input})
+		ofile=$(head -n1 ${TMP}/files/${input})
+
+		do_cfg "${file}" "${ofile}"
+
+		sed -e "${fcount}!p;d" ${TMP}/files/${input} > ${TMP}/files/sed
+		mv ${TMP}/files/sed ${TMP}/files/${input}
+
+		if [[ ${my_input} == -1 ]] ; then
+			break
+		fi
+	done
+	echo
+	rm ${TMP}/files/${input}
+	count=${count}-1
+}
+
+function do_cfg() {
+
+	local file="${1}"
+	local ofile="${2}"
+	local -i my_input=0
+
+	until (( ${my_input} == -1 )) || [ ! -f ${file} ]; do
+		if [[ "${OVERWRITE_ALL}" == "yes" ]] && ! user_special "${ofile}"; then
+			my_input=1
+		elif [[ "${DELETE_ALL}" == "yes" ]] && ! user_special "${ofile}"; then
+			my_input=2
+		else
+			showdiffcmd=$(echo "${diff_command}" |
+				sed -e "s:%file1:${ofile}:" -e "s:%file2:${file}:")
+
+			if [ "${using_editor}" == 0 ]; then
+				(
+					echo "Showing differences between ${ofile} and ${file}"
+					${showdiffcmd}
+				) | ${pager}
+			else
+				echo "Beginning of differences between ${ofile} and ${file}"
+				${showdiffcmd}
+				echo "End of differences between ${ofile} and ${file}"
+			fi
+			if [ -L "${file}" ]; then
+				echo
+				echo "-------------------------------------------------------------"
+				echo "NOTE: File is a symlink to another file. REPLACE recommended."
+				echo "      The original file may simply have moved. Please review."
+				echo "-------------------------------------------------------------"
+				echo
+			fi
+			echo -n "File: ${file}
+1) Replace original with update
+2) Delete update, keeping original as is
+3) Interactively merge original with update
+4) Show differences again
+Please select from the menu above (-1 to ignore this update): "
+			my_input=$(read_int)
+		fi
+
+		case ${my_input} in
+			1) echo "Replacing ${ofile} with ${file}"
+			   mv ${mv_opts} ${file} ${ofile}
+			   [ -n "${OVERWRITE_ALL}" ] && my_input=-1
+			   continue
+			   ;;
+			2) echo "Deleting ${file}"
+			   rm ${rm_opts} ${file}
+			   [ -n "${DELETE_ALL}" ] && my_input=-1
+			   continue
+			   ;;
+			3) do_merge "${file}" "${ofile}"
+			   my_input=${?}
+#			   [ ${my_input} == 255 ] && my_input=-1
+			   continue
+			   ;;
+			4) continue
+			   ;;
+			*) continue
+			   ;;
+		esac
+	done
+}
+
+function do_merge() {
+
+	local file="${1}"
+	local ofile="${2}"
+	local mfile="${2}.merged"
+	local -i my_input=0
+	echo "${file} ${ofile} ${mfile}"
+
+	if [ -e ${mfile} ] ; then
+		echo "A previous version of the merged file exists, cleaning..."
+		rm ${rm_opts} ${mfile}
+	fi
+
+	until (( ${my_input} == -1 )); do
+		echo "Merging ${file} and ${ofile}"
+		$(echo "${merge_command}" |
+		 sed -e "s:%merged:${mfile}:g" \
+		 	 -e "s:%orig:${ofile}:g" \
+			 -e "s:%new:${file}:g")
+		until (( ${my_input} == -1 )); do
+			echo -n "1) Replace ${ofile} with merged file
+2) Show differences between merged file and original
+3) Remerge original with update
+4) Edit merged file
+5) Return to the previous menu
+Please select from the menu above (-1 to exit, losing this merge): "
+			my_input=$(read_int)
+			case ${my_input} in
+				1) echo "Replacing ${ofile} with ${mfile}"
+				   if [[ ${USERLAND:-GNU} == GNU ]]; then
+				       chmod --reference="${ofile}" "${mfile}"
+				   else
+				       chmod $(stat -f %Mp%Lp "${ofile}") "${mfile}"
+				   fi
+				   mv ${mv_opts} ${mfile} ${ofile}
+				   rm ${rm_opts} ${file}
+				   return 255
+				   ;;
+				2) ( echo "Showing differences between ${ofile} and ${mfile}"
+					 $(echo "${diff_command}" | \
+					  sed -e "s:%file1:${ofile}:" \
+					  	  -e "s:%file2:${mfile}:") ) | ${pager}
+				   continue
+				   ;;
+				3) break
+				   ;;
+				4) ${EDITOR:-nano -w} "${mfile}"
+				   continue
+					 ;;
+				5) rm ${rm_opts} ${mfile}
+				   return 0
+				   ;;
+				*) continue
+				   ;;
+			esac
+		done
+	done
+	rm ${rm_opts} ${mfile}
+	return 255
+}
+
+function die() {
+	trap "" TERM
+	trap "" KILL
+	echo "Exiting: ${1}"
+
+	if [ ${2} -eq 0 ]; then
+		scan > /dev/null
+		[ ${count} -gt 0 ] && echo "NOTE: ${count} updates remaining"
+	fi
+
+	rm -rf ${TMP}
+	exit ${2}
+}
+
+#
+# Run the script
+#
+scriptname=$(basename $0)
+
+trap die term
+
+type portageq > /dev/null || exit $?
+eval $(portageq envvar -v CONFIG_PROTECT \
+	CONFIG_PROTECT_MASK PORTAGE_CONFIGROOT PORTAGE_TMPDIR ROOT USERLAND EPREFIX)
+export PORTAGE_TMPDIR
+export EROOT=${ROOT%/}${EPREFIX}/
+
+# quick hack to get prefix support in
+PORTAGE_CONFIGROOT=${PORTAGE_CONFIGROOT}${EPREFIX}/
+
+[ -w ${PORTAGE_CONFIGROOT}etc ] || die "Need write access to ${PORTAGE_CONFIGROOT}etc" 1
+#echo $PORTAGE_TMPDIR
+#echo $CONFIG_PROTECT
+#echo $CONFIG_PROTECT_MASK
+#export PORTAGE_TMPDIR=$(/usr/lib/portage/bin/portageq envvar PORTAGE_TMPDIR)
+
+TMP="${PORTAGE_TMPDIR}/$$"
+rm -rf ${TMP} 2> /dev/null
+mkdir ${TMP} || die "failed mkdir command!" 1
+
+# I need the CONFIG_PROTECT value
+#CONFIG_PROTECT=$(@PORTAGE_BASE@/bin/portageq envvar CONFIG_PROTECT)
+#CONFIG_PROTECT_MASK=$(@PORTAGE_BASE@/bin/portageq envvar CONFIG_PROTECT_MASK)
+
+# load etc-config's configuration
+EU_AUTOMERGE=$(get_config eu_automerge)
+rm_opts=$(get_config rm_opts)
+mv_opts=$(get_config mv_opts)
+cp_opts=$(get_config cp_opts)
+pager=$(get_config pager)
+diff_command=$(get_config diff_command)
+using_editor=$(get_config using_editor)
+merge_command=$(get_config merge_command)
+declare -i mode=$(get_config mode)
+[ -z ${mode} ] && mode=0
+[ -z "${pager}" ] && pager="cat"
+
+#echo "rm_opts: $rm_opts, mv_opts: $mv_opts, cp_opts: $cp_opts"
+#echo "pager: $pager, diff_command: $diff_command, merge_command: $merge_command"
+
+if (( ${mode} == 0 )); then
+	PAR=")"
+else
+	PAR=""
+fi
+
+declare -i count=0
+declare input=0
+declare title="Gentoolkit's etc-update tool!"
+
+scan
+
+until (( ${input} == -1 )); do
+	if (( ${count} == 0 )); then
+		die "Nothing left to do; exiting. :)" 0
+	fi
+	sel_file
+	if (( ${input} != -1 )); then
+		do_file
+	fi
+done
+
+die "User termination!" 0
Index: /vendor/prefix-portage/current/bin/find-requires
===================================================================
--- /vendor/prefix-portage/current/bin/find-requires	(revision 3489)
+++ /vendor/prefix-portage/current/bin/find-requires	(revision 3489)
@@ -0,0 +1,44 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/find-requires,v 1.5 2004/10/04 13:56:50 vapier Exp $
+
+# note this works for both a.out and ELF executables
+# it also auto-generates requirment lines for shell scripts
+
+ulimit -c 0
+
+filelist=`sed "s/['\"]/\\\&/g"`
+exelist=`echo $filelist | $XARGS file | grep ":.*executable" | cut -d: -f1 `
+scriptlist=`echo $filelist | $XARGS file | @EGREP@ ":.* (commands|script) " | cut -d: -f1 `
+liblist=`echo $filelist | $XARGS file | grep ":.*shared object" | cut -d : -f1 `
+
+for f in $exelist; do
+    if [ -x $f ]; then
+	ldd $f | awk '/=>/ { print $1 }'
+    fi
+done | sort -u | sed "s/['\"]/\\\&/g" | $XARGS -n 1 basename | grep -v 'libNoVersion.so' | sort -u
+
+for f in $liblist; do
+    ldd $f | awk '/=>/ { print $1 }'
+done | sort -u | sed "s/['\"]/\\\&/g" | $XARGS -n 1 basename | grep -v 'libNoVersion.so' | sort -u
+
+for f in $scriptlist; do
+    if [ -x $f ]; then
+	head -1 $f | sed -e 's/^\#\![ 	]*//' | cut -d" " -f1
+    fi
+done | sort -u
+
+#for f in $liblist $exelist ; do
+#    objdump -p $f | awk '
+#	BEGIN { START=0; LIBNAME=""; }
+#	/Version References:/ { START=1; }
+#	/required from/ && (START==1) {
+#	    sub(/:/, "", $3);
+#	    LIBNAME=$3;
+#	}
+#	(START==1) && (LIBNAME!="") && ($4~/^GLIBC_*/) { print LIBNAME "(" $4 ")"; }
+#	/^$/ { START=0; }
+#    '
+#done | sort -u
+
Index: /vendor/prefix-portage/current/bin/fix-db.py
===================================================================
--- /vendor/prefix-portage/current/bin/fix-db.py	(revision 3489)
+++ /vendor/prefix-portage/current/bin/fix-db.py	(revision 3489)
@@ -0,0 +1,166 @@
+#!@PYTHON@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/fix-db.py,v 1.8 2004/10/11 04:01:00 jstubbs Exp $
+
+import os,sys,re
+
+try:
+	import portage
+except ImportError:
+	from os import path as osp
+	sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
+	import portage
+
+from stat import *
+from portage.output import *
+from portage import lockfile,unlockfile,VDB_PATH,root
+import portage.const
+
+
+mylog = open(portage.const.EPREFIX+"/var/log/emerge_fix-db.log", "a")
+def writemsg(msg):
+	if msg[-1] != '\n':
+		msg += "\n"
+	sys.stderr.write(msg)
+	sys.stderr.flush()
+	mylog.write(msg)
+	mylog.flush()
+
+def fix_global_counter(value):
+	myf = open(portage.const.EPREFIX+"/var/cache/edb/counter")
+	newvalue = value+1000
+	myf.write(str(newvalue))
+	myf.flush()
+	myf.close()
+	return newvalue
+
+bad = {}
+counters = {}
+times = {}
+
+try:
+	real_counter = long(open(portage.const.EPREFIX+"/var/cache/edb/counter").read())
+except SystemExit, e:
+	raise  # This needs to be propogated
+except:
+	writemsg("ERROR: Real counter is invalid.\n")
+	real_counter = 0
+
+vardbdir = root+VDB_PATH+"/"
+for cat in os.listdir(vardbdir):
+	catdir = vardbdir+cat+"/"
+	if not os.path.isdir(catdir):
+		writemsg("Invalid file: '%s'\n" % catdir[:-1])
+		continue
+	for pkg in os.listdir(catdir):
+		pkgdir = catdir+pkg+"/"
+		catpkg = cat+"/"+pkg
+
+		if not os.path.isdir(catdir):
+			writemsg("Invalid file: '%s'\n" % pkgdir)
+			continue
+			
+		bad[catpkg] = []
+		
+		pkgdirlist = os.listdir(pkgdir)
+		if not pkgdirlist:
+			writemsg("ERROR: Package directory is empty for '%s'\n" % catpkg)
+			writemsg("       Deleting this directory. Remerge if you want it back.\n")
+			os.rmdir(pkgdir)
+			del bad[catpkg]
+			continue
+		
+		if "CONTENTS" not in pkgdirlist:
+			bad[catpkg] += ["CONTENTS is missing"]
+			times[catpkg] = -1
+			writemsg("ERROR: Contents file is missing from the package directory.\n")
+			writemsg("       '%s' is corrupt and should be deleted.\n" % catpkg)
+		else:
+			times[catpkg] = None
+			for line in open(pkgdir+"CONTENTS").readlines():
+				mysplit = line.split()
+				if mysplit[0] == "obj":
+					try:
+						times[catpkg] = long(mysplit[-1])
+					except SystemExit, e:
+						raise  # This needs to be propogated
+					except:
+						times[catpkg] = -1
+						bad[catpkg] += ["CONTENTS is corrupt"]
+						writemsg("ERROR: Corrupt CONTENTS file in '%s'\n" % catpkg)
+						writemsg("       This package should be deleted.\n")
+					break
+			if times[catpkg] == None:
+				times[catpkg] = os.stat(pkgdir+"CONTENTS")[ST_MTIME]
+
+		if "COUNTER" not in pkgdirlist:
+			bad[catpkg] += ["COUNTER is missing"]
+			writemsg("ERROR: COUNTER file missing from '%s'.\n" % catpkg)
+			counters[catpkg] = -1
+		else:
+			try:
+				counters[catpkg] = long(open(pkgdir+"COUNTER").read().strip())
+				if counters[catpkg] > real_counter:
+					writemsg("ERROR: Global counter is lower than the '%s' COUNTER." % catpkg)
+					real_counter = fix_global_counter(counters[catpkg])
+			except SystemExit, e:
+				raise  # This needs to be propogated
+			except:
+				bad[catpkg] += ["COUNTER is corrupt"]
+				counters[catpkg] = -1
+
+		if "SLOT" not in pkgdirlist:
+			writemsg("ERROR: SLOT file missing from '%s'.\n" % catpkg)
+			writemsg("       RE-MERGE this exact package version or unmerge and remerge.\n")
+			bad[catpkg] += ["SLOT is missing"]
+		else:
+			myslot = open(pkgdir+"SLOT").read()
+			if myslot and myslot[-1]=="\n":
+				#writemsg("WARN: SLOT file has a newline. '%s'\n" % catpkg)
+				myslot = myslot[:-1]
+			if not myslot:
+				bad[catpkg] += ["SLOT is empty"]
+				writemsg("ERROR: SLOT file is empty for '%s'.\n" % catpkg)
+				writemsg("       RE-MERGE this exact package version or unmerge and remerge it.\n")
+			elif re.search("[^-a-zA-Z0-9\._]", myslot):
+				bad[catpkg] += ["SLOT is corrupt"]
+				writemsg("ERROR: SLOT file is corrupt for '%s'.\n" % catpkg)
+				writemsg("       RE-MERGE this exact package version or unmerge and remerge it.\n")
+			elif myslot.strip() != myslot:
+				writemsg("WARN: SLOT file has invalid characters. '%s'\n" % catpkg)
+				bad[catpkg] += ["SLOT is invalid"]
+
+		if not bad[catpkg]:
+			del bad[catpkg]
+
+
+actions = {}
+writemsg("\n\n")
+for catpkg in bad.keys():
+	bad[catpkg].sort()
+
+	mystr = ""
+	for x in bad[catpkg]:
+		mystr += "   "+str(x)+"\n"
+
+	if bad[catpkg] == ["CONTENTS is missing", "SLOT is missing"]:
+		writemsg("%s: (possibly injected)\n%s\n" % (green(catpkg), mystr))
+		actions[catpkg] = ["ignore"]
+	elif bad[catpkg] == ["SLOT is empty"]:
+		writemsg("%s: (old package) []\n%s\n" % (yellow(catpkg), mystr))
+		actions[catpkg] = ["remerge"]
+	else:
+		writemsg("%s: (damaged/invalid) []\n%s\n" % (red(catpkg), mystr))
+		actions[catpkg] = ["merge exact"]
+
+if (len(sys.argv) > 1) and (sys.argv[1] == "--fix"):
+	writemsg("These are only directions, at the moment.")
+	for catpkg in actions.keys():
+		action = actions[catpkg]
+		writemsg("We will now '%s' '%s'..." % (action, catpkg))
+		#if action == 
+else:
+	#writemsg("Run with '--fix' to attempt automatic correction.")
+	pass
+
Index: /vendor/prefix-portage/current/bin/fixdbentries
===================================================================
--- /vendor/prefix-portage/current/bin/fixdbentries	(revision 3489)
+++ /vendor/prefix-portage/current/bin/fixdbentries	(revision 3489)
@@ -0,0 +1,20 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/fixdbentries,v 1.3 2004/10/04 13:56:50 vapier Exp $
+
+# Script to adjust the contents of the DB entries after a package move.
+# Fairly straight forward... ./movedbentry 'from/here' 'to/here' /over/here
+
+VAR=$1
+NEW=$2
+SPATH=$3
+
+grep -FrZl "${VAR}" "${SPATH}" |
+sed "s#${SPATH}[^\d000]\+/CONTENTS\d000##g" |
+$XARGS -0 sed -i -e "
+s#${VAR}\$#${NEW}#g; 
+s#${VAR}\([[:space:]]\)#${NEW}\1#g; 
+s#${VAR}\(-[^a-zA-Z]\)#${NEW}\1#g; 
+s#${VAR}\([^a-zA-Z0-9-]\)#${NEW}\1#g
+"
Index: /vendor/prefix-portage/current/bin/fixpackages
===================================================================
--- /vendor/prefix-portage/current/bin/fixpackages	(revision 3489)
+++ /vendor/prefix-portage/current/bin/fixpackages	(revision 3489)
@@ -0,0 +1,31 @@
+#!@PYTHON@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/fixpackages,v 1.6 2004/10/04 13:56:50 vapier Exp $
+
+import os,sys
+os.environ["PORTAGE_CALLER"]="fixpackages"
+try:
+	import portage
+except ImportError:
+	from os import path as osp
+	sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
+	import portage
+
+mysettings = portage.settings
+mytrees = portage.db
+mtimedb = portage.mtimedb
+
+try:
+	os.nice(int(mysettings.get("PORTAGE_NICENESS", "0")))
+except (OSError, ValueError), e:
+	portage.writemsg("!!! Failed to change nice value to '%s'\n" % \
+		mysettings["PORTAGE_NICENESS"])
+	portage.writemsg("!!! %s\n" % str(e))
+	del e
+
+portage._global_updates(mytrees, mtimedb["updates"])
+
+print
+print "Done."
+print
Index: /vendor/prefix-portage/current/bin/fowners
===================================================================
--- /vendor/prefix-portage/current/bin/fowners	(revision 3489)
+++ /vendor/prefix-portage/current/bin/fowners	(revision 3489)
@@ -0,0 +1,9 @@
+#!@BASH@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# we can't prefix all arguments because
+# chown takes random options
+slash="/"
+exec chown "${@/#${slash}/${ED}${slash}}"
Index: /vendor/prefix-portage/current/bin/fperms
===================================================================
--- /vendor/prefix-portage/current/bin/fperms	(revision 3489)
+++ /vendor/prefix-portage/current/bin/fperms	(revision 3489)
@@ -0,0 +1,9 @@
+#!@BASH@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# we can't prefix all arguments because
+# chmod takes random options
+slash="/"
+exec chmod "${@/#${slash}/${ED}${slash}}"
Index: /vendor/prefix-portage/current/bin/isolated-functions.sh
===================================================================
--- /vendor/prefix-portage/current/bin/isolated-functions.sh	(revision 3489)
+++ /vendor/prefix-portage/current/bin/isolated-functions.sh	(revision 3489)
@@ -0,0 +1,331 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# We need this next line for "die" and "assert". It expands
+# It _must_ preceed all the calls to die and assert.
+shopt -s expand_aliases
+alias die='diefunc "$FUNCNAME" "$LINENO" "$?"'
+alias assert='_pipestatus="${PIPESTATUS[*]}"; [[ "${_pipestatus// /}" -eq 0 ]] || diefunc "$FUNCNAME" "$LINENO" "$_pipestatus"'
+alias save_IFS='[ "${IFS:-unset}" != "unset" ] && old_IFS="${IFS}"'
+alias restore_IFS='if [ "${old_IFS:-unset}" != "unset" ]; then IFS="${old_IFS}"; unset old_IFS; else unset IFS; fi'
+
+shopt -s extdebug
+
+# usage- first arg is the number of funcs on the stack to ignore.
+# defaults to 1 (ignoring dump_trace)
+dump_trace() {
+        local funcname="" sourcefile="" lineno="" n e s="yes"
+
+        declare -i strip=1
+
+        if [[ -n $1 ]]; then
+                strip=$(( $1 ))
+        fi
+
+        echo "Call stack:"
+        for (( n = ${#FUNCNAME[@]} - 1, p = ${#BASH_ARGV[@]} ; n > $strip ; n-- )) ; do
+                funcname=${FUNCNAME[${n} - 1]}
+                sourcefile=$(basename ${BASH_SOURCE[${n}]})
+                lineno=${BASH_LINENO[${n} - 1]}
+                # Display function arguments
+                args=
+                if [[ -n "${BASH_ARGV[@]}" ]]; then
+                        for (( j = 1 ; j <= ${BASH_ARGC[${n} - 1]} ; ++j )); do
+                                newarg=${BASH_ARGV[$(( p - j - 1 ))]}
+                                args="${args:+${args} }'${newarg}'"
+                        done
+                        (( p -= ${BASH_ARGC[${n} - 1]} ))
+                fi
+                echo "  ${sourcefile}, line ${lineno}:   Called ${funcname}${args:+ ${args}}"
+        done
+}
+
+diefunc() {
+        local funcname="$1" lineno="$2" exitcode="$3"
+        shift 3
+        echo >&2
+        echo "!!! ERROR: $CATEGORY/$PF failed." >&2
+        dump_trace 2 1>&2
+        echo "  $(basename "${BASH_SOURCE[1]}"), line ${BASH_LINENO[0]}:   Called die" 1>&2
+        echo >&2
+        echo "!!! ${*:-(no error message)}" >&2
+        echo "!!! If you need support, post the topmost build error, and the call stack if relevant." >&2
+        [ -n "${PORTAGE_LOG_FILE}" ] && \
+            echo "!!! A complete build log is located at '${PORTAGE_LOG_FILE}'." >&2
+        echo >&2
+        if [ -n "${EBUILD_OVERLAY_ECLASSES}" ] ; then
+                echo "This ebuild used the following eclasses from overlays:" >&2
+                echo >&2
+                for x in ${EBUILD_OVERLAY_ECLASSES} ; do
+                        echo "  ${x}" >&2
+                done
+                echo >&2
+        fi
+
+        if [ "${EBUILD_PHASE/depend}" == "${EBUILD_PHASE}" ]; then
+                local x
+                for x in $EBUILD_DEATH_HOOKS; do
+                        ${x} "$@" >&2 1>&2
+                done
+        fi
+
+        # subshell die support
+        kill -s SIGTERM ${EBUILD_MASTER_PID}
+        exit 1
+}
+
+quiet_mode() {
+	[[ ${PORTAGE_QUIET} -eq 1 ]]
+}
+
+vecho() {
+	quiet_mode || echo "$@"
+}
+
+# Internal logging function, don't use this in ebuilds
+elog_base() {
+	local messagetype
+	[ -z "${1}" -o -z "${T}" -o ! -d "${T}/logging" ] && return 1
+	case "${1}" in
+		INFO|WARN|ERROR|LOG|QA)
+			messagetype="${1}"
+			shift
+			;;
+		*)
+			vecho -e " ${BAD}*${NORMAL} Invalid use of internal function elog_base(), next message will not be logged"
+			return 1
+			;;
+	esac
+	echo -e "$*" >> ${T}/logging/${EBUILD_PHASE:-other}.${messagetype}
+	return 0
+}
+
+eqawarn() {
+	elog_base QA "$*"
+	vecho -e " ${WARN}*${NORMAL} $*" >&2
+	return 0
+}
+
+elog() {
+	elog_base LOG "$*"
+	echo -e " ${GOOD}*${NORMAL} $*"
+	return 0
+}
+
+esyslog() {
+	# not prefixed yet as I don't know if it's possible to have a logger
+	# inside the prefix at all
+	local pri=
+	local tag=
+
+	if [ -x /usr/bin/logger ]
+	then
+		pri="$1"
+		tag="$2"
+
+		shift 2
+		[ -z "$*" ] && return 0
+
+		/usr/bin/logger -p "${pri}" -t "${tag}" -- "$*"
+	fi
+
+	return 0
+}
+
+einfo() {
+	elog_base INFO "$*"
+	[[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo
+	echo -e " ${GOOD}*${NORMAL} $*"
+	LAST_E_CMD="einfo"
+	return 0
+}
+
+einfon() {
+	elog_base INFO "$*"
+	[[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo
+	echo -ne " ${GOOD}*${NORMAL} $*"
+	LAST_E_CMD="einfon"
+	return 0
+}
+
+ewarn() {
+	elog_base WARN "$*"
+	[[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo
+	echo -e " ${WARN}*${NORMAL} ${RC_INDENTATION}$*"
+	LAST_E_CMD="ewarn"
+	return 0
+}
+
+eerror() {
+	elog_base ERROR "$*"
+	[[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo
+	echo -e " ${BAD}*${NORMAL} ${RC_INDENTATION}$*"
+	LAST_E_CMD="eerror"
+	return 0
+}
+
+ebegin() {
+	local msg="$*" dots spaces=${RC_DOT_PATTERN//?/ }
+	if [[ -n ${RC_DOT_PATTERN} ]] ; then
+		dots=$(printf "%$(( COLS - 3 - ${#RC_INDENTATION} - ${#msg} - 7 ))s" '')
+		dots=${dots//${spaces}/${RC_DOT_PATTERN}}
+		msg="${msg}${dots}"
+	else
+		msg="${msg} ..."
+	fi
+	einfon "${msg}"
+	[[ ${RC_ENDCOL} == "yes" ]] && echo
+	LAST_E_LEN=$(( 3 + ${#RC_INDENTATION} + ${#msg} ))
+	LAST_E_CMD="ebegin"
+	return 0
+}
+
+_eend() {
+	local retval=${1:-0} efunc=${2:-eerror} msg
+	shift 2
+
+	if [[ ${retval} == "0" ]] ; then
+		msg="${BRACKET}[ ${GOOD}ok${BRACKET} ]${NORMAL}"
+	else
+		if [[ -n $* ]] ; then
+			${efunc} "$*"
+		fi
+		msg="${BRACKET}[ ${BAD}!!${BRACKET} ]${NORMAL}"
+	fi
+
+	if [[ ${RC_ENDCOL} == "yes" ]] ; then
+		echo -e "${ENDCOL}  ${msg}"
+	else
+		[[ ${LAST_E_CMD} == ebegin ]] || LAST_E_LEN=0
+		printf "%$(( COLS - LAST_E_LEN - 6 ))s%b\n" '' "${msg}"
+	fi
+
+	return ${retval}
+}
+
+eend() {
+	local retval=${1:-0}
+	shift
+
+	_eend ${retval} eerror "$*"
+
+	return ${retval}
+}
+
+KV_major() {
+	[[ -z $1 ]] && return 1
+
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+KV_minor() {
+	[[ -z $1 ]] && return 1
+
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+KV_micro() {
+	[[ -z $1 ]] && return 1
+
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+KV_to_int() {
+	[[ -z $1 ]] && return 1
+
+	local KV_MAJOR=$(KV_major "$1")
+	local KV_MINOR=$(KV_minor "$1")
+	local KV_MICRO=$(KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+
+	return 1
+}
+
+_RC_GET_KV_CACHE=""
+get_KV() {
+	[[ -z ${_RC_GET_KV_CACHE} ]] \
+		&& _RC_GET_KV_CACHE=$(uname -r)
+
+	echo $(KV_to_int "${_RC_GET_KV_CACHE}")
+
+	return $?
+}
+
+unset_colors() {
+	COLS="25 80"
+	ENDCOL=
+
+	GOOD=
+	WARN=
+	BAD=
+	NORMAL=
+	HILITE=
+	BRACKET=
+}
+
+set_colors() {
+	COLS=${COLUMNS:-0}      # bash's internal COLUMNS variable
+	(( COLS == 0 )) && COLS=$(set -- $(stty size 2>/dev/null) ; echo $2)
+	(( COLS > 0 )) || (( COLS = 80 ))
+	COLS=$((${COLS} - 8))	# width of [ ok ] == 7
+	# Adjust COLS so that eend works properly on a standard BSD console.
+	[ "${TERM}" = "cons25" ] && COLS=$((${COLS} - 1))
+
+	ENDCOL=$'\e[A\e['${COLS}'C'    # Now, ${ENDCOL} will move us to the end of the
+	                               # column;  irregardless of character width
+	if [ -n "${PORTAGE_COLORMAP}" ] ; then
+		eval ${PORTAGE_COLORMAP}
+	else
+		GOOD=$'\e[32;01m'
+		WARN=$'\e[33;01m'
+		BAD=$'\e[31;01m'
+		HILITE=$'\e[36;01m'
+		BRACKET=$'\e[34;01m'
+	fi
+	NORMAL=$'\e[0m'
+}
+
+RC_ENDCOL="yes"
+RC_INDENTATION=''
+RC_DEFAULT_INDENT=2
+RC_DOT_PATTERN=''
+
+case "${NOCOLOR:-false}" in
+	yes|true)
+		unset_colors
+		;;
+	no|false)
+		set_colors
+		;;
+esac
+
+has() {
+	hasq "$@"
+}
+
+hasv() {
+	if hasq "$@" ; then
+		echo "$1"
+		return 0
+	fi
+	return 1
+}
+
+hasq() {
+	[[ " ${*:2} " == *" $1 "* ]]
+}
+
+true
Index: /vendor/prefix-portage/current/bin/md5check.py
===================================================================
--- /vendor/prefix-portage/current/bin/md5check.py	(revision 3489)
+++ /vendor/prefix-portage/current/bin/md5check.py	(revision 3489)
@@ -0,0 +1,100 @@
+#!@PYTHON@ -O
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/md5check.py,v 1.4 2004/10/10 10:07:20 carpaski Exp $
+
+import os,sys
+os.environ["FEATURES"]="mirror cvs"
+try:
+	import portage
+except ImportError:
+	from os import path as osp
+	sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
+	import portage
+import portage.util
+
+def cstrip(mystr,mychars):
+	newstr = ""
+	for x in mystr:
+		if x not in mychars:
+			newstr += x
+	return newstr
+
+md5_list = {}
+bn_list  = []
+col_list = []
+
+hugelist = []
+for mycp in portage.db["/"]["porttree"].dbapi.cp_all():
+	hugelist += portage.db["/"]["porttree"].dbapi.cp_list(mycp)
+hugelist.sort()
+
+for mycpv in hugelist:
+	pv = mycpv.split("/")[-1]
+
+	newuri = portage.db["/"]["porttree"].dbapi.aux_get(mycpv,["SRC_URI"])[0]
+	newuri = newuri.split()
+
+	digestpath = portage.db["/"]["porttree"].dbapi.findname(mycpv)
+	digestpath = os.path.dirname(digestpath)+"/files/digest-"+pv
+	md5sums    = portage.digestParseFile(digestpath)
+	
+	if md5sums == None:
+		portage.writemsg("Missing digest: %s\n" % mycpv)
+		md5sums = {}
+
+	for x in md5sums.keys():
+		if x[0] == '/':
+			del md5sums[x]
+
+	#portage.writemsg("\n\ndigestpath: %s\n" % digestpath)
+	#portage.writemsg("md5sums: %s\n" % md5sums)
+	#portage.writemsg("newuri: %s\n" % newuri)
+
+	bn_list = []
+	for x in newuri:
+		if not x:
+			continue
+		if (x in [")","(",":","||"]) or (x[-1] == "?"):
+			# ignore it. :)
+			continue
+		x = cstrip(x,"()|?")
+		if not x:
+			continue
+
+		mybn = os.path.basename(x)
+		if mybn not in bn_list:
+			bn_list += [mybn]
+		else:
+			continue
+		
+		if mybn not in md5sums.keys():
+			portage.util.writemsg("Missing md5sum: %s in %s\n" % (mybn, mycpv))
+		else:
+			if mybn in md5_list.keys():
+				if (md5_list[mybn]["MD5"]  != md5sums[mybn]["MD5"]) or \
+				   (md5_list[mybn]["size"] != md5sums[mybn]["size"]):
+
+					# This associates teh md5 with each file. [md5/size]
+					md5joins = md5_list[mybn][2].split(",")
+					md5joins = (" ["+md5_list[mybn][0]+"/"+md5_list[mybn][1]+"],").join(md5joins)
+					md5joins += " ["+md5_list[mybn][0]+"/"+md5_list[mybn][1]+"]"
+
+					portage.writemsg("Colliding md5: %s of %s [%s/%s] and %s\n" % (mybn,mycpv,md5sums[mybn][0],md5sums[mybn][1],md5joins))
+					col_list += [mybn]
+				else:
+					md5_list[mybn][2] += ","+mycpv
+			else:
+				md5_list[mybn] = md5sums[mybn]+[mycpv]
+			del md5sums[mybn]
+		
+	#portage.writemsg(str(bn_list)+"\n")
+	for x in md5sums.keys():
+		if x not in bn_list:
+			portage.writemsg("Extra md5sum: %s in %s\n" % (x, mycpv))
+
+
+print col_list
+print
+print str(len(md5_list.keys()))+" unique distfile md5s."
+print str(len(bn_list))+" unique distfile names."
Index: /vendor/prefix-portage/current/bin/md5check.sh
===================================================================
--- /vendor/prefix-portage/current/bin/md5check.sh	(revision 3489)
+++ /vendor/prefix-portage/current/bin/md5check.sh	(revision 3489)
@@ -0,0 +1,31 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/md5check.sh,v 1.2 2004/10/04 13:56:50 vapier Exp $
+
+# pipe in the data.
+
+sort -u -                    > md5check.tmp
+grep '^Extra'   md5check.tmp > md5check.tmp.extra
+grep '^Missing' md5check.tmp > md5check.tmp.missing
+grep '^Coll'    md5check.tmp > md5check.tmp.colliding
+
+sed -i "
+s:^Col:\nCol:
+s:,:\n  :g
+s: of :\n  :g
+s: and :\n  :g" md5check.tmp.colliding
+sed -i "s/^[^ ]\+ md5sum: \(.*\) in \(.*\)$/  \2: \1/g" md5check.tmp.missing
+sed -i "s/^[^ ]\+ md5sum: \(.*\) in \(.*\)$/  \2: \1/g" md5check.tmp.extra
+
+#echo "Colliding files:" > md5check.colliding
+#sort -u md5check.tmp.colliding >> md5check.colliding
+cp md5check.tmp.colliding md5check.colliding
+
+echo "Missing from digest:" > md5check.missing
+sort -u md5check.tmp.missing >> md5check.missing
+
+echo "Extra files in digest:" > md5check.extra
+sort -u md5check.tmp.extra >> md5check.extra
+
+rm md5check.tmp*
Index: /vendor/prefix-portage/current/bin/misc-functions.sh
===================================================================
--- /vendor/prefix-portage/current/bin/misc-functions.sh	(revision 3489)
+++ /vendor/prefix-portage/current/bin/misc-functions.sh	(revision 3489)
@@ -0,0 +1,621 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header$
+#
+# Miscellaneous shell functions that make use of the ebuild env but don't need
+# to be included directly in ebuild.sh.
+#
+# We're sourcing ebuild.sh here so that we inherit all of it's goodness,
+# including bashrc trickery.  This approach allows us to do our miscellaneous
+# shell work withing the same env that ebuild.sh has, but without polluting
+# ebuild.sh itself with unneeded logic and shell code.
+#
+# XXX hack: clear the args so ebuild.sh doesn't see them
+MISC_FUNCTIONS_ARGS="$@"
+shift $#
+
+source @PORTAGE_BASE@/bin/ebuild.sh
+
+install_symlink_html_docs() {
+	cd "${ED}" || die "cd failed"
+	#symlink the html documentation (if DOC_SYMLINKS_DIR is set in make.conf)
+	if [ -n "${DOC_SYMLINKS_DIR}" ] ; then
+		local mydocdir docdir
+		for docdir in "${HTMLDOC_DIR:-does/not/exist}" "${PF}/html" "${PF}/HTML" "${P}/html" "${P}/HTML" ; do
+			if [ -d "usr/share/doc/${docdir}" ] ; then
+				mydocdir="${EPREFIX}/usr/share/doc/${docdir}"
+			fi
+		done
+		if [ -n "${mydocdir}" ] ; then
+			local mysympath
+			if [ -z "${SLOT}" -o "${SLOT}" = "0" ] ; then
+				mysympath="${DOC_SYMLINKS_DIR}/${CATEGORY}/${PN}"
+			else
+				mysympath="${DOC_SYMLINKS_DIR}/${CATEGORY}/${PN}-${SLOT}"
+			fi
+			einfo "Symlinking ${mysympath} to the HTML documentation"
+			dodir "${DOC_SYMLINKS_DIR}/${CATEGORY}"
+			dosym "${mydocdir}" "${mysympath}"
+		fi
+	fi
+}
+
+install_qa_check() {
+	cd "${ED}" || die "cd failed"
+	prepall
+
+	# Now we look for all world writable files.
+	find "${ED%/}" -type f -perm -2 | \
+	while read i ; do
+		vecho -ne '\a'
+		vecho "QA Security Notice:"
+		vecho "- ${i:${#ED}:${#i}} will be a world writable file."
+		vecho "- This may or may not be a security problem, most of the time it is one."
+		vecho "- Please double check that $PF really needs a world writeable bit and file bugs accordingly."
+		sleep 1
+	done
+
+	if type -P scanelf > /dev/null && ! hasq binchecks ${RESTRICT}; then
+		local qa_var insecure_rpath=0 tmp_quiet=${PORTAGE_QUIET}
+		
+		# display warnings when using stricter because we die afterwards
+		if has stricter ${FEATURES} ; then
+			unset PORTAGE_QUIET
+		fi
+		
+		# Make sure we disallow insecure RUNPATH/RPATH's
+		# Don't want paths that point to the tree where the package was built
+		# (older, broken libtools would do this).  Also check for null paths
+		# because the loader will search $PWD when it finds null paths.
+		f=$(scanelf -qyRF '%r %p' "${ED}" | grep -E "(${PORTAGE_BUILDDIR}|: |::|^:|^ )")
+		if [[ -n ${f} ]] ; then
+			vecho -ne '\a\n'
+			eqawarn "QA Notice: The following files contain insecure RUNPATH's"
+			eqawarn " Please file a bug about this at http://bugs.gentoo.org/"
+			eqawarn " with the maintaining herd of the package."
+			eqawarn "${f}"
+			vecho -ne '\a\n'
+			if has stricter ${FEATURES} ; then
+				insecure_rpath=1
+			else
+				vecho "Auto fixing rpaths for ${f}"
+				TMPDIR=${PORTAGE_BUILDDIR} scanelf -BXr ${f} -o /dev/null
+			fi
+		fi
+
+		# TEXTREL's are baaaaaaaad
+		# Allow devs to mark things as ignorable ... e.g. things that are
+		# binary-only and upstream isn't cooperating (nvidia-glx) ... we
+		# allow ebuild authors to set QA_TEXTRELS_arch and QA_TEXTRELS ...
+		# the former overrides the latter ... regexes allowed ! :)
+		qa_var="QA_TEXTRELS_${ARCH/-/_}"
+		[[ -n ${!qa_var} ]] && QA_TEXTRELS=${!qa_var}
+		[[ -n ${QA_STRICT_TEXTRELS} ]] && QA_TEXTRELS=""
+		export QA_TEXTRELS
+		f=$(scanelf -qyRF '%t %p' "${ED}" | grep -v 'usr/lib/debug/')
+		if [[ -n ${f} ]] ; then
+			scanelf -qyRF '%T %p' "${PORTAGE_BUILDDIR}"/ &> "${T}"/scanelf-textrel.log
+			vecho -ne '\a\n'
+			eqawarn "QA Notice: The following files contain runtime text relocations"
+			eqawarn " Text relocations force the dynamic linker to perform extra"
+			eqawarn " work at startup, waste system resources, and may pose a security"
+			eqawarn " risk.  On some architectures, the code may not even function"
+			eqawarn " properly, if at all."
+			eqawarn " For more information, see http://hardened.gentoo.org/pic-fix-guide.xml"
+			eqawarn " Please include this file in your report:"
+			eqawarn " ${T}/scanelf-textrel.log"
+			eqawarn "${f}"
+			vecho -ne '\a\n'
+			die_msg="${die_msg} textrels,"
+			sleep 1
+		fi
+
+		# Also, executable stacks only matter on linux (and just glibc atm ...)
+		f=""
+		case ${CTARGET:-${CHOST}} in
+			*-linux-gnu*)
+			# Check for files with executable stacks, but only on arches which
+			# are supported at the moment.  Keep this list in sync with
+			# http://hardened.gentoo.org/gnu-stack.xml (Arch Status)
+			case ${CTARGET:-${CHOST}} in
+				arm*|i?86*|ia64*|m68k*|s390*|sh*|x86_64*)
+					# Allow devs to mark things as ignorable ... e.g. things
+					# that are binary-only and upstream isn't cooperating ...
+					# we allow ebuild authors to set QA_EXECSTACK_arch and
+					# QA_EXECSTACK ... the former overrides the latter ...
+					# regexes allowed ! :)
+
+					qa_var="QA_EXECSTACK_${ARCH/-/_}"
+					[[ -n ${!qa_var} ]] && QA_EXECSTACK=${!qa_var}
+					[[ -n ${QA_STRICT_EXECSTACK} ]] && QA_EXECSTACK=""
+					qa_var="QA_WX_LOAD_${ARCH/-/_}"
+					[[ -n ${!qa_var} ]] && QA_WX_LOAD=${!qa_var}
+					[[ -n ${QA_STRICT_WX_LOAD} ]] && QA_WX_LOAD=""
+					export QA_EXECSTACK QA_WX_LOAD
+					f=$(scanelf -qyRF '%e %p' "${ED}" | grep -v 'usr/lib/debug/')
+					;;
+			esac
+			;;
+		esac
+		if [[ -n ${f} ]] ; then
+			# One more pass to help devs track down the source
+			scanelf -qyRF '%e %p' "${PORTAGE_BUILDDIR}"/ &> "${T}"/scanelf-execstack.log
+			vecho -ne '\a\n'
+			eqawarn "QA Notice: The following files contain executable stacks"
+			eqawarn " Files with executable stacks will not work properly (or at all!)"
+			eqawarn " on some architectures/operating systems.  A bug should be filed"
+			eqawarn " at http://bugs.gentoo.org/ to make sure the file is fixed."
+			eqawarn " For more information, see http://hardened.gentoo.org/gnu-stack.xml"
+			eqawarn " Please include this file in your report:"
+			eqawarn " ${T}/scanelf-execstack.log"
+			eqawarn "${f}"
+			vecho -ne '\a\n'
+			die_msg="${die_msg} execstacks"
+			sleep 1
+		fi
+
+		# Save NEEDED information
+		scanelf -qyRF '%p %n' "${ED}" | sed -e 's:^:/:' > "${PORTAGE_BUILDDIR}"/build-info/NEEDED
+
+		if [[ ${insecure_rpath} -eq 1 ]] ; then
+			die "Aborting due to serious QA concerns with RUNPATH/RPATH"
+		elif [[ -n ${die_msg} ]] && has stricter ${FEATURES} ; then
+			die "Aborting due to QA concerns: ${die_msg}"
+		fi
+
+		# Run some sanity checks on shared libraries
+		for d in "${D}"lib* "${D}"usr/lib* ; do
+			f=$(scanelf -ByF '%S %p' "${d}"/lib*.so* | gawk '$2 == "" { print }')
+			if [[ -n ${f} ]] ; then
+				vecho -ne '\a\n'
+				eqawarn "QA Notice: The following shared libraries lack a SONAME"
+				eqawarn "${f}"
+				vecho -ne '\a\n'
+				sleep 1
+			fi
+
+			f=$(scanelf -ByF '%n %p' "${d}"/lib*.so* | gawk '$2 == "" { print }')
+			if [[ -n ${f} ]] ; then
+				vecho -ne '\a\n'
+				eqawarn "QA Notice: The following shared libraries lack NEEDED entries"
+				eqawarn "${f}"
+				vecho -ne '\a\n'
+				sleep 1
+			fi
+		done
+
+		PORTAGE_QUIET=${tmp_quiet}
+	fi
+
+	local unsafe_files=$(find "${ED}" -type f '(' -perm -2002 -o -perm -4002 ')')
+	if [[ -n ${unsafe_files} ]] ; then
+		eqawarn "QA Notice: Unsafe files detected (set*id and world writable)"
+		eqawarn "${unsafe_files}"
+		die "Unsafe files found in \${ED}.  Portage will not install them."
+	fi
+
+	if [[ -d ${ED}/${D} ]] ; then
+		find "${ED}/${D}" | \
+		while read i ; do
+			eqawarn "QA Notice: /${i##${ED}/${D}} installed in \${ED}/\${D}"
+		done
+		die "Aborting due to QA concerns: files installed in ${ED}/${D}"
+	fi
+
+	if [[ -d ${ED}/${EPREFIX} ]] ; then
+		find "${ED}/${EPREFIX}/" | \
+		while read i ; do
+			eqawarn "QA Notice: ${i#${ED}} double prefix"
+		done
+		die "Aborting due to QA concerns: double prefix files installed"
+	fi
+
+	if [[ -d ${D} ]] ; then
+		INSTALLTOD=$(find ${D%/} | egrep -v "^${ED}" | sed -e "s|^${D%/}||" | awk '{if (length($0) <= length("'"${EPREFIX}"'")) { if (substr("'"${EPREFIX}"'", 1, length($0)) != $0) {print $0;} } else if (substr($0, 1, length("'"${EPREFIX}"'")) != "'"${EPREFIX}"'") {print $0;} }') 
+		if [[ -n ${INSTALLTOD} ]] ; then
+			eqawarn "QA Notice: the following files are outside of the prefix:"
+			eqawarn "${INSTALLTOD}"
+			die "Aborting due to QA concerns: there are files installed outside the prefix"
+		fi
+	fi
+
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		# on Darwin, dynamic libraries are called .dylibs instead of
+		# .sos.  In addition the version component is before the
+		# extension, not after it.  Check for this, and *only* warn
+		# about it.  Some packages do ship .so files on Darwin and make
+		# it work (ugly! e.g. python does this by default).
+		f=""
+		find ${ED%/} -name "*.so" -or -name "*.so.*" | \
+		while read i ; do
+			[[ $(file $i) == *"Mach-O"* ]] && f="${f} ${i#${D}}"
+		done
+		if [[ -n ${f} ]] ; then
+			f=${f# }
+			vecho -ne '\a\n'
+			eqawarn "QA Notice: Found .so dynamic libraries on Darwin:"
+			eqawarn "    ${f// /\n    }"
+		fi
+		# The naming for dynamic libraries is different on Darwin; the
+		# version component is before the extention, instead of after
+		# it, as with .sos.  Again, make this a warning only.
+		f=""
+		find ${ED%/} -name "*.dylib.*" | \
+		while read i ; do
+			f="${f} ${i#${D}}"
+		done
+		if [[ -n ${f} ]] ; then
+			f=${f# }
+			vecho -ne '\a\n'
+			eqawarn "QA Notice: Found wrongly named dynamic libraries on Darwin:"
+			eqawarn "    ${f// /\n    }"
+		fi
+	fi
+
+	# this should help to ensure that all (most?) shared libraries are executable
+	# and that all libtool scripts / static libraries are not executable
+	for i in "${ED}"opt/*/lib{,32,64} \
+	         "${ED}"lib{,32,64}       \
+	         "${ED}"usr/lib{,32,64}   \
+	         "${ED}"usr/X11R6/lib{,32,64} ; do
+		[[ ! -d ${i} ]] && continue
+
+		for j in "${i}"/*.so.* "${i}"/*.so "${i}"/*.dylib ; do
+			[[ ! -e ${j} ]] && continue
+			if [[ -L ${j} ]] ; then
+				linkdest=$(readlink "${j}")
+				if [[ ${linkdest} == /* ]] ; then
+					vecho -ne '\a\n'
+					eqawarn "QA Notice: Found an absolute symlink in a library directory:"
+					eqawarn "           ${j#${D}} -> ${linkdest}"
+					eqawarn "           It should be a relative symlink if in the same directory"
+					eqawarn "           or a linker script if it crosses the /usr boundary."
+				fi
+				continue
+			fi
+			[[ -x ${j} ]] && continue
+			vecho "making executable: ${j#${D}}"
+			chmod +x "${j}"
+		done
+
+		for j in "${i}"/*.a "${i}"/*.la ; do
+			[[ ! -e ${j} ]] && continue
+			[[ -L ${j} ]] && continue
+			[[ ! -x ${j} ]] && continue
+			vecho "removing executable bit: ${j#${D}}"
+			chmod -x "${j}"
+		done
+	done
+
+	# When installing static libraries into /usr/lib and shared libraries into 
+	# /lib, we have to make sure we have a linker script in /usr/lib along side 
+	# the static library, or gcc will utilize the static lib when linking :(.
+	# http://bugs.gentoo.org/4411
+	abort="no"
+	for a in "${ED}"usr/lib*/*.a ; do
+		[[ ${CHOST} == *-darwin* ]] \
+			&& s=${a%.a}.dylib \
+			|| s=${a%.a}.so
+		if [[ ! -e ${s} ]] ; then
+			s=${s%usr/*}${s##*/usr/}
+			if [[ -e ${s} ]] ; then
+				vecho -ne '\a\n'
+				eqawarn "QA Notice: Missing gen_usr_ldscript for ${s##*/}"
+	 			abort="yes"
+			fi
+		fi
+	done
+	[[ ${abort} == "yes" ]] && die "add those ldscripts"
+
+	# Make sure people don't store libtool files or static libs in /lib
+	f=$(ls "${ED}"lib*/*.{a,la} 2>/dev/null)
+	if [[ -n ${f} ]] ; then
+		vecho -ne '\a\n'
+		eqawarn "QA Notice: Excessive files found in the / partition"
+		eqawarn "${f}"
+		vecho -ne '\a\n'
+		die "static archives (*.a) and libtool library files (*.la) do not belong in /"
+	fi
+
+	# Verify that the libtool files don't contain bogus $D entries.
+	abort="no"
+	for a in "${ED}"usr/lib*/*.la ; do
+		s=${a##*/}
+		if grep -qs "${ED}" "${a}" ; then
+			vecho -ne '\a\n'
+			eqawarn "QA Notice: ${s} appears to contain PORTAGE_TMPDIR paths"
+			abort="yes"
+		fi
+	done
+	[[ ${abort} == "yes" ]] && die "soiled libtool library files found"
+
+	# Evaluate misc gcc warnings
+	if [[ -n ${PORTAGE_LOG_FILE} && -r ${PORTAGE_LOG_FILE} ]] ; then
+		local m msgs=(
+			": warning: dereferencing type-punned pointer will break strict-aliasing rules$"
+			": warning: implicit declaration of function "
+			": warning: incompatible implicit declaration of built-in function "
+			": warning: is used uninitialized in this function$" # we'll ignore "may" and "might"
+			": warning: comparisons like X<=Y<=Z do not have their mathematical meaning$"
+			": warning: null argument where non-null required "
+		)
+		abort="no"
+		i=0
+		while [[ -n ${msgs[${i}]} ]] ; do
+			m=${msgs[$((i++))]}
+			# force C locale to work around slow unicode locales #160234
+			f=$(LC_ALL=C grep "${m}" "${PORTAGE_LOG_FILE}")
+			if [[ -n ${f} ]] ; then
+				vecho -ne '\a\n'
+				eqawarn "QA Notice: Package has poor programming practices which may compile"
+				eqawarn "           fine but exhibit random runtime failures."
+				eqawarn "${f}"
+				vecho -ne '\a\n'
+				abort="yes"
+			fi
+		done
+		f=$(cat "${PORTAGE_LOG_FILE}" | check-implicit-pointer-usage.py)
+		if [[ -n ${f} ]] ; then
+			vecho -ne '\a\n'
+			eqawarn "QA Notice: Package has poor programming practices which may compile"
+			eqawarn "           but will almost certainly crash on 64bit architectures."
+			eqawarn "${f}"
+			vecho -ne '\a\n'
+			# just warn on 32bit hosts but bail on 64bit hosts
+			case ${CHOST} in
+				alpha*|ia64*|powerpc64*|mips64*|sparc64*|x86_64*) die "this code is not 64bit clean";;
+				*) abort="yes";;
+			esac
+		fi
+		[[ ${abort} == "yes" ]] && hasq stricter ${FEATURES} && die "poor code kills airplanes"
+	fi
+
+	# Portage regenerates this on the installed system.
+	rm -f "${ED}"/usr/share/info/dir{,.gz,.bz2}
+
+	if hasq multilib-strict ${FEATURES} && \
+	   [[ -x ${EPREFIX}/usr/bin/file && -x ${EPREFIX}/usr/bin/find ]] && \
+	   [[ -n ${MULTILIB_STRICT_DIRS} && -n ${MULTILIB_STRICT_DENY} ]]
+	then
+		local abort=no firstrun=yes
+		MULTILIB_STRICT_EXEMPT=$(echo ${MULTILIB_STRICT_EXEMPT} | sed -e 's:\([(|)]\):\\\1:g')
+		for dir in ${MULTILIB_STRICT_DIRS} ; do
+			[[ -d ${ED}/${dir} ]] || continue
+			find ${ED}/${dir} -type f | grep -v "^${ED}/${dir}/${MULTILIB_STRICT_EXEMPT}" | \
+			while read file ; do
+				if file ${file} | egrep -q "${MULTILIB_STRICT_DENY}" ; then
+					if [[ ${firstrun} == yes ]] ; then
+						echo "Files matching a file type that is not allowed:"
+						firstrun=no
+					fi
+					abort=yes
+					echo "   ${file#${ED}//}"
+				fi
+			done
+		done
+		[[ ${abort} == yes ]] && die "multilib-strict check failed!"
+	fi
+}
+
+
+install_mask() {
+	local root="$1"
+	shift
+	local install_mask="$*"
+
+	# we don't want globbing for initial expansion, but afterwards, we do
+	local shopts=$-
+	set -o noglob
+	for no_inst in ${install_mask}; do
+		set +o noglob
+		quiet_mode || einfo "Removing ${no_inst}"
+		# normal stuff
+		rm -Rf ${root}/${no_inst} >&/dev/null
+
+		# we also need to handle globs (*.a, *.h, etc)
+		find "${root}" -path ${no_inst} -exec rm -fR {} \; >/dev/null
+	done
+	# set everything back the way we found it
+	set +o noglob
+	set -${shopts}
+}
+
+preinst_bsdflags() {
+	type -P chflags > /dev/null || return 0
+	type -P mtree > /dev/null || return 1
+	# Save all the file flags for restoration after installation.
+	mtree -c -p "${ED}" -k flags > "${T}/bsdflags.mtree"
+	# Remove all the file flags so that the merge phase can do anything
+	# necessary.
+	chflags -R noschg,nouchg,nosappnd,nouappnd "${ED}"
+	chflags -R nosunlnk,nouunlnk "${ED}" 2>/dev/null
+}
+
+postinst_bsdflags() {
+	type -P chflags > /dev/null || return 0
+	type -P mtree > /dev/null || return 1
+	# Restore all the file flags that were saved before installation.
+	mtree -e -p "${EROOT}" -U -k flags < "${T}/bsdflags.mtree" &> /dev/null
+}
+
+preinst_mask() {
+	if [ -z "$IMAGE" ]; then
+		 eerror "${FUNCNAME}: IMAGE is unset"
+		 return 1
+	fi
+	# remove man pages, info pages, docs if requested
+	for f in man info doc; do
+		if hasq no${f} $FEATURES; then
+			INSTALL_MASK="${INSTALL_MASK} ${EPREFIX}/usr/share/${f}"
+		fi
+	done
+
+	install_mask "${IMAGE}" ${INSTALL_MASK}
+
+	# remove share dir if unnessesary
+	if hasq nodoc $FEATURES -o hasq noman $FEATURES -o hasq noinfo $FEATURES; then
+		rmdir "${IMAGE}/usr/share" &> /dev/null
+	fi
+}
+
+preinst_sfperms() {
+	if [ -z "$IMAGE" ]; then
+		 eerror "${FUNCNAME}: IMAGE is unset"
+		 return 1
+	fi
+	# Smart FileSystem Permissions
+	if hasq sfperms $FEATURES; then
+		find ${IMAGE}/ -type f -perm -4000 | \
+		while read i ; do
+			ebegin ">>> SetUID: [chmod go-r] $i "
+			chmod go-r "$i"
+			eend $?
+		done
+		find ${IMAGE}/ -type f -perm -2000 | \
+		while read i ; do
+			ebegin ">>> SetGID: [chmod o-r] $i "
+			chmod o-r "$i"
+			eend $?
+		done
+	fi
+}
+
+preinst_suid_scan() {
+	if [ -z "$IMAGE" ]; then
+		 eerror "${FUNCNAME}: IMAGE is unset"
+		 return 1
+	fi
+	# total suid control.
+	if hasq suidctl $FEATURES; then
+		sfconf=${EPREFIX}/etc/portage/suidctl.conf
+		vecho ">>> Performing suid scan in ${IMAGE}"
+		find ${IMAGE}/ -type f \( -perm -4000 -o -perm -2000 \) | \
+		while read i ; do
+			if [ -s "${sfconf}" ]; then
+				suid="$(grep ^${i/${IMAGE}/}$ ${sfconf})"
+				if [ "${suid}" = "${i/${IMAGE}/}" ]; then
+					vecho "- ${i/${IMAGE}/} is an approved suid file"
+				else
+					vecho ">>> Removing sbit on non registered ${i/${IMAGE}/}"
+					for x in 5 4 3 2 1 0; do echo -ne "\a"; sleep 0.25 ; done
+					vecho -ne "\a"
+					ls_ret=$(ls -ldh "${i}")
+					chmod ugo-s "${i}"
+					grep ^#${i/${IMAGE}/}$ ${sfconf} > /dev/null || {
+						# sandbox prevents us from writing directly
+						# to files outside of the sandbox, but this
+						# can easly be bypassed using the addwrite() function
+						addwrite "${sfconf}"
+						vecho ">>> Appending commented out entry to ${sfconf} for ${PF}"
+						echo "## ${ls_ret%${IMAGE}*}${ls_ret#*${IMAGE}}" >> ${sfconf}
+						echo "#${i/${IMAGE}/}" >> ${sfconf}
+						# no delwrite() eh?
+						# delwrite ${sconf}
+					}
+				fi
+			else
+				vecho "suidctl feature set but you are lacking a ${sfconf}"
+			fi
+		done
+	fi
+}
+
+preinst_selinux_labels() {
+	if [ -z "$IMAGE" ]; then
+		 eerror "${FUNCNAME}: IMAGE is unset"
+		 return 1
+	fi
+	if hasq selinux ${FEATURES}; then
+		# SELinux file labeling (needs to always be last in dyn_preinst)
+		# only attempt to label if setfiles is executable
+		# and 'context' is available on selinuxfs.
+		if [ -f ${EPREFIX}/selinux/context -a -x ${EPREFIX}/usr/sbin/setfiles -a -x ${EPREFIX}/usr/sbin/selinuxconfig ]; then
+			vecho ">>> Setting SELinux security labels"
+			(
+				eval "$(${EPREFIX}/usr/sbin/selinuxconfig)" || \
+					die "Failed to determine SELinux policy paths.";
+	
+				addwrite /selinux/context;
+	
+				${EPREFIX}/usr/sbin/setfiles "${file_contexts_path}" -r "${IMAGE}" "${IMAGE}";
+			) || die "Failed to set SELinux security labels."
+		else
+			# nonfatal, since merging can happen outside a SE kernel
+			# like during a recovery situation
+			vecho "!!! Unable to set SELinux security labels"
+		fi
+	fi
+}
+
+dyn_package() {
+	cd "${PORTAGE_BUILDDIR}/image"
+	install_mask "${PORTAGE_BUILDDIR}/image" ${PKG_INSTALL_MASK}
+	local tar_options=""
+	[ "${PORTAGE_QUIET}" == "1" ] ||  tar_options="${tar_options} -v"
+	# Sandbox is disabled in case the user wants to use a symlink
+	# for $PKGDIR and/or $PKGDIR/All.
+	export SANDBOX_ON="0"
+	mkdir -p "${PORTAGE_BINPKG_TMPFILE%/*}" || die "mkdir failed"
+	tar ${tar_options} -cf - . | bzip2 -f > "${PORTAGE_BINPKG_TMPFILE}" || \
+		die "Failed to create tarball"
+	cd ..
+	export PYTHONPATH=${PORTAGE_PYM_PATH:-${EPREFIX}/usr/lib/portage/pym}
+	python -c "from portage import xpak; t=xpak.tbz2('${PORTAGE_BINPKG_TMPFILE}'); t.recompose('${PORTAGE_BUILDDIR}/build-info')"
+	if [ $? -ne 0 ]; then
+		rm -f "${PORTAGE_BINPKG_TMPFILE}"
+		die "Failed to append metadata to the tbz2 file"
+	fi
+	vecho ">>> Done."
+	cd "${PORTAGE_BUILDDIR}"
+	touch .packaged || die "Failed to 'touch .packaged' in ${PORTAGE_BUILDDIR}"
+}
+
+dyn_spec() {
+	tar czf "/usr/src/redhat/SOURCES/${PF}.tar.gz" "${O}/${PF}.ebuild" "${O}/files" || die "Failed to create base rpm tarball."
+
+	cat <<__END1__ > ${PF}.spec
+Summary: ${DESCRIPTION}
+Name: ${PN}
+Version: ${PV}
+Release: ${PR}
+Copyright: GPL
+Group: portage/${CATEGORY}
+Source: ${PF}.tar.gz
+Buildroot: ${D}
+%description
+${DESCRIPTION}
+
+${HOMEPAGE}
+
+%prep
+%setup -c
+
+%build
+
+%install
+
+%clean
+
+%files
+/
+__END1__
+
+}
+
+dyn_rpm() {
+	addwrite /usr/src/redhat/
+	addwrite ${RPMDIR}
+	dyn_spec
+	rpmbuild -bb "${PF}.spec" || die "Failed to integrate rpm spec file"
+	install -D "/usr/src/redhat/RPMS/i386/${PN}-${PV}-${PR}.i386.rpm" "${RPMDIR}/${CATEGORY}/${PN}-${PV}-${PR}.rpm" || die "Failed to move rpm"
+}
+
+if [ -n "${MISC_FUNCTIONS_ARGS}" ]; then
+	[ "$PORTAGE_DEBUG" == "1" ] && set -x
+	for x in ${MISC_FUNCTIONS_ARGS}; do
+		${x}
+	done
+fi
+
+:
Index: /vendor/prefix-portage/current/bin/newbin
===================================================================
--- /vendor/prefix-portage/current/bin/newbin	(revision 3489)
+++ /vendor/prefix-portage/current/bin/newbin	(revision 3489)
@@ -0,0 +1,13 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/newbin,v 1.7 2004/10/04 13:56:50 vapier Exp $
+
+if [[ -z ${T} ]] || [[ -z ${2} ]] ; then
+	echo "$0: Need two arguments, old file and new file" 1>&2
+	exit 1
+fi
+
+rm -rf "${T}/${2}" && \
+cp -f "${1}" "${T}/${2}" && \
+exec dobin "${T}/${2}"
Index: /vendor/prefix-portage/current/bin/newconfd
===================================================================
--- /vendor/prefix-portage/current/bin/newconfd	(revision 3489)
+++ /vendor/prefix-portage/current/bin/newconfd	(revision 3489)
@@ -0,0 +1,13 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/newconfd,v 1.2 2004/10/04 13:56:50 vapier Exp $
+
+if [[ -z ${T} ]] || [[ -z ${2} ]] ; then
+	echo "$0: Need two arguments, old file and new file" 1>&2
+	exit 1
+fi
+
+rm -rf "${T}/${2}" && \
+cp -f "${1}" "${T}/${2}" && \
+exec doconfd "${T}/${2}"
Index: /vendor/prefix-portage/current/bin/newdoc
===================================================================
--- /vendor/prefix-portage/current/bin/newdoc	(revision 3489)
+++ /vendor/prefix-portage/current/bin/newdoc	(revision 3489)
@@ -0,0 +1,13 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/newdoc,v 1.7 2004/10/04 13:56:50 vapier Exp $
+
+if [[ -z ${T} ]] || [[ -z ${2} ]] ; then
+	echo "$0: Need two arguments, old file and new file" 1>&2
+	exit 1
+fi
+
+rm -rf "${T}/${2}" && \
+cp -f "${1}" "${T}/${2}" && \
+exec dodoc "${T}/${2}"
Index: /vendor/prefix-portage/current/bin/newenvd
===================================================================
--- /vendor/prefix-portage/current/bin/newenvd	(revision 3489)
+++ /vendor/prefix-portage/current/bin/newenvd	(revision 3489)
@@ -0,0 +1,13 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/newenvd,v 1.2 2004/10/04 13:56:50 vapier Exp $
+
+if [[ -z ${T} ]] || [[ -z ${2} ]] ; then
+	echo "$0: Need two arguments, old file and new file" 1>&2
+	exit 1
+fi
+
+rm -rf "${T}/${2}" && \
+cp -f "${1}" "${T}/${2}" && \
+exec doenvd "${T}/${2}"
Index: /vendor/prefix-portage/current/bin/newexe
===================================================================
--- /vendor/prefix-portage/current/bin/newexe	(revision 3489)
+++ /vendor/prefix-portage/current/bin/newexe	(revision 3489)
@@ -0,0 +1,13 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: $
+
+if [[ -z ${T} ]] || [[ -z ${2} ]] ; then
+	echo "$0: Need two arguments, old file and new file" 1>&2
+	exit 1
+fi
+
+rm -rf "${T}/${2}" && \
+cp -f "${1}" "${T}/${2}" && \
+exec doexe "${T}/${2}"
Index: /vendor/prefix-portage/current/bin/newinitd
===================================================================
--- /vendor/prefix-portage/current/bin/newinitd	(revision 3489)
+++ /vendor/prefix-portage/current/bin/newinitd	(revision 3489)
@@ -0,0 +1,13 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/newinitd,v 1.2 2004/10/04 13:56:50 vapier Exp $
+
+if [[ -z ${T} ]] || [[ -z ${2} ]] ; then
+	echo "$0: Need two arguments, old file and new file" 1>&2
+	exit 1
+fi
+
+rm -rf "${T}/${2}" && \
+cp -f "${1}" "${T}/${2}" && \
+exec doinitd "${T}/${2}"
Index: /vendor/prefix-portage/current/bin/newins
===================================================================
--- /vendor/prefix-portage/current/bin/newins	(revision 3489)
+++ /vendor/prefix-portage/current/bin/newins	(revision 3489)
@@ -0,0 +1,13 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/newins,v 1.7 2004/10/04 13:56:50 vapier Exp $
+
+if [[ -z ${T} ]] || [[ -z ${2} ]] ; then
+	echo "$0: Need two arguments, old file and new file" 1>&2
+	exit 1
+fi
+
+rm -rf "${T}/${2}" && \
+cp -f "${1}" "${T}/${2}" && \
+exec doins "${T}/${2}"
Index: /vendor/prefix-portage/current/bin/newman
===================================================================
--- /vendor/prefix-portage/current/bin/newman	(revision 3489)
+++ /vendor/prefix-portage/current/bin/newman	(revision 3489)
@@ -0,0 +1,13 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/newman,v 1.7 2004/10/04 13:56:50 vapier Exp $
+
+if [[ -z ${T} ]] || [[ -z ${2} ]] ; then
+	echo "$0: Need two arguments, old file and new file" 1>&2
+	exit 1
+fi
+
+rm -rf "${T}/${2}" && \
+cp -f "${1}" "${T}/${2}" && \
+exec doman "${T}/${2}"
Index: /vendor/prefix-portage/current/bin/newsbin
===================================================================
--- /vendor/prefix-portage/current/bin/newsbin	(revision 3489)
+++ /vendor/prefix-portage/current/bin/newsbin	(revision 3489)
@@ -0,0 +1,13 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/newsbin,v 1.7 2004/10/04 13:56:50 vapier Exp $
+
+if [[ -z ${T} ]] || [[ -z ${2} ]] ; then
+	echo "$0: Need two arguments, old file and new file" 1>&2
+	exit 1
+fi
+
+rm -rf "${T}/${2}" && \
+cp -f "${1}" "${T}/${2}" && \
+exec dosbin "${T}/${2}"
Index: /vendor/prefix-portage/current/bin/pemerge.py
===================================================================
--- /vendor/prefix-portage/current/bin/pemerge.py	(revision 3489)
+++ /vendor/prefix-portage/current/bin/pemerge.py	(revision 3489)
@@ -0,0 +1,44 @@
+#!@PYTHON@ -O
+
+import profile,time,sys,os
+sys.path = ["@PORTAGE_BASE@/bin","@PORTAGE_BASE@/pym"]+sys.path
+
+def clock():
+	return time.time()
+profile.time.clock = clock
+
+profile.run("import emerge", os.getcwd()+"/prof")
+
+class StatsProcesser:
+	def __init__(self, stats):
+		self.output = []
+		self.last = ""
+		import sys
+		sys.stdout = self
+		stats.print_stats()
+		sys.stdout = sys.__stdout__
+		funcs = ["?"]
+		for line in self.output:
+			spline = line.split()
+			if len(spline) == 6 and spline[0][0].isdigit():
+				func = spline[5][spline[5].index("(")+1:-1]
+				print line
+				if func not in funcs:
+					funcs.append(func)
+					func = "\\(" + func + "\\)"
+					stats.print_callers(func)
+
+	def write(self, text):
+		new = self.last + text
+		new = new.split("\n")
+		if len(new) > 1:
+			self.output += new[:-1]
+		self.last = new[-1]
+
+import pstats
+p = pstats.Stats("prof")
+dir(p)
+p.sort_stats("time")
+p.print_stats()
+
+sp = StatsProcesser(p)
Index: /vendor/prefix-portage/current/bin/pkgname
===================================================================
--- /vendor/prefix-portage/current/bin/pkgname	(revision 3489)
+++ /vendor/prefix-portage/current/bin/pkgname	(revision 3489)
@@ -0,0 +1,20 @@
+#!@PYTHON@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/pkgname,v 1.8 2004/10/04 13:56:50 vapier Exp $
+
+import sys, os
+try:
+	import portage
+except ImportError:
+	from os import path as osp
+	sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
+	import portage
+
+a=portage.pkgsplit(sys.argv[1])
+if a:
+	print a[0],a[1],a[2][1:]
+	sys.exit(0)
+else:
+	print '!!! Error: package name is invalid.'
+	sys.exit(1)
Index: /vendor/prefix-portage/current/bin/portage_gpg_update.sh
===================================================================
--- /vendor/prefix-portage/current/bin/portage_gpg_update.sh	(revision 3489)
+++ /vendor/prefix-portage/current/bin/portage_gpg_update.sh	(revision 3489)
@@ -0,0 +1,6 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/portage_gpg_update.sh,v 1.2 2004/10/04 13:56:50 vapier Exp $
+
+wget -O - http://www.gentoo.org/proj/en/devrel/roll-call/userinfo.xml | sed 's:.*\(0x[0-9a-fA-F]\+\)[^0-9a-fA-F].*:\1:gp;d' | xargs gpg -vvv --no-default-keyring  --no-permission-warning --homedir "${EPREFIX}"/usr/portage/metadata --keyring "gentoo.gpg" --keyserver subkeys.pgp.net --recv-keys &> gpg.log
Index: /vendor/prefix-portage/current/bin/portageq
===================================================================
--- /vendor/prefix-portage/current/bin/portageq	(revision 3489)
+++ /vendor/prefix-portage/current/bin/portageq	(revision 3489)
@@ -0,0 +1,361 @@
+#!@PYTHON@ -O
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/portageq,v 1.13.2.1 2005/04/12 12:23:41 jstubbs Exp $
+
+import sys
+# This block ensures that ^C interrupts are handled quietly.
+try:
+	import signal
+
+	def exithandler(signum, frame):
+		signal.signal(signal.SIGINT, signal.SIG_IGN)
+		signal.signal(signal.SIGTERM, signal.SIG_IGN)
+		sys.exit(1)
+
+	signal.signal(signal.SIGINT, exithandler)
+	signal.signal(signal.SIGTERM, exithandler)
+
+except KeyboardInterrupt:
+	sys.exit(1)
+
+import os
+
+import types
+
+#-----------------------------------------------------------------------------
+#
+# To add functionality to this tool, add a function below.
+#
+# The format for functions is:
+#
+#   def function(argv):
+#       """<list of options for this function>
+#       <description of the function>
+#       """
+#       <code>
+#
+# "argv" is an array of the command line parameters provided after the command.
+#
+# Make sure you document the function in the right format.  The documentation
+# is used to display help on the function.
+#
+# You do not need to add the function to any lists, this tool is introspective,
+# and will automaticly add a command by the same name as the function!
+#
+
+
+def has_version(argv):
+	"""<root> <category/package>
+	Return code 0 if it's available, 1 otherwise.
+	"""
+	if (len(argv) < 2):
+		print "ERROR: insufficient parameters!"
+		sys.exit(2)
+	try:
+		mylist=portage.db[argv[0]]["vartree"].dbapi.match(argv[1])
+		if mylist:
+			sys.exit(0)
+		else:
+			sys.exit(1)
+	except KeyError:
+		sys.exit(1)
+has_version.uses_root = True
+
+
+def best_version(argv):
+	"""<root> <category/package>
+	Returns category/package-version (without .ebuild).
+	"""
+	if (len(argv) < 2):
+		print "ERROR: insufficient parameters!"
+		sys.exit(2)
+	try:
+		mylist=portage.db[argv[0]]["vartree"].dbapi.match(argv[1])
+		print portage.best(mylist)
+	except KeyError:
+		sys.exit(1)
+best_version.uses_root = True
+
+
+def mass_best_version(argv):
+	"""<root> [<category/package>]+
+	Returns category/package-version (without .ebuild).
+	"""
+	if (len(argv) < 2):
+		print "ERROR: insufficient parameters!"
+		sys.exit(2)
+	try:
+		for pack in argv[1:]:
+			mylist=portage.db[argv[0]]["vartree"].dbapi.match(pack)
+			print pack+":"+portage.best(mylist)
+	except KeyError:
+		sys.exit(1)
+mass_best_version.uses_root = True
+
+def metadata(argv):
+	"""<root> <pkgtype> <category/package> [<key>]+
+	Returns metadata values for the specified package.
+	"""
+	if (len(argv) < 4):
+		print >> sys.stderr, "ERROR: insufficient parameters!"
+		sys.exit(2)
+
+	root, pkgtype, pkgspec = argv[0:3]
+	metakeys = argv[3:]
+	type_map = {
+		"ebuild":"porttree",
+		"binary":"bintree",
+		"installed":"vartree"}
+	if pkgtype not in type_map:
+		print >> sys.stderr, "Unrecognized package type: '%s'" % pkgtype
+		sys.exit(1)
+	trees = portage.db
+	if os.path.realpath(root) == os.path.realpath(portage.settings["ROOT"]):
+		root = portage.settings["ROOT"] # contains the normalized $ROOT
+	try:
+			values = trees[root][type_map[pkgtype]].dbapi.aux_get(
+				pkgspec, metakeys)
+			for value in values:
+				print value
+	except KeyError:
+		print >> sys.stderr, "Package not found: '%s'" % pkgspec
+		sys.exit(1)
+
+metadata.uses_root = True
+
+def best_visible(argv):
+	"""<root> [<category/package>]+
+	Returns category/package-version (without .ebuild).
+	"""
+	if (len(argv) < 2):
+		print "ERROR: insufficient parameters!"
+		sys.exit(2)
+	try:
+		mylist=portage.db[argv[0]]["porttree"].dbapi.match(argv[1])
+		visible=portage.best(mylist)
+		if visible:
+			print visible
+			sys.exit(0)
+		else:
+			sys.exit(1)
+	except KeyError:
+		sys.exit(1)
+best_visible.uses_root = True
+
+
+def mass_best_visible(argv):
+	"""<root> [<category/package>]+
+	Returns category/package-version (without .ebuild).
+	"""
+	if (len(argv) < 2):
+		print "ERROR: insufficient parameters!"
+		sys.exit(2)
+	try:
+		for pack in argv[1:]:
+			mylist=portage.db[argv[0]]["porttree"].dbapi.match(pack)
+			print pack+":"+portage.best(mylist)
+	except KeyError:
+		sys.exit(1)
+mass_best_visible.uses_root = True
+
+
+def all_best_visible(argv):
+	"""<root>
+	Returns all best_visible packages (without .ebuild).
+	"""
+	if (len(argv) < 1):
+		print "ERROR: insufficient parameters!"
+	
+	#print portage.db[argv[0]]["porttree"].dbapi.cp_all()
+	for pkg in portage.db[argv[0]]["porttree"].dbapi.cp_all():
+		mybest=portage.best(portage.db[argv[0]]["porttree"].dbapi.match(pkg))
+		if mybest:
+			print mybest
+all_best_visible.uses_root = True
+
+
+def match(argv):
+	"""<root> <category/package>
+	Returns \n seperated list of category/package-version
+	"""
+	if (len(argv) < 2):
+		print "ERROR: insufficient parameters!"
+		sys.exit(2)
+	try:
+		print "\n".join(portage.db[argv[0]]["vartree"].dbapi.match(argv[1]))
+	except KeyError:
+		sys.exit(1)
+match.uses_root = True
+
+
+def vdb_path(argv):
+	"""
+	Returns the path used for the var(installed) package database for the
+	set environment/configuration options.
+	"""
+	print portage.root+portage.VDB_PATH
+
+
+def gentoo_mirrors(argv):
+	"""
+	Returns the mirrors set to use in the portage configuration.
+	"""
+	print portage.settings["GENTOO_MIRRORS"]
+
+
+def portdir(argv):
+	"""
+	Returns the PORTDIR path.
+	"""
+	print portage.settings["PORTDIR"]
+
+
+def config_protect(argv):
+	"""
+	Returns the CONFIG_PROTECT paths.
+	"""
+	print portage.settings["CONFIG_PROTECT"]
+
+
+def config_protect_mask(argv):
+	"""
+	Returns the CONFIG_PROTECT_MASK paths.
+	"""
+	print portage.settings["CONFIG_PROTECT_MASK"]
+
+
+def portdir_overlay(argv):
+	"""
+	Returns the PORTDIR_OVERLAY path.
+	"""
+	print portage.settings["PORTDIR_OVERLAY"]
+
+
+def pkgdir(argv):
+	"""
+	Returns the PKGDIR path.
+	"""
+	print portage.settings["PKGDIR"]
+
+
+def distdir(argv):
+	"""
+	Returns the DISTDIR path.
+	"""
+	print portage.settings["DISTDIR"]
+
+
+def envvar(argv):
+	"""<variable>+
+	Returns a specific environment variable as exists prior to ebuild.sh.
+	Similar to: emerge --verbose --info | @EGREP@ '^<variable>='
+	"""
+	verbose = "-v" in argv
+	if verbose:
+		argv.pop(argv.index("-v"))
+
+	if len(argv) == 0:
+		print "ERROR: insufficient parameters!"
+		sys.exit(2)
+
+	for arg in argv:
+		if verbose:
+			print arg +"='"+ portage.settings[arg] +"'"
+		else:
+			print portage.settings[arg]
+
+def get_repos(argv):
+	"""<root>
+	Returns all repos with names (repo_name file) argv[0] = $ROOT
+	"""
+	if len(argv) < 1:
+		print "ERROR: insufficient parameters!"
+		sys.exit(2)
+	print " ".join(portage.db[argv[0]]["porttree"].dbapi.getRepositories())
+
+def get_repo_path(argv):
+	"""<root> <repo_id>+
+	Returns the path to the repo named argv[1], argv[0] = $ROOT
+	"""
+	if len(argv) < 2:
+		print "ERROR: insufficient parameters!"
+		sys.exit(2)
+	for arg in arvg[1:]:
+		print portage.db[argv[0]]["porttree"].dbapi.getRepositoryPath(argv[1])
+
+#-----------------------------------------------------------------------------
+#
+# DO NOT CHANGE CODE BEYOND THIS POINT - IT'S NOT NEEDED!
+#
+
+def usage(argv):
+	rev="$Revision: 1.13.2.1 $"
+	ver= rev.split(' ')[1]
+	print ">>> Portage information query tool -- version "+ver
+	print ">>> Usage: portageq <command> [<option> ...]"
+	print ""
+	print "Available commands:"
+
+	#
+	# Show our commands -- we do this by scanning the functions in this
+	# file, and formatting each functions documentation.
+	#
+	for name in globals().keys():
+		# Drop python stuff, modules, and our own support functions.
+		if (name in ("usage", "__doc__", "__name__", "main", "os", "portage", "sys", "__builtins__", "types", "string","exithandler")):
+			continue
+
+		# Drop non-functions
+		obj = globals()[name]
+		if  (type(obj) != types.FunctionType):
+			continue
+
+		doc = obj.__doc__
+		if (doc == None):
+			print "   "+name
+			print "      MISSING DOCUMENTATION!"
+			print ""
+			continue
+
+		lines = doc.split("\n")
+		print "   "+name+" "+lines[0].strip()
+		if (len(sys.argv) > 1):
+			if ("--help" not in sys.argv):
+				lines = lines[:-1]
+			for line in lines[1:]:
+				print "      "+line.strip()
+	if (len(sys.argv) == 1):
+		print "\nRun portageq with --help for info"
+
+def main():
+	if "-h" in sys.argv or "--help" in sys.argv:
+		usage(sys.argv)
+		sys.exit(os.EX_OK)
+	elif len(sys.argv) < 2:
+		usage(sys.argv)
+		sys.exit(os.EX_USAGE)
+
+	cmd = sys.argv[1]
+	try:
+		function = globals()[cmd]
+		uses_root = (getattr(function, "uses_root", False) and len(sys.argv) > 2)
+		if uses_root:
+			os.environ["ROOT"] = sys.argv[2]
+		global portage
+		try:
+			import portage
+		except ImportError:
+			from os import path as osp
+			sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
+			import portage
+		if uses_root:
+			sys.argv[2] = portage.root
+		function(sys.argv[2:])
+	except KeyError:
+		usage(sys.argv)
+		sys.exit(os.EX_USAGE)
+
+main()
+
+#-----------------------------------------------------------------------------
Index: /vendor/prefix-portage/current/bin/prepall
===================================================================
--- /vendor/prefix-portage/current/bin/prepall	(revision 3489)
+++ /vendor/prefix-portage/current/bin/prepall	(revision 3489)
@@ -0,0 +1,25 @@
+#!@BASH@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: prepall 2230 2005-11-01 01:35:59Z vapier $
+
+if type -P chflags > /dev/null && type -P mtree > /dev/null ; then
+	# Save all the file flags for restoration at the end of prepall.
+	mtree -c -p "${ED}" -k flags > "${T}/bsdflags.mtree"
+	# Remove all the file flags so that prepall can do anything necessary.
+	chflags -R noschg,nouchg,nosappnd,nouappnd "${ED}"
+	chflags -R nosunlnk,nouunlnk "${ED}" 2>/dev/null
+fi
+
+prepallman
+prepallinfo
+
+ecompressdir --dequeue
+ecompress --dequeue
+
+prepallstrip
+
+if type -P chflags > /dev/null && type -P mtree > /dev/null; then
+	# Restore all the file flags that were saved at the beginning of prepall.
+	mtree -U -e -p "${ED}" -k flags < "${T}/bsdflags.mtree" &> /dev/null
+fi
Index: /vendor/prefix-portage/current/bin/prepalldocs
===================================================================
--- /vendor/prefix-portage/current/bin/prepalldocs	(revision 3489)
+++ /vendor/prefix-portage/current/bin/prepalldocs	(revision 3489)
@@ -0,0 +1,14 @@
+#!@BASH@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/prepalldocs,v 1.6 2004/10/04 13:56:50 vapier Exp $
+
+if [[ -n $1 ]] ; then
+	vecho "${0##*/}: invalid usage; takes no arguments" 1>&2
+fi
+
+cd "${ED}"
+[[ -d usr/share/doc ]] || exit 0
+
+ecompressdir --ignore /usr/share/doc/${PF}/html
+ecompressdir --queue /usr/share/doc
Index: /vendor/prefix-portage/current/bin/prepallinfo
===================================================================
--- /vendor/prefix-portage/current/bin/prepallinfo	(revision 3489)
+++ /vendor/prefix-portage/current/bin/prepallinfo	(revision 3489)
@@ -0,0 +1,8 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/prepallinfo,v 1.6 2004/10/04 13:56:50 vapier Exp $
+
+[[ ! -d ${ED}usr/share/info ]] && exit 0
+
+exec prepinfo
Index: /vendor/prefix-portage/current/bin/prepallman
===================================================================
--- /vendor/prefix-portage/current/bin/prepallman	(revision 3489)
+++ /vendor/prefix-portage/current/bin/prepallman	(revision 3489)
@@ -0,0 +1,15 @@
+#!@BASH@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/prepallman,v 1.10 2004/10/04 13:56:50 vapier Exp $
+
+ret=0
+
+find "${ED}" -type d -name man > "${T}"/prepallman.filelist
+while read mandir ; do
+	mandir=${mandir#${ED}}
+	prepman "${mandir%/man}"
+	((ret+=$?))
+done < "${T}"/prepallman.filelist
+
+exit ${ret}
Index: /vendor/prefix-portage/current/bin/prepallstrip
===================================================================
--- /vendor/prefix-portage/current/bin/prepallstrip	(revision 3489)
+++ /vendor/prefix-portage/current/bin/prepallstrip	(revision 3489)
@@ -0,0 +1,6 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/prepallstrip,v 1.12 2004/10/04 13:56:50 vapier Exp $
+
+exec prepstrip "${ED}"
Index: /vendor/prefix-portage/current/bin/prepinfo
===================================================================
--- /vendor/prefix-portage/current/bin/prepinfo	(revision 3489)
+++ /vendor/prefix-portage/current/bin/prepinfo	(revision 3489)
@@ -0,0 +1,29 @@
+#!@BASH@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/prepinfo,v 1.6.2.1 2005/05/29 12:40:08 jstubbs Exp $
+
+if [[ -z $1 ]] ; then
+	infodir="${EPREFIX}/usr/share/info"
+else
+	if [[ -d ${ED}$1/share/info ]] ; then
+		infodir="${EPREFIX}$1/share/info"
+	else
+		infodir="${EPREFIX}$1/info"
+	fi
+fi
+
+if [[ ! -d ${ED}${infodir} ]] ; then
+	if [[ -n $1 ]] ; then
+		vecho "${0##*/}: '${infodir}' does not exist!"
+		exit 1
+	else
+		exit 0
+	fi
+fi
+
+find "${ED}${infodir}" -type d -print0 | while read -d $'\0' x ; do
+	rm -f "${x}"/dir{,.info}{,.gz,.bz2}
+done
+
+exec ecompressdir --queue "${infodir}"
Index: /vendor/prefix-portage/current/bin/preplib
===================================================================
--- /vendor/prefix-portage/current/bin/preplib	(revision 3489)
+++ /vendor/prefix-portage/current/bin/preplib	(revision 3489)
@@ -0,0 +1,29 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/preplib,v 1.7.2.1 2005/01/02 09:36:02 jstubbs Exp $
+
+source "${PORTAGE_BIN_PATH:-${EPREFIX}/usr/lib/portage/bin}"/isolated-functions.sh
+
+eqawarn "QA Notice: Deprecated call to 'preplib'"
+
+LIBDIR_VAR="LIBDIR_${ABI}"
+if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then
+	CONF_LIBDIR="${!LIBDIR_VAR}"
+fi
+unset LIBDIR_VAR
+
+if [ -z "${CONF_LIBDIR}" ]; then
+	# we need this to default to lib so that things dont break
+	CONF_LIBDIR="lib"
+fi
+
+if [ -z "$1" ] ; then
+	z="${ED}/usr/${CONF_LIBDIR}"
+else
+	z="${ED}$1/${CONF_LIBDIR}"
+fi
+
+if [ -d "${z}" ] ; then
+	ldconfig -n -N "${z}"
+fi
Index: /vendor/prefix-portage/current/bin/prepman
===================================================================
--- /vendor/prefix-portage/current/bin/prepman	(revision 3489)
+++ /vendor/prefix-portage/current/bin/prepman	(revision 3489)
@@ -0,0 +1,28 @@
+#!@BASH@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/prepman,v 1.10.2.3 2005/05/29 12:40:08 jstubbs Exp $
+
+if [[ -z $1 ]] ; then 
+	mandir="${ED}usr/share/man"
+else
+	mandir="${ED}$1/man"
+fi
+
+if [[ ! -d ${mandir} ]] ; then
+	eqawarn "QA Notice: prepman called with non-existent dir '${mandir#${ED}}'"
+	exit 0
+fi
+
+shopt -s nullglob
+
+really_is_mandir=0
+
+# use some heuristics to test if this is a real mandir
+for subdir in "${mandir}"/man* "${mandir}"/*/man* ; do
+	[[ -d ${subdir} ]] && really_is_mandir=1 && break
+done
+
+[[ ${really_is_mandir} == 1 ]] && exec ecompressdir --queue "${mandir#${ED}}"
+
+exit 0
Index: /vendor/prefix-portage/current/bin/prepstrip
===================================================================
--- /vendor/prefix-portage/current/bin/prepstrip	(revision 3489)
+++ /vendor/prefix-portage/current/bin/prepstrip	(revision 3489)
@@ -0,0 +1,102 @@
+#!@BASH@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+source "${PORTAGE_BIN_PATH:-${EPREFIX}/usr/lib/portage/bin}"/isolated-functions.sh
+
+unset NOSTRIP
+if hasq nostrip ${FEATURES} ${RESTRICT} || \
+   hasq strip ${RESTRICT}
+then
+	NOSTRIP=1
+	hasq installsources ${FEATURES} || exit 0
+fi
+
+STRIP=${STRIP:-${CHOST}-strip}
+type -P -- ${STRIP} > /dev/null || STRIP=strip
+OBJCOPY=${OBJCOPY:-${CHOST}-objcopy}
+type -P -- ${OBJCOPY} > /dev/null || OBJCOPY=objcopy
+
+# We'll leave out -R .note for now until we can check out the relevance
+# of the section when it has the ALLOC flag set on it ...
+export SAFE_STRIP_FLAGS="--strip-unneeded"
+export PORTAGE_STRIP_FLAGS=${PORTAGE_STRIP_FLAGS-${SAFE_STRIP_FLAGS} -R .comment}
+
+banner=1
+
+save_elf_debug() {
+	local x=$1
+	local y="${ED}usr/lib/debug/${x:${#ED}}.debug"
+
+	if hasq installsources ${FEATURES} && [ -x "${EPREFIX}"/usr/bin/debugedit ] ; then
+		local sources_dir=/usr/src/debug/${CATEGORY}/${PF}
+		debugedit -b "${WORKDIR}" -d "${EPREFIX}/${sources_dir}" \
+			-l "${T}"/debug.sources "${x}"
+		if [[ -s ${T}/debug.sources ]] ; then 
+			[[ -d ${ED}${sources_dir} ]] || mkdir -p "${ED}${sources_dir}"
+			grep -zv '/<built-in>$' "${T}"/debug.sources | \
+				(cd "${WORKDIR}"; LANG=C sort -z -u | \
+				rsync -rtL0 --files-from=- "${WORKDIR}/" "${ED}${sources_dir}/" )
+		fi
+	fi
+
+	hasq splitdebug ${FEATURES} || return 0
+	[[ -z "${NOSTRIP}" ]] || return 0
+
+	# dont save debug info twice.
+	[[ ${x:7} == ".debug" ]] && return 0
+
+	mkdir -p $(dirname "${y}")
+	${OBJCOPY} --only-keep-debug "${x}" "${y}"
+	${OBJCOPY} --add-gnu-debuglink="${y}" "${x}"
+	chmod a-x,o-w "${y}"
+
+}
+
+# The existance of the section .symtab tells us that a binary is stripped.
+# We want to log already stripped binaries, as this may be a QA violation.
+# They prevent us from getting the splitdebug data.
+f="$(scanelf -yqRBF '#k%F' -k '!.symtab' "$@")"
+if [[ -n "${f}" ]] ; then
+	vecho -e "\a\n"
+	eqawarn "QA Notice: Pre-stripped files found:"
+	eqawarn "${f}"
+	echo "${f}" > "${T}"/scanelf-already-stripped.log
+fi
+
+# Now we look for unstripped binaries.
+for x in $(scanelf -yqRBF '#k%F' -k '.symtab' "$@") $(for y in "$@"; do find "${y}" -type f -name '*.a' -print ; done); do
+	if [[ ${banner} -eq 1 ]] ; then
+		[[ -z ${NOSTRIP} ]] && vecho "strip: ${STRIP} ${PORTAGE_STRIP_FLAGS}"
+		banner=0
+	fi
+
+	f=$(file "${x}") || continue
+	[[ -z ${f} ]] && continue
+
+	# The noglob funk is to support STRIP_MASK="/*/booga" and to keep
+	#  the for loop from expanding the globs.
+	# The eval echo is to support STRIP_MASK="/*/{booga,bar}" sex.
+	set -o noglob
+	stripitbaby=1
+	for m in $(eval echo ${STRIP_MASK}) ; do
+		[[ ${x} == ${m} ]] && stripitbaby=0 && break
+	done
+	set +o noglob
+
+	if [[ ${f} == *"current ar archive"* ]] ; then
+		vecho "   ${x:${#ED}}"
+		[[ -n ${NOSTRIP} ]] && continue
+		[[ ${stripitbaby} -eq 1 ]] && ${STRIP} -g "${x}"
+	elif [[ ${f} == *"SB executable"* || ${f} == *"SB shared object"* || ${f} == *"SB relocatable"* ]] ; then
+		vecho "   ${x:${#ED}}"
+		save_elf_debug "${x}"
+		[[ -n ${NOSTRIP} ]] && continue
+		if [[ ${stripitbaby} -eq 1 ]] ; then
+			[[ ${f} == *"SB relocatable"* ]] \
+				&& ${STRIP} ${SAFE_STRIP_FLAGS} "${x}" \
+				|| ${STRIP} ${PORTAGE_STRIP_FLAGS} "${x}"
+		fi
+	fi
+done
Index: /vendor/prefix-portage/current/bin/quickpkg
===================================================================
--- /vendor/prefix-portage/current/bin/quickpkg	(revision 3489)
+++ /vendor/prefix-portage/current/bin/quickpkg	(revision 3489)
@@ -0,0 +1,139 @@
+#!@PYTHON@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+import errno, signal, sys, os
+
+def quickpkg_main(options, args, eout):
+	from portage import dblink, dep_expand, catsplit, isvalidatom, xpak
+	from portage.util import ensure_dirs
+	from portage.exception import InvalidData
+	from portage.dbapi.vartree import tar_contents
+	import tarfile
+	import portage
+	root = portage.settings["ROOT"]
+	trees = portage.db[root]
+	vartree = trees["vartree"]
+	vardb = vartree.dbapi
+	bintree = trees["bintree"]
+	if not os.access(bintree.pkgdir, os.W_OK):
+		eout.eerror("No write access to '%s'" % bintree.pkgdir)
+		return errno.EACCES
+	successes = []
+	missing = []
+	for arg in args:
+		try:
+			atom = dep_expand(arg, mydb=vardb, settings=vartree.settings)
+		except ValueError, e:
+			# Multiple matches thrown from cpv_expand
+			eout.eerror("Please use a more specific atom: %s" % \
+				" ".join(e.args[0]))
+			del e
+			missing.append(arg)
+			continue
+		except InvalidData, e:
+			eout.eerror("Invalid atom: %s" % str(e))
+			del e
+			missing.append(arg)
+			continue
+		if not isvalidatom(atom):
+			eout.eerror("Invalid atom: %s" % atom)
+			missing.append(arg)
+			continue
+		matches = vardb.match(atom)
+		pkgs_for_arg = 0
+		for cpv in matches:
+			bintree.prevent_collision(cpv)
+			cat, pkg = catsplit(cpv)
+			dblnk = dblink(cat, pkg, root,
+				vartree.settings, treetype="vartree",
+				vartree=vartree)
+			dblnk.lockdb()
+			try:
+				if not dblnk.exists():
+					# unmerged by a concurrent process
+					continue
+				eout.ebegin("Building package for %s" % cpv)
+				pkgs_for_arg += 1
+				contents = dblnk.getcontents()
+				xpdata = xpak.xpak(dblnk.dbdir)
+				binpkg_tmpfile = os.path.join(bintree.pkgdir,
+					cpv + ".tbz2." + str(os.getpid()))
+				ensure_dirs(os.path.dirname(binpkg_tmpfile))
+				tar = tarfile.open(binpkg_tmpfile, "w:bz2")
+				tar_contents(contents, root, tar)
+				tar.close()
+				xpak.tbz2(binpkg_tmpfile).recompose_mem(xpdata)
+			finally:
+				dblnk.unlockdb()
+			bintree.inject(cpv, filename=binpkg_tmpfile)
+			binpkg_path = bintree.getname(cpv)
+			try:
+				s = os.stat(binpkg_path)
+			except OSError, e:
+				# Sanity check, shouldn't happen normally.
+				eout.eend(1)
+				eout.eerror(str(e))
+				del e
+				eout.eerror("Failed to create package: '%s'" % binpkg_path)
+			else:
+				eout.eend(0)
+				successes.append((cpv, s.st_size))
+		if not pkgs_for_arg:
+			eout.eerror("Could not find anything " + \
+				"to match '%s'; skipping" % arg)
+			missing.append(arg)
+	if not successes:
+		eout.eerror("No packages found")
+		return 1
+	print
+	eout.einfo("Packages now in '%s':" % bintree.pkgdir)
+	import math
+	units = {10:'K', 20:'M', 30:'G', 40:'T',
+		50:'P', 60:'E', 70:'Z', 80:'Y'}
+	for cpv, size in successes:
+		if not size:
+			# avoid OverflowError in math.log()
+			size_str = "0"
+		else:
+			power_of_2 = math.log(size, 2)
+			power_of_2 = 10*int(power_of_2/10)
+			unit = units.get(power_of_2)
+			if unit:
+				size = float(size)/(2**power_of_2)
+				size_str = "%.1f" % size
+				if len(size_str) > 4:
+					# emulate `du -h`, don't show too many sig figs
+					size_str = str(int(size))
+				size_str += unit
+			else:
+				size_str = str(size)
+		eout.einfo("%s: %s" % (cpv, size_str))
+	if missing:
+		print
+		eout.ewarn("The following packages could not be found:")
+		eout.ewarn(" ".join(missing))
+		return 2
+	return os.EX_OK
+
+if __name__ == "__main__":
+	usage = "Usage: quickpkg [options] <list of package atoms>"
+	from optparse import OptionParser
+	parser = OptionParser(usage=usage)
+	options, args = parser.parse_args(sys.argv[1:])
+	if not args:
+		parser.error("no packages atoms given")
+	# We need to ensure a sane umask for the packages that will be created.
+	old_umask = os.umask(022)
+	from portage.output import get_term_size, EOutput
+	eout = EOutput()
+	def sigwinch_handler(signum, frame):
+		lines, eout.term_columns = get_term_size()
+	signal.signal(signal.SIGWINCH, sigwinch_handler)
+	try:
+		retval = quickpkg_main(options, args, eout)
+	finally:
+		os.umask(old_umask)
+		signal.signal(signal.SIGWINCH, signal.SIG_DFL)
+	sys.exit(retval)
Index: /vendor/prefix-portage/current/bin/regenworld
===================================================================
--- /vendor/prefix-portage/current/bin/regenworld	(revision 3489)
+++ /vendor/prefix-portage/current/bin/regenworld	(revision 3489)
@@ -0,0 +1,95 @@
+#!@PYTHON@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/bin/regenworld,v 1.10.2.1 2005/01/11 03:40:57 carpaski Exp $
+
+import sys, os
+try:
+	import portage
+except ImportError:
+	from os import path as osp
+	sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
+	import portage
+import re, portage.const
+
+__candidatematcher__ = re.compile("^[0-9]+: \\*\\*\\* emerge ")
+__noncandidatematcher__ = re.compile(" sync( |$)| clean( |$)| search( |$)|--oneshot|--fetchonly| unmerge( |$)")
+
+def issyspkg(pkgline):
+	return (pkgline[0] == "*")
+
+def iscandidate(logline):
+	return (__candidatematcher__.match(logline) \
+				and not __noncandidatematcher__.search(logline))
+
+def getpkginfo(logline):
+	logline = re.sub("^[0-9]+: \\*\\*\\* emerge ", "", logline)
+	logline = logline.strip()
+	logline = re.sub("(\\S+\\.(ebuild|tbz2))|(--\\S+)|inject ", "", logline)
+	return logline.strip()
+
+__uniqlist__ = []
+def isunwanted(pkgline):
+	if pkgline in ["world", "system", "depclean", "info", "regen", ""]:
+		return False
+	elif pkgline in __uniqlist__:
+		return False
+	elif not re.search("^[a-zA-Z<>=~]", pkgline):
+		return False
+	else:
+		__uniqlist__.append(pkgline)
+		return True
+
+# show a little description if we have arguments
+if len(sys.argv) >= 2 and sys.argv[1] in ["-h", "--help"]:
+	print "This script regenerates the portage world file by checking the portage"
+	print "logfile for all actions that you've done in the past. It ignores any"
+	print "arguments except --help. It is recommended that you make a backup of"
+	print "your existing world file (%s) before using this tool." % portage.WORLD_FILE
+	sys.exit(0)
+
+worldlist = portage.grabfile(os.path.join("/", portage.WORLD_FILE))
+syslist = portage.settings.packages
+syslist = filter(issyspkg, syslist)
+
+logfile = portage.grabfile(portage.const.EPREFIX+"/var/log/emerge.log")
+biglist = filter(iscandidate, logfile)
+biglist = map(getpkginfo, biglist)
+tmplist = []
+for l in biglist:
+	tmplist += l.split()
+biglist = filter(isunwanted, tmplist)
+#for p in biglist:
+#	print p
+#sys.exit(0)
+
+# resolving virtuals
+realsyslist = []
+for mykey in syslist:
+	# drop the asterix
+	mykey = mykey[1:]
+	#print "candidate:",mykey
+	mylist=portage.db["/"]["vartree"].dbapi.match(mykey)
+	if mylist:
+		mykey=portage.cpv_getkey(mylist[0])
+		if mykey not in realsyslist:
+			realsyslist.append(mykey)
+
+for mykey in biglist:
+	#print "checking:",mykey
+	try:
+		mylist=portage.db["/"]["vartree"].dbapi.match(mykey)
+	except KeyError:
+		if "--debug" in sys.argv:
+			print "* ignoring broken log entry for %s (likely injected)" % mykey
+	except ValueError, e:
+		print "* %s is an ambigous package name, candidates are:\n%s" % (mykey, e)
+		continue
+	if mylist:
+		#print "mylist:",mylist
+		myfavkey=portage.cpv_getkey(mylist[0])
+		if (myfavkey not in realsyslist) and (myfavkey not in worldlist):
+			print "add to world:",myfavkey
+			worldlist.append(myfavkey)
+
+portage.write_atomic(os.path.join("/", portage.WORLD_FILE), "\n".join(worldlist))
Index: /vendor/prefix-portage/current/bin/repoman
===================================================================
--- /vendor/prefix-portage/current/bin/repoman	(revision 3489)
+++ /vendor/prefix-portage/current/bin/repoman	(revision 3489)
@@ -0,0 +1,2090 @@
+#!@PYTHON@ -O
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: repoman 4651 2006-10-10 21:10:33Z zmedico $
+
+# Next to do: dep syntax checking in mask files
+# Then, check to make sure deps are satisfiable (to avoid "can't find match for" problems)
+# that last one is tricky because multiple profiles need to be checked.
+
+import errno
+import os
+import shutil
+import sys
+import signal
+import re
+import tempfile
+
+try:
+	import cPickle as pickle
+except ImportError:
+	import pickle
+
+if not hasattr(__builtins__, "set"):
+	from sets import Set as set
+
+exename=os.path.basename(sys.argv[0])	
+version="1.2"	
+
+allowed_filename_chars="a-zA-Z0-9._-+:"
+allowed_filename_chars_set = {}
+map(allowed_filename_chars_set.setdefault, map(chr, range(ord('a'), ord('z')+1)))
+map(allowed_filename_chars_set.setdefault, map(chr, range(ord('A'), ord('Z')+1)))
+map(allowed_filename_chars_set.setdefault, map(chr, range(ord('0'), ord('9')+1)))
+map(allowed_filename_chars_set.setdefault, map(chr, map(ord, [".", "-", "_", "+", ":"])))
+
+os.environ["PORTAGE_LEGACY_GLOBALS"] = "false"
+try:
+	import portage
+except ImportError:
+	from os import path as osp
+	sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
+	import portage
+del os.environ["PORTAGE_LEGACY_GLOBALS"]
+
+import portage.checksum
+import portage.const
+import portage.dep
+import portage.dep
+portage.dep._dep_check_strict = True
+import portage.exception
+from portage import cvstree
+import time
+import codecs
+
+from portage.manifest import Manifest
+from portage.exception import ParseError
+from portage.process import find_binary, spawn
+
+from portage.output import bold, darkgreen, darkred, green, nocolor, red, turquoise, yellow
+
+from commands import getstatusoutput
+from fileinput import input
+from grp import getgrnam
+from stat import S_ISDIR, ST_CTIME, ST_GID, ST_MTIME
+
+# A sane umask is needed for files that portage creates.
+os.umask(022)
+repoman_settings = portage.config(local_config=False,
+	config_incrementals=portage.const.INCREMENTALS)
+repoman_settings.lock()
+
+if repoman_settings.get("NOCOLOR", "").lower() in ("yes", "true") or \
+	not sys.stdout.isatty():
+	nocolor()
+
+def warn(txt):
+	print exename+": "+txt
+def err(txt):
+	warn(txt)
+	sys.exit(1)
+
+def err_help(txt):
+	help(exitstatus=-1,helpfulness=0)
+	warn(txt)
+	sys.exit(1)
+
+def exithandler(signum=None,frame=None):
+	sys.stderr.write("\n"+exename+": Interrupted; exiting...\n")
+	sys.exit(1)
+	os.kill(0,signal.SIGKILL)
+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",
+"commit" : "Scan directory tree for QA issues; if OK, commit via cvs",
+"last"   : "Remember report from last run",
+"lfull"  : "Remember report from last run (full listing)"
+}
+modes=modeshelp.keys()
+repoman_options={
+"--commitmsg"      : "Adds a commit message via the command line",
+"--commitmsgfile"  : "Adds a commit message from the specified file",
+"--help"           : "Show this screen",
+"--ignore-arches"  : "Ignore arch-specific failures (where arch != host)",
+"--ignore-masked"  : "Ignore masked packages (not allowed with commit mode)",
+"--pretend"        : "Don't commit or fix anything; just show what would be done",
+"--quiet"          : "Be less verbose about extraneous info",
+"--verbose"        : "Displays every package name while checking",
+"--version"        : "Show version info",
+"--xmlparse"       : "Forces the metadata.xml parse check to be carried out"
+}
+repoman_shortoptions={
+"-h" : "--help",
+"-i" : "--ignore-masked",
+"-I" : "--ignore-arches",
+"-m" : "--commitmsg",
+"-M" : "--commitmsgfile",
+"-p" : "--pretend",
+"-q" : "--quiet",
+"-v" : "--verbose",
+"-V" : "--version",
+"-x" : "--xmlparse"
+}
+repoman_shortoptions_rev=dict([(v,k) for (k,v) in repoman_shortoptions.items()])
+options=repoman_options.keys()
+
+qahelp={
+	"CVS/Entries.IO_error":"Attempting to commit, and an IO error was encountered access the Entries file",
+	"digest.partial":"Digest files do not contain all corresponding URI elements",
+	"digest.assumed":"Existing digest must be assumed correct (Package level only)",
+	"digestentry.unused":"Digest/Manifest entry has no matching SRC_URI entry",
+	"digest.fail":"Digest does not match the specified local file",
+	"digest.stray":"Digest files that do not have a corresponding ebuild",
+	"digest.missing":"Digest files that are missing (ebuild exists, digest doesn't)",
+	"digest.disjointed":"Digests not added to cvs when the matching ebuild has been added",
+	"digest.notadded":"Digests that exist but have not been added to cvs",
+	"digest.unmatch":"Digests which are incomplete (please check if your USE/ARCH includes all files)",
+	"ebuild.invalidname":"Ebuild files with a non-parseable or syntactically incorrect name (or using 2.1 versioning extensions)",
+	"ebuild.namenomatch":"Ebuild files that do not have the same name as their parent directory",
+	"changelog.missing":"Missing ChangeLog files",
+	"ebuild.disjointed":"Ebuilds not added to cvs when the matching digest has been added",
+	"ebuild.notadded":"Ebuilds that exist but have not been added to cvs",
+	"changelog.notadded":"ChangeLogs that exist but have not been added to cvs",
+	"filedir.missing":"Package lacks a files directory",
+	"file.executable":"Ebuilds, digests, metadata.xml, Manifest, and ChangeLog do note need the executable bit",
+	"file.size":"Files in the files directory must be under 20k",
+	"file.name":"File/dir name must be composed of only the following chars: %s " % allowed_filename_chars,
+	"file.UTF8":"File is not UTF8 compliant",
+	"KEYWORDS.missing":"Ebuilds that have a missing or empty KEYWORDS variable",
+	"KEYWORDS.stupid":"Ebuilds that use KEYWORDS=-* instead of package.mask", 
+	"LICENSE.missing":"Ebuilds that have a missing or empty LICENSE variable",
+	"DESCRIPTION.missing":"Ebuilds that have a missing or empty DESCRIPTION variable",
+	"SLOT.missing":"Ebuilds that have a missing or empty SLOT variable",
+	"HOMEPAGE.missing":"Ebuilds that have a missing or empty HOMEPAGE variable",
+	"DEPEND.bad":"User-visible ebuilds with bad DEPEND settings (matched against *visible* ebuilds)",
+	"RDEPEND.bad":"User-visible ebuilds with bad RDEPEND settings (matched against *visible* ebuilds)",
+	"PDEPEND.bad":"User-visible ebuilds with bad PDEPEND settings (matched against *visible* ebuilds)",
+	"DEPEND.badmasked":"Masked ebuilds with bad DEPEND settings (matched against *all* ebuilds)",
+	"RDEPEND.badmasked":"Masked ebuilds with RDEPEND settings (matched against *all* ebuilds)",
+	"PDEPEND.badmasked":"Masked ebuilds with PDEPEND settings (matched against *all* ebuilds)",
+	"DEPEND.badindev":"User-visible ebuilds with bad DEPEND settings (matched against *visible* ebuilds) in developing arch",
+	"RDEPEND.badindev":"User-visible ebuilds with bad RDEPEND settings (matched against *visible* ebuilds) in developing arch",
+	"PDEPEND.badindev":"User-visible ebuilds with bad PDEPEND settings (matched against *visible* ebuilds) in developing arch",
+	"DEPEND.badmaskedindev":"Masked ebuilds with bad DEPEND settings (matched against *all* ebuilds) in developing arch",
+	"RDEPEND.badmaskedindev":"Masked ebuilds with RDEPEND settings (matched against *all* ebuilds) in developing arch",
+	"PDEPEND.badmaskedindev":"Masked ebuilds with PDEPEND settings (matched against *all* ebuilds) in developing arch",
+	"DEPEND.syntax":"Syntax error in DEPEND (usually an extra/missing space/parenthesis)",
+	"RDEPEND.syntax":"Syntax error in RDEPEND (usually an extra/missing space/parenthesis)",
+	"PDEPEND.syntax":"Syntax error in PDEPEND (usually an extra/missing space/parenthesis)",
+	"LICENSE.syntax":"Syntax error in LICENSE (usually an extra/missing space/parenthesis)",
+	"PROVIDE.syntax":"Syntax error in PROVIDE (usually an extra/missing space/parenthesis)",
+	"SRC_URI.syntax":"Syntax error in SRC_URI (usually an extra/missing space/parenthesis)",
+	"ebuild.syntax":"Error generating cache entry for ebuild; typically caused by ebuild syntax error",
+	"ebuild.output":"A simple sourcing of the ebuild produces output; this breaks ebuild policy.",
+	"ebuild.nesteddie":"Placing 'die' inside ( ) prints an error, but doesn't stop the ebuild.",
+	"variable.readonly":"Assigning a readonly variable",
+	"LIVEVCS.stable":"This ebuild is a live checkout from a VCS but has stable keywords.",
+	"IUSE.invalid":"This ebuild has a variable in IUSE that is not in the use.desc or use.local.desc file",
+	"LICENSE.invalid":"This ebuild is listing a license that doesnt exist in portages license/ dir.",
+	"KEYWORDS.invalid":"This ebuild contains KEYWORDS that are not listed in profiles/arch.list or for which no valid profile was found",
+	"ebuild.nostable":"There are no ebuilds that are marked as stable for your ARCH",
+	"ebuild.allmasked":"All ebuilds are masked for this package (Package level only)",
+	"ebuild.majorsyn":"This ebuild has a major syntax error that may cause the ebuild to fail partially or fully",
+	"ebuild.minorsyn":"This ebuild has a minor syntax error that contravenes gentoo coding style",
+	"ebuild.badheader":"This ebuild has a malformed header",
+	"metadata.missing":"Missing metadata.xml files",
+	"metadata.bad":"Bad metadata.xml files",
+	"virtual.versioned":"PROVIDE contains virtuals with versions",
+	"virtual.exists":"PROVIDE contains existing package names",
+	"virtual.unavailable":"PROVIDE contains a virtual which contains no profile default",
+	"usage.obsolete":"The ebuild makes use of an obsolete construct"
+}
+
+qacats = qahelp.keys()
+qacats.sort()
+
+qawarnings=[
+"changelog.missing",
+"changelog.notadded",
+"ebuild.notadded",
+"ebuild.nostable",
+"ebuild.allmasked",
+"ebuild.nesteddie",
+"digest.assumed",
+"digest.notadded",
+"digest.disjointed",
+"digest.missing",
+"digestentry.unused",
+"DEPEND.badmasked","RDEPEND.badmasked","PDEPEND.badmasked",
+"DEPEND.badindev","RDEPEND.badindev","PDEPEND.badindev",
+"DEPEND.badmaskedindev","RDEPEND.badmaskedindev","PDEPEND.badmaskedindev",
+"IUSE.invalid",
+"KEYWORDS.stupid",
+"KEYWORDS.missing",
+"ebuild.minorsyn",
+"ebuild.badheader",
+"file.size",
+"metadata.missing",
+"metadata.bad",
+"virtual.versioned",
+"virtual.exists",
+"virtual.unavailable",
+"usage.obsolete",
+"LIVEVCS.stable"
+]
+
+missingvars=["KEYWORDS","LICENSE","DESCRIPTION","HOMEPAGE","SLOT"]
+allvars=portage.auxdbkeys
+commitmessage=None
+commitmessagefile=None
+for x in missingvars:
+	x += ".missing"
+	if x not in qacats:
+		print "* missingvars values need to be added to qahelp ("+x+")"
+		qacats.append(x)
+		qawarnings.append(x)
+
+
+verbose=0
+quiet=0
+
+def show_version():
+	print exename+" "+version
+	sys.exit(0)
+	
+def help(exitstatus=1,helpfulness=1):
+	if quiet:
+		helpfulness=0
+	if helpfulness:
+		print
+		print green(exename+" "+version)
+		print " \"Quality is job zero.\""
+		print " Copyright 1999-2006 Gentoo Foundation"
+		print " Distributed under the terms of the GNU General Public License v2"
+		print
+	print bold(" Usage:"),turquoise(exename),"[",green("options"),"] [",green("mode"),"]"
+	if helpfulness:
+		print bold(" Modes:"),turquoise("scan (default)"),
+		for x in modes[1:]:
+			print "|",turquoise(x),
+		print
+	print
+	print " "+green("Options".ljust(20)+" Description")
+	for x in options:
+		if repoman_shortoptions_rev.has_key(x):
+			shopt=repoman_shortoptions_rev[x]+", "+x
+		else:
+			shopt="    "+x
+		print " "+shopt.ljust(20),repoman_options[x]
+	print
+	print " "+green("Modes".ljust(20)+" Description")
+	for x in modes:
+		print " "+x.ljust(20),modeshelp[x]
+	if helpfulness:
+		print
+		print " "+green("QA keyword".ljust(20)+" Description")
+		for x in qacats:
+			print " "+x.ljust(20),qahelp[x]
+		print
+	if (exitstatus != -1):
+		sys.exit(exitstatus)
+	else:
+		print
+
+def last():
+	try:
+		#Retrieve and unpickle stats and fails from saved files
+		mystats=os.path.normpath(portage.const.CACHE_DIR+'/repo.stats')
+		myfails=os.path.normpath(portage.const.CACHE_DIR+'/repo.fails')
+		savedf=open(mystat,'r')
+		stats = pickle.load(savedf)
+		savedf.close()
+		savedf=open(myfails,'r')
+		fails = pickle.load(savedf)
+		savedf.close()
+	except SystemExit, e:
+		raise  # Need to propogate this
+	except:
+		err("Error retrieving last repoman run data; exiting.")
+
+	#dofail will be set to 1 if we have failed in at least one non-warning category
+	dofail=0
+	#dowarn will be set to 1 if we tripped any warnings
+	dowarn=0
+	#dofull will be set if we should print a "repoman full" informational message
+	dofull=0
+
+	print
+	print green("RepoMan remembers...")
+	print
+	for x in qacats:
+		if stats[x]:
+			dowarn=1
+			if x not in qawarnings:
+				dofail=1
+		else:
+			continue
+		print "  "+ x.ljust(20),
+		if stats[x]==0:
+			print green(`stats[x]`)
+			continue
+		elif x in qawarnings:
+			print yellow(`stats[x]`)
+		else:
+			print red(`stats[x]`)
+		if mymode!="lfull":
+			if stats[x]<12:
+				for y in fails[x]:
+					print "   "+y
+			else:
+				dofull=1
+		else:
+			for y in fails[x]:
+				print "   "+y
+	print
+	if dofull:
+		print bold("Note: type \"repoman lfull\" for a complete listing of repomans last run.")
+		print
+	if dowarn and not dofail:
+		print green("RepoMan sez:"),"\"You only gave me a partial QA payment last time?\n              I took it, but I wasn't happy.\""
+	elif not dofail:
+		print green("RepoMan sez:"),"\"If everyone were like you, I'd be out of business!\""
+	print
+	sys.exit(1)
+
+mymode=None
+myoptions=[]
+if len(sys.argv)>1:
+	x=1
+	while x < len(sys.argv):
+		if sys.argv[x] in shortmodes.keys():
+			sys.argv[x]=shortmodes[sys.argv[x]]
+		elif sys.argv[x] in repoman_shortoptions.keys():
+			sys.argv[x] = repoman_shortoptions[sys.argv[x]]
+		if sys.argv[x] in modes:
+			if mymode is None:
+				mymode=sys.argv[x]
+			else:
+				err("Please specify either \""+mymode+"\" or \""+sys.argv[x]+"\", but not both.")
+		elif sys.argv[x] in options:
+			optionx=sys.argv[x]
+			if (optionx=="--commitmsg") and (len(sys.argv)>=(x+1)):
+				commitmessage=sys.argv[x+1]
+				x=x+1
+			elif (optionx=="--commitmsgfile") and (len(sys.argv)>=(x+1)):
+				commitmessagefile=sys.argv[x+1]
+				x=x+1
+			elif (optionx=="--verbose"):
+				verbose+=1
+			elif (optionx=="--quiet"):
+				quiet+=1
+			elif optionx not in myoptions:
+				myoptions.append(optionx)
+		else:
+			err_help("\""+sys.argv[x]+"\" is not a valid mode or option.")
+		x=x+1
+if mymode is None:
+	mymode="scan"
+if mymode=="help" or ("--help" in myoptions):
+	help(exitstatus=0)
+if ("--version" in myoptions):
+	show_version()
+if mymode=="last" or (mymode=="lfull"):
+	last()
+if mymode == "commit":
+	while "--ignore-masked" in myoptions:
+		myoptions.remove("--ignore-masked")
+
+from portage import normalize_path
+isCvs=False
+myreporoot=None
+if os.path.isdir("CVS"):
+	isCvs = True
+
+	try:
+		isCvs=True
+		myrepofile=open("CVS/Repository")
+		myreporoot=myrepofile.readline()[:-1]
+		myrepofile.close()
+		myrepofile=open("CVS/Root")
+		myreporootpath=string.split(myrepofile.readline()[:-1], ":")[-1]
+		myrepofile.close()
+		if myreporootpath == myreporoot[:len(myreporootpath)]:
+			# goofy os x cvs co.
+			myreporoot = myreporoot[len(myreporootpath):]
+			while myreporoot and myreporoot[0] == '/':
+				myreporoot = myreporoot[1:]
+	except SystemExit, e:
+		raise  # Need to propogate this
+	except:
+		err("Error grabbing repository information; exiting.")
+	myreporootpath=os.path.normpath(myreporootpath)
+	if myreporootpath=="/space/cvsroot":
+		print
+		print
+		print red("You're using the wrong cvsroot. For Manifests to be correct, you must")
+		print red("use the same base cvsroot path that the servers use. Please try the")
+		print red("following script to remedy this:")
+		print
+		print "cd my_cvs_tree"
+		print
+		print "rm -Rf [a-z]*"
+		print "cvs up"
+		print
+		if portage.userland=="BSD" or portage.userland=="Darwin":
+			print "find ./ -type f -regex '.*/CVS/Root$' -print0 | xargs -0 sed \\"
+		else:
+			print "find ./ -type f -regex '.*/CVS/Root$' -print0 | xargs -0r sed \\"
+		fi
+		print "  -i 's:/space/cvsroot$:/home/cvsroot:'"
+		print
+		print red("You must clear and re-update your tree as all header tags will cause")
+		print red("problems in manifests for all rsync and /home/cvsroot users.")
+		print
+		print "You should do this to any other gentoo trees your have as well,"
+		print "excluding the deletions. 'gentoo-src' should be /home/cvsroot."
+		print
+		sys.exit(123)
+
+isSvn=False
+myreporoot=None
+if os.path.isdir(".svn"):
+	try:
+		isSvn=True
+		myrepoinfo = os.popen("svn info").readlines()
+		myurl = myrepoinfo[1].split(":")[1].rstrip()
+		myreproot = myrepoinfo[2].split(":")[1].rstrip()
+		# This one is EVIL, but I don't know how to solve the problem of
+		# getting rid of /trunk/prefix-overlay.  This only works on the
+		# prefix overlay.
+		myreporoot = "/".join(myurl[len(myreproot):].split("/")[2:])
+		myreporootpath = "/" + "/".join(myreproot.split("/")[3:])
+	except SystemExit, e:
+		raise  # Need to propogate this
+	except:
+		err("Error grabbing repository information; exiting.")
+
+if mymode == "commit" and \
+	not isCvs and not isSvn and \
+	"--pretend" not in myoptions:
+	print
+	print darkgreen("Not in a CVS or SVN repository; enabling pretend mode.")
+	myoptions.append("--pretend");
+
+
+def have_profile_dir(path, maxdepth=3):
+	while path != "/" and maxdepth:
+		if os.path.exists(path + "/profiles/package.mask"):
+			return normalize_path(path)
+		path = normalize_path(path + "/..")
+		maxdepth -= 1
+
+portdir=None
+portdir_overlay=None
+mydir=os.getcwd()
+if "PWD" in os.environ and os.environ["PWD"] != mydir and \
+	os.path.realpath(os.environ["PWD"]) == mydir:
+	# getcwd() returns the canonical path but that makes it hard for repoman to
+	# orient itself if the user has symlinks in their portage tree structure.
+	# We use os.environ["PWD"], if available, to get the non-canonical path of
+	# 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 overlay_id in path_ids:
+		portdir_overlay = overlay
+		subdir = mydir[len(overlay):]
+		if subdir and subdir[-1] != "/":
+			subdir += "/"
+		if have_profile_dir(mydir, subdir.count("/")):
+			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"]
+	else:
+		portdir_overlay = have_profile_dir(mydir)
+	portdir = portdir_overlay
+
+if not portdir_overlay:
+	sys.stderr.write("Repoman is unable to determine PORTDIR or PORTDIR_OVERLAY from" + \
+		" the current\nworking directory.\n")
+	sys.exit(1)
+
+if not portdir:
+	portdir = repoman_settings["PORTDIR"]
+
+portdir = normalize_path(portdir)
+portdir_overlay = normalize_path(portdir_overlay)
+
+os.environ["PORTDIR"] = portdir
+if portdir_overlay != portdir:
+	os.environ["PORTDIR_OVERLAY"] = portdir_overlay
+else:
+	os.environ["PORTDIR_OVERLAY"] = ""
+
+if quiet < 2:
+	print "\nSetting paths:"
+	print "PORTDIR = \""+os.environ["PORTDIR"]+"\""
+	print "PORTDIR_OVERLAY = \""+os.environ["PORTDIR_OVERLAY"]+"\""
+
+# Now that PORTDIR_OVERLAY is properly overridden, create the portdb.
+repoman_settings = portage.config(local_config=False,
+	config_incrementals=portage.const.INCREMENTALS)
+trees = portage.create_trees()
+trees["/"]["porttree"].settings = repoman_settings
+portdb = trees["/"]["porttree"].dbapi
+portdb.mysettings = repoman_settings
+# dep_zapdeps looks at the vardbapi, but it shouldn't for repoman.
+del trees["/"]["vartree"]
+
+if not myreporoot:
+	myreporoot = os.path.basename(portdir_overlay)
+	myreporoot += mydir[len(portdir_overlay):-1]
+
+if isSvn:
+	reposplit=myreporoot.split("/")
+else:
+	reposplit=myreporoot.split("/")
+repolevel=len(reposplit)
+
+# check if it's in $PORTDIR/$CATEGORY/$PN , otherwise bail if commiting.
+# Reason for this is if they're trying to commit in just $FILESDIR/*, the Manifest needs updating.
+# this check ensure that repoman knows where it is, and the manifest recommit is at least possible.
+if mymode == "commit" and repolevel not in [1,2,3]:
+	print red("***")+" Commit attempts *must* be from within a cvs or svn co, category, or package directory."
+	print red("***")+" Attempting to commit from a packages files directory will be blocked for instance."
+	print red("***")+" This is intended behaviour, to ensure the manifest is recommited for a package."
+	print red("***")
+	err("Unable to identify level we're commiting from for %s" % '/'.join(reposplit))
+
+startdir = normalize_path(mydir)
+repodir = startdir
+for x in range(0,repolevel-1):
+	repodir = os.path.dirname(repodir)
+
+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 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...")
+
+def parse_use_local_desc(mylines, usedict=None):
+	"""returns a dict of the form {cpv:set(flags)}"""
+	if usedict is None:
+		usedict = {}
+	lineno = 0
+	for l in mylines:
+		lineno += 1
+		if not l or l.startswith("#"):
+			continue
+		mysplit = l.split(None, 1)
+		if not mysplit:
+			continue
+		mysplit = mysplit[0].split(":")
+		if len(mysplit) != 2:
+			raise ParseError("line %d: Malformed input: '%s'" % \
+				(lineno, l.rstrip("\n")))
+		usedict.setdefault(mysplit[0], set())
+		usedict[mysplit[0]].add(mysplit[1])
+	return usedict
+
+# retreive local USE list
+luselist={}
+try:
+	f = open(os.path.join(portdir, "profiles", "use.local.desc"))
+	parse_use_local_desc(f, luselist)
+	f.close()
+except (IOError, OSError, ParseError), e:
+	print >> sys.stderr, str(e)
+	err("Couldn't read from use.local.desc")
+
+if portdir_overlay != portdir:
+	filename = os.path.join(portdir_overlay, "profiles", "use.local.desc")
+	if os.path.exists(filename):
+		try:
+			f = open(filename)
+			parse_use_local_desc(f, luselist)
+			f.close()
+		except (IOError, OSError, ParseError), e:
+			print >> sys.stderr, str(e)
+			err("Couldn't read from '%s'" % filename)
+	del filename
+
+# setup a uselist from portage
+uselist=[]
+try:
+	uselist=portage.grabfile(portdir+"/profiles/use.desc")
+	for l in range(0,len(uselist)):
+		uselist[l]=uselist[l].split()[0]
+	for var in repoman_settings["USE_EXPAND"].split():
+		vardescs = portage.grabfile(portdir+"/profiles/desc/"+var.lower()+".desc")
+		for l in range(0, len(vardescs)):
+			uselist.append(var.lower() + "_" + vardescs[l].split()[0])
+except SystemExit, e:
+	raise  # Need to propogate this
+except:
+	err("Couldn't read USE flags from use.desc")
+
+# retrieve a list of current licenses in portage
+liclist = set(portage.listdir(os.path.join(portdir, "licenses")))
+if not liclist:
+	err("Couldn't find licenses?")
+if portdir_overlay != portdir:
+	liclist.update(portage.listdir(os.path.join(portdir_overlay, "licenses")))
+
+# retrieve list of offical keywords
+kwlist = set(portage.grabfile(os.path.join(portdir, "profiles", "arch.list")))
+if not kwlist:
+	err("Couldn't read KEYWORDS from arch.list")
+
+manifest1_compat = not os.path.exists(
+	os.path.join(portdir, "manifest1_obsolete"))
+if portdir_overlay != portdir:
+	kwlist.update(portage.grabfile(
+		os.path.join(portdir_overlay, "profiles", "arch.list")))
+	manifest1_compat = not os.path.exists(
+		os.path.join(portdir_overlay, "manifest1_obsolete"))
+
+scanlist=[]
+if repolevel==2:
+	#we are inside a category directory
+	catdir=reposplit[-1]
+	if catdir not in repoman_settings.categories:
+		caterror(catdir)
+	mydirlist=os.listdir(startdir)
+	for x in mydirlist:
+		if x == "CVS" or x.startswith("."):
+			continue
+		if os.path.isdir(startdir+"/"+x):
+			scanlist.append(catdir+"/"+x)
+elif repolevel==1:
+	for x in repoman_settings.categories:
+		if not os.path.isdir(startdir+"/"+x):
+			continue
+		for y in os.listdir(startdir+"/"+x):
+			if y == "CVS" or y.startswith("."):
+				continue
+			if os.path.isdir(startdir+"/"+x+"/"+y):
+				scanlist.append(x+"/"+y)
+elif repolevel==3:
+	catdir = reposplit[-2]
+	if catdir not in repoman_settings.categories:
+		caterror(catdir)
+	scanlist.append(catdir+"/"+reposplit[-1])
+
+profiles={}
+descfile=portdir+"/profiles/profiles.desc"
+if os.path.exists(descfile):
+	for x in portage.grabfile(descfile):
+		if x[0]=="#":
+			continue
+		arch=x.split()
+		if len(arch)!=3:
+			print "wrong format: \""+red(x)+"\" in "+descfile
+			continue
+		if not os.path.isdir(portdir+"/profiles/"+arch[1]):
+			print "Invalid "+arch[2]+" profile ("+arch[1]+") for arch "+arch[0]
+			continue
+		if profiles.has_key(arch[0]):
+			profiles[arch[0]]+= [[arch[1], arch[2]]]
+		else:
+			profiles[arch[0]] = [[arch[1], arch[2]]]
+
+	for x in repoman_settings.archlist():
+		if x[0] == "~":
+			continue
+		if not profiles.has_key(x):
+			print red("\""+x+"\" doesn't have a valid profile listed in profiles.desc.")
+			print red("You need to either \"cvs update\" your profiles dir or follow this")
+			print red("up with the "+x+" team.")
+			print
+else:
+	print red("profiles.desc does not exist: "+descfile)
+	print red("You need to do \"cvs update\" in profiles dir.")
+	print
+	sys.exit(1)
+
+
+stats={}
+fails={}
+
+for x in qacats:
+	stats[x]=0
+	fails[x]=[]
+xmllint_capable = False
+metadata_dtd = os.path.join(repoman_settings["DISTDIR"], 'metadata.dtd')
+if mymode == "manifest":
+	pass
+elif not find_binary('xmllint'):
+	print red("!!! xmllint not found. Can't check metadata.xml.\n")
+	if "--xmlparse" in myoptions or repolevel==3:
+		print red("!!!")+" sorry, xmllint is needed.  failing\n"
+		sys.exit(1)
+else:
+	#hardcoded paths/urls suck. :-/
+	must_fetch=1
+	backup_exists=0
+	try:
+		# if it's been over a week since fetching (or the system clock is fscked), grab an updated copy of metadata.dtd 
+		# clock is fscked or it's been a week. time to grab a new one.
+		ct = os.stat(metadata_dtd)[ST_CTIME]
+		if abs(time.time() - ct) > (60*60*24*7):
+			# don't trap the exception, we're watching for errno 2 (file not found), anything else is a bug.
+			backup_exists=1
+		else:
+			must_fetch=0
+
+	except (OSError,IOError), e:
+		if e.errno != 2:
+			print red("!!!")+" caught exception '%s' for %s/metadata.dtd, bailing" % (str(e), portage.CACHE_PATH)
+			sys.exit(1)
+
+	if must_fetch:
+		print 
+		print green("***")+" the local copy of metadata.dtd needs to be refetched, doing that now"
+		print
+		val = 0
+		try:
+			try:
+				os.unlink(metadata_dtd)
+			except OSError, e:
+				if e.errno != errno.ENOENT:
+					raise
+				del e
+			val=portage.fetch(['http://www.gentoo.org/dtd/metadata.dtd'],repoman_settings,fetchonly=0, \
+				try_mirrors=0)
+
+		except SystemExit, e:
+			raise  # Need to propogate this
+		except Exception,e:
+			print
+			print red("!!!")+" attempting to fetch 'http://www.gentoo.org/dtd/metadata.dtd', caught"
+			print red("!!!")+" exception '%s' though." % str(e)
+			val=0
+		if not val:
+			print red("!!!")+" fetching new metadata.dtd failed, aborting"
+			sys.exit(1)
+	#this can be problematic if xmllint changes their output
+	xmllint_capable=True
+
+
+def x11_deprecation_check(depstr):
+	if depstr.find("virtual/x11") == -1:
+		return False
+	depsplit = depstr.split()
+	ok_stack = []
+	ok = False
+	for token in depsplit:
+		if token == "(":
+			ok_stack.append(ok)
+			ok = False
+		elif token == ")":
+			ok = ok_stack.pop()
+		elif token == "||":
+			ok = True
+		else:
+			ok = False
+			if token.find("virtual/x11") != -1 and (not ok_stack or not ok_stack[-1]):
+				return True
+	return False
+
+dofail = 0
+arch_caches={}
+arch_xmatch_caches = {}
+for x in scanlist:
+	#ebuilds and digests added to cvs respectively.
+	if verbose:
+		print "checking package " + x
+	eadded=[]
+	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:
+		if y[-7:]==".ebuild":
+			ebuildlist.append(y[:-7])
+		if y in ["Manifest","ChangeLog","metadata.xml"]:
+			if os.stat(checkdir+"/"+y)[0] & 0x0248:
+				stats["file.executable"] += 1
+				fails["file.executable"].append(checkdir+"/"+y)
+	digestlist=[]
+
+	for y in checkdirlist:
+		for c in y.strip(os.path.sep):
+			if c not in allowed_filename_chars_set:
+				stats["file.name"] += 1
+				fails["file.name"].append("%s/%s: char '%s'" % (checkdir, y, c))
+				break
+
+		if not (y in ("ChangeLog", "metadata.xml") or y.endswith(".ebuild")):
+			continue
+		try:
+			line = 1
+			for l in codecs.open(checkdir+"/"+y, "r", "utf8"):
+				line +=1
+		except UnicodeDecodeError, ue:
+			stats["file.UTF8"] += 1
+			s = ue.object[:ue.start]
+			l2 = s.count("\n")
+			line += l2
+			if l2 != 0:
+				s = s[s.rfind("\n") + 1:]
+			fails["file.UTF8"].append("%s/%s: line %i, just after: '%s'" % (checkdir, y, line, s))
+
+	has_filesdir = True
+	if not os.path.isdir(os.path.join(checkdir, "files")):
+		has_filesdir = False
+		if manifest1_compat:
+			stats["filedir.missing"] += 1
+			fails["filedir.missing"].append(checkdir)
+
+	if isCvs or isSvn:
+		try:
+			if isCvs:
+				myf=open(checkdir+"/CVS/Entries","r")
+			if isSvn:
+				myf=os.popen("svn update > /dev/null; svn list")
+			myl=myf.readlines()	
+			myf.close()
+			for l in myl:
+				if isCvs:
+					if l[0]!="/":
+						continue
+					splitl=l[1:].split("/")
+					if not len(splitl):
+						continue
+					if splitl[0][-7:]==".ebuild":
+						eadded.append(splitl[0][:-7])
+				if isSvn:
+					l = l.rstrip();
+					if l[-1:] == "/":
+						continue
+					if l[-7:] == ".ebuild":
+						eadded.append(l[:-7])
+			if isSvn:
+				myf=os.popen("svn status")
+				myl=myf.readlines()
+				myf.close()
+				for l in myl:
+					if l[0] == "A":
+						l = l.rstrip().split(' ')[-1]
+						if l[-7:] == ".ebuild":
+							eadded.append(l[:-7])
+		except IOError:
+			if mymode=="commit" and isCvs:
+				stats["CVS/Entries.IO_error"] += 1
+				fails["CVS/Entries.IO_error"].append(checkdir+"/CVS/Entries")
+			if mymode=="commit" and isSvn:
+				stats["svn.IO_error"] += 1
+				fails["svn.IO_error"].append(checkdir+"svn info")
+			continue
+
+	if isCvs and has_filesdir:
+		try:
+			if isCvs:
+				myf=open(checkdir+"/files/CVS/Entries","r")
+			if isSvn:
+				myf=os.popen("svn list "+os.path.normpath(checkdir+"/files"))
+			myl=myf.readlines()
+			myf.close()
+			for l in myl:
+				if isCvs:
+					if l[0]!="/":
+						continue
+					splitl=l[1:].split("/")
+					if not len(splitl):
+						continue
+					if splitl[0][:7]=="digest-":
+						dadded.append(splitl[0][7:])
+				if isSvn:
+					l = l.rstrip();
+					if l[-1:] == "/":
+						continue
+					if l[:7] == "digest-":
+						dadded.append(l[7:])
+			if isSvn:
+				myf=os.popen("svn status "+os.path.normpath(checkdir+"/files"))
+				myl=myf.readlines()
+				myf.close()
+				for l in myl:
+					if l[0] == "A":
+						l = l.rstrip().split(' ')[-1]
+						if l[:7] == "digest-":
+							dadded.append(l[7:])
+		except IOError:
+			if mymode=="commit" and isCvs:
+				stats["CVS/Entries.IO_error"] += 1
+				fails["CVS/Entries.IO_error"].append(checkdir+"/files/CVS/Entries")
+			if mymode=="commit" and isSvn:
+				stats["svn.IO_error"] += 1
+				fails["svn.IO_error"].append(checkdir+"/files svn info")
+			continue
+
+	if mymode in ("fix", "commit") and \
+		"--pretend" not in myoptions:
+		repoman_settings["O"] = checkdir
+		if not portage.digestgen([], repoman_settings, myportdb=portdb):
+			print "Unable to generate manifest."
+			sys.exit(1)
+
+	mf = Manifest(checkdir, repoman_settings["DISTDIR"])
+	mydigests=mf.getTypeDigests("DIST")
+
+	fetchlist_dict = portage.FetchlistDict(checkdir, repoman_settings, portdb)
+	myfiles_all = []
+	for mykey in fetchlist_dict:
+		try:
+			myfiles_all.extend(fetchlist_dict[mykey])
+		except portage.exception.InvalidDependString, e:
+			stats["SRC_URI.syntax"] = stats["SRC_URI.syntax"] + 1
+			fails["SRC_URI.syntax"].append(mykey+".ebuild SRC_URI: "+str(e))
+	del fetchlist_dict
+	myfiles_all = set(myfiles_all)
+	for entry in mydigests:
+		if entry not in myfiles_all:
+			stats["digestentry.unused"] += 1
+			fails["digestentry.unused"].append(checkdir+"::"+entry)
+	del myfiles_all
+
+	if os.path.exists(checkdir+"/files"):
+		filesdirlist=os.listdir(checkdir+"/files")
+		if manifest1_compat:
+			for y in filesdirlist:
+				if not y.startswith("digest-"):
+					continue
+				if y[7:] not in dadded:
+					#digest not added to cvs or svn
+					stats["digest.notadded"]=stats["digest.notadded"]+1
+					fails["digest.notadded"].append(x+"/files/"+y)
+					if y[7:] in eadded:
+						stats["digest.disjointed"]=stats["digest.disjointed"]+1
+						fails["digest.disjointed"].append(x+"/files/"+y)
+						
+				if os.stat(checkdir+"/files/"+y)[0] & 0x0248:
+					stats["file.executable"] += 1
+					fails["file.executable"].append(x+"/files/"+y)
+				
+				mykey = catdir + "/" + y[7:]
+				if y[7:] not in ebuildlist:
+					#stray digest
+					if mymode=="fix":
+						if isCvs:
+							vcsrm="cvs rm -f"
+						if isSvn:
+							vcsrm="svn rm --force"
+						if "--pretend" in myoptions:
+								print "(cd "+repodir+"/"+x+"/files; "+vcsrm+" "+y+")"
+						else:
+							os.system("(cd "+repodir+"/"+x+"/files; "+vcsrm+" "+y+")")
+					else:
+						stats["digest.stray"]=stats["digest.stray"]+1
+						fails["digest.stray"].append(x+"/files/"+y)
+				else:
+					# We have an ebuild
+					try:
+						myuris, myfiles = portdb.getfetchlist(mykey, all=True)
+					except portage.exception.InvalidDependString, e:
+						# Already handled above.
+						continue
+
+					uri_dict = {}
+					for myu in myuris:
+						myubn = os.path.basename(myu)
+						if myubn not in uri_dict:
+							uri_dict[myubn]  = [myu]
+						else:
+							uri_dict[myubn] += [myu]
+
+					for myf in uri_dict:
+						myff = repoman_settings["DISTDIR"] + "/" + myf
+						if not mydigests.has_key(myf):
+							uri_settings = portage.config(clone=repoman_settings)
+							if mymode == "fix":
+								if not portage.fetch(uri_dict[myf], uri_settings):
+									stats["digest.unmatch"] += 1
+									fails["digest.unmatch"].append(y+"::"+myf)
+								else:
+									eb_name = portdb.findname2(mykey)[0]
+									portage.doebuild(eb_name, "digest", "/",
+										uri_settings, tree="porttree",
+										mydbapi=portdb)
+							else:
+								stats["digest.partial"] += 1
+								fails["digest.partial"].append(y+"::"+myf)
+						elif "assume-digests" not in repoman_settings.features:
+							if os.path.exists(myff):
+								if not portage.checksum.verify_all(myff, mydigests[myf]):
+									stats["digest.fail"] += 1
+									fails["digest.fail"].append(y+"::"+myf)
+							elif repolevel == 3:
+								stats["digest.assumed"] += 1
+								fails["digest.assumed"].append(y+"::"+myf)
+
+		# recurse through files directory
+		# use filesdirlist as a stack, appending directories as needed so people can't hide > 20k files in a subdirectory.
+		while filesdirlist:
+			y = filesdirlist.pop(0)
+			try:
+				mystat = os.stat(checkdir+"/files/"+y)
+			except OSError, oe:
+				if oe.errno == 2:
+					# don't worry about it.  it likely was removed via fix above.
+					continue
+				else:
+					raise oe
+			if S_ISDIR(mystat.st_mode):
+				if y == "CVS" or y == ".svn":
+					continue
+				for z in os.listdir(checkdir+"/files/"+y):
+					if z == "CVS" or z == ".svn":
+						continue
+					filesdirlist.append(y+"/"+z)
+			# current policy is no files over 20k, this is the check.
+			elif mystat.st_size > 20480:
+				stats["file.size"] += 1
+				fails["file.size"].append("("+ str(mystat.st_size/1024) + "K) "+x+"/files/"+y)
+
+			for c in os.path.basename(y.rstrip(os.path.sep)):
+				if c not in allowed_filename_chars_set:
+					stats["file.name"] += 1
+					fails["file.name"].append("%s/files/%s: char '%s'" % (checkdir, y, c))
+					break
+
+	del mydigests
+
+	if "ChangeLog" not in checkdirlist:
+		stats["changelog.missing"]+=1
+		fails["changelog.missing"].append(x+"/ChangeLog")
+	
+	#metadata.xml file check
+	if "metadata.xml" not in checkdirlist:
+		stats["metadata.missing"]+=1
+		fails["metadata.missing"].append(x+"/metadata.xml")
+	#metadata.xml parse check
+	else:
+		#Only carry out if in package directory or check forced
+		if xmllint_capable:
+			# 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:"
+				for z in out.splitlines():
+					print red("!!! ")+z
+				stats["metadata.bad"]+=1
+				fails["metadata.bad"].append(x+"/metadata.xml")
+
+	allmasked = True
+
+	for y in ebuildlist:
+		if os.stat(checkdir+"/"+y+".ebuild")[0] & 0x0248:
+			stats["file.executable"] += 1
+			fails["file.executable"].append(x+"/"+y+".ebuild")
+		if y not in eadded:
+			#ebuild not added to cvs
+			stats["ebuild.notadded"]=stats["ebuild.notadded"]+1
+			fails["ebuild.notadded"].append(x+"/"+y+".ebuild")
+			if y in dadded:
+				stats["ebuild.disjointed"]=stats["ebuild.disjointed"]+1
+				fails["ebuild.disjointed"].append(x+"/"+y+".ebuild")
+		if manifest1_compat and \
+			not os.path.exists(os.path.join(checkdir, "files", "digest-"+y)):
+			if mymode=="fix":
+				if "--pretend" in myoptions:
+					print "You will need to run:"
+					print "  "+portage.const.PORTAGE_BASE+"/bin/ebuild "+repodir+"/"+x+"/"+y+".ebuild digest"
+				else:
+					retval=os.system(portage.const.PORTAGE_BASE+"/bin/ebuild "+repodir+"/"+x+"/"+y+".ebuild digest")
+					if retval:
+						print "!!! Exiting on ebuild digest (shell) error code:",retval
+						sys.exit(retval)
+			else:
+				stats["digest.missing"]=stats["digest.missing"]+1
+				fails["digest.missing"].append(x+"/files/digest-"+y)
+		myesplit=portage.pkgsplit(y)
+		if myesplit is None or myesplit[0] != x.split("/")[-1]:
+			stats["ebuild.invalidname"]=stats["ebuild.invalidname"]+1
+			fails["ebuild.invalidname"].append(x+"/"+y+".ebuild")
+			continue
+		elif myesplit[0]!=pkgdir:
+			print pkgdir,myesplit[0]
+			stats["ebuild.namenomatch"]=stats["ebuild.namenomatch"]+1
+			fails["ebuild.namenomatch"].append(x+"/"+y+".ebuild")
+			continue
+		try:
+			myaux = dict(
+				zip(allvars, portdb.aux_get(os.path.join(catdir, y), allvars)))
+		except KeyError:
+			stats["ebuild.syntax"]=stats["ebuild.syntax"]+1
+			fails["ebuild.syntax"].append(x+"/"+y+".ebuild")
+			continue
+		except IOError:
+			stats["ebuild.output"]=stats["ebuild.output"]+1
+			fails["ebuild.output"].append(x+"/"+y+".ebuild")
+			continue
+
+		# Test for negative logic and bad words in the RESTRICT var.
+		#for x in myaux[allvars.index("RESTRICT")].split():
+		#	if x.startswith("no"):
+		#		print "Bad RESTRICT value: %s" % x
+		try:
+			myaux["PROVIDE"] = portage.dep.use_reduce(
+				portage.dep.paren_reduce(myaux["PROVIDE"]), matchall=1)
+		except portage.exception.InvalidDependString, e:
+			stats["PROVIDE.syntax"] = stats["PROVIDE.syntax"] + 1
+			fails["PROVIDE.syntax"].append(mykey+".ebuild PROVIDE: "+str(e))
+			del e
+			continue
+		myaux["PROVIDE"] = " ".join(portage.flatten(myaux["PROVIDE"]))
+		for myprovide in myaux["PROVIDE"].split():
+			prov_cp = portage.dep_getkey(myprovide)
+			if prov_cp != myprovide:
+				stats["virtual.versioned"]+=1
+				fails["virtual.versioned"].append(x+"/"+y+".ebuild: "+myprovide)
+			prov_pkg = portage.dep_getkey(
+				portage.best(portdb.xmatch("match-all", prov_cp)))
+			if prov_cp == prov_pkg:
+				stats["virtual.exists"]+=1
+				fails["virtual.exists"].append(x+"/"+y+".ebuild: "+prov_cp)
+
+		for pos in range(0,len(missingvars)):
+			if not myaux[missingvars[pos]]:
+				myqakey=missingvars[pos]+".missing"
+				stats[myqakey]=stats[myqakey]+1
+				fails[myqakey].append(x+"/"+y+".ebuild")
+
+		# KEYWORDS="-*" is a stupid replacement for package.mask and screws general KEYWORDS semantics
+		if "-*" in myaux["KEYWORDS"].split():
+			haskeyword = False
+			for kw in myaux["KEYWORDS"].split():
+				if kw[0] == "~":
+					kw = kw[1:]
+				if kw in kwlist:
+					haskeyword = True
+			if not haskeyword:
+				stats["KEYWORDS.stupid"] += 1
+				fails["KEYWORDS.stupid"].append(x+"/"+y+".ebuild")
+
+		"""
+		Ebuilds that inherit a "Live" eclasss (darcs,subversion,git,cvs,etc..) should
+		not be allowed to be marked stable
+		"""
+		if set(["darcs","cvs","subversion","git"]).intersection(
+			myaux["INHERITED"].split()):
+			bad_stable_keywords = []
+			for keyword in myaux["KEYWORDS"].split():
+				if not keyword.startswith("~") and \
+					not keyword.startswith("-"):
+					bad_stable_keywords.append(keyword)
+				del keyword
+			if bad_stable_keywords:
+				stats["LIVEVCS.stable"] += 1
+				fails["LIVEVCS.stable"].append(
+					x + "/" + y + ".ebuild with stable keywords:%s " % \
+						bad_stable_keywords)
+			del bad_stable_keywords
+
+		if "--ignore-arches" in myoptions:
+			arches = [[repoman_settings["ARCH"], repoman_settings["ARCH"],
+				repoman_settings["ACCEPT_KEYWORDS"].split()]]
+		else:
+			arches=[]
+			for keyword in myaux["KEYWORDS"].split():
+				if (keyword[0]=="-"):
+					continue
+				elif (keyword[0]=="~"):
+					arches.append([keyword, keyword[1:], [keyword[1:], keyword]])
+				else:
+					arches.append([keyword, keyword, [keyword]])
+					allmasked = False
+
+		baddepsyntax = False
+		badlicsyntax = False
+		badprovsyntax = False
+		catpkg = catdir+"/"+y
+		myiuse = set(repoman_settings.archlist())
+		for myflag in myaux["IUSE"].split():
+			if myflag.startswith("+"):
+				myflag = myflag[1:]
+			myiuse.add(myflag)
+
+		operator_tokens = set(["||", "(", ")"])
+		type_list, badsyntax = [], []
+		for mytype in ("DEPEND", "RDEPEND", "PDEPEND", "LICENSE", "PROVIDE"):
+			mydepstr = myaux[mytype]
+			
+			if mydepstr.find(" ?") != -1:
+				badsyntax.append("'?' preceded by space")
+
+			try:
+				# Missing closing parenthesis will result in a ValueError
+				mydeplist = portage.dep.paren_reduce(mydepstr)
+				# Missing opening parenthesis will result in a final "" element
+				if "" in mydeplist or "(" in mydeplist:
+					raise ValueError
+			except ValueError:
+				badsyntax.append("parenthesis mismatch")
+				mydeplist = []
+			except portage.exception.InvalidDependString, e:
+				badsyntax.append(str(e))
+				del e
+				mydeplist = []
+
+			try:
+				portage.dep.use_reduce(mydeplist, excludeall=myiuse)
+			except portage.exception.InvalidDependString, e:
+				badsyntax.append(str(e))
+
+			for token in operator_tokens:
+				if mydepstr.startswith(token+" "):
+					myteststr = mydepstr[len(token):]
+				else:
+					myteststr = mydepstr
+				if myteststr.endswith(" "+token):
+					myteststr = myteststr[:-len(token)]
+				while myteststr.find(" "+token+" ") != -1:
+					myteststr = " ".join(myteststr.split(" "+token+" ", 1))
+				if myteststr.find(token) != -1:
+					badsyntax.append("'%s' not separated by space" % (token))
+
+
+			if mytype in ("DEPEND", "RDEPEND", "PDEPEND"):
+				for token in mydepstr.split():
+					if token in operator_tokens or \
+						token.endswith("?"):
+						continue
+					if not portage.isvalidatom(token, allow_blockers=True) or \
+						":" in token and myaux["EAPI"] == "0":
+						badsyntax.append("'%s' not a valid atom" % token)
+
+			type_list.extend([mytype] * (len(badsyntax) - len(type_list)))
+
+		for m,b in zip(type_list, badsyntax):
+			stats[m+".syntax"] += 1
+			fails[m+".syntax"].append(catpkg+".ebuild "+m+": "+b)
+
+		badlicsyntax = len(filter(lambda x:x=="LICENSE", type_list))
+		badprovsyntax = len(filter(lambda x:x=="PROVIDE", type_list))
+		baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax 
+		badlicsyntax = badlicsyntax > 0
+		badprovsyntax = badprovsyntax > 0
+
+		if not baddepsyntax:
+			if x11_deprecation_check(" ".join([myaux["DEPEND"], myaux["RDEPEND"], myaux["PDEPEND"]])):
+				stats["usage.obsolete"] += 1
+				fails["usage.obsolete"].append("%s/%s.ebuild: not migrated to modular X" % (x, y))
+
+		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("grep -E '^[^#]*\([^)]*\<die\>' "+checkdir+"/"+y+".ebuild >/dev/null 2>&1"):
+			stats["ebuild.nesteddie"]=stats["ebuild.nesteddie"]+1
+			fails["ebuild.nesteddie"].append(x+"/"+y+".ebuild")
+		# uselist checks - global
+		myuse = []
+		default_use = []
+		for myflag in myaux["IUSE"].split():
+			flag_name = myflag.lstrip("+-")
+			if myflag != flag_name:
+				default_use.append(myflag)
+			if flag_name not in uselist:
+				myuse.append(flag_name)
+
+		# uselist checks - local
+		mykey = portage.dep_getkey(catpkg)
+		if luselist.has_key(mykey):
+			for mypos in range(len(myuse)-1,-1,-1):
+				if myuse[mypos] and (myuse[mypos] in luselist[mykey]):
+					del myuse[mypos]
+		if default_use and myaux["EAPI"] == "0":
+			myuse += default_use
+		for mypos in range(len(myuse)):
+			stats["IUSE.invalid"]=stats["IUSE.invalid"]+1
+			fails["IUSE.invalid"].append(x+"/"+y+".ebuild: %s" % myuse[mypos])	
+
+		# license checks
+		if not badlicsyntax:
+			myuse = myaux["LICENSE"]
+			# Parse the LICENSE variable, remove USE conditions and
+			# flatten it.
+			myuse=portage.dep.use_reduce(portage.dep.paren_reduce(myuse), matchall=1)
+			myuse=portage.flatten(myuse)
+			# Check each entry to ensure that it exists in PORTDIR's
+			# license directory.
+			for mypos in range(0,len(myuse)):
+				# Need to check for "||" manually as no portage
+				# function will remove it without removing values.
+				if myuse[mypos] not in liclist and myuse[mypos] != "||":
+					stats["LICENSE.invalid"]=stats["LICENSE.invalid"]+1
+					fails["LICENSE.invalid"].append(x+"/"+y+".ebuild: %s" % myuse[mypos])
+
+		#keyword checks
+		myuse = myaux["KEYWORDS"].split()
+		for mykey in myuse:
+			myskey=mykey[:]
+			if myskey[0]=="-":
+				myskey=myskey[1:]
+			if myskey[0]=="~":
+				myskey=myskey[1:]
+			if mykey!="-*":
+				if myskey not in kwlist:
+					stats["KEYWORDS.invalid"] += 1
+					fails["KEYWORDS.invalid"].append(x+"/"+y+".ebuild: %s" % mykey)
+				elif not profiles.has_key(myskey):
+					stats["KEYWORDS.invalid"] += 1
+					fails["KEYWORDS.invalid"].append(x+"/"+y+".ebuild: %s (profile invalid)" % mykey)
+
+		#syntax checks
+		myear = time.gmtime(os.stat(checkdir+"/"+y+".ebuild")[ST_MTIME])[0]
+		gentoo_copyright = re.compile(r'^# Copyright ((1999|200\d)-)?' + str(myear) + r' Gentoo Foundation')
+		gentoo_license = re.compile(r'^# Distributed under the terms of the GNU General Public License v2$')
+		cvs_header = re.compile(r'^#\s*\$Header.*\$$')
+		ignore_line = re.compile(r'(^$)|(^(\t)*#)')
+		leading_spaces = re.compile(r'^[\S\t]')
+		trailing_whitespace = re.compile(r'.*([\S]$)')
+		readonly_assignment = re.compile(r'^\s*(export\s+)?(A|CATEGORY|P|PV|PN|PR|PVR|PF|D|WORKDIR|FILESDIR|FEATURES|USE)=')
+		line_continuation = re.compile(r'([^#]*\S)(\s+|\t)\\$')
+		linenum=0
+		previous_line = None
+		for line in input(checkdir+"/"+y+".ebuild"):
+			linenum += 1
+			# Gentoo copyright check
+			if linenum == 1:
+				match = gentoo_copyright.match(line)
+				if not match:
+					myerrormsg = "Copyright header Error. Possibly date related."
+					stats["ebuild.badheader"] +=1
+					fails["ebuild.badheader"].append(x+"/"+y+".ebuild: %s" % myerrormsg)
+			# Gentoo license check
+			elif linenum == 2:
+				match = gentoo_license.match(line)
+				if not match:
+					myerrormsg = "Gentoo License Error."
+					stats["ebuild.badheader"] +=1
+					fails["ebuild.badheader"].append(x+"/"+y+".ebuild: %s" % myerrormsg)
+			# CVS Header check
+			elif linenum == 3:
+				match = cvs_header.match(line)
+				if not match:
+					myerrormsg = "CVS Header Error."
+					stats["ebuild.badheader"] +=1
+					fails["ebuild.badheader"].append(x+"/"+y+".ebuild: %s" % myerrormsg)
+			else:
+				match = ignore_line.match(line)
+				if not match:
+					# Excluded Blank lines and full line comments. Good!
+					# Leading Spaces Check
+					match = leading_spaces.match(line)
+					if not match:
+						#Line has got leading spaces. Bad!
+						myerrormsg = "Leading Space Syntax Error. Line %d" % linenum
+						stats["ebuild.minorsyn"] +=1
+						fails["ebuild.minorsyn"].append(x+"/"+y+".ebuild: %s" % myerrormsg)
+					# Trailing whitespace check
+					match = trailing_whitespace.match(line)
+					if not match:
+						#Line has got trailing whitespace. Bad!
+						myerrormsg = "Trailing whitespace Syntax Error. Line %d" % linenum
+						stats["ebuild.minorsyn"] +=1
+						fails["ebuild.minorsyn"].append(x+"/"+y+".ebuild: %s" % myerrormsg)
+					# Readonly variable assignment check
+					match = readonly_assignment.match(line)
+					# The regex can give a false positive for continued lines,
+					# so we check the previous line to see if it was continued.
+					if match and (not previous_line or not line_continuation.match(previous_line)):
+						# invalid assignment, very bad!
+						myerrormsg = "Readonly variable assignment to %s on line %d" % (match.group(2), linenum)
+						stats["variable.readonly"] += 1
+						fails["variable.readonly"].append(x+"/"+y+".ebuild: %s" % myerrormsg)
+			previous_line = line
+		del previous_line
+
+	# 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):
+	#    stats["ebuild.nostable"]+=1
+	#    fails["ebuild.nostable"].append(x)
+	if allmasked and repolevel == 3:
+		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"):
+		fpath = os.path.join(portage.const.CACHE_PATH, fname)
+		savef = open(fpath, 'w')
+		pickle.dump(myobj, savef)
+		savef.close()
+		portage.apply_secpass_permissions(fpath, gid=portage.portage_gid,
+			mode=0664)
+if quiet < 2:
+	print
+#dofail will be set to 1 if we have failed in at least one non-warning category
+dofail=0
+#dowarn will be set to 1 if we tripped any warnings
+dowarn=0
+#dofull will be set if we should print a "repoman full" informational message
+dofull=0
+for x in qacats:
+	if not isCvs and not isSvn and (x.find("notadded") != -1):
+		stats[x] = 0
+	if stats[x]:
+		dowarn=1
+		if x not in qawarnings:
+			dofail=1
+	else:
+		continue
+	print "  "+x.ljust(30),
+	if stats[x]==0:
+		print green(`stats[x]`)
+		continue
+	elif x in qawarnings:
+		print yellow(`stats[x]`)
+	else:
+		print red(`stats[x]`)
+	if mymode!="full":
+		if stats[x]<12:
+			for y in fails[x]:
+				print "   "+y
+		else:
+			dofull=1
+	else:
+		for y in fails[x]:
+			print "   "+y
+
+def grouplist(mylist,seperator="/"):
+	"""(list,seperator="/") -- Takes a list of elements; groups them into
+	same initial element categories. Returns a dict of {base:[sublist]}
+	From: ["blah/foo","spork/spatula","blah/weee/splat"]
+	To:   {"blah":["foo","weee/splat"], "spork":["spatula"]}"""
+	mygroups={}
+	for x in mylist:
+		xs=x.split(seperator)
+		if xs[0]==".":
+			xs=xs[1:]
+		if xs[0] not in mygroups.keys():
+			mygroups[xs[0]]=[seperator.join(xs[1:])]
+		else:
+			mygroups[xs[0]]+=[seperator.join(xs[1:])]
+	return mygroups
+
+if mymode!="commit":
+	if dofull:
+		print bold("Note: type \"repoman full\" for a complete listing.")
+		if quiet < 1:
+			print
+	if dowarn and not dofail:
+		if quiet < 2:
+			print green("RepoMan sez:"),"\"You're only giving me a partial QA payment?\n              I'll take it this time, but I'm not happy.\""
+		else:
+			print green("RepoMan sez:"),"\"OK for now, but I'll be back ...\""
+	elif not dofail:
+		print green("RepoMan sez:"),"\"If everyone were like you, I'd be out of business!\""
+	if quiet < 1:
+		print
+elif "--pretend" not in myoptions:
+	if dofail:
+		print turquoise("Please fix these important QA issues first.")
+		print green("RepoMan sez:"),"\"Make your QA payment on time and you'll never see the likes of me.\"\n"
+		sys.exit(1)
+
+	if "--pretend" in myoptions:
+		print green("RepoMan sez:"), "\"So, you want to play it safe. Good call.\"\n"
+
+	if fails["digest.missing"]:
+		print green("Creating missing digests...")
+	for x in fails["digest.missing"]:
+		xs=x.split("/")
+		del xs[-2]
+		myeb="/".join(xs[:-1])+"/"+xs[-1][7:]
+		if "--pretend" in myoptions:
+			print "(ebuild "+portdir+"/"+myeb+".ebuild digest)"
+		else:
+			retval=os.system("ebuild "+portdir+"/"+myeb+".ebuild digest")
+			if retval:
+				print "!!! Exiting on ebuild digest (shell) error code:",retval
+				sys.exit(retval)
+
+	if isCvs:
+		try:
+			myvcstree=portage.cvstree.getentries("./",recursive=1)
+			myunadded=portage.cvstree.findunadded(myvcstree,recursive=1,basedir="./")
+		except SystemExit, e:
+			raise  # TODO propogate this
+		except:
+			err("Error retrieving CVS tree; exiting.")
+
+	if isSvn:
+		try:
+			svnstatus=os.popen("svn status").readlines()
+			myunadded = [ "./"+elem.rstrip().split()[1] for elem in svnstatus if elem.startswith("?") ]	
+		except SystemExit, e:
+			raise  # TODO propogate this
+		except:
+			err("Error retrieving SVN info; exiting.")
+	myautoadd=[]
+	if myunadded:
+		for x in range(len(myunadded)-1,-1,-1):
+			xs=myunadded[x].split("/")
+			if xs[-1]=="files":
+				print "!!! files dir is not added! Please correct this."
+				sys.exit(-1)
+			elif xs[-1]=="Manifest":
+				# It's a manifest... auto add
+				myautoadd+=[myunadded[x]]
+				del myunadded[x]
+			elif len(xs[-1])>=7:
+				if xs[-1][:7]=="digest-":
+					del xs[-2]
+					myeb="/".join(xs[:-1]+[xs[-1][7:]])+".ebuild"
+					if os.path.exists(myeb):
+						# Ebuild exists for digest... So autoadd it.
+						myautoadd+=[myunadded[x]]
+						del myunadded[x]
+		
+	if myautoadd:
+		print ">>> Auto-Adding missing digests..."
+		if "--pretend" in myoptions:
+			if isCvs:
+				print "(cvs add "+" ".join(myautoadd)+")"
+			if isSvn:
+				print "(svn add "+" ".join(myautoadd)+")"
+			retval=0
+		else:
+			if isCvs:
+				retval=os.system("cvs add "+" ".join(myautoadd))
+			if isSvn:
+				retval=os.system("svn add "+" ".join(myautoadd))
+		if retval:
+			print "!!! Exiting on vcs (shell) error code:",retval
+			sys.exit(retval)
+
+	if myunadded:
+		print red("!!! The following files are in your local tree but are not added to the master")
+		print red("!!! tree. Please remove them from the local tree or add them to the master tree.")
+		for x in myunadded:
+			print "   ",x
+		print
+		print
+		sys.exit(1)
+
+	retval=["",""]
+	if isCvs:
+		print "Performing a "+green("cvs -n up")+" with a little magic grep to check for updates."
+		retval=getstatusoutput("cvs -n up 2>&1 | egrep '^[^\?] .*' | egrep -v '^. .*/digest-[^/]+|^cvs server: .* -- ignored$'")
+	if isSvn:
+		print "Performing a "+green("svn status -u")+" with a little magic grep to check for updates."
+		retval=getstatusoutput("svn status -u 2>&1 | egrep -v '^.  +.*/digest-[^/]+' | head -n-1")
+
+	mylines=retval[1].split("\n")
+	myupdates=[]
+	for x in mylines:
+		if not x:
+			continue
+		if x[0] not in "UPMARD": # Updates,Patches,Modified,Added,Removed/Replaced(svn),Deleted(svn)
+			print red("!!! Please fix the following issues reported from cvs: ")+green("(U,P,M,A,R,D are ok)")
+			if isCvs:
+				print red("!!! Note: This is a pretend/no-modify pass...")
+			if isSvn:
+				print red("!!! Note: This your local checkout has been modified!")
+			print retval[1]
+			print
+			sys.exit(1)
+		elif isCvs and x[0] in ["U","P"]:
+			myupdates+=[x[2:]]
+		elif isSvn and x[8] == '*':
+			myupdates+=[x[9:].lstrip(" 1234567890")]
+	
+	if myupdates:
+		print green("Fetching trivial updates...")
+		if "--pretend" in myoptions:
+			print "(cvs/svn up "+" ".join(myupdates)+")"
+			retval=0
+		else:
+			if isCvs:
+				retval=os.system("cvs up "+" ".join(myupdates))
+			elif isSvn:
+				retval=os.system("svn update "+" ".join(myupdates))
+		if retval!=0:
+			print "!!! cvs/svn exited with an error. Terminating."
+			sys.exit(retval)
+	
+	if isCvs:
+		mycvstree=portage.cvstree.getentries("./",recursive=1)
+		mychanged=portage.cvstree.findchanged(mycvstree,recursive=1,basedir="./")
+		mynew=portage.cvstree.findnew(mycvstree,recursive=1,basedir="./")
+		myremoved=portage.cvstree.findremoved(mycvstree,recursive=1,basedir="./")
+	if isSvn:
+		svnstatus = os.popen("svn status").readlines()
+		mychanged = [ elem.rstrip()[7:] for elem in svnstatus if elem.startswith("M") ]
+		for manifest in [ file for file in mychanged if '/Manifest' in file ]:
+			mychanged.remove(manifest)
+		mynew = [ elem.rstrip()[7:] for elem in svnstatus if elem.startswith("A") ]
+		myremoved = [ elem.rstrip()[7:] for elem in svnstatus if elem.startswith("D") ]
+
+	if isCvs or isSvn:
+		if not (mychanged or mynew or myremoved):
+			print
+			print green("RepoMan sez:"), "\"Doing nothing is not always good for QA.\"\n"
+			print
+			print "(Didn't find any changed files...)"
+			print
+			sys.exit(0)
+
+	# Manifests need to be regenerated after all other commits, so don't commit
+	# them now even if they have changed.
+	# However, in SVN mode, the manifest won't change, hence, if we
+	# don't sign, we can commit it right away, avoiding an extra commit
+	if not isSvn or "sign" in repoman_settings.features:
+		mymanifests = [f for f in mychanged if "Manifest" == os.path.basename(f)]
+		mychanged = [f for f in mychanged if "Manifest" != os.path.basename(f)]
+	else:
+		mymanifests = [] # avoid undefined error
+	myupdates=mychanged+mynew
+	myheaders=[]
+	mydirty=[]
+	headerstring="'\$(Header|Id)"
+	headerstring+=".*\$'"
+	for myfile in myupdates:
+		myout=getstatusoutput("egrep -q "+headerstring+" "+myfile)
+		if myout[0]==0:
+			myheaders.append(myfile)
+
+	print "*",green(str(len(myupdates))),"files being committed...",green(str(len(myheaders))),"have headers that will change."
+	print "*","Files with headers will cause the manifests to be made and recommited."
+	if quiet == 0:
+		print "myupdates:",myupdates
+		print "myheaders:",myheaders
+		print
+
+	if commitmessagefile:
+		try:
+			f = open(commitmessagefile)
+			commitmessage = f.read()
+			f.close()
+			del f
+		except (IOError, OSError), e:
+			if e.errno == errno.ENOENT:
+				portage.writemsg("!!! File Not Found: --commitmsgfile='%s'\n" % commitmessagefile)
+			else:
+				raise
+		# We've read the content so the file is no longer needed.
+		commitmessagefile = None
+	
+	if not (commitmessage or commitmessagefile):
+		print "Please enter a commit message at the prompt:"
+		while not commitmessage:
+			try:
+				commitmessage=raw_input(green("> "))
+			except KeyboardInterrupt: 
+				exithandler()
+	try:
+		unameout=getstatusoutput("uname -srp")[1]
+		commitmessage+="\n(Portage "+str(portage.VERSION)+"-prefix/"
+		if isCvs:
+			commitmessage+="CVS"
+		elif isSvn:
+			commitmessage+="SVN"
+		commitmessage+="/"+unameout+")"
+	except AttributeError:
+		print "Failed to insert portage version in message!"
+		commitmessage+="\n(Portage version: Unknown)"
+
+	if not manifest1_compat:
+		myfiles = myupdates + myremoved + mymanifests
+		filesdirs = set()
+		if repolevel == 3:
+			filesdirs.add(os.path.join(".", "files"))
+		elif repolevel in (1, 2):
+			for x in myfiles:
+				xs = x.split(os.path.sep)
+				if len(xs) < 4-repolevel:
+					continue
+				xs = xs[0:4-repolevel]
+				xs.append("files")
+				filesdirs.add(os.path.join(*xs))
+		else:
+			raise AssertionError("repolevel=%s" % str(repolevel))
+		digest_files = []
+		for x in filesdirs:
+			dir_path = os.path.join(startdir, x)
+			if not os.path.isdir(dir_path):
+				continue
+			for y in os.listdir(dir_path):
+				if y.startswith("digest-"):
+					digest_files.append(os.path.join(x, y))
+		if digest_files:
+			digest_files.sort()
+			if "--pretend" in myoptions:
+				if isCvs:
+					print "(rm %s)" % " ".join(digest_files)
+					print "(cvs remove %s)" % " ".join(digest_files)
+				elif isSvn:
+					print "(svn remove %s)" % " ".join(digest_files)
+			else:
+				if isCvs:
+					for x in digest_files:
+						os.unlink(os.path.join(startdir, x))
+					retval = spawn(["cvs", "remove"] + digest_files,
+							env=os.environ)
+				elif isSvn:
+					retval = spawn(["svn", "remove"] + digest_files,
+							env=os.environ)
+				if retval != os.EX_OK:
+					print "!!! Exiting on vcs (shell) error code:",retval
+					sys.exit(retval)
+			myremoved.extend(digest_files)
+			myremoved = list(set(myremoved))
+			myremoved.sort()
+
+	if myupdates or myremoved:
+		myfiles = myupdates + myremoved
+		fd, commitmessagefile = tempfile.mkstemp(".repoman.msg")
+		mymsg = os.fdopen(fd, "w")
+		mymsg.write(commitmessage)
+		mymsg.close()
+
+		print
+		print green("Using commit message:")
+		print green("------------------------------------------------------------------------------")
+		print commitmessage
+		print green("------------------------------------------------------------------------------")
+		print
+
+		retval = None
+		if "--pretend" in myoptions:
+			if isCvs:
+				print "(cvs -q commit -F %s %s)" % \
+					(commitmessagefile, " ".join(myfiles))
+			if isSvn:
+				print "(svn commit -F %s %s)" % \
+					(commitmessagefile, " ".join(myfiles))
+		else:
+			if isCvs:
+				retval = spawn(["cvs", "-q", "commit",
+					"-F", commitmessagefile] + myfiles,
+					env=os.environ)
+			if isSvn:
+				retval = spawn(["svn", "commit",
+					"-F", commitmessagefile] + myfiles,
+					env=os.environ)
+		try:
+			os.unlink(commitmessagefile)
+		except OSError:
+			pass
+		if retval:
+			print "!!! Exiting on cvs (shell) error code:",retval
+			sys.exit(retval)
+
+	# Setup the GPG commands
+	def gpgsign(filename):
+		if "PORTAGE_GPG_KEY" not in repoman_settings:
+			raise portage.exception.MissingParameter("PORTAGE_GPG_KEY is unset!")
+		if "PORTAGE_GPG_DIR" not in repoman_settings:
+			if os.environ.has_key("HOME"):
+				repoman_settings["PORTAGE_GPG_DIR"] = os.path.join(os.environ["HOME"], ".gnupg")
+				if quiet < 1:
+					print "Automatically setting PORTAGE_GPG_DIR to",repoman_settings["PORTAGE_GPG_DIR"]
+			else:
+				raise portage.exception.MissingParameter("PORTAGE_GPG_DIR is unset!")
+		gpg_dir = repoman_settings["PORTAGE_GPG_DIR"]
+		if gpg_dir.startswith("~") and "HOME" in os.environ:
+			repoman_settings["PORTAGE_GPG_DIR"] = os.path.join(
+				os.environ["HOME"], gpg_dir[1:].lstrip(os.path.sep))
+		if not os.access(repoman_settings["PORTAGE_GPG_DIR"], os.X_OK):
+			raise portage.exception.InvalidLocation(
+				"Unable to access directory: PORTAGE_GPG_DIR='%s'" % \
+				repoman_settings["PORTAGE_GPG_DIR"])
+		gpgcmd = "gpg --sign --clearsign --yes "
+		gpgcmd+= "--default-key "+repoman_settings["PORTAGE_GPG_KEY"]
+		if repoman_settings.has_key("PORTAGE_GPG_DIR"):
+			gpgcmd += " --homedir "+repoman_settings["PORTAGE_GPG_DIR"]
+		if "--pretend" in myoptions:
+			print "("+gpgcmd+" "+filename+")"
+		else:
+			rValue = os.system(gpgcmd+" "+filename)
+			if rValue == os.EX_OK:
+				os.rename(filename+".asc", filename)
+			else:
+				raise portage.exception.PortageException("!!! gpg exited with '" + str(rValue) + "' status")
+
+	manifest_commit_required = True
+	if myheaders or myupdates or myremoved or mynew:
+		myfiles=myheaders+myupdates+myremoved+mynew
+		for x in range(len(myfiles)-1, -1, -1):
+			if myfiles[x].count("/") < 4-repolevel:
+				del myfiles[x]
+		mydone=[]
+		if repolevel==3:   # In a package dir
+			repoman_settings["O"] = startdir
+			portage.digestgen([], repoman_settings, manifestonly=1,
+				myportdb=portdb)
+		elif repolevel==2: # In a category dir
+			for x in myfiles:
+				xs=x.split("/")
+				if len(xs) < 4-repolevel:
+					continue
+				if xs[0]==".":
+					xs=xs[1:]
+				if xs[0] in mydone:
+					continue
+				mydone.append(xs[0])
+				repoman_settings["O"] = os.path.join(startdir, xs[0])
+				if not os.path.isdir(repoman_settings["O"]):
+					continue
+				portage.digestgen([], repoman_settings, manifestonly=1,
+					myportdb=portdb)
+		elif repolevel==1: # repo-cvsroot
+			print green("RepoMan sez:"), "\"You're rather crazy... doing the entire repository.\"\n"
+			for x in myfiles:
+				xs=x.split("/")
+				if len(xs) < 4-repolevel:
+					continue
+				if xs[0]==".":
+					xs=xs[1:]
+				if "/".join(xs[:2]) in mydone:
+					continue
+				mydone.append("/".join(xs[:2]))
+				repoman_settings["O"] = os.path.join(startdir, xs[0], xs[1])
+				if not os.path.isdir(repoman_settings["O"]):
+					continue
+				portage.digestgen([], repoman_settings, manifestonly=1,
+					myportdb=portdb)
+		else:
+			print red("I'm confused... I don't know where I am!")
+			sys.exit(1)
+
+		# Force an unsigned commit when more than one Manifest needs to be signed.
+		if repolevel < 3 and "sign" in repoman_settings.features:
+			if "--pretend" in myoptions:
+				print "(cvs -q commit -F commitmessagefile)"
+			else:
+				fd, commitmessagefile = tempfile.mkstemp(".repoman.msg")
+				mymsg = os.fdopen(fd, "w")
+				mymsg.write(commitmessage)
+				mymsg.write("\n (Unsigned Manifest commit)")
+				mymsg.close()
+				retval=os.system("cvs -q commit -F "+commitmessagefile)
+				try:
+					os.unlink(commitmessagefile)
+				except OSError:
+					pass
+				if retval:
+					print "!!! Exiting on cvs (shell) error code:",retval
+					sys.exit(retval)
+			manifest_commit_required = False
+
+	signed = False
+	if "sign" in repoman_settings.features:
+		signed = True
+		myfiles = myupdates + myremoved + mymanifests
+		try:
+			if repolevel==3:   # In a package dir
+				repoman_settings["O"] = "."
+				gpgsign(os.path.join(repoman_settings["O"], "Manifest"))
+			elif repolevel==2: # In a category dir
+				mydone=[]
+				for x in myfiles:
+					xs=x.split("/")
+					if len(xs) < 4-repolevel:
+						continue
+					if xs[0]==".":
+						xs=xs[1:]
+					if xs[0] in mydone:
+						continue
+					mydone.append(xs[0])
+					repoman_settings["O"] = os.path.join(".", xs[0])
+					if not os.path.isdir(repoman_settings["O"]):
+						continue
+					gpgsign(os.path.join(repoman_settings["O"], "Manifest"))
+			elif repolevel==1: # repo-cvsroot
+				print green("RepoMan sez:"), "\"You're rather crazy... doing the entire repository.\"\n"
+				mydone=[]
+				for x in myfiles:
+					xs=x.split("/")
+					if len(xs) < 4-repolevel:
+						continue
+					if xs[0]==".":
+						xs=xs[1:]
+					if "/".join(xs[:2]) in mydone:
+						continue
+					mydone.append("/".join(xs[:2]))
+					repoman_settings["O"] = os.path.join(".", xs[0], xs[1])
+					if not os.path.isdir(repoman_settings["O"]):
+						continue
+					gpgsign(os.path.join(repoman_settings["O"], "Manifest"))
+		except portage.exception.PortageException, e:
+			portage.writemsg("!!! %s\n" % str(e))
+			portage.writemsg("!!! Disabled FEATURES='sign'\n")
+			signed = False
+
+	if manifest_commit_required or signed:
+		if "--pretend" in myoptions:
+			if isCvs:
+				print "(cvs -q commit -F commitmessagefile)"
+			if isSvn:
+				print "(svn -q commit -F commitmessagefile)"
+		else:
+			fd, commitmessagefile = tempfile.mkstemp(".repoman.msg")
+			mymsg = os.fdopen(fd, "w")
+			mymsg.write(commitmessage)
+			if signed:
+				mymsg.write("\n (Signed Manifest commit)")
+			else:
+				mymsg.write("\n (Unsigned Manifest commit)")
+			mymsg.close()
+			if isCvs:
+				retval=os.system("cvs -q commit -F "+commitmessagefile)
+			if isSvn:
+				retval=os.system("svn -q commit -F "+commitmessagefile)
+			try:
+				os.unlink(commitmessagefile)
+			except OSError:
+				pass
+			if retval:
+				print "!!! Exiting on cvs (shell) error code:",retval
+				sys.exit(retval)
+
+	print
+	if isCvs or isSvn:
+		print "Commit complete."
+	else:
+		print "repoman was too scared by not seeing any familiar version control file that he forgot to commit anything"
+	print green("RepoMan sez:"), "\"If everyone were like you, I'd be out of business!\"\n"
+sys.exit(0)
+
Index: /vendor/prefix-portage/current/bin/sed
===================================================================
--- /vendor/prefix-portage/current/bin/sed	(revision 3489)
+++ /vendor/prefix-portage/current/bin/sed	(revision 3489)
@@ -0,0 +1,26 @@
+#!@BASH@
+# Copyright 2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+ 
+scriptpath="${BASH_SOURCE[0]}"
+
+if [[ -n ${ESED} ]]; then
+	exec ${ESED} "$@"
+elif type -P gsed > /dev/null ; then
+	exec gsed "$@"
+else
+	old_IFS="${IFS}"
+	IFS=":"
+ 
+	for path in $PATH; do
+		[[ ${path}/sed == $scriptpath ]] && continue
+		if [[ -x $path/sed ]]; then
+			exec $path/sed "$@"	
+			exit 0
+		fi
+	done
+	
+	IFS="${old_IFS}"
+fi
+ 
+exit 1
Index: /vendor/prefix-portage/current/bin/xpak
===================================================================
--- /vendor/prefix-portage/current/bin/xpak	(revision 3489)
+++ /vendor/prefix-portage/current/bin/xpak	(revision 3489)
@@ -0,0 +1,18 @@
+#!@PYTHON@ -O
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: xpak 3483 2006-06-10 21:40:40Z genone $
+
+import sys, os
+if len(sys.argv)!=3:
+	print "xpak: expecting three arguments."
+	sys.exit(1)
+
+try:
+	import portage.xpak
+except ImportError:
+	from os import path as osp
+	sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
+	import portage.xpak
+
+portage.xpak.xpak(sys.argv[1],sys.argv[2])
Index: /vendor/prefix-portage/current/cnf/Makefile.in
===================================================================
--- /vendor/prefix-portage/current/cnf/Makefile.in	(revision 3489)
+++ /vendor/prefix-portage/current/cnf/Makefile.in	(revision 3489)
@@ -0,0 +1,54 @@
+sysconfdir = @sysconfdir@
+DEFAULT_PATH = @DEFAULT_PATH@
+ARCH = @ARCH@
+
+srcdir=@srcdir@
+top_builddir=@top_builddir@
+
+portageuser = @portageuser@
+portagegroup = @portagegroup@
+
+INSTALL = @INSTALL@
+INSTALL_cnf = @INSTALL_PROGRAM@ -o $(portageuser) -g $(portagegroup) -m 644
+INSTALL_cnfsubst = $(SHELL) ${top_builddir}/subst-install --installcmd='${INSTALL_cnf}'
+
+list_sourcedir = \
+	  ( cd ${srcdir} \
+	&& find . -name 'CVS' -prune \
+		   -o -name 'Makefile*' -prune \
+		   -o -name 'make.*' -type f -print \
+		   -o -name 'dispatch-conf.conf' -type f -print \
+		   -o -name 'etc-update.conf' -type f -print \
+	 )
+
+all:
+
+install:
+	$(INSTALL) -d -m 755 -o $(portageuser) -g $(portagegroup) $(DESTDIR)$(sysconfdir) \
+	; echo "$(INSTALL_cnfsubst) $(srcdir)/make.globals $(DESTDIR)$(sysconfdir)/make.globals" \
+	; $(INSTALL_cnfsubst) $(srcdir)/make.globals $(DESTDIR)$(sysconfdir)/make.globals \
+	; echo "$(INSTALL_cnfsubst) $(srcdir)/make.conf $(DESTDIR)$(sysconfdir)/make.conf.example" \
+	; $(INSTALL_cnfsubst) $(srcdir)/make.conf $(DESTDIR)$(sysconfdir)/make.conf.example \
+	; echo "$(INSTALL_cnfsubst) $(srcdir)/dispatch-conf.conf $(DESTDIR)$(sysconfdir)/dispatch-conf.conf" \
+	; $(INSTALL_cnfsubst) $(srcdir)/dispatch-conf.conf $(DESTDIR)$(sysconfdir)/dispatch-conf.conf \
+	; echo "$(INSTALL_cnfsubst) $(srcdir)/etc-update.conf $(DESTDIR)$(sysconfdir)/etc-update.conf" \
+	; $(INSTALL_cnfsubst) $(srcdir)/etc-update.conf $(DESTDIR)$(sysconfdir)/etc-update.conf
+	
+uninstall:
+	@ echo rm -f $(DESTDIR)$(sysconfdir)/make.conf.example \
+	; rm -f $(DESTDIR)$(sysconfdir)/make.conf.example \
+	; echo rm -f $(DESTDIR)$(sysconfdir)/make.globals \
+	; rm -f $(DESTDIR)$(sysconfdir)/make.globals \
+
+distdir:
+	$(list_sourcedir) | while read f \
+	; do echo $(INSTALL_cnf) ${srcdir}/$${f} $(distdir)/$${f} \
+	   ; $(INSTALL_cnf) ${srcdir}/$${f} $(distdir)/$${f} \
+	; done
+
+all dvi check installcheck:
+clean distclean maintainer-clean:
+
+.PHONY: all install distdir uninstall
+.PHONY: dvi check installcheck
+.PHONY: clean distclean maintainer-clean
Index: /vendor/prefix-portage/current/cnf/dispatch-conf.conf
===================================================================
--- /vendor/prefix-portage/current/cnf/dispatch-conf.conf	(revision 3489)
+++ /vendor/prefix-portage/current/cnf/dispatch-conf.conf	(revision 3489)
@@ -0,0 +1,44 @@
+#
+# dispatch-conf.conf
+#
+
+# Directory to archive replaced configs
+archive-dir=@DOMAIN_PREFIX@/etc/config-archive
+
+# Use rcs for storing files in the archive directory?
+# (yes or no)
+use-rcs=no
+
+# Diff for display
+# %s old file
+# %s new file
+diff="diff -Nu %s %s | less --no-init --QUIT-AT-EOF"
+
+# Diff for interactive merges.
+# %s output file
+# %s old file
+# %s new file
+merge="sdiff --suppress-common-lines --output=%s %s %s"
+
+# Automerge files comprising only CVS interpolations (e.g. Header or Id)
+# (yes or no)
+replace-cvs=yes
+
+# Automerge files comprising only whitespace and/or comments
+# (yes or no)
+replace-wscomments=no
+
+# Automerge files that the user hasn't modified
+# (yes or no)
+replace-unmodified=no
+
+# Ignore a version that is identical to the previously merged version,
+# even though it is different from the current user modified version
+# (yes or no)
+ignore-previously-merged=yes
+
+# Per-session log file of changes made to configuration files
+#log-file=/var/log/dispatch-conf.log
+
+# List of frozen files for which dispatch-conf will automatically zap updates
+#frozen-files=""
Index: /vendor/prefix-portage/current/cnf/etc-update.conf
===================================================================
--- /vendor/prefix-portage/current/cnf/etc-update.conf	(revision 3489)
+++ /vendor/prefix-portage/current/cnf/etc-update.conf	(revision 3489)
@@ -0,0 +1,75 @@
+# edit the lines below to your liking
+# $Id: etc-update.conf 3483 2006-06-10 21:40:40Z genone $
+
+# mode - 0 for text, 1 for menu (support incomplete)
+# note that you need dev-util/dialog installed
+mode="0"
+
+# Whether trivial/comment changes should be automerged
+eu_automerge="yes"
+
+# arguments used whenever rm is called
+rm_opts="-i"
+
+# arguments used whenever mv is called
+mv_opts="-i"
+
+# arguments used whenever cp is called
+cp_opts="-i"
+
+# pager for use with diff commands (see NOTE_2)
+pager="less"
+#pager=""
+
+# For emacs-users
+# diff_command="eval emacs -nw --eval=\(ediff\ \"%file1\"\ \"%file2\"\)"
+#using_editor=1
+
+# vim-users: you CAN use vimdiff for diff_command. (see NOTE_1)
+#diff_command="vim -d %file1 %file2"
+#using_editor=1
+
+diff_command="diff -uN %file1 %file2"
+using_editor=0
+
+
+# vim-users: don't use vimdiff for merging (see NOTE_1)
+merge_command="sdiff -s -o %merged %orig %new"
+
+# EXPLANATION
+#
+# pager:
+#
+# Examples of pager usage:
+#	pager=""		# don't use a pager
+#	pager="less -E"	# less
+#	pager="more"	# more
+#
+#
+# diff_command:
+#
+# Arguments:
+#	%file1	[REQUIRED]
+#	%file2	[REQUIRED]
+#
+# Examples of diff_command:
+#	diff_command="diff -uN %file1 %file2"	# diff
+#	diff_command="vim -d %file1 %file2"		# vimdiff
+#
+#
+# merge_command:
+#
+# Arguments:
+#	%orig	[REQUIRED]
+#   %new    [REQUIRED]
+#	%merged	[REQUIRED]
+#
+# Examples of merge_command:
+#	merge_command="sdiff -s -o %merged %old %new"	# sdiff
+#
+
+# NOTE_1: Editors such as vim/vimdiff are not usable for the merge_command
+# because it is not known what filenames the produced files have (the user can
+# choose while using those programs)
+
+# NOTE_2: Make sure pager is set to "" when using an editor as diff_command!
Index: /vendor/prefix-portage/current/cnf/make.conf
===================================================================
--- /vendor/prefix-portage/current/cnf/make.conf	(revision 3489)
+++ /vendor/prefix-portage/current/cnf/make.conf	(revision 3489)
@@ -0,0 +1,375 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: make.conf 4618 2006-10-08 18:21:05Z zmedico $
+# Contains local system settings for Portage system
+
+# Please review 'man make.conf' for more information.
+
+# Build-time functionality
+# ========================
+#
+# The USE variable is used to enable optional build-time functionality. For
+# example, quite a few packages have optional X, gtk or GNOME functionality
+# that can only be enabled or disabled at compile-time. Gentoo Linux has a
+# very extensive set of USE variables described in our USE variable HOWTO at
+# http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=1
+#
+# The available list of use flags with descriptions is in your portage tree.
+# Use 'less' to view them:  --> less /usr/portage/profiles/use.desc <--
+#
+# 'ufed' is an ncurses/dialog interface available in portage to make handling
+# useflags for you. 'emerge app-portage/ufed'
+#
+# Example:
+#USE="X gtk gnome -alsa"
+
+# Host and optimization settings 
+# ==============================
+#
+# For optimal performance, enable a CFLAGS setting appropriate for your CPU.
+#
+# Please note that if you experience strange issues with a package, it may be
+# due to gcc's optimizations interacting in a strange way. Please test the
+# package (and in some cases the libraries it uses) at default optimizations
+# before reporting errors to developers.
+#
+# Please refer to the GCC manual for a list of possible values.
+#
+#CFLAGS="-O2 -pipe"
+#
+# If you set a CFLAGS above, then this line will set your default C++ flags to
+# the same settings.
+#CXXFLAGS="${CFLAGS}"
+
+# Advanced Masking
+# ================
+#
+# Gentoo is using a new masking system to allow for easier stability testing
+# on packages. KEYWORDS are used in ebuilds to mask and unmask packages based
+# on the platform they are set for. A special form has been added that
+# indicates packages and revisions that are expected to work, but have not yet
+# been approved for the stable set. '~arch' is a superset of 'arch' which
+# includes the unstable, in testing, packages. Users of the 'x86' architecture
+# would add '~x86' to ACCEPT_KEYWORDS to enable unstable/testing packages.
+# '~ppc', '~sparc' are the unstable KEYWORDS for their respective platforms.
+#
+# Please note that this is not for development, alpha, beta, nor cvs release
+# packages. "Broken" packages will not be added to testing and should not be
+# requested to be added. Alternative routes are available to developers
+# for experimental packages, and it is at their discretion to use them.
+#
+# DO NOT PUT ANYTHING BUT YOUR SPECIFIC ~ARCHITECTURE IN THE LIST.
+# IF YOU ARE UNSURE OF YOUR ARCH, OR THE IMPLICATIONS, DO NOT MODIFY THIS.
+#
+#ACCEPT_KEYWORDS="~arch"
+
+# Portage Directories
+# ===================
+#
+# Each of these settings controls an aspect of portage's storage and file
+# system usage. If you change any of these, be sure it is available when
+# you try to use portage. *** DO NOT INCLUDE A TRAILING "/" ***
+#
+# EPREFIX is the filesystem location in which ALL packages will be
+#     installed to.
+#EPREFIX=/opt/gentoo
+#
+# PORTAGE_TMPDIR is the location portage will use for compilations and
+#     temporary storage of data. This can get VERY large depending upon
+#     the application being installed.
+#PORTAGE_TMPDIR=${EPREFIX}/var/tmp
+#
+# PORTDIR is the location of the portage tree. This is the repository
+#     for all profile information as well as all ebuilds. If you change
+#     this, you must update your /etc/make.profile symlink accordingly.
+#PORTDIR=${EPREFIX}/usr/portage
+#
+# DISTDIR is where all of the source code tarballs will be placed for
+#     emerges. The source code is maintained here unless you delete
+#     it. The entire repository of tarballs for Gentoo is 9G. This is
+#     considerably more than any user will ever download. 2-3G is
+#     a large DISTDIR.
+#DISTDIR=/usr/portage/distfiles
+#
+# PKGDIR is the location of binary packages that you can have created
+#     with '--buildpkg' or '-b' while emerging a package. This can get
+#     up to several hundred megs, or even a few gigs.
+#PKGDIR=/usr/portage/packages
+#
+# PORT_LOGDIR is the location where portage will store all the logs it
+#     creates from each individual merge. They are stored as NNNN-$PF.log
+#     in the directory specified. This is disabled until you enable it by
+#     providing a directory. Permissions will be modified as needed IF the
+#     directory exists, otherwise logging will be disabled. NNNN is the
+#     increment at the time the log is created. Logs are thus sequential.
+#     The common setting is to use the /var/log/portage path.
+#PORT_LOGDIR=""
+#
+# PORTDIR_OVERLAY is a directory where local ebuilds may be stored without
+#     concern that they will be deleted by rsync updates. Default is not
+#     defined.
+#PORTDIR_OVERLAY=/usr/local/portage
+
+# Fetching files 
+# ==============
+#
+# If you need to set a proxy for wget or lukemftp, add the appropriate "export
+# ftp_proxy=<proxy>" and "export http_proxy=<proxy>" lines to /etc/profile if
+# all users on your system should use them.
+#
+# Portage uses wget by default. Here are some settings for some alternate
+# downloaders -- note that you need to merge these programs first before they
+# will be available.
+#
+# Default fetch command (5 tries, passive ftp for firewall compatibility)
+#FETCHCOMMAND="${EPREFIX}/usr/bin/wget -t 5 -T 60 --passive-ftp \${URI} -P \${DISTDIR}"
+#RESUMECOMMAND="${EPREFIX}/usr/bin/wget -c -t 5 -T 60 --passive-ftp \${URI} -P \${DISTDIR}"
+#
+# Using wget, ratelimiting downloads
+#FETCHCOMMAND="${EPREFIX}/usr/bin/wget -t 5 -T 60 --passive-ftp --limit-rate=200k \${URI} -P \${DISTDIR}"
+#RESUMECOMMAND="${EPREFIX}/usr/bin/wget -c -t 5 -T 60 --passive-ftp --limit-rate=200k \${URI} -P \${DISTDIR}"
+#
+# curl groks urls
+#FETCHCOMMAND="${EPREFIX}/usr/bin/curl -f --connect-timeout 15 -# -o \${DISTDIR}/\${FILE} \${URI}"
+#RESUMECOMMAND="${EPREFIX}/usr/bin/curl -f --connect-timeout 15 -# -C - -o \${DISTDIR}/\${FILE} \${URI}"
+#
+# Lukemftp (BSD ftp):
+#FETCHCOMMAND="${EPREFIX}/usr/bin/lukemftp -s -a -o \${DISTDIR}/\${FILE} \${URI}"
+#RESUMECOMMAND="${EPREFIX}/usr/bin/lukemftp -s -a -R -o \${DISTDIR}/\${FILE} \${URI}"
+#
+# Portage uses GENTOO_MIRRORS to specify mirrors to use for source retrieval.
+# The list is a space separated list which is read left to right. If you use
+# another mirror we highly recommend leaving the default mirror at the end of
+# the list so that portage will fall back to it if the files cannot be found
+# on your specified mirror. We _HIGHLY_ recommend that you change this setting
+# to a nearby mirror by merging and using the 'mirrorselect' tool.
+#GENTOO_MIRRORS="<your_mirror_here> http://distfiles.gentoo.org http://www.ibiblio.org/pub/Linux/distributions/gentoo"
+#
+# Portage uses PORTAGE_BINHOST to specify mirrors for prebuilt-binary packages.
+# The list is a single entry specifying the full address of the directory
+# serving the tbz2's for your system. Running emerge with either '--getbinpkg'
+# or '--getbinpkgonly' will cause portage to retrieve the metadata from all
+# packages in the directory specified, and use that data to determine what will
+# be downloaded and merged. '-g' or '-gK' are the recommend parameters. Please
+# consult the man pages and 'emerge --help' for more information. For FTP, the
+# default connection is passive -- If you require an active connection, affix
+# an asterisk (*) to the end of the host:port string before the path.
+#PORTAGE_BINHOST="http://grp.mirror.site/gentoo/grp/1.4/i686/athlon-xp/"
+# This ftp connection is passive ftp.
+#PORTAGE_BINHOST="ftp://login:pass@grp.mirror.site/pub/grp/i686/athlon-xp/"
+# This ftp connection is active ftp.
+#PORTAGE_BINHOST="ftp://login:pass@grp.mirror.site:21*/pub/grp/i686/athlon-xp/"
+
+# Synchronizing Portage
+# =====================
+#
+# Each of these settings affects how Gentoo synchronizes your Portage tree.
+# Synchronization is handled by rsync and these settings allow some control
+# over how it is done.
+#
+# SYNC is the server used by rsync to retrieve a localized rsync mirror
+#     rotation. This allows you to select servers that are geographically
+#     close to you, yet still distribute the load over a number of servers.
+#     Please do not single out specific rsync mirrors. Doing so places undue
+#     stress on particular mirrors.  Instead you may use one of the following
+#     continent specific rotations:
+#
+#   Default:       "rsync://rsync.gentoo.org/gentoo-portage"
+#   North America: "rsync://rsync.namerica.gentoo.org/gentoo-portage"
+#   South America: "rsync://rsync.samerica.gentoo.org/gentoo-portage"
+#   Europe:        "rsync://rsync.europe.gentoo.org/gentoo-portage"
+#   Asia:          "rsync://rsync.asia.gentoo.org/gentoo-portage"
+#   Australia:     "rsync://rsync.au.gentoo.org/gentoo-portage"
+#
+#     If you have multiple Gentoo boxes, it is probably a good idea to have only
+#     one of them sync from the rotations above. The other boxes can then rsync
+#     from the local rsync server, reducing the load on the mirrors.
+#     Instructions for setting up a local rsync server are available here:
+#     http://www.gentoo.org/doc/en/rsync.xml
+#
+#SYNC="rsync://rsync.gentoo.org/gentoo-portage"
+#
+# PORTAGE_RSYNC_RETRIES sets the number of times portage will attempt to retrieve
+#     a current portage tree before it exits with an error. This allows
+#     for a more successful retrieval without user intervention most times.
+#PORTAGE_RSYNC_RETRIES="3"
+#
+# PORTAGE_RSYNC_EXTRA_OPTS can be used to feed additional options to the rsync
+#     command used by `emerge --sync`. This will not change the default options
+#     which are set by PORTAGE_RSYNC_OPTS (don't change those unless you know 
+#     exactly what you're doing).
+#PORTAGE_RSYNC_EXTRA_OPTS=""
+#
+# Advanced Features
+# =================
+#
+# EMERGE_DEFAULT_OPTS allows emerge to act as if certain options are
+#     specified on every run. Useful options include --ask, --verbose,
+#     --usepkg and many others. Options that are not useful, such as --help,
+#     are not filtered.
+#EMERGE_DEFAULT_OPTS=""
+#
+# INSTALL_MASK allows certain files to not be installed into your file system.
+#     This is useful when you wish to filter out a certain set of files from
+#     ever being installed, such as INSTALL.gz or TODO.gz
+#INSTALL_MASK=""
+#
+# MAKEOPTS provides extra options that may be passed to 'make' when a
+#     program is compiled. Presently the only use is for specifying
+#     the number of parallel makes (-j) to perform. The suggested number
+#     for parallel makes is CPUs+1.
+#MAKEOPTS="-j2"
+#
+# PORTAGE_NICENESS provides a default increment to emerge's niceness level.
+#     Note: This is an increment. Running emerge in a niced environment will
+#     reduce it further. Default is unset.
+#PORTAGE_NICENESS=3
+#
+# AUTOCLEAN enables portage to automatically clean out older or overlapping
+#     packages from the system after every successful merge. This is the
+#     same as running 'emerge -c' after every merge. Set with: "yes" or "no".
+#     This does not affect the unpacked source. See 'noclean' below.
+#
+#     Warning: AUTOCLEAN="no" can cause serious problems due to overlapping
+#              packages.  Do not use it unless absolutely necessary!
+#AUTOCLEAN="yes"
+#
+# PORTAGE_TMPFS is a location where portage may create temporary files.
+#     If specified, portage will use this directory whenever possible
+#     for all rapid operations such as lockfiles and transient data.
+#     It is _highly_ recommended that this be a tmpfs or ramdisk. Do not
+#     set this to anything that does not give a significant performance
+#     enhancement and proper FS compliance for locks and read/write.
+#     /dev/shm is a glibc mandated tmpfs, and should be a reasonable
+#     setting for all linux kernel+glibc based systems.
+#PORTAGE_TMPFS="/dev/shm"
+#
+# FEATURES are settings that affect the functionality of portage. Most of
+#     these settings are for developer use, but some are available to non-
+#     developers as well.
+#
+#  'buildpkg'    causes binary packages to be created of all packages that 
+#                are being merged.
+#  'buildsyspkg' only build binary packages for system packages.
+#  'ccache'      enable support for the dev-util/ccache package, which can
+#                noticably decrease the time needed to remerge previously built
+#                packages.
+#  'collision-protect'
+#                prevents packages from overwriting files that are owned by
+#                another package or by no package at all.
+#  'distcc'      enables distcc support via CC.
+#  'distlocks'   enables distfiles locking using fcntl or hardlinks. This
+#                is enabled by default. Tools exist to help clean the locks
+#                after crashes: /usr/lib/portage/bin/clean_locks.
+#  'test'        causes ebuilds to perform testing phases if they are capable
+#                of it. Some packages support this automatically via makefiles.
+#  'metadata-transfer'
+#                automatically perform a metadata transfer when `emerge --sync`
+#                is run.
+#  'noauto'      causes ebuild to perform only the action requested and 
+#                not any other required actions like clean or unpack -- for
+#                debugging purposes only.
+#  'nostrip'     prevents the stripping of binaries.
+#  'notitles'    disables xterm titlebar updates (which contain status info). 
+#  'parallel-fetch'
+#                do fetching in parallel to compilation
+#  'sandbox'     enables sandboxing when running emerge and ebuild.
+#  'strict'      causes portage to react strongly to conditions that are
+#                potentially dangerous, like missing/incorrect Manifest files.
+#  'stricter'    causes portage to react strongly to conditions that may
+#                conflict with system security provisions (for example
+#                textrels, executable stacks).
+#  'userfetch'   when portage is run as root, drop privileges to
+#                portage:portage during the fetching of package sources.
+#  'userpriv'    allows portage to drop root privileges while it is compiling,
+#                as a security measure.  As a side effect this can remove 
+#                sandbox access violations for users. 
+#  'usersandbox' enables sandboxing while portage is running under userpriv.
+#FEATURES="sandbox buildpkg ccache distcc userpriv usersandbox notitles noauto"
+#FEATURES="sandbox ccache distcc distlocks"
+
+# CCACHE_SIZE and CCACHE_DIR are used to control the behavior of ccache, and
+#     and are only used if "ccache" is in FEATURES.
+#
+# CCACHE_SIZE sets the space limitations for ccache. The default size is
+#     "2G", or 2 gigabytes.  Units are specified with 'G', 'M', or 'K'.
+#
+#CCACHE_SIZE="512M"
+#
+# CCACHE_DIR sets the ccache path.  If not specified, portage will default
+#     to "${PORTAGE_TMPDIR}/ccache".
+#
+#     Note that to display ccache statistics outside of portage, you must
+#     remember to give the correct path to the cache.
+#
+#        $ CCACHE_DIR=/var/tmp/ccache ccache -s 
+#
+#CCACHE_DIR="${PORTAGE_TMPDIR}/ccache"
+
+# DISTCC_DIR sets the temporary space used by distcc.
+#DISTCC_DIR="${PORTAGE_TMPDIR}/.distcc"
+
+# logging related variables:
+# PORTAGE_ELOG_CLASSES: selects messages to be logged, possible values are:
+#                          info, warn, error, log, qa, *
+#                       Warning: commenting this will disable elog
+PORTAGE_ELOG_CLASSES="warn error log"
+
+# PORTAGE_ELOG_SYSTEM: selects the module(s) to process the log messages. Modules
+#                      included in portage are (empty means logging is disabled):
+#                          echo (display messages again when emerge exits)
+#                          save (saves one log per package in $PORT_LOGDIR/elog, 
+#                                /var/log/portage/elog if $PORT_LOGDIR is unset)
+#                          custom (passes all messages to $PORTAGE_ELOG_COMMAND)
+#                          syslog (sends all messages to syslog)
+#                          mail (send all messages to the mailserver defined 
+#                                in $PORTAGE_ELOG_MAILURI)
+#                          save_summary (like "save" but merges all messages
+#                                        in $PORT_LOGDIR/elog/summary.log,
+#                                        /var/log/portage/elog/summary.log if
+#                                        $PORT_LOGDIR is unset)
+#                          mail_summary (like "mail" but sends all messages in
+#                                        a single mail when emerge exits)
+#                      To use elog you should enable at least one module
+#                      The module name may be followed by a colon and a comma
+#                      separated list of loglevels to override PORTAGE_ELOG_CLASSES
+#                      for this module (e.g.
+#                        PORTAGE_ELOG_SYSTEM="mail:warn,error syslog:* save")
+#PORTAGE_ELOG_SYSTEM="save mail"
+
+# PORTAGE_ELOG_COMMAND: only used with the "custom" logging module. Specifies a command
+#                      to process log messages. Two variables are expanded:
+#                          ${PACKAGE} - expands to the cpv entry of the processed 
+#                                       package (see $PVR in ebuild(5))
+#                          ${LOGFILE} - absolute path to the logfile
+#						Both variables have to be quoted with single quotes
+#PORTAGE_ELOG_COMMAND="/path/to/logprocessor -p '\${PACKAGE}' -f '\${LOGFILE}'"
+
+# PORTAGE_ELOG_MAILURI: this variable holds all important settings for the mail
+#                       module. In most cases listing the recipient address and
+#                       the receiving mailserver should be sufficient, but you can
+#                       also use advanced settings like authentication or TLS. The
+#                       full syntax is:
+#                           address [[user:passwd@]mailserver[:port]]
+#                       where
+#                           address:    recipient address
+#                           user:       username for smtp auth (defaults to none)
+#                           passwd:     password for smtp auth (defaults to none)
+#                           mailserver: smtp server that should be used to deliver the mail (defaults to localhost)
+#                                       alternatively this can also be a the path to a sendmail binary if you don't want to use smtp
+#                           port:       port to use on the given smtp server (defaults to 25, values > 100000 indicate that starttls should be used on (port-100000))
+#                       Examples:
+#PORTAGE_ELOG_MAILURI="root@localhost localhost" (this is also the default setting)
+#PORTAGE_ELOG_MAILURI="user@some.domain mail.some.domain" (sends mails to user@some.domain using the mailserver mail.some.domain)
+#PORTAGE_ELOG_MAILURI="user@some.domain user:secret@mail.some.domain:100465" (this is left uncommented as a reader exercise ;)
+
+# PORTAGE_ELOG_MAILFROM: you can set the from-address of logmails with this variable,
+#                        if unset mails are sent by "portage" (this default may fail
+#                        in some environments).
+#PORTAGE_ELOG_MAILFROM="portage@some.domain"
+
+# PORTAGE_ELOG_MAILSUBJECT: template string to be used as subject for logmails. The following
+#                           variables are expanded:
+#                               ${PACKAGE} - see description of PORTAGE_ELOG_COMMAND
+#                               ${HOST} - FQDN of the host portage is running on
+#PORTAGE_ELOG_MAILSUBJECT="package \${PACKAGE} merged on \${HOST} with notice"
Index: /vendor/prefix-portage/current/cnf/make.conf.alpha.diff
===================================================================
--- /vendor/prefix-portage/current/cnf/make.conf.alpha.diff	(revision 3489)
+++ /vendor/prefix-portage/current/cnf/make.conf.alpha.diff	(revision 3489)
@@ -0,0 +1,50 @@
+--- make.conf	2006-03-19 18:40:11.000000000 +0100
++++ make.conf.alpha	2006-03-19 18:26:21.000000000 +0100
+@@ -23,6 +23,17 @@
+ # Example:
+ #USE="X gtk gnome -alsa"
+ 
++# Host Setting
++# ============
++#
++# DO NOT CHANGE THIS SETTING UNLESS YOU ARE USING STAGE1!
++# The generic HOST setting on alpha is alpha-unknown-linux-gnu. If your machine
++# is an ev6 or ev67 based system you might want to use 
++# either alphaev6-unknown-linux-gnu or alphaev67-unknown-linux-gnu accordingly.
++#
++#CHOST="alphaev67-unknown-linux-gnu"
++CHOST="alpha-unknown-linux-gnu"
++
+ # Host and optimization settings 
+ # ==============================
+ #
+@@ -33,10 +44,18 @@
+ # package (and in some cases the libraries it uses) at default optimizations
+ # before reporting errors to developers.
+ #
+-# Please refer to the GCC manual for a list of possible values.
++# -mcpu=<cpu-type> means optimize code for the particular type of CPU. In 
++#                  difference to x86 for example -mcpu does break compatibility
++#                  to older cpu types in case of ev6 or higher.
++#                  On Alpha there is no -march= option in gcc-3.
+ #
+-#CFLAGS="-O2 -pipe"
++# CPU types supported in gcc-3.2 or higher: ev4, ev45, ev5, ev56, ev6, ev67
+ #
++# Decent examples:
++#
++#CFLAGS="-mcpu=ev67 -O3 -pipe "
++CFLAGS="-mcpu=ev5 -O3 -pipe "
++
+ # If you set a CFLAGS above, then this line will set your default C++ flags to
+ # the same settings.
+ #CXXFLAGS="${CFLAGS}"
+@@ -61,7 +80,7 @@
+ # DO NOT PUT ANYTHING BUT YOUR SPECIFIC ~ARCHITECTURE IN THE LIST.
+ # IF YOU ARE UNSURE OF YOUR ARCH, OR THE IMPLICATIONS, DO NOT MODIFY THIS.
+ #
+-#ACCEPT_KEYWORDS="~arch"
++#ACCEPT_KEYWORDS="~alpha"
+ 
+ # Portage Directories
+ # ===================
Index: /vendor/prefix-portage/current/cnf/make.conf.amd64.diff
===================================================================
--- /vendor/prefix-portage/current/cnf/make.conf.amd64.diff	(revision 3489)
+++ /vendor/prefix-portage/current/cnf/make.conf.amd64.diff	(revision 3489)
@@ -0,0 +1,61 @@
+--- make.conf	2006-03-19 18:40:11.000000000 +0100
++++ make.conf.amd64	2006-03-19 18:26:21.000000000 +0100
+@@ -23,6 +23,11 @@
+ # Example:
+ #USE="X gtk gnome -alsa"
+ 
++# Host Setting
++# ============
++#
++CHOST="x86_64-pc-linux-gnu"
++
+ # Host and optimization settings 
+ # ==============================
+ #
+@@ -33,10 +38,35 @@
+ # package (and in some cases the libraries it uses) at default optimizations
+ # before reporting errors to developers.
+ #
+-# Please refer to the GCC manual for a list of possible values.
++# -mcpu=<cpu-type> means optimize code for the particular type of CPU without
++# breaking compatibility with other CPUs. GCC 3.4 has deprecated support for
++# -mcpu, so use -mtune instead if using this compiler.
++#
++# -march=<cpu-type> means to take full advantage of the ABI and instructions
++# for the particular CPU; this will break compatibility with older CPUs (for
++# example, -march=athlon-xp code will not run on a regular Athlon, and
++# -march=i686 code will not run on a Pentium Classic.)
++#
++# CPU types supported in gcc-3.2 and higher: athlon-xp, athlon-mp,
++# athlon-tbird, athlon, k6, k6-2, k6-3, i386, i486, i586 (Pentium), i686
++# (PentiumPro), pentium, pentium-mmx, pentiumpro, pentium2 (Celeron),
++# pentium3, and pentium4.
++#
++# Note that Gentoo Linux 1.4 and higher include at least gcc-3.2.
++#
++# amd64 CPU types supported in gcc-3.4: athlon64, opteron, k8
++# 
++# CRITICAL WARNINGS: ****************************************************** #
++# K6 markings are deceptive. Avoid setting -march for them. See Bug #24379. #
++# Pentium-M CPU's should not enable sse2 until at least gcc-3.4. Bug 50616. #
++# GCC 3.3 doesnt support an amd64 specific -march setting, use 3.4.         #
++# ************************************************************************* #
+ #
+-#CFLAGS="-O2 -pipe"
++# Decent examples:
+ #
++#CFLAGS="-mtune=k8 -O2 -pipe"
++#CFLAGS="-march=athlon64 -O2 -pipe"
++
+ # If you set a CFLAGS above, then this line will set your default C++ flags to
+ # the same settings.
+ #CXXFLAGS="${CFLAGS}"
+@@ -61,7 +91,7 @@
+ # DO NOT PUT ANYTHING BUT YOUR SPECIFIC ~ARCHITECTURE IN THE LIST.
+ # IF YOU ARE UNSURE OF YOUR ARCH, OR THE IMPLICATIONS, DO NOT MODIFY THIS.
+ #
+-#ACCEPT_KEYWORDS="~arch"
++#ACCEPT_KEYWORDS="~amd64"
+ 
+ # Portage Directories
+ # ===================
Index: /vendor/prefix-portage/current/cnf/make.conf.arm.diff
===================================================================
--- /vendor/prefix-portage/current/cnf/make.conf.arm.diff	(revision 3489)
+++ /vendor/prefix-portage/current/cnf/make.conf.arm.diff	(revision 3489)
@@ -0,0 +1,50 @@
+--- make.conf	2006-03-19 18:40:11.000000000 +0100
++++ make.conf.arm	2006-03-19 18:26:21.000000000 +0100
+@@ -23,6 +23,19 @@
+ # Example:
+ #USE="X gtk gnome -alsa"
+ 
++# Host Setting
++# ============
++#
++# DO NOT CHANGE THIS SETTING UNLESS YOU ARE USING STAGE1!
++# It's very important you select the right CHOST from the start.  A wrong
++# CHOST could easily lead to weird errors either in compiling or running.
++#
++# Netwinder (or any StrongArm110): armv4l-unknown-linux-gnu
++# nslu2: armvbe-unknown-linux-gnu
++# Generic ARM: arm-unknown-linux-gnu
++#
++CHOST="armv4l-unknown-linux-gnu"
++
+ # Host and optimization settings 
+ # ==============================
+ #
+@@ -33,10 +46,24 @@
+ # package (and in some cases the libraries it uses) at default optimizations
+ # before reporting errors to developers.
+ #
+-# Please refer to the GCC manual for a list of possible values.
+-#
+-#CFLAGS="-O2 -pipe"
++# -mcpu=<cpu-type> means optimize code for the particular type of CPU without
++# breaking compatibility with other CPUs.
+ #
++# -march=<cpu-type> means to take full advantage of the ABI and instructions
++# for the particular CPU; this will break compatibility with older CPUs (for
++# example, -march=xscale code will not run on a StrongARM 11x0, and
++# -march=strongarm110 code will not run on a regular StrongARM).
++#
++# Don't use -O3.  Even -O2 may be risky in some cases.
++#
++# For a full listing of supported CPU models, please refer to the GCC website:
++# http://gcc.gnu.org/onlinedocs/gcc-3.3/gcc/ARM-Options.html
++#
++# Netwinder:
++#CFLAGS="-mcpu=strongarm110 -O2 -pipe"
++# NSLU2:
++#CFLAGS="-mcpu=armeb -O2 -pipe"
++
+ # If you set a CFLAGS above, then this line will set your default C++ flags to
+ # the same settings.
+ #CXXFLAGS="${CFLAGS}"
Index: /vendor/prefix-portage/current/cnf/make.conf.hppa.diff
===================================================================
--- /vendor/prefix-portage/current/cnf/make.conf.hppa.diff	(revision 3489)
+++ /vendor/prefix-portage/current/cnf/make.conf.hppa.diff	(revision 3489)
@@ -0,0 +1,71 @@
+--- make.conf	2006-03-19 18:40:11.000000000 +0100
++++ make.conf.hppa	2006-03-24 18:36:24.000000000 +0100
+@@ -23,6 +23,18 @@
+ # Example:
+ #USE="X gtk gnome -alsa"
+ 
++# Host Setting
++# ============
++#
++# DO NOT CHANGE THIS SETTING UNLESS YOU ARE USING STAGE1!
++# The generic CHOST value for hppa is hppa-unknown-linux-gnu.
++# But you might want to use hppa1.1-unknown-linux-gnu or hppa2.0-unknown-linux-gnu
++# according to your station.
++#
++CHOST="hppa-unknown-linux-gnu"
++#CHOST="hppa1.1-unknown-linux-gnu"
++#CHOST="hppa2.0-unknown-linux-gnu"
++
+ # Host and optimization settings 
+ # ==============================
+ #
+@@ -33,14 +45,38 @@
+ # package (and in some cases the libraries it uses) at default optimizations
+ # before reporting errors to developers.
+ #
+-# Please refer to the GCC manual for a list of possible values.
++# -march=<cpu-type> means to take full advantage of the ABI and instructions
++# for the particular CPU; this will break compatibility with older CPUs (for
++# example, -march=2.0 code will not run on a regular hppa1.1 station)
++#
++# -mschedule=cpu-type create schedule code according to the constraints for the machine
++# cpu-type.  The choices for cpu-type are 700 7100, 7100LC, 7200, and 8000.
++# Use 'cat /proc/cpuinfo' to know the right schedule for your hppa.
++# Note that you must use 7100LC for 7300LC.
++#
++# Architectures types supported in gcc-3.2 and higher: 1.0, 1.1 and 2.0
++# Note that 64bit userspace is not yet implemented.
+ #
+-#CFLAGS="-O2 -pipe"
++# Decent examples:
+ #
++
++# Use this one if you have a hppa1.1
++#CFLAGS="-march=1.1 -O2 -pipe -mschedule=7100LC"
++
++# Or this one if you have a hppa2.0
++# Note that -march=2.0 was unstable on some stations.
++# -march=1.0 will create problems too.
++#CFLAGS="-O2 -pipe -mschedule=8000"
++
++
+ # If you set a CFLAGS above, then this line will set your default C++ flags to
+ # the same settings.
+ #CXXFLAGS="${CFLAGS}"
+ 
++# Btw it's recommended to use this setting for stability.
++# There are still many bugs with higher level of optimisation.
++#CXXFLAGS="-O1 -pipe"
++
+ # Advanced Masking
+ # ================
+ #
+@@ -61,7 +97,7 @@
+ # DO NOT PUT ANYTHING BUT YOUR SPECIFIC ~ARCHITECTURE IN THE LIST.
+ # IF YOU ARE UNSURE OF YOUR ARCH, OR THE IMPLICATIONS, DO NOT MODIFY THIS.
+ #
+-#ACCEPT_KEYWORDS="~arch"
++#ACCEPT_KEYWORDS="~hppa"
+ 
+ # Portage Directories
+ # ===================
Index: /vendor/prefix-portage/current/cnf/make.conf.ia64.diff
===================================================================
--- /vendor/prefix-portage/current/cnf/make.conf.ia64.diff	(revision 3489)
+++ /vendor/prefix-portage/current/cnf/make.conf.ia64.diff	(revision 3489)
@@ -0,0 +1,40 @@
+--- make.conf	2006-03-19 18:40:11.000000000 +0100
++++ make.conf.ia64	2006-03-19 18:26:21.000000000 +0100
+@@ -23,20 +23,18 @@
+ # Example:
+ #USE="X gtk gnome -alsa"
+ 
++# Host Setting
++# ============
++#
++# All Itanium systems should use this host setting:
++
++CHOST="ia64-unknown-linux-gnu"
++
+ # Host and optimization settings 
+ # ==============================
+ #
+-# For optimal performance, enable a CFLAGS setting appropriate for your CPU.
+-#
+-# Please note that if you experience strange issues with a package, it may be
+-# due to gcc's optimizations interacting in a strange way. Please test the
+-# package (and in some cases the libraries it uses) at default optimizations
+-# before reporting errors to developers.
+-#
+-# Please refer to the GCC manual for a list of possible values.
+-#
+ #CFLAGS="-O2 -pipe"
+-#
++
+ # If you set a CFLAGS above, then this line will set your default C++ flags to
+ # the same settings.
+ #CXXFLAGS="${CFLAGS}"
+@@ -61,7 +80,7 @@
+ # DO NOT PUT ANYTHING BUT YOUR SPECIFIC ~ARCHITECTURE IN THE LIST.
+ # IF YOU ARE UNSURE OF YOUR ARCH, OR THE IMPLICATIONS, DO NOT MODIFY THIS.
+ #
+-#ACCEPT_KEYWORDS="~arch"
++#ACCEPT_KEYWORDS="~ia64"
+ 
+ # Portage Directories
+ # ===================
Index: /vendor/prefix-portage/current/cnf/make.conf.mips.diff
===================================================================
--- /vendor/prefix-portage/current/cnf/make.conf.mips.diff	(revision 3489)
+++ /vendor/prefix-portage/current/cnf/make.conf.mips.diff	(revision 3489)
@@ -0,0 +1,43 @@
+--- make.conf	2006-03-19 18:40:11.000000000 +0100
++++ make.conf.mips	2006-03-19 18:26:21.000000000 +0100
+@@ -23,6 +23,13 @@
+ # Example:
+ #USE="X gtk gnome -alsa"
+ 
++# Host Setting
++# ============
++#
++# All MIPS systems should use this host setting:
++
++CHOST="mips-unknown-linux-gnu"
++
+ # Host and optimization settings 
+ # ==============================
+ #
+@@ -33,10 +40,15 @@
+ # package (and in some cases the libraries it uses) at default optimizations
+ # before reporting errors to developers.
+ #
+-# Please refer to the GCC manual for a list of possible values.
++# -mcpu=<cpu-type> for MIPS systems selects the type of processor you want
++# to optimize your code for.   Code generated under those options will run best
++# on that processor, and may not run at all on others.
+ #
+-#CFLAGS="-O2 -pipe"
++# GCC 3.2 supports many mips processor types including: r2000, r3000, r3900, r4000, 
++# r4100, r4300, r4400, r4600, r4650, r5000, r6000, r8000 , orion
+ #
++#CFLAGS="-O2 -pipe"
++
+ # If you set a CFLAGS above, then this line will set your default C++ flags to
+ # the same settings.
+ #CXXFLAGS="${CFLAGS}"
+@@ -61,7 +73,7 @@
+ # DO NOT PUT ANYTHING BUT YOUR SPECIFIC ~ARCHITECTURE IN THE LIST.
+ # IF YOU ARE UNSURE OF YOUR ARCH, OR THE IMPLICATIONS, DO NOT MODIFY THIS.
+ #
+-#ACCEPT_KEYWORDS="~arch"
++#ACCEPT_KEYWORDS="~mips"
+ 
+ # Portage Directories
+ # ===================
Index: /vendor/prefix-portage/current/cnf/make.conf.ppc.diff
===================================================================
--- /vendor/prefix-portage/current/cnf/make.conf.ppc.diff	(revision 3489)
+++ /vendor/prefix-portage/current/cnf/make.conf.ppc.diff	(revision 3489)
@@ -0,0 +1,87 @@
+--- make.conf	2006-03-19 18:40:11.000000000 +0100
++++ make.conf.ppc	2006-03-19 18:26:21.000000000 +0100
+@@ -23,6 +23,13 @@
+ # Example:
+ #USE="X gtk gnome -alsa"
+ 
++# Host Setting
++# ============
++#
++# All PowerPC systems should use this host setting:
++
++CHOST="powerpc-unknown-linux-gnu"
++
+ # Host and optimization settings 
+ # ==============================
+ #
+@@ -33,10 +40,56 @@
+ # package (and in some cases the libraries it uses) at default optimizations
+ # before reporting errors to developers.
+ #
+-# Please refer to the GCC manual for a list of possible values.
++# -mcpu=<cpu-type> for PowerPC systems selects the type of processor you want
++# to optimize your code for.   Code generated under those options will run best
++# on that processor, and may not run at all on others.
++#
++# GCC 3.4 supports many powerpc processor types including: 401, 403, 405,
++# 405fp, 440, 440fp, 505, 601, 602, 603, 603e, 604, 604e, 620, 630, 740, 7400,
++# 7450, 750, 801, 821, 823, 860, 970, 8540, common, ec603e, G3, G4, G5, power,
++# power2, power3, power4, power5, powerpc, powerpc64, rios, rios1, rios2, rsc,
++# and rs64a
++#
++# Recommended settings for GCC 3.4 only :
++#
++# -maltivec enables optional altivec support and should be used
++# only for G4 processors,  on GCC 3.2 or newer.  It also requires that you have
++# the alitvec option compiled into your kernel to take full advantage of this
++# feature.  Note: you should also include -mabi=altivec flag if using this 
++# option.
++#
++# The newer gcc has a stricter aliasing ruleset that makes type punned 
++# expression faulty compiled if -fstrict-aliasing is enabled.
++# That option is implied by -O2 -Os and -O3. Make SURE you don't have that
++# option enabled by adding -fno-strict-aliasing to your CFLAGS and CXXFLAGS
++#
++# Long term testing has shown that -O3 opts can be unreliable on G4's but work
++# on G3 series processors or earlier.
++#
++# The following is the suggested CFLAGS for a generic G4 cpu
++#
++#CFLAGS="-O2 -pipe -mcpu=G4 -maltivec -mabi=altivec -fno-strict-aliasing"
+ #
+-#CFLAGS="-O2 -pipe"
+ #
++# All non G4 PPC boxen should choose this next option.  It will work fine for
++# all G3 and pre machines.  (note it will not hurt pre G3 machines either to 
++# use this mcpu option as it is the default for gcc 3.2.x anyway)
++#
++#CFLAGS="-O3 -pipe -mcpu=G3 -fno-strict-aliasing"
++
++# Recommended settings for GCC 2.95.3 only (Gentoo 1.2 or older):
++#
++# PowerPC 750 > up: this works on G3's and G4s, gcc 2.95.3 doesn't make the
++# distinction between G3 and G4, so this is fine for all NewWorld machines, if
++# you use yaboot to boot you should select this option
++#
++#CFLAGS="-O2 -pipe -mcpu=750 -mpowerpc-gfxopt -mmultiple -mstring"
++#
++# This will run on all other processors, by building more generic code This is
++# safe for all PPC machines running gcc 2.95.3, and works for all OldWorld
++# machines - if you use BootX to boot you should select this option
++#CFLAGS="-O2 -pipe -mmultiple -mstring"
++
+ # If you set a CFLAGS above, then this line will set your default C++ flags to
+ # the same settings.
+ #CXXFLAGS="${CFLAGS}"
+@@ -61,7 +114,10 @@
+ # DO NOT PUT ANYTHING BUT YOUR SPECIFIC ~ARCHITECTURE IN THE LIST.
+ # IF YOU ARE UNSURE OF YOUR ARCH, OR THE IMPLICATIONS, DO NOT MODIFY THIS.
+ #
+-#ACCEPT_KEYWORDS="~arch"
++# Note: this really shouldn't be enabled until _AFTER_ you bootstrap and emerge
++# system.  If you want the testing things update after these steps are completed.
++#
++#ACCEPT_KEYWORDS="~ppc"
+ 
+ # Portage Directories
+ # ===================
Index: /vendor/prefix-portage/current/cnf/make.conf.ppc64.diff
===================================================================
--- /vendor/prefix-portage/current/cnf/make.conf.ppc64.diff	(revision 3489)
+++ /vendor/prefix-portage/current/cnf/make.conf.ppc64.diff	(revision 3489)
@@ -0,0 +1,69 @@
+--- make.conf	2006-03-19 18:40:11.000000000 +0100
++++ make.conf.ppc64	2006-03-19 18:26:21.000000000 +0100
+@@ -23,6 +23,13 @@
+ # Example:
+ #USE="X gtk gnome -alsa"
+ 
++# Host Setting
++# ============
++#
++# All PowerPC64 systems should use this host setting:
++
++CHOST="powerpc64-unknown-linux-gnu"
++
+ # Host and optimization settings 
+ # ==============================
+ #
+@@ -33,9 +40,38 @@
+ # package (and in some cases the libraries it uses) at default optimizations
+ # before reporting errors to developers.
+ #
+-# Please refer to the GCC manual for a list of possible values.
++# -mtune=<cpu-type> for PowerPC64 systems instructs the gcc compiler that
++# it can use instruction scheduling specific for that type of processor
++# specified
++#
++# -mcpu=<cpu-type> for PowerPC64 systems selects the type of processor you want
++# to optimize your code for.   Code generated under those options will run best
++# on that processor.
++#
++# -mcpu=<cpu-type>  and -mtune=<cpu-type>  should both be specified
++#
++# GCC 3.x supports many ppc64 processor types including: power3, power4,
++# 970 (aka G5), and power5.
++#
++# RS64 processors should specify power3. 
++#
++# Additional options of interest:
++#
++# -maltivec enables optional altivec support and should be used
++# only for 970 processors.  It also requires that you have
++# the alitvec option compiled into your kernel to take full advantage of this
++# feature.  Note: you should also include -mabi=altivec flag if using this option.
+ #
+-#CFLAGS="-O2 -pipe"
++# -O3 for the most part seems ok but should be used with caution as
++# for instance app-editors/vim has problems if it is used. -O2 is a
++# good selection.
++#
++#Example CFLAGS setting
++#CFLAGS="-O2 -pipe -mcpu=970 -mtune=970 -maltivec -mabi=altivec"
++#
++#or
++#
++#CFLAGS="-O2 -pipe -mcpu=power3 -mtune=power3"
+ #
+ # If you set a CFLAGS above, then this line will set your default C++ flags to
+ # the same settings.
+@@ -61,7 +97,10 @@
+ # DO NOT PUT ANYTHING BUT YOUR SPECIFIC ~ARCHITECTURE IN THE LIST.
+ # IF YOU ARE UNSURE OF YOUR ARCH, OR THE IMPLICATIONS, DO NOT MODIFY THIS.
+ #
+-#ACCEPT_KEYWORDS="~arch"
++# Note: this really shouldn't be enabled until _AFTER_ you bootstrap and emerge
++# system.  If you want the testing things update after these steps are completed.
++#
++#ACCEPT_KEYWORDS="ppc64"
+ 
+ # Portage Directories
+ # ===================
Index: /vendor/prefix-portage/current/cnf/make.conf.s390.diff
===================================================================
--- /vendor/prefix-portage/current/cnf/make.conf.s390.diff	(revision 3489)
+++ /vendor/prefix-portage/current/cnf/make.conf.s390.diff	(revision 3489)
@@ -0,0 +1,40 @@
+--- make.conf	2006-03-19 18:40:11.000000000 +0100
++++ make.conf.s390	2006-03-19 18:26:21.000000000 +0100
+@@ -23,20 +23,18 @@
+ # Example:
+ #USE="X gtk gnome -alsa"
+ 
++# Host Setting
++# ============
++#
++# All s390 systems should use this host setting:
++
++CHOST="s390-ibm-linux-gnu"
++
+ # Host and optimization settings 
+ # ==============================
+ #
+-# For optimal performance, enable a CFLAGS setting appropriate for your CPU.
+-#
+-# Please note that if you experience strange issues with a package, it may be
+-# due to gcc's optimizations interacting in a strange way. Please test the
+-# package (and in some cases the libraries it uses) at default optimizations
+-# before reporting errors to developers.
+-#
+-# Please refer to the GCC manual for a list of possible values.
+-#
+ #CFLAGS="-O2 -pipe"
+-#
++
+ # If you set a CFLAGS above, then this line will set your default C++ flags to
+ # the same settings.
+ #CXXFLAGS="${CFLAGS}"
+@@ -61,7 +80,7 @@
+ # DO NOT PUT ANYTHING BUT YOUR SPECIFIC ~ARCHITECTURE IN THE LIST.
+ # IF YOU ARE UNSURE OF YOUR ARCH, OR THE IMPLICATIONS, DO NOT MODIFY THIS.
+ #
+-#ACCEPT_KEYWORDS="~arch"
++#ACCEPT_KEYWORDS="~s390"
+ 
+ # Portage Directories
+ # ===================
Index: /vendor/prefix-portage/current/cnf/make.conf.sh.diff
===================================================================
--- /vendor/prefix-portage/current/cnf/make.conf.sh.diff	(revision 3489)
+++ /vendor/prefix-portage/current/cnf/make.conf.sh.diff	(revision 3489)
@@ -0,0 +1,43 @@
+--- make.conf	2006-03-19 18:40:11.000000000 +0100
++++ make.conf.sh	2006-03-19 18:26:21.000000000 +0100
+@@ -23,6 +23,19 @@
+ # Example:
+ #USE="X gtk gnome -alsa"
+ 
++# Host Setting
++# ============
++#
++# DO NOT CHANGE THIS SETTING UNLESS YOU ARE USING STAGE1!
++# It's very important you select the right CHOST from the start.  A wrong
++# CHOST could easily lead to weird errors either in compiling or running.
++#
++# There are really only two choices right now:
++#   sh3-unknown-linux-gnu
++#   sh4-unknown-linux-gnu    (Dreamcast / LANTank)
++#
++CHOST="sh4-unknown-linux-gnu"
++
+ # Host and optimization settings 
+ # ==============================
+ #
+@@ -33,10 +46,17 @@
+ # package (and in some cases the libraries it uses) at default optimizations
+ # before reporting errors to developers.
+ #
+-# Please refer to the GCC manual for a list of possible values.
+-#
+-#CFLAGS="-O2 -pipe"
++# -m# optimize code for the particular type of CPU.  The number should match
++# your CHOST so if you are using "sh4-unknown-linux-gnu", you should have
++# -m4 below.
+ #
++# Don't use -O3.  Even -O2 may be risky in some cases.
++#
++# For a full listing of supported CPU models, please refer to the GCC website:
++# http://gcc.gnu.org/onlinedocs/gcc-3.3/gcc/SH-Options.html
++#
++#CFLAGS="-m4 -O2 -pipe"
++
+ # If you set a CFLAGS above, then this line will set your default C++ flags to
+ # the same settings.
+ #CXXFLAGS="${CFLAGS}"
Index: /vendor/prefix-portage/current/cnf/make.conf.sparc-fbsd.diff
===================================================================
--- /vendor/prefix-portage/current/cnf/make.conf.sparc-fbsd.diff	(revision 3489)
+++ /vendor/prefix-portage/current/cnf/make.conf.sparc-fbsd.diff	(revision 3489)
@@ -0,0 +1,35 @@
+--- make.conf	2006-10-16 17:06:32 +0100
++++ make.conf.sparc-fbsd	2006-10-16 17:09:22 +0100
+@@ -23,6 +23,13 @@
+ # Example:
+ #USE="X gtk gnome -alsa"
+ 
++# Host Setting
++# ============
++#
++# The version number at the end has to correspond to the version of the
++# profile and of freebsd-lib package.
++CHOST="sparc64-gentoo-freebsd6.2"
++
+ # Host and optimization settings 
+ # ==============================
+ #
+@@ -61,7 +68,7 @@
+ # DO NOT PUT ANYTHING BUT YOUR SPECIFIC ~ARCHITECTURE IN THE LIST.
+ # IF YOU ARE UNSURE OF YOUR ARCH, OR THE IMPLICATIONS, DO NOT MODIFY THIS.
+ #
+-#ACCEPT_KEYWORDS="~arch"
++ACCEPT_KEYWORDS="~sparc-fbsd"
+ 
+ # Portage Directories
+ # ===================
+@@ -287,7 +294,8 @@
+ #  'notitles'    disables xterm titlebar updates (which contain status info). 
+ #  'parallel-fetch'
+ #                do fetching in parallel to compilation
+-#  'sandbox'     enables sandboxing when running emerge and ebuild.
++#  'sandbox'     enables sandboxing when running emerge and ebuild. Doesn't
++#                work on *BSD-based systems.
+ #  'strict'      causes portage to react strongly to conditions that are
+ #                potentially dangerous, like missing/incorrect Manifest files.
+ #  'userfetch'   when portage is run as root, drop privileges to
Index: /vendor/prefix-portage/current/cnf/make.conf.sparc.diff
===================================================================
--- /vendor/prefix-portage/current/cnf/make.conf.sparc.diff	(revision 3489)
+++ /vendor/prefix-portage/current/cnf/make.conf.sparc.diff	(revision 3489)
@@ -0,0 +1,66 @@
+--- make.conf	2006-03-19 18:40:11.000000000 +0100
++++ make.conf.sparc	2006-03-19 18:26:21.000000000 +0100
+@@ -23,6 +23,15 @@
+ # Example:
+ #USE="X gtk gnome -alsa"
+ 
++# Host Setting
++# ============
++# This should be left to the default value of sparc-unknown-linux-gnu unless
++# you are absolutely certain of the consequences.  In addition to potentially
++# destroying your system, you will recieve no support and your bugs will be 
++# marked INVALID if you change this.
++#
++# CHOST="sparc-unknown-linux-gnu"
++
+ # Host and optimization settings 
+ # ==============================
+ #
+@@ -33,10 +42,34 @@
+ # package (and in some cases the libraries it uses) at default optimizations
+ # before reporting errors to developers.
+ #
+-# Please refer to the GCC manual for a list of possible values.
+-#
+-#CFLAGS="-O2 -pipe"
+-#
++# Sparc specific cpu optimizatiobn flags can be found here:
++# http://gcc.gnu.org/onlinedocs/gcc-3.3/gcc/SPARC-Options.html#SPARC%20Options
++# 
++# -mcpu=<cpu-type> means optimize code for the particular type of CPU without
++# breaking compatibility with other CPUs.
++#
++# -mtune=<cpu-type> set the instruction scheduling parameters for machine, but
++# do not set the instruction set or register set.
++#
++# Here is a list of each supported architecture and their supported
++# implementations:
++#
++# gcc-3.2 and higher:
++#    v7:             cypress
++#    v8:             supersparc, hypersparc
++#    sparclite:      f930, f934, sparclite86x
++#    sparclet:       tsc701
++#    v9:             ultrasparc
++#
++# Additionally in gcc-3.3 and higher:
++#    v9:             ultrasparc3
++#
++# Decent examples:
++#
++#CFLAGS="-mcpu=supersparc -O3 -pipe"
++#CFLAGS="-mcpu=ultrasparc -O3 -pipe"
++#CFLAGS="-mcpu=v8 -mtune=v9 -O2 -pipe"
++
+ # If you set a CFLAGS above, then this line will set your default C++ flags to
+ # the same settings.
+ #CXXFLAGS="${CFLAGS}"
+@@ -61,7 +94,7 @@
+ # DO NOT PUT ANYTHING BUT YOUR SPECIFIC ~ARCHITECTURE IN THE LIST.
+ # IF YOU ARE UNSURE OF YOUR ARCH, OR THE IMPLICATIONS, DO NOT MODIFY THIS.
+ #
+-#ACCEPT_KEYWORDS="~arch"
++#ACCEPT_KEYWORDS="~sparc"
+ 
+ # Portage Directories
+ # ===================
Index: /vendor/prefix-portage/current/cnf/make.conf.x86-fbsd.diff
===================================================================
--- /vendor/prefix-portage/current/cnf/make.conf.x86-fbsd.diff	(revision 3489)
+++ /vendor/prefix-portage/current/cnf/make.conf.x86-fbsd.diff	(revision 3489)
@@ -0,0 +1,74 @@
+--- make.conf	2006-03-19 18:40:11.000000000 +0100
++++ make.conf.x86-fbsd	2006-03-19 18:26:21.000000000 +0100
+@@ -23,6 +23,16 @@
+ # Example:
+ #USE="X gtk gnome -alsa"
+ 
++# Host Setting
++# ============
++#
++# Change this line as appropriate (i686, i586, i486 or i386).
++# All modern systems (even Athlons) should use "i686-pc-linux-gnu".
++# All K6's are i586.
++# The version number at the end has to correspond to the version of the
++# profile and of freebsd-lib package.
++CHOST="i686-gentoo-freebsd6.1"
++
+ # Host and optimization settings 
+ # ==============================
+ #
+@@ -33,10 +42,34 @@
+ # package (and in some cases the libraries it uses) at default optimizations
+ # before reporting errors to developers.
+ #
+-# Please refer to the GCC manual for a list of possible values.
++# -mtune=<cpu-type> means optimize code for the particular type of CPU without
++# breaking compatibility with other CPUs.
++#
++# -march=<cpu-type> means to take full advantage of the ABI and instructions
++# for the particular CPU; this will break compatibility with older CPUs (for
++# example, -march=athlon-xp code will not run on a regular Athlon, and
++# -march=i686 code will not run on a Pentium Classic.
++#
++# CPU types supported in gcc-3.2 and higher: athlon-xp, athlon-mp,
++# athlon-tbird, athlon, k6, k6-2, k6-3, i386, i486, i586 (Pentium), i686
++# (PentiumPro), pentium, pentium-mmx, pentiumpro, pentium2 (Celeron),
++# pentium3, and pentium4.
++#
++# Note that Gentoo Linux 1.4 and higher include at least gcc-3.2.
++# 
++# CPU types supported in gcc-2.95*: k6, i386, i486, i586 (Pentium), i686
++# (Pentium Pro), pentium, pentiumpro Gentoo Linux 1.2 and below use gcc-2.95*
++#
++# CRITICAL WARNINGS: ****************************************************** #
++# K6 markings are deceptive. Avoid setting -march for them. See Bug #24379. #
++# Pentium-M CPU's should not enable sse2 until at least gcc-3.4. Bug 50616. #
++# ************************************************************************* #
+ #
+-#CFLAGS="-O2 -pipe"
++# Decent examples:
+ #
++#CFLAGS="-mtune=athlon-xp -O3 -pipe"
++#CFLAGS="-march=pentium3 -O3 -pipe"
++
+ # If you set a CFLAGS above, then this line will set your default C++ flags to
+ # the same settings.
+ #CXXFLAGS="${CFLAGS}"
+@@ -61,7 +80,7 @@
+ # DO NOT PUT ANYTHING BUT YOUR SPECIFIC ~ARCHITECTURE IN THE LIST.
+ # IF YOU ARE UNSURE OF YOUR ARCH, OR THE IMPLICATIONS, DO NOT MODIFY THIS.
+ #
+-#ACCEPT_KEYWORDS="~arch"
++ACCEPT_KEYWORDS="~x86-fbsd"
+ 
+ # Portage Directories
+ # ===================
+@@ -268,7 +289,8 @@
+ #  'notitles'    disables xterm titlebar updates (which contain status info). 
+ #  'parallel-fetch'
+ #                do fetching in parallel to compilation
+-#  'sandbox'     enables sandboxing when running emerge and ebuild.
++#  'sandbox'     enables sandboxing when running emerge and ebuild. Doesn't 
++#                work on *BSD-based systems.
+ #  'strict'      causes portage to react strongly to conditions that are
+ #                potentially dangerous, like missing/incorrect Manifest files.
Index: /vendor/prefix-portage/current/cnf/make.conf.x86.diff
===================================================================
--- /vendor/prefix-portage/current/cnf/make.conf.x86.diff	(revision 3489)
+++ /vendor/prefix-portage/current/cnf/make.conf.x86.diff	(revision 3489)
@@ -0,0 +1,96 @@
+--- make.conf	2007-01-10 03:22:07.410548112 +0100
++++ make.conf.x86	2007-01-10 03:22:13.206910362 +0100
+@@ -23,6 +23,15 @@
+ # Example:
+ #USE="X gtk gnome -alsa"
+ 
++# Host Setting
++# ============
++#
++# DO NOT CHANGE THIS SETTING UNLESS YOU ARE USING STAGE1!
++# Change this line as appropriate (i686, i586, i486 or i386).
++# All modern systems (even Athlons) should use "i686-pc-linux-gnu".
++# All K6's are i586.
++CHOST="i686-pc-linux-gnu"
++
+ # Host and optimization settings 
+ # ==============================
+ #
+@@ -33,10 +42,65 @@
+ # package (and in some cases the libraries it uses) at default optimizations
+ # before reporting errors to developers.
+ #
+-# Please refer to the GCC manual for a list of possible values.
+-#
+-#CFLAGS="-O2 -pipe"
++# -mcpu=<cpu-type> means optimize code for the particular type of CPU without
++# breaking compatibility with other CPUs.
+ #
++# -march=<cpu-type> means to take full advantage of the ABI and instructions
++# for the particular CPU; this will break compatibility with older CPUs (for
++# example, -march=athlon-xp code will not run on a regular Athlon, and
++# -march=i686 code will not run on a Pentium Classic.
++#
++# CPU types supported by gcc version:
++# (Higher versions include the targets from older ones,
++# those listed on the same line are equivalent.)
++# === >=gcc-2.95
++# i386			Original Intel's i386.
++# i486			Intel's i486. (No scheduling implemented.)
++# i586, pentium	Intel Pentium with no MMX support.
++# pentium-mmx	Intel PentiumMMX based on Pentium core with MMX.
++# i686, pentiumpro	Intel PentiumPro.
++# === >=gcc-3.2
++# k6			AMD K6 with MMX.
++# k6-2, k6-3	AMD K6 with MMX and 3dNOW!.
++# pentium2		Intel Pentium2 based on PentiumPro with MMX.
++# pentium3		Intel Pentium3 based on PentiumPro with MMX and SSE.
++# pentium4		Intel Pentium4 with MMX, SSE and SSE2.
++# athlon, athlon-tbird	AMD Athlon with MMX, 3dNOW!, enhanced 3dNOW!
++#				and SSE prefetch.
++# athlon-4, athlon-xp, athlon-mp	AMD Athlon with MMX, 3dNOW!, enhanced
++#				3dNOW! and full SSE.
++# === >=gcc-3.3
++# winchip-c6	IDT Winchip C6, i486 with MMX.
++# winchip2		IDT Winchip2, i486 MMX and 3dNOW!.
++# c3			Via C3 with MMX and 3dNOW! (No scheduling implemented.)
++# === >=gcc-4.1
++# c3-2			Via C3-2 with MMX and SSE. (No scheduling implemented.)
++# pentium-m		Low power version of Intel Pentium3 with MMX, SSE, SSE2.
++#				Used by Centrino notebooks.
++# prescott		Intel Pentium4 with MMX, SSE, SSE2 and SSE3.
++# nocona		Intel Pentium4 with 64-bit extensions, MMX, SSE, SSE2
++#				and SSE3.
++# k8, opteron, athlon64, athlon-fx	AMD K8 core based CPUs with x86-64.
++#				(This supersets MMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW! and
++#				64-bit extensions.)
++#
++# Gentoo Linux 1.2 and below used gcc-2.95*
++# Gentoo Linux 1.4 and 2004.* had gcc-3.2
++# Gentoo Linux 2005.1 through 2006.0 use gcc-3.3
++# Gentoo Linux 2006.1 has gcc-4.1
++# 
++#
++# CRITICAL WARNINGS: ****************************************************** #
++# K6 markings are deceptive. Avoid setting -march for them. See Bug #24379. #
++# Pentium-M CPU's should not enable sse2 until at least gcc-3.4. Bug 50616. #
++# ************************************************************************* #
++#
++# NOTE: the -On optimization levels are set with the letter O, not -0 (zero).
++#
++# Decent examples:
++#CFLAGS="-mcpu=athlon-xp -O3 -pipe"
++#CFLAGS="-march=pentium3 -O3 -pipe"
++
+ # If you set a CFLAGS above, then this line will set your default C++ flags to
+ # the same settings.
+ #CXXFLAGS="${CFLAGS}"
+@@ -61,7 +125,7 @@
+ # DO NOT PUT ANYTHING BUT YOUR SPECIFIC ~ARCHITECTURE IN THE LIST.
+ # IF YOU ARE UNSURE OF YOUR ARCH, OR THE IMPLICATIONS, DO NOT MODIFY THIS.
+ #
+-#ACCEPT_KEYWORDS="~arch"
++#ACCEPT_KEYWORDS="~x86"
+ 
+ # Portage Directories
+ # ===================
Index: /vendor/prefix-portage/current/cnf/make.globals
===================================================================
--- /vendor/prefix-portage/current/cnf/make.globals	(revision 3489)
+++ /vendor/prefix-portage/current/cnf/make.globals	(revision 3489)
@@ -0,0 +1,95 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/cnf/make.globals,v 1.56.2.5 2005/05/05 03:59:59 jstubbs Exp $
+# System-wide defaults for the Portage system
+
+#            *****************************
+#            **  DO NOT EDIT THIS FILE  **
+# ***************************************************
+# **** CHANGES TO make.conf *OVERRIDE* THIS FILE ****
+# ***************************************************
+# ** Incremental Variables Accumulate Across Files **
+# **  USE, CONFIG_*, and FEATURES are incremental  **
+# ***************************************************
+
+
+# Default rsync mirror
+SYNC="rsync://rsync.gentoo.org/gentoo-portage"
+
+# Default distfiles mirrors
+GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
+
+# Repository Paths
+PORTDIR=@DOMAIN_PREFIX@/usr/portage
+DISTDIR=@DOMAIN_PREFIX@/usr/portage/distfiles
+PKGDIR=@DOMAIN_PREFIX@/usr/portage/packages
+RPMDIR=@DOMAIN_PREFIX@/usr/portage/rpm
+
+# Temporary build directory
+PORTAGE_TMPDIR=@DOMAIN_PREFIX@/var/tmp
+
+# Fetching command (5 tries, passive ftp for firewall compatibility)
+FETCHCOMMAND="wget -t 5 -T 60 --passive-ftp -O \${DISTDIR}/\${FILE} \${URI}"
+RESUMECOMMAND="wget -c -t 5 -T 60 --passive-ftp -O \${DISTDIR}/\${FILE} \${URI}"
+
+# Default user options
+FEATURES="sandbox distlocks metadata-transfer"
+
+# Default chunksize for binhost comms
+PORTAGE_BINHOST_CHUNKSIZE="3000"
+
+# By default wait 5 secs before cleaning a package
+CLEAN_DELAY="5"
+
+# By default wait 10 secs on an important warning
+EMERGE_WARNING_DELAY="10"
+
+# Automatically clean installed packages after they are updated.
+# This option will be removed and forced to yes.
+AUTOCLEAN="yes"
+
+# Number of times 'emerge --sync' will run before giving up.
+PORTAGE_RSYNC_RETRIES="3"
+
+# Number of seconds rsync will wait before timing out.
+#RSYNC_TIMEOUT="180"
+
+PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
+
+# Minimal CONFIG_PROTECT
+CONFIG_PROTECT="/etc"
+
+# Disable auto-use
+USE_ORDER="env:pkg:conf:defaults:pkginternal"
+
+# Default portage user/group
+PORTAGE_USER="@portageuser@"
+PORTAGE_GROUP="@portagegroup@"
+
+# Default ownership of installed files.
+PORTAGE_INST_UID="@rootuid@"
+PORTAGE_INST_USER="@rootuser@"
+PORTAGE_INST_GID="@wheelgid@"
+
+# Default PATH for ebuild env
+DEFAULT_PATH="@DEFAULT_PATH@"
+
+# Mode bits for ${WORKDIR} (see ebuild.5).
+PORTAGE_WORKDIR_MODE="0700"
+
+# Some defaults for elog
+PORTAGE_ELOG_CLASSES="log warn error"
+PORTAGE_ELOG_SYSTEM="save_summary echo"
+
+PORTAGE_ELOG_MAILURI="@rootuser@"
+PORTAGE_ELOG_MAILSUBJECT="[portage] ebuild log for \${PACKAGE} on \${HOST}"
+PORTAGE_ELOG_MAILFROM="portage"
+
+#            *****************************
+#            **  DO NOT EDIT THIS FILE  **
+# ***************************************************
+# **** CHANGES TO make.conf *OVERRIDE* THIS FILE ****
+# ***************************************************
+# ** Incremental Variables Accumulate Across Files **
+# **  USE, CONFIG_*, and FEATURES are incremental  **
+# ***************************************************
Index: /vendor/prefix-portage/current/commit
===================================================================
--- /vendor/prefix-portage/current/commit	(revision 3489)
+++ /vendor/prefix-portage/current/commit	(revision 3489)
@@ -0,0 +1,73 @@
+   Merged from trunk 6765:6802
+
+   +------------------------------------------------------------------------+
+   | 6766    | For bug #181104, make econf give an appropriate error        |
+   | zmedico | message when configure is not executable.                    |
+   |---------+--------------------------------------------------------------|
+   | 6768    | For bug #139383, in xtermTitleReset() use os.system()        |
+   | zmedico | instead of commands.getoutput() since the latter puts too    |
+   |         | much restriction on what $PROMPT_COMMAND may contain.        |
+   |---------+--------------------------------------------------------------|
+   | 6770    | For bug #152828, run ${CHOST}-ldconfig when ${CBUILD} !=     |
+   | zmedico | ${CHOST}.                                                    |
+   |---------+--------------------------------------------------------------|
+   | 6772    | Only execute $PROMPT_COMMAND when appropriate.               |
+   | zmedico |                                                              |
+   |---------+--------------------------------------------------------------|
+   | 6775    | Skip bogus '$ECLASS inherited illegally' messages when       |
+   | zmedico | installing from a binary package.                            |
+   |---------+--------------------------------------------------------------|
+   | 6778    | For bug #181387, fix an UnboundLocalError for the mymtime    |
+   | zmedico | variable that is triggered by confmem.                       |
+   |---------+--------------------------------------------------------------|
+   | 6780    | For bug #148702, automatically enable flags from IUSE if     |
+   | zmedico | they correspond to unset USE_EXPAND variables such as        |
+   |         | LINGUAS. The variable only has to be set to some value or an |
+   |         | empty string in order to disable these flags.                |
+   |---------+--------------------------------------------------------------|
+   | 6782    | When an update is discarded due to confmem, record it's      |
+   | zmedico | mtime in the contents (it's md5 is already recorded there    |
+   |         | too).                                                        |
+   |---------+--------------------------------------------------------------|
+   | 6784    | For bug #148702, use the * token to trigger wildcard         |
+   | zmedico | expansion of IUSE. This adds flexibility and prevents flags  |
+   |         | from being enabled unexpectedly.                             |
+   |---------+--------------------------------------------------------------|
+   | 6786    | Preserve order of flags from IUSE in wildcard expansion.     |
+   | zmedico |                                                              |
+   |---------+--------------------------------------------------------------|
+   | 6788    | Make repoman work with both + and - flags in IUSE.           |
+   | zmedico |                                                              |
+   |---------+--------------------------------------------------------------|
+   | 6790    | For bug #181551, support slot deps in package.keywords.      |
+   | zmedico |                                                              |
+   |---------+--------------------------------------------------------------|
+   | 6792    | For bug #81097, detect and report suspicious hardlinks to    |
+   | zmedico | suid/sgid files. False positives are prevented by doing      |
+   |         | reference counts for each inode having suid/sgid bits and    |
+   |         | multiple hardlinks. The security check is done prior to each |
+   |         | merge or unmerge phase and it will cause the phase to abort  |
+   |         | if a problem is found (so that the user can investigate      |
+   |         | before any files are removed).                               |
+   |---------+--------------------------------------------------------------|
+   | 6793    | Don't bother to warn about hardlinks to suid/sgid files      |
+   | zmedico | before unlink since it can give false positives and the      |
+   |         | existing suid/sgid security check should spot problems       |
+   |         | before this anyway.                                          |
+   |---------+--------------------------------------------------------------|
+   | 6794    | Fix the suid/sgid check so it only looks at regular files    |
+   | zmedico | since it can generate false positives otherwise.             |
+   |---------+--------------------------------------------------------------|
+   | 6796    | For bug #181355, detect parenthesis mismatch in              |
+   | zmedico | paren_reduce(), raise an InvalidDependString exception, and  |
+   |         | make sure that all callers handle the exception properly.    |
+   |---------+--------------------------------------------------------------|
+   | 6797    | Remove the "missing left parenthesis" test for now since it  |
+   | zmedico | gives false positives.                                       |
+   |---------+--------------------------------------------------------------|
+   | 6799    | For consistency with other xterm titles code, redirect       |
+   | zmedico | $PROMPT_COMMAND output to stderr.                            |
+   |---------+--------------------------------------------------------------|
+   | 6802    | Bump 2.1.3 to 2.2 for some features and add news about       |
+   | zmedico | USE_EXPAND wildcards.                                        |
+   +------------------------------------------------------------------------+
Index: /vendor/prefix-portage/current/config.guess
===================================================================
--- /vendor/prefix-portage/current/config.guess	(revision 3489)
+++ /vendor/prefix-portage/current/config.guess	(revision 3489)
@@ -0,0 +1,1532 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+#   Inc.
+
+timestamp='2007-01-15'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+	for c in cc gcc c89 c99 ; do
+	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+	     CC_FOR_BUILD="$c"; break ;
+	  fi ;
+	done ;
+	if test x"$CC_FOR_BUILD" = x ; then
+	  CC_FOR_BUILD=no_compiler_found ;
+	fi
+	;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+	PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+if [ "${UNAME_SYSTEM}" = "Linux" ] ; then
+	eval $set_cc_for_build
+	cat << EOF > $dummy.c
+	#include <features.h>
+	#ifdef __UCLIBC__
+	# ifdef __UCLIBC_CONFIG_VERSION__
+	LIBC=uclibc __UCLIBC_CONFIG_VERSION__
+	# else
+	LIBC=uclibc
+	# endif
+	#else
+	LIBC=gnu
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep LIBC= | sed -e 's: ::g'`
+fi
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+	# NetBSD (nbsd) targets should (where applicable) match one or
+	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+	# switched to ELF, *-*-netbsd* would select the old
+	# object file format.  This provides both forward
+	# compatibility and a consistent mechanism for selecting the
+	# object file format.
+	#
+	# Note: NetBSD doesn't particularly care about the vendor
+	# portion of the name.  We always set it to "unknown".
+	sysctl="sysctl -n hw.machine_arch"
+	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	case "${UNAME_MACHINE_ARCH}" in
+	    armeb) machine=armeb-unknown ;;
+	    arm*) machine=arm-unknown ;;
+	    sh3el) machine=shl-unknown ;;
+	    sh3eb) machine=sh-unknown ;;
+	    sh5el) machine=sh5le-unknown ;;
+	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+	esac
+	# The Operating System including object format, if it has switched
+	# to ELF recently, or will in the future.
+	case "${UNAME_MACHINE_ARCH}" in
+	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+		eval $set_cc_for_build
+		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+			| grep __ELF__ >/dev/null
+		then
+		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+		    # Return netbsd for either.  FIX?
+		    os=netbsd
+		else
+		    os=netbsdelf
+		fi
+		;;
+	    *)
+	        os=netbsd
+		;;
+	esac
+	# The OS release
+	# Debian GNU/NetBSD machines have a different userland, and
+	# thus, need a distinct triplet. However, they do not need
+	# kernel version information, so it can be replaced with a
+	# suitable tag, in the style of linux-gnu.
+	case "${UNAME_VERSION}" in
+	    Debian*)
+		release='-gnu'
+		;;
+	    *)
+		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		;;
+	esac
+	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+	# contains redundant information, the shorter form:
+	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+	echo "${machine}-${os}${release}"
+	exit ;;
+    *:OpenBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+	exit ;;
+    *:ekkoBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+	exit ;;
+    *:SolidBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+	exit ;;
+    macppc:MirBSD:*:*)
+	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    *:MirBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    alpha:OSF1:*:*)
+	case $UNAME_RELEASE in
+	*4.0)
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+		;;
+	*5.*)
+	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+		;;
+	esac
+	# According to Compaq, /usr/sbin/psrinfo has been available on
+	# OSF/1 and Tru64 systems produced since 1995.  I hope that
+	# covers most systems running today.  This code pipes the CPU
+	# types through head -n 1, so we only detect the type of CPU 0.
+	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+	case "$ALPHA_CPU_TYPE" in
+	    "EV4 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV4.5 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "LCA4 (21066/21068)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV5 (21164)")
+		UNAME_MACHINE="alphaev5" ;;
+	    "EV5.6 (21164A)")
+		UNAME_MACHINE="alphaev56" ;;
+	    "EV5.6 (21164PC)")
+		UNAME_MACHINE="alphapca56" ;;
+	    "EV5.7 (21164PC)")
+		UNAME_MACHINE="alphapca57" ;;
+	    "EV6 (21264)")
+		UNAME_MACHINE="alphaev6" ;;
+	    "EV6.7 (21264A)")
+		UNAME_MACHINE="alphaev67" ;;
+	    "EV6.8CB (21264C)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8AL (21264B)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8CX (21264D)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.9A (21264/EV69A)")
+		UNAME_MACHINE="alphaev69" ;;
+	    "EV7 (21364)")
+		UNAME_MACHINE="alphaev7" ;;
+	    "EV7.9 (21364A)")
+		UNAME_MACHINE="alphaev79" ;;
+	esac
+	# A Pn.n version is a patched version.
+	# A Vn.n version is a released version.
+	# A Tn.n version is a released field test version.
+	# A Xn.n version is an unreleased experimental baselevel.
+	# 1.2 uses "1.2" for uname -r.
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	exit ;;
+    Alpha\ *:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# Should we change UNAME_MACHINE based on the output of uname instead
+	# of the specific Alpha model?
+	echo alpha-pc-interix
+	exit ;;
+    21064:Windows_NT:50:3)
+	echo alpha-dec-winnt3.5
+	exit ;;
+    Amiga*:UNIX_System_V:4.0:*)
+	echo m68k-unknown-sysv4
+	exit ;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-amigaos
+	exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-morphos
+	exit ;;
+    *:OS/390:*:*)
+	echo i370-ibm-openedition
+	exit ;;
+    *:z/VM:*:*)
+	echo s390-ibm-zvmoe
+	exit ;;
+    *:OS400:*:*)
+        echo powerpc-ibm-os400
+	exit ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+	echo arm-acorn-riscix${UNAME_RELEASE}
+	exit ;;
+    arm:riscos:*:*|arm:RISCOS:*:*)
+	echo arm-unknown-riscos
+	exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+	echo hppa1.1-hitachi-hiuxmpp
+	exit ;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+	if test "`(/bin/universe) 2>/dev/null`" = att ; then
+		echo pyramid-pyramid-sysv3
+	else
+		echo pyramid-pyramid-bsd
+	fi
+	exit ;;
+    NILE*:*:*:dcosx)
+	echo pyramid-pyramid-svr4
+	exit ;;
+    DRS?6000:unix:4.0:6*)
+	echo sparc-icl-nx6
+	exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+	case `/usr/bin/uname -p` in
+	    sparc) echo sparc-icl-nx7; exit ;;
+	esac ;;
+    sun4H:SunOS:5.*:*)
+	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    i86pc:SunOS:5.*:*)
+	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:6*:*)
+	# According to config.sub, this is the proper way to canonicalize
+	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+	# it's likely to be more like Solaris than SunOS4.
+	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:*:*)
+	case "`/usr/bin/arch -k`" in
+	    Series*|S4*)
+		UNAME_RELEASE=`uname -v`
+		;;
+	esac
+	# Japanese Language versions have a version number like `4.1.3-JL'.
+	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+	exit ;;
+    sun3*:SunOS:*:*)
+	echo m68k-sun-sunos${UNAME_RELEASE}
+	exit ;;
+    sun*:*:4.2BSD:*)
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+	case "`/bin/arch`" in
+	    sun3)
+		echo m68k-sun-sunos${UNAME_RELEASE}
+		;;
+	    sun4)
+		echo sparc-sun-sunos${UNAME_RELEASE}
+		;;
+	esac
+	exit ;;
+    aushp:SunOS:*:*)
+	echo sparc-auspex-sunos${UNAME_RELEASE}
+	exit ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+        exit ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit ;;
+    m68k:machten:*:*)
+	echo m68k-apple-machten${UNAME_RELEASE}
+	exit ;;
+    powerpc:machten:*:*)
+	echo powerpc-apple-machten${UNAME_RELEASE}
+	exit ;;
+    RISC*:Mach:*:*)
+	echo mips-dec-mach_bsd4.3
+	exit ;;
+    RISC*:ULTRIX:*:*)
+	echo mips-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    VAX*:ULTRIX*:*:*)
+	echo vax-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+	echo clipper-intergraph-clix${UNAME_RELEASE}
+	exit ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
+	#if defined (host_mips) && defined (MIPSEB)
+	#if defined (SYSTYPE_SYSV)
+	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_SVR4)
+	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+	#endif
+	#endif
+	  exit (-1);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c &&
+	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+	  SYSTEM_NAME=`$dummy $dummyarg` &&
+	    { echo "$SYSTEM_NAME"; exit; }
+	echo mips-mips-riscos${UNAME_RELEASE}
+	exit ;;
+    Motorola:PowerMAX_OS:*:*)
+	echo powerpc-motorola-powermax
+	exit ;;
+    Motorola:*:4.3:PL8-*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:Power_UNIX:*:*)
+	echo powerpc-harris-powerunix
+	exit ;;
+    m88k:CX/UX:7*:*)
+	echo m88k-harris-cxux7
+	exit ;;
+    m88k:*:4*:R4*)
+	echo m88k-motorola-sysv4
+	exit ;;
+    m88k:*:3*:R3*)
+	echo m88k-motorola-sysv3
+	exit ;;
+    AViiON:dgux:*:*)
+        # DG/UX returns AViiON for all architectures
+        UNAME_PROCESSOR=`/usr/bin/uname -p`
+	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+	then
+	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    then
+		echo m88k-dg-dgux${UNAME_RELEASE}
+	    else
+		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+	    fi
+	else
+	    echo i586-dg-dgux${UNAME_RELEASE}
+	fi
+ 	exit ;;
+    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
+	echo m88k-dolphin-sysv3
+	exit ;;
+    M88*:*:R3*:*)
+	# Delta 88k system running SVR3
+	echo m88k-motorola-sysv3
+	exit ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+	echo m88k-tektronix-sysv3
+	exit ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+	echo m68k-tektronix-bsd
+	exit ;;
+    *:IRIX*:*:*)
+	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+	exit ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
+	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+	echo i386-ibm-aix
+	exit ;;
+    ia64:AIX:*:*)
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:2:3)
+	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+		eval $set_cc_for_build
+		sed 's/^		//' << EOF >$dummy.c
+		#include <sys/systemcfg.h>
+
+		main()
+			{
+			if (!__power_pc())
+				exit(1);
+			puts("powerpc-ibm-aix3.2.5");
+			exit(0);
+			}
+EOF
+		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+		then
+			echo "$SYSTEM_NAME"
+		else
+			echo rs6000-ibm-aix3.2.5
+		fi
+	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+		echo rs6000-ibm-aix3.2.4
+	else
+		echo rs6000-ibm-aix3.2
+	fi
+	exit ;;
+    *:AIX:*:[45])
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+		IBM_ARCH=rs6000
+	else
+		IBM_ARCH=powerpc
+	fi
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:*:*)
+	echo rs6000-ibm-aix
+	exit ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+	echo romp-ibm-bsd4.4
+	exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+	exit ;;                             # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+	echo rs6000-bull-bosx
+	exit ;;
+    DPX/2?00:B.O.S.:*:*)
+	echo m68k-bull-sysv3
+	exit ;;
+    9000/[34]??:4.3bsd:1.*:*)
+	echo m68k-hp-bsd
+	exit ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+	echo m68k-hp-bsd4.4
+	exit ;;
+    9000/[34678]??:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	case "${UNAME_MACHINE}" in
+	    9000/31? )            HP_ARCH=m68000 ;;
+	    9000/[34]?? )         HP_ARCH=m68k ;;
+	    9000/[678][0-9][0-9])
+		if [ -x /usr/bin/getconf ]; then
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                        esac ;;
+                    esac
+		fi
+		if [ "${HP_ARCH}" = "" ]; then
+		    eval $set_cc_for_build
+		    sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
+              #include <stdlib.h>
+              #include <unistd.h>
+
+              int main ()
+              {
+              #if defined(_SC_KERNEL_BITS)
+                  long bits = sysconf(_SC_KERNEL_BITS);
+              #endif
+                  long cpu  = sysconf (_SC_CPU_VERSION);
+
+                  switch (cpu)
+              	{
+              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+              	case CPU_PA_RISC2_0:
+              #if defined(_SC_KERNEL_BITS)
+              	    switch (bits)
+              		{
+              		case 64: puts ("hppa2.0w"); break;
+              		case 32: puts ("hppa2.0n"); break;
+              		default: puts ("hppa2.0"); break;
+              		} break;
+              #else  /* !defined(_SC_KERNEL_BITS) */
+              	    puts ("hppa2.0"); break;
+              #endif
+              	default: puts ("hppa1.0"); break;
+              	}
+                  exit (0);
+              }
+EOF
+		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    test -z "$HP_ARCH" && HP_ARCH=hppa
+		fi ;;
+	esac
+	if [ ${HP_ARCH} = "hppa2.0w" ]
+	then
+	    eval $set_cc_for_build
+
+	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+	    # generating 64-bit code.  GNU and HP use different nomenclature:
+	    #
+	    # $ CC_FOR_BUILD=cc ./config.guess
+	    # => hppa2.0w-hp-hpux11.23
+	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+	    # => hppa64-hp-hpux11.23
+
+	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+		grep __LP64__ >/dev/null
+	    then
+		HP_ARCH="hppa2.0w"
+	    else
+		HP_ARCH="hppa64"
+	    fi
+	fi
+	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	exit ;;
+    ia64:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	echo ia64-hp-hpux${HPUX_REV}
+	exit ;;
+    3050*:HI-UX:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <unistd.h>
+	int
+	main ()
+	{
+	  long cpu = sysconf (_SC_CPU_VERSION);
+	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+	     results, however.  */
+	  if (CPU_IS_PA_RISC (cpu))
+	    {
+	      switch (cpu)
+		{
+		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+		  default: puts ("hppa-hitachi-hiuxwe2"); break;
+		}
+	    }
+	  else if (CPU_IS_HP_MC68K (cpu))
+	    puts ("m68k-hitachi-hiuxwe2");
+	  else puts ("unknown-hitachi-hiuxwe2");
+	  exit (0);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+		{ echo "$SYSTEM_NAME"; exit; }
+	echo unknown-hitachi-hiuxwe2
+	exit ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+	echo hppa1.1-hp-bsd
+	exit ;;
+    9000/8??:4.3bsd:*:*)
+	echo hppa1.0-hp-bsd
+	exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+	echo hppa1.0-hp-mpeix
+	exit ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+	echo hppa1.1-hp-osf
+	exit ;;
+    hp8??:OSF1:*:*)
+	echo hppa1.0-hp-osf
+	exit ;;
+    i*86:OSF1:*:*)
+	if [ -x /usr/sbin/sysversion ] ; then
+	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	else
+	    echo ${UNAME_MACHINE}-unknown-osf1
+	fi
+	exit ;;
+    parisc*:Lites*:*:*)
+	echo hppa1.1-hp-lites
+	exit ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+	echo c1-convex-bsd
+        exit ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+        exit ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+	echo c34-convex-bsd
+        exit ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+	echo c38-convex-bsd
+        exit ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+	echo c4-convex-bsd
+        exit ;;
+    CRAY*Y-MP:*:*:*)
+	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*[A-Z]90:*:*:*)
+	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+	      -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*TS:*:*:*)
+	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*T3E:*:*:*)
+	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*SV1:*:*:*)
+	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    *:UNICOS/mp:*:*)
+	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit ;;
+    5000:UNIX_System_V:4.*:*)
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	exit ;;
+    sparc*:BSD/OS:*:*)
+	echo sparc-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:BSD/OS:*:*)
+	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:FreeBSD:*:*)
+	case ${UNAME_MACHINE} in
+	    pc98)
+		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    amd64)
+		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    *)
+		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	esac
+	exit ;;
+    i*:CYGWIN*:*)
+	echo ${UNAME_MACHINE}-pc-cygwin
+	exit ;;
+    *:MINGW*:*)
+	echo ${UNAME_MACHINE}-pc-mingw32
+	exit ;;
+    i*:windows32*:*)
+    	# uname -m includes "-pc" on this system.
+    	echo ${UNAME_MACHINE}-mingw32
+	exit ;;
+    i*:PW*:*)
+	echo ${UNAME_MACHINE}-pc-pw32
+	exit ;;
+    x86:Interix*:[3456]*)
+	echo i586-pc-interix${UNAME_RELEASE}
+	exit ;;
+    EM64T:Interix*:[3456]* | authenticamd:Interix*:[3456]*)
+	echo x86_64-unknown-interix${UNAME_RELEASE}
+	exit ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+	echo i${UNAME_MACHINE}-pc-mks
+	exit ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+	# UNAME_MACHINE based on the output of uname instead of i386?
+	echo i586-pc-interix
+	exit ;;
+    i*:UWIN*:*)
+	echo ${UNAME_MACHINE}-pc-uwin
+	exit ;;
+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+	echo x86_64-unknown-cygwin
+	exit ;;
+    p*:CYGWIN*:*)
+	echo powerpcle-unknown-cygwin
+	exit ;;
+    prep*:SunOS:5.*:*)
+	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    *:GNU:*:*)
+	# the GNU system
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	exit ;;
+    *:GNU/*:*:*)
+	# other systems with GNU libc and userland
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+	exit ;;
+    i*86:Minix:*:*)
+	echo ${UNAME_MACHINE}-pc-minix
+	exit ;;
+    arm*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    avr32*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    cris:Linux:*:*)
+	echo cris-axis-linux-${LIBC}
+	exit ;;
+    crisv32:Linux:*:*)
+	echo crisv32-axis-linux-${LIBC}
+	exit ;;
+    frv:Linux:*:*)
+    	echo frv-unknown-linux-${LIBC}
+	exit ;;
+    ia64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    m32r*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    m68*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    mips:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips
+	#undef mipsel
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mipsel
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^CPU/{
+		s: ::g
+		p
+	    }'`"
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
+	;;
+    mips64:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips64
+	#undef mips64el
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mips64el
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips64
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^CPU/{
+		s: ::g
+		p
+	    }'`"
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
+	;;
+    or32:Linux:*:*)
+	echo or32-unknown-linux-${LIBC}
+	exit ;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-${LIBC}
+	exit ;;
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-${LIBC}
+	exit ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+	if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+	# Look for CPU level
+	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+	  PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
+	  PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
+	  *)    echo hppa-unknown-linux-${LIBC} ;;
+	esac
+	exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-${LIBC}
+	exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+	echo ${UNAME_MACHINE}-ibm-linux
+	exit ;;
+    sh64*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    sh*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    vax:Linux:*:*)
+	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
+	exit ;;
+    x86_64:Linux:*:*)
+	echo x86_64-unknown-linux-${LIBC}
+	exit ;;
+    xtensa:Linux:*:*)
+    	echo xtensa-unknown-linux-${LIBC}
+	exit ;;
+    i*86:Linux:*:*)
+	# The BFD linker knows what the default object file format is, so
+	# first see if it will tell us. cd to the root directory to prevent
+	# problems with other programs or directories called `ld' in the path.
+	# Set LC_ALL=C to ensure ld outputs messages in English.
+	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+			 | sed -ne '/supported targets:/!d
+				    s/[ 	][ 	]*/ /g
+				    s/.*supported targets: *//
+				    s/ .*//
+				    p'`
+        case "$ld_supported_targets" in
+	  elf32-i386)
+		TENTATIVE="${UNAME_MACHINE}-pc-linux-${LIBC}"
+		;;
+	  a.out-i386-linux)
+		echo "${UNAME_MACHINE}-pc-linux-${LIBC}aout"
+		exit ;;
+	  coff-i386)
+		echo "${UNAME_MACHINE}-pc-linux-${LIBC}coff"
+		exit ;;
+	  "")
+		# Either a pre-BFD a.out linker (linux-gnuoldld) or
+		# one that does not give us useful --help.
+		echo "${UNAME_MACHINE}-pc-linux-${LIBC}oldld"
+		exit ;;
+	esac
+	# This should get integrated into the C code below, but now we hack
+	if [ "$LIBC" != "gnu" ] ; then echo "$TENTATIVE" && exit 0 ; fi
+	# Determine whether the default compiler is a.out or elf
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <features.h>
+	#ifdef __ELF__
+	# ifdef __GLIBC__
+	#  if __GLIBC__ >= 2
+	LIBC=gnu
+	#  else
+	LIBC=gnulibc1
+	#  endif
+	# else
+	LIBC=gnulibc1
+	# endif
+	#else
+	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+	LIBC=gnu
+	#else
+	LIBC=gnuaout
+	#endif
+	#endif
+	#ifdef __dietlibc__
+	LIBC=dietlibc
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^LIBC/{
+		s: ::g
+		p
+	    }'`"
+	test x"${LIBC}" != x && {
+		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+		exit
+	}
+	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+	;;
+    i*86:DYNIX/ptx:4*:*)
+	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+	# earlier versions are messed up and put the nodename in both
+	# sysname and nodename.
+	echo i386-sequent-sysv4
+	exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+        # Unixware is an offshoot of SVR4, but it has its own version
+        # number series starting with 2...
+        # I am not positive that other SVR4 systems won't match this,
+	# I just have to hope.  -- rms.
+        # Use sysv4.2uw... so that sysv4* matches it.
+	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+	exit ;;
+    i*86:OS/2:*:*)
+	# If we were able to find `uname', then EMX Unix compatibility
+	# is probably installed.
+	echo ${UNAME_MACHINE}-pc-os2-emx
+	exit ;;
+    i*86:XTS-300:*:STOP)
+	echo ${UNAME_MACHINE}-unknown-stop
+	exit ;;
+    i*86:atheos:*:*)
+	echo ${UNAME_MACHINE}-unknown-atheos
+	exit ;;
+    i*86:syllable:*:*)
+	echo ${UNAME_MACHINE}-pc-syllable
+	exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+	echo i386-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    i*86:*DOS:*:*)
+	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+	else
+		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+	fi
+	exit ;;
+    i*86:*:5:[678]*)
+    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
+	case `/bin/uname -X | grep "^Machine"` in
+	    *486*)	     UNAME_MACHINE=i486 ;;
+	    *Pentium)	     UNAME_MACHINE=i586 ;;
+	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+	esac
+	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	exit ;;
+    i*86:*:3.2:*)
+	if test -f /usr/options/cb.name; then
+		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+	elif /bin/uname -X 2>/dev/null >/dev/null ; then
+		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+			&& UNAME_MACHINE=i586
+		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+	else
+		echo ${UNAME_MACHINE}-pc-sysv32
+	fi
+	exit ;;
+    pc:*:*:*)
+	# Left here for compatibility:
+        # uname -m prints for DJGPP always 'pc', but it prints nothing about
+        # the processor, so we play safe by assuming i386.
+	echo i386-pc-msdosdjgpp
+        exit ;;
+    Intel:Mach:3*:*)
+	echo i386-pc-mach3
+	exit ;;
+    paragon:*:*:*)
+	echo i860-intel-osf1
+	exit ;;
+    i860:*:4.*:*) # i860-SVR4
+	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+	else # Add other i860-SVR4 vendors below as they are discovered.
+	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+	fi
+	exit ;;
+    mini*:CTIX:SYS*5:*)
+	# "miniframe"
+	echo m68010-convergent-sysv
+	exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+	echo m68k-convergent-sysv
+	exit ;;
+    M680?0:D-NIX:5.3:*)
+	echo m68k-diab-dnix
+	exit ;;
+    M68*:*:R3V[5678]*:*)
+	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+	OS_REL=''
+	test -r /etc/.relid \
+	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+          && { echo i486-ncr-sysv4; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    mc68030:UNIX_System_V:4.*:*)
+	echo m68k-atari-sysv4
+	exit ;;
+    TSUNAMI:LynxOS:2.*:*)
+	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    rs6000:LynxOS:2.*:*)
+	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    SM[BE]S:UNIX_SV:*:*)
+	echo mips-dde-sysv${UNAME_RELEASE}
+	exit ;;
+    RM*:ReliantUNIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    RM*:SINIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    *:SINIX-*:*:*)
+	if uname -p 2>/dev/null >/dev/null ; then
+		UNAME_MACHINE=`(uname -p) 2>/dev/null`
+		echo ${UNAME_MACHINE}-sni-sysv4
+	else
+		echo ns32k-sni-sysv
+	fi
+	exit ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says <Richard.M.Bartel@ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit ;;
+    *:UNIX_System_V:4*:FTX*)
+	# From Gerald Hewes <hewes@openmarket.com>.
+	# How about differentiating between stratus architectures? -djm
+	echo hppa1.1-stratus-sysv4
+	exit ;;
+    *:*:*:FTX*)
+	# From seanf@swdc.stratus.com.
+	echo i860-stratus-sysv4
+	exit ;;
+    i*86:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo ${UNAME_MACHINE}-stratus-vos
+	exit ;;
+    *:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo hppa1.1-stratus-vos
+	exit ;;
+    mc68*:A/UX:*:*)
+	echo m68k-apple-aux${UNAME_RELEASE}
+	exit ;;
+    news*:NEWS-OS:6*:*)
+	echo mips-sony-newsos6
+	exit ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+	if [ -d /usr/nec ]; then
+	        echo mips-nec-sysv${UNAME_RELEASE}
+	else
+	        echo mips-unknown-sysv${UNAME_RELEASE}
+	fi
+        exit ;;
+    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
+	echo powerpc-be-beos
+	exit ;;
+    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
+	echo powerpc-apple-beos
+	exit ;;
+    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
+	echo i586-pc-beos
+	exit ;;
+    SX-4:SUPER-UX:*:*)
+	echo sx4-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-5:SUPER-UX:*:*)
+	echo sx5-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-6:SUPER-UX:*:*)
+	echo sx6-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-7:SUPER-UX:*:*)
+	echo sx7-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8:SUPER-UX:*:*)
+	echo sx8-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8R:SUPER-UX:*:*)
+	echo sx8r-nec-superux${UNAME_RELEASE}
+	exit ;;
+    Power*:Rhapsody:*:*)
+	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Rhapsody:*:*)
+	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Darwin:*:*)
+	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+	case $UNAME_PROCESSOR in
+	    unknown) UNAME_PROCESSOR=powerpc ;;
+	esac
+	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+	exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+	UNAME_PROCESSOR=`uname -p`
+	if test "$UNAME_PROCESSOR" = "x86"; then
+		UNAME_PROCESSOR=i386
+		UNAME_MACHINE=pc
+	fi
+	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+	exit ;;
+    *:QNX:*:4*)
+	echo i386-pc-qnx
+	exit ;;
+    NSE-?:NONSTOP_KERNEL:*:*)
+	echo nse-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+	echo nsr-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    *:NonStop-UX:*:*)
+	echo mips-compaq-nonstopux
+	exit ;;
+    BS2000:POSIX*:*:*)
+	echo bs2000-siemens-sysv
+	exit ;;
+    DS/*:UNIX_System_V:*:*)
+	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	exit ;;
+    *:Plan9:*:*)
+	# "uname -m" is not consistent, so use $cputype instead. 386
+	# is converted to i386 for consistency with other x86
+	# operating systems.
+	if test "$cputype" = "386"; then
+	    UNAME_MACHINE=i386
+	else
+	    UNAME_MACHINE="$cputype"
+	fi
+	echo ${UNAME_MACHINE}-unknown-plan9
+	exit ;;
+    *:TOPS-10:*:*)
+	echo pdp10-unknown-tops10
+	exit ;;
+    *:TENEX:*:*)
+	echo pdp10-unknown-tenex
+	exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+	echo pdp10-dec-tops20
+	exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+	echo pdp10-xkl-tops20
+	exit ;;
+    *:TOPS-20:*:*)
+	echo pdp10-unknown-tops20
+	exit ;;
+    *:ITS:*:*)
+	echo pdp10-unknown-its
+	exit ;;
+    SEI:*:*:SEIUX)
+        echo mips-sei-seiux${UNAME_RELEASE}
+	exit ;;
+    *:DragonFly:*:*)
+	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	exit ;;
+    *:*VMS:*:*)
+    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
+	case "${UNAME_MACHINE}" in
+	    A*) echo alpha-dec-vms ; exit ;;
+	    I*) echo ia64-dec-vms ; exit ;;
+	    V*) echo vax-dec-vms ; exit ;;
+	esac ;;
+    *:XENIX:*:SysV)
+	echo i386-pc-xenix
+	exit ;;
+    i*86:skyos:*:*)
+	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+	exit ;;
+    i*86:rdos:*:*)
+	echo ${UNAME_MACHINE}-pc-rdos
+	exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+          "4"
+#else
+	  ""
+#endif
+         ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+	printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+	printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+	{ echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+	echo c1-convex-bsd
+	exit ;;
+    c2*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit ;;
+    c34*)
+	echo c34-convex-bsd
+	exit ;;
+    c38*)
+	echo c38-convex-bsd
+	exit ;;
+    c4*)
+	echo c4-convex-bsd
+	exit ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+and
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
Index: /vendor/prefix-portage/current/config.sub
===================================================================
--- /vendor/prefix-portage/current/config.sub	(revision 3489)
+++ /vendor/prefix-portage/current/config.sub	(revision 3489)
@@ -0,0 +1,1640 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+#   Inc.
+
+timestamp='2007-01-18'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+	-sun*os*)
+		# Prevent following clause from handling this invalid input.
+		;;
+	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+	-apple | -axis | -knuth | -cray)
+		os=
+		basic_machine=$1
+		;;
+	-sim | -cisco | -oki | -wec | -winbond)
+		os=
+		basic_machine=$1
+		;;
+	-scout)
+		;;
+	-wrs)
+		os=-vxworks
+		basic_machine=$1
+		;;
+	-chorusos*)
+		os=-chorusos
+		basic_machine=$1
+		;;
+ 	-chorusrdb)
+ 		os=-chorusrdb
+		basic_machine=$1
+ 		;;
+	-hiux*)
+		os=-hiuxwe2
+		;;
+	-sco6)
+		os=-sco5v6
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5)
+		os=-sco3.2v5
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco4)
+		os=-sco3.2v4
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2.[4-9]*)
+		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2v[4-9]*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5v6*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco*)
+		os=-sco3.2v2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-udk*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-isc)
+		os=-isc2.2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-clix*)
+		basic_machine=clipper-intergraph
+		;;
+	-isc*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-lynx*)
+		os=-lynxos
+		;;
+	-ptx*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+		;;
+	-windowsnt*)
+		os=`echo $os | sed -e 's/windowsnt/winnt/'`
+		;;
+	-psos*)
+		os=-psos
+		;;
+	-mint | -mint[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+	# Recognize the basic CPU types without company name.
+	# Some are omitted here because they have special meanings below.
+	1750a | 580 \
+	| a29k \
+	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+	| am33_2.0 \
+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+	| bfin \
+	| c4x | clipper \
+	| d10v | d30v | dlx | dsp16xx | dvp \
+	| fido | fr30 | frv \
+	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| i370 | i860 | i960 | ia64 \
+	| ip2k | iq2000 \
+	| m32c | m32r | m32rle | m68000 | m68k | m88k \
+	| maxq | mb | microblaze | mcore | mep \
+	| mips | mipsbe | mipseb | mipsel | mipsle \
+	| mips16 \
+	| mips64 | mips64el \
+	| mips64vr | mips64vrel \
+	| mips64orion | mips64orionel \
+	| mips64vr4100 | mips64vr4100el \
+	| mips64vr4300 | mips64vr4300el \
+	| mips64vr5000 | mips64vr5000el \
+	| mips64vr5900 | mips64vr5900el \
+	| mipsisa32 | mipsisa32el \
+	| mipsisa32r2 | mipsisa32r2el \
+	| mipsisa64 | mipsisa64el \
+	| mipsisa64r2 | mipsisa64r2el \
+	| mipsisa64sb1 | mipsisa64sb1el \
+	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipstx39 | mipstx39el \
+	| mn10200 | mn10300 \
+	| mt \
+	| msp430 \
+	| nios | nios2 \
+	| ns16k | ns32k \
+	| or32 \
+	| pdp10 | pdp11 | pj | pjl \
+	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+	| pyramid \
+	| score \
+	| sh | sh[1234] | sh[24]a | sh[24]a*eb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+	| sh64 | sh64le \
+	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+	| spu | strongarm \
+	| tahoe | thumb | tic4x | tic80 | tron \
+	| v850 | v850e \
+	| we32k \
+	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+	| z8k)
+		basic_machine=$basic_machine-unknown
+		;;
+	m6811 | m68hc11 | m6812 | m68hc12)
+		# Motorola 68HC11/12.
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+		;;
+	ms1)
+		basic_machine=mt-unknown
+		;;
+
+	# We use `pc' rather than `unknown'
+	# because (1) that's what they normally are, and
+	# (2) the word "unknown" tends to confuse beginning users.
+	i*86 | x86_64)
+	  basic_machine=$basic_machine-pc
+	  ;;
+	# Object if more than one company name word.
+	*-*-*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+	# Recognize the basic CPU types with company name.
+	580-* \
+	| a29k-* \
+	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+	| avr-* | avr32-* \
+	| bfin-* | bs2000-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+	| clipper-* | craynv-* | cydra-* \
+	| d10v-* | d30v-* | dlx-* \
+	| elxsi-* \
+	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+	| h8300-* | h8500-* \
+	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| i*86-* | i860-* | i960-* | ia64-* \
+	| ip2k-* | iq2000-* \
+	| m32c-* | m32r-* | m32rle-* \
+	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* \
+	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+	| mips16-* \
+	| mips64-* | mips64el-* \
+	| mips64vr-* | mips64vrel-* \
+	| mips64orion-* | mips64orionel-* \
+	| mips64vr4100-* | mips64vr4100el-* \
+	| mips64vr4300-* | mips64vr4300el-* \
+	| mips64vr5000-* | mips64vr5000el-* \
+	| mips64vr5900-* | mips64vr5900el-* \
+	| mipsisa32-* | mipsisa32el-* \
+	| mipsisa32r2-* | mipsisa32r2el-* \
+	| mipsisa64-* | mipsisa64el-* \
+	| mipsisa64r2-* | mipsisa64r2el-* \
+	| mipsisa64sb1-* | mipsisa64sb1el-* \
+	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipstx39-* | mipstx39el-* \
+	| mmix-* \
+	| mt-* \
+	| msp430-* \
+	| nios-* | nios2-* \
+	| none-* | np1-* | ns16k-* | ns32k-* \
+	| orion-* \
+	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+	| pyramid-* \
+	| romp-* | rs6000-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]a*eb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+	| sparclite-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
+	| tahoe-* | thumb-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tron-* \
+	| v850-* | v850e-* | vax-* \
+	| we32k-* \
+	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+	| xstormy16-* | xtensa-* \
+	| ymp-* \
+	| z8k-*)
+		;;
+	# Recognize the various machine names and aliases which stand
+	# for a CPU type and a company and sometimes even an OS.
+	386bsd)
+		basic_machine=i386-unknown
+		os=-bsd
+		;;
+	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+		basic_machine=m68000-att
+		;;
+	3b*)
+		basic_machine=we32k-att
+		;;
+	a29khif)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+    	abacus)
+		basic_machine=abacus-unknown
+		;;
+	adobe68k)
+		basic_machine=m68010-adobe
+		os=-scout
+		;;
+	alliant | fx80)
+		basic_machine=fx80-alliant
+		;;
+	altos | altos3068)
+		basic_machine=m68k-altos
+		;;
+	am29k)
+		basic_machine=a29k-none
+		os=-bsd
+		;;
+	amd64)
+		basic_machine=x86_64-pc
+		;;
+	amd64-*)
+		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	amdahl)
+		basic_machine=580-amdahl
+		os=-sysv
+		;;
+	amiga | amiga-*)
+		basic_machine=m68k-unknown
+		;;
+	amigaos | amigados)
+		basic_machine=m68k-unknown
+		os=-amigaos
+		;;
+	amigaunix | amix)
+		basic_machine=m68k-unknown
+		os=-sysv4
+		;;
+	apollo68)
+		basic_machine=m68k-apollo
+		os=-sysv
+		;;
+	apollo68bsd)
+		basic_machine=m68k-apollo
+		os=-bsd
+		;;
+	aux)
+		basic_machine=m68k-apple
+		os=-aux
+		;;
+	balance)
+		basic_machine=ns32k-sequent
+		os=-dynix
+		;;
+	c90)
+		basic_machine=c90-cray
+		os=-unicos
+		;;
+	convex-c1)
+		basic_machine=c1-convex
+		os=-bsd
+		;;
+	convex-c2)
+		basic_machine=c2-convex
+		os=-bsd
+		;;
+	convex-c32)
+		basic_machine=c32-convex
+		os=-bsd
+		;;
+	convex-c34)
+		basic_machine=c34-convex
+		os=-bsd
+		;;
+	convex-c38)
+		basic_machine=c38-convex
+		os=-bsd
+		;;
+	cray | j90)
+		basic_machine=j90-cray
+		os=-unicos
+		;;
+	craynv)
+		basic_machine=craynv-cray
+		os=-unicosmp
+		;;
+	cr16c)
+		basic_machine=cr16c-unknown
+		os=-elf
+		;;
+	crds | unos)
+		basic_machine=m68k-crds
+		;;
+	crisv32 | crisv32-* | etraxfs*)
+		basic_machine=crisv32-axis
+		;;
+	cris | cris-* | etrax*)
+		basic_machine=cris-axis
+		;;
+	crx)
+		basic_machine=crx-unknown
+		os=-elf
+		;;
+	da30 | da30-*)
+		basic_machine=m68k-da30
+		;;
+	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+		basic_machine=mips-dec
+		;;
+	decsystem10* | dec10*)
+		basic_machine=pdp10-dec
+		os=-tops10
+		;;
+	decsystem20* | dec20*)
+		basic_machine=pdp10-dec
+		os=-tops20
+		;;
+	delta | 3300 | motorola-3300 | motorola-delta \
+	      | 3300-motorola | delta-motorola)
+		basic_machine=m68k-motorola
+		;;
+	delta88)
+		basic_machine=m88k-motorola
+		os=-sysv3
+		;;
+	djgpp)
+		basic_machine=i586-pc
+		os=-msdosdjgpp
+		;;
+	dpx20 | dpx20-*)
+		basic_machine=rs6000-bull
+		os=-bosx
+		;;
+	dpx2* | dpx2*-bull)
+		basic_machine=m68k-bull
+		os=-sysv3
+		;;
+	ebmon29k)
+		basic_machine=a29k-amd
+		os=-ebmon
+		;;
+	elxsi)
+		basic_machine=elxsi-elxsi
+		os=-bsd
+		;;
+	encore | umax | mmax)
+		basic_machine=ns32k-encore
+		;;
+	es1800 | OSE68k | ose68k | ose | OSE)
+		basic_machine=m68k-ericsson
+		os=-ose
+		;;
+	fx2800)
+		basic_machine=i860-alliant
+		;;
+	genix)
+		basic_machine=ns32k-ns
+		;;
+	gmicro)
+		basic_machine=tron-gmicro
+		os=-sysv
+		;;
+	go32)
+		basic_machine=i386-pc
+		os=-go32
+		;;
+	h3050r* | hiux*)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	h8300hms)
+		basic_machine=h8300-hitachi
+		os=-hms
+		;;
+	h8300xray)
+		basic_machine=h8300-hitachi
+		os=-xray
+		;;
+	h8500hms)
+		basic_machine=h8500-hitachi
+		os=-hms
+		;;
+	harris)
+		basic_machine=m88k-harris
+		os=-sysv3
+		;;
+	hp300-*)
+		basic_machine=m68k-hp
+		;;
+	hp300bsd)
+		basic_machine=m68k-hp
+		os=-bsd
+		;;
+	hp300hpux)
+		basic_machine=m68k-hp
+		os=-hpux
+		;;
+	hp3k9[0-9][0-9] | hp9[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k2[0-9][0-9] | hp9k31[0-9])
+		basic_machine=m68000-hp
+		;;
+	hp9k3[2-9][0-9])
+		basic_machine=m68k-hp
+		;;
+	hp9k6[0-9][0-9] | hp6[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k7[0-79][0-9] | hp7[0-79][0-9])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k78[0-9] | hp78[0-9])
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][13679] | hp8[0-9][13679])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][0-9] | hp8[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hppa-next)
+		os=-nextstep3
+		;;
+	hppaosf)
+		basic_machine=hppa1.1-hp
+		os=-osf
+		;;
+	hppro)
+		basic_machine=hppa1.1-hp
+		os=-proelf
+		;;
+	i370-ibm* | ibm*)
+		basic_machine=i370-ibm
+		;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+	i*86v32)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv32
+		;;
+	i*86v4*)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv4
+		;;
+	i*86v)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv
+		;;
+	i*86sol2)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-solaris2
+		;;
+	i386mach)
+		basic_machine=i386-mach
+		os=-mach
+		;;
+	i386-vsta | vsta)
+		basic_machine=i386-unknown
+		os=-vsta
+		;;
+	iris | iris4d)
+		basic_machine=mips-sgi
+		case $os in
+		    -irix*)
+			;;
+		    *)
+			os=-irix4
+			;;
+		esac
+		;;
+	isi68 | isi)
+		basic_machine=m68k-isi
+		os=-sysv
+		;;
+	m88k-omron*)
+		basic_machine=m88k-omron
+		;;
+	magnum | m3230)
+		basic_machine=mips-mips
+		os=-sysv
+		;;
+	merlin)
+		basic_machine=ns32k-utek
+		os=-sysv
+		;;
+	mingw32)
+		basic_machine=i386-pc
+		os=-mingw32
+		;;
+	miniframe)
+		basic_machine=m68000-convergent
+		;;
+	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+	mipsEE* | ee | ps2)
+		basic_machine=mips64r5900el-scei
+		case $os in
+		    -linux*)
+			;;
+		    *)
+			os=-elf
+			;;
+		esac
+		;;
+	iop)
+		basic_machine=mipsel-scei
+		os=-irx
+		;;
+	dvp)
+		basic_machine=dvp-scei
+		os=-elf
+		;;
+	mips3*-*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+		;;
+	mips3*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+		;;
+	monitor)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	morphos)
+		basic_machine=powerpc-unknown
+		os=-morphos
+		;;
+	msdos)
+		basic_machine=i386-pc
+		os=-msdos
+		;;
+	ms1-*)
+		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+		;;
+	mvs)
+		basic_machine=i370-ibm
+		os=-mvs
+		;;
+	ncr3000)
+		basic_machine=i486-ncr
+		os=-sysv4
+		;;
+	netbsd386)
+		basic_machine=i386-unknown
+		os=-netbsd
+		;;
+	netwinder)
+		basic_machine=armv4l-rebel
+		os=-linux
+		;;
+	news | news700 | news800 | news900)
+		basic_machine=m68k-sony
+		os=-newsos
+		;;
+	news1000)
+		basic_machine=m68030-sony
+		os=-newsos
+		;;
+	news-3600 | risc-news)
+		basic_machine=mips-sony
+		os=-newsos
+		;;
+	necv70)
+		basic_machine=v70-nec
+		os=-sysv
+		;;
+	next | m*-next )
+		basic_machine=m68k-next
+		case $os in
+		    -nextstep* )
+			;;
+		    -ns2*)
+		      os=-nextstep2
+			;;
+		    *)
+		      os=-nextstep3
+			;;
+		esac
+		;;
+	nh3000)
+		basic_machine=m68k-harris
+		os=-cxux
+		;;
+	nh[45]000)
+		basic_machine=m88k-harris
+		os=-cxux
+		;;
+	nindy960)
+		basic_machine=i960-intel
+		os=-nindy
+		;;
+	mon960)
+		basic_machine=i960-intel
+		os=-mon960
+		;;
+	nonstopux)
+		basic_machine=mips-compaq
+		os=-nonstopux
+		;;
+	np1)
+		basic_machine=np1-gould
+		;;
+	nsr-tandem)
+		basic_machine=nsr-tandem
+		;;
+	op50n-* | op60c-*)
+		basic_machine=hppa1.1-oki
+		os=-proelf
+		;;
+	openrisc | openrisc-*)
+		basic_machine=or32-unknown
+		;;
+	os400)
+		basic_machine=powerpc-ibm
+		os=-os400
+		;;
+	OSE68000 | ose68000)
+		basic_machine=m68000-ericsson
+		os=-ose
+		;;
+	os68k)
+		basic_machine=m68k-none
+		os=-os68k
+		;;
+	pa-hitachi)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	paragon)
+		basic_machine=i860-intel
+		os=-osf
+		;;
+	pbd)
+		basic_machine=sparc-tti
+		;;
+	pbb)
+		basic_machine=m68k-tti
+		;;
+	pc532 | pc532-*)
+		basic_machine=ns32k-pc532
+		;;
+	pc98)
+		basic_machine=i386-pc
+		;;
+	pc98-*)
+		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium | p5 | k5 | k6 | nexgen | viac3)
+		basic_machine=i586-pc
+		;;
+	pentiumpro | p6 | 6x86 | athlon | athlon_*)
+		basic_machine=i686-pc
+		;;
+	pentiumii | pentium2 | pentiumiii | pentium3)
+		basic_machine=i686-pc
+		;;
+	pentium4)
+		basic_machine=i786-pc
+		;;
+	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumpro-* | p6-* | 6x86-* | athlon-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium4-*)
+		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pn)
+		basic_machine=pn-gould
+		;;
+	power)	basic_machine=power-ibm
+		;;
+	ppc)	basic_machine=powerpc-unknown
+		;;
+	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppcle | powerpclittle | ppc-le | powerpc-little)
+		basic_machine=powerpcle-unknown
+		;;
+	ppcle-* | powerpclittle-*)
+		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64)	basic_machine=powerpc64-unknown
+		;;
+	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+		basic_machine=powerpc64le-unknown
+		;;
+	ppc64le-* | powerpc64little-*)
+		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ps2)
+		basic_machine=i386-ibm
+		;;
+	pw32)
+		basic_machine=i586-unknown
+		os=-pw32
+		;;
+	rdos)
+		basic_machine=i386-pc
+		os=-rdos
+		;;
+	rom68k)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	rm[46]00)
+		basic_machine=mips-siemens
+		;;
+	rtpc | rtpc-*)
+		basic_machine=romp-ibm
+		;;
+	s390 | s390-*)
+		basic_machine=s390-ibm
+		;;
+	s390x | s390x-*)
+		basic_machine=s390x-ibm
+		;;
+	sa29200)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	sb1)
+		basic_machine=mipsisa64sb1-unknown
+		;;
+	sb1el)
+		basic_machine=mipsisa64sb1el-unknown
+		;;
+	sde)
+		basic_machine=mipsisa32-sde
+		os=-elf
+		;;
+	sei)
+		basic_machine=mips-sei
+		os=-seiux
+		;;
+	sequent)
+		basic_machine=i386-sequent
+		;;
+	sh)
+		basic_machine=sh-hitachi
+		os=-hms
+		;;
+	sh5el)
+		basic_machine=sh5le-unknown
+		;;
+	sh64)
+		basic_machine=sh64-unknown
+		;;
+	sparclite-wrs | simso-wrs)
+		basic_machine=sparclite-wrs
+		os=-vxworks
+		;;
+	sps7)
+		basic_machine=m68k-bull
+		os=-sysv2
+		;;
+	spur)
+		basic_machine=spur-unknown
+		;;
+	st2000)
+		basic_machine=m68k-tandem
+		;;
+	stratus)
+		basic_machine=i860-stratus
+		os=-sysv4
+		;;
+	sun2)
+		basic_machine=m68000-sun
+		;;
+	sun2os3)
+		basic_machine=m68000-sun
+		os=-sunos3
+		;;
+	sun2os4)
+		basic_machine=m68000-sun
+		os=-sunos4
+		;;
+	sun3os3)
+		basic_machine=m68k-sun
+		os=-sunos3
+		;;
+	sun3os4)
+		basic_machine=m68k-sun
+		os=-sunos4
+		;;
+	sun4os3)
+		basic_machine=sparc-sun
+		os=-sunos3
+		;;
+	sun4os4)
+		basic_machine=sparc-sun
+		os=-sunos4
+		;;
+	sun4sol2)
+		basic_machine=sparc-sun
+		os=-solaris2
+		;;
+	sun3 | sun3-*)
+		basic_machine=m68k-sun
+		;;
+	sun4)
+		basic_machine=sparc-sun
+		;;
+	sun386 | sun386i | roadrunner)
+		basic_machine=i386-sun
+		;;
+	sv1)
+		basic_machine=sv1-cray
+		os=-unicos
+		;;
+	symmetry)
+		basic_machine=i386-sequent
+		os=-dynix
+		;;
+	t3e)
+		basic_machine=alphaev5-cray
+		os=-unicos
+		;;
+	t90)
+		basic_machine=t90-cray
+		os=-unicos
+		;;
+	tic54x | c54x*)
+		basic_machine=tic54x-unknown
+		os=-coff
+		;;
+	tic55x | c55x*)
+		basic_machine=tic55x-unknown
+		os=-coff
+		;;
+	tic6x | c6x*)
+		basic_machine=tic6x-unknown
+		os=-coff
+		;;
+	tx39)
+		basic_machine=mipstx39-unknown
+		;;
+	tx39el)
+		basic_machine=mipstx39el-unknown
+		;;
+	toad1)
+		basic_machine=pdp10-xkl
+		os=-tops20
+		;;
+	tower | tower-32)
+		basic_machine=m68k-ncr
+		;;
+	tpf)
+		basic_machine=s390x-ibm
+		os=-tpf
+		;;
+	udi29k)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	ultra3)
+		basic_machine=a29k-nyu
+		os=-sym1
+		;;
+	v810 | necv810)
+		basic_machine=v810-nec
+		os=-none
+		;;
+	vaxv)
+		basic_machine=vax-dec
+		os=-sysv
+		;;
+	vms)
+		basic_machine=vax-dec
+		os=-vms
+		;;
+	vpp*|vx|vx-*)
+		basic_machine=f301-fujitsu
+		;;
+	vxworks960)
+		basic_machine=i960-wrs
+		os=-vxworks
+		;;
+	vxworks68)
+		basic_machine=m68k-wrs
+		os=-vxworks
+		;;
+	vxworks29k)
+		basic_machine=a29k-wrs
+		os=-vxworks
+		;;
+	w65*)
+		basic_machine=w65-wdc
+		os=-none
+		;;
+	w89k-*)
+		basic_machine=hppa1.1-winbond
+		os=-proelf
+		;;
+	xbox)
+		basic_machine=i686-pc
+		os=-mingw32
+		;;
+	xps | xps100)
+		basic_machine=xps100-honeywell
+		;;
+	ymp)
+		basic_machine=ymp-cray
+		os=-unicos
+		;;
+	z8k-*-coff)
+		basic_machine=z8k-unknown
+		os=-sim
+		;;
+	none)
+		basic_machine=none-none
+		os=-none
+		;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+	w89k)
+		basic_machine=hppa1.1-winbond
+		;;
+	op50n)
+		basic_machine=hppa1.1-oki
+		;;
+	op60c)
+		basic_machine=hppa1.1-oki
+		;;
+	romp)
+		basic_machine=romp-ibm
+		;;
+	mmix)
+		basic_machine=mmix-knuth
+		;;
+	rs6000)
+		basic_machine=rs6000-ibm
+		;;
+	vax)
+		basic_machine=vax-dec
+		;;
+	pdp10)
+		# there are many clones, so DEC is not a safe bet
+		basic_machine=pdp10-unknown
+		;;
+	pdp11)
+		basic_machine=pdp11-dec
+		;;
+	we32k)
+		basic_machine=we32k-att
+		;;
+	sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+		basic_machine=sh-unknown
+		;;
+	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+		basic_machine=sparc-sun
+		;;
+	cydra)
+		basic_machine=cydra-cydrome
+		;;
+	orion)
+		basic_machine=orion-highlevel
+		;;
+	orion105)
+		basic_machine=clipper-highlevel
+		;;
+	mac | mpw | mac-mpw)
+		basic_machine=m68k-apple
+		;;
+	pmac | pmac-mpw)
+		basic_machine=powerpc-apple
+		;;
+	*-unknown)
+		# Make sure to match an already-canonicalized machine name.
+		;;
+	*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+	*-digital*)
+		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+		;;
+	*-commodore*)
+		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+		;;
+	*)
+		;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+        # First match some system type aliases
+        # that might get confused with valid system types.
+	# -solaris* is a basic system type, with this one exception.
+	-solaris1 | -solaris1.*)
+		os=`echo $os | sed -e 's|solaris1|sunos4|'`
+		;;
+	-solaris)
+		os=-solaris2
+		;;
+	-svr4*)
+		os=-sysv4
+		;;
+	-unixware*)
+		os=-sysv4.2uw
+		;;
+	-gnu/linux*)
+		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+		;;
+	# First accept the basic system types.
+	# The portable systems comes first.
+	# Each alternative MUST END IN A *, to match a version number.
+	# -sysv* is not here because it comes later, after sysvr4.
+	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+	      | -aos* \
+	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+	      | -openbsd* | -solidbsd* \
+	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+	      | -chorusos* | -chorusrdb* \
+	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+	      | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -irx*)
+	# Remember, each alternative MUST END IN *, to match a version number.
+		;;
+	-qnx*)
+		case $basic_machine in
+		    x86-* | i*86-*)
+			;;
+		    *)
+			os=-nto$os
+			;;
+		esac
+		;;
+	-nto-qnx*)
+		;;
+	-nto*)
+		os=`echo $os | sed -e 's|nto|nto-qnx|'`
+		;;
+	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+		;;
+	-mac*)
+		os=`echo $os | sed -e 's|mac|macos|'`
+		;;
+	-linux-dietlibc)
+		os=-linux-dietlibc
+		;;
+	-linux*)
+		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+		;;
+	-sunos5*)
+		os=`echo $os | sed -e 's|sunos5|solaris2|'`
+		;;
+	-sunos6*)
+		os=`echo $os | sed -e 's|sunos6|solaris3|'`
+		;;
+	-opened*)
+		os=-openedition
+		;;
+        -os400*)
+		os=-os400
+		;;
+	-wince*)
+		os=-wince
+		;;
+	-osfrose*)
+		os=-osfrose
+		;;
+	-osf*)
+		os=-osf
+		;;
+	-utek*)
+		os=-bsd
+		;;
+	-dynix*)
+		os=-bsd
+		;;
+	-acis*)
+		os=-aos
+		;;
+	-atheos*)
+		os=-atheos
+		;;
+	-syllable*)
+		os=-syllable
+		;;
+	-386bsd)
+		os=-bsd
+		;;
+	-ctix* | -uts*)
+		os=-sysv
+		;;
+	-nova*)
+		os=-rtmk-nova
+		;;
+	-ns2 )
+		os=-nextstep2
+		;;
+	-nsk*)
+		os=-nsk
+		;;
+	# Preserve the version number of sinix5.
+	-sinix5.*)
+		os=`echo $os | sed -e 's|sinix|sysv|'`
+		;;
+	-sinix*)
+		os=-sysv4
+		;;
+        -tpf*)
+		os=-tpf
+		;;
+	-triton*)
+		os=-sysv3
+		;;
+	-oss*)
+		os=-sysv3
+		;;
+	-svr4)
+		os=-sysv4
+		;;
+	-svr3)
+		os=-sysv3
+		;;
+	-sysvr4)
+		os=-sysv4
+		;;
+	# This must come after -sysvr4.
+	-sysv*)
+		;;
+	-ose*)
+		os=-ose
+		;;
+	-es1800*)
+		os=-ose
+		;;
+	-xenix)
+		os=-xenix
+		;;
+	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+		os=-mint
+		;;
+	-aros*)
+		os=-aros
+		;;
+	-kaos*)
+		os=-kaos
+		;;
+	-zvmoe)
+		os=-zvmoe
+		;;
+	-none)
+		;;
+	*)
+		# Get rid of the `-' at the beginning of $os.
+		os=`echo $os | sed 's/[^-]*-//'`
+		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+		exit 1
+		;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+        score-*)
+		os=-elf
+		;;
+        spu-*)
+		os=-elf
+		;;
+	*-acorn)
+		os=-riscix1.2
+		;;
+	arm*-rebel)
+		os=-linux
+		;;
+	arm*-semi)
+		os=-aout
+		;;
+        c4x-* | tic4x-*)
+        	os=-coff
+		;;
+	# This must come before the *-dec entry.
+	pdp10-*)
+		os=-tops20
+		;;
+	pdp11-*)
+		os=-none
+		;;
+	*-dec | vax-*)
+		os=-ultrix4.2
+		;;
+	m68*-apollo)
+		os=-domain
+		;;
+	i386-sun)
+		os=-sunos4.0.2
+		;;
+	m68000-sun)
+		os=-sunos3
+		# This also exists in the configure program, but was not the
+		# default.
+		# os=-sunos4
+		;;
+	m68*-cisco)
+		os=-aout
+		;;
+        mep-*)
+		os=-elf
+		;;
+	mips*-cisco)
+		os=-elf
+		;;
+	mips*-*)
+		os=-elf
+		;;
+	or32-*)
+		os=-coff
+		;;
+	*-tti)	# must be before sparc entry or we get the wrong os.
+		os=-sysv3
+		;;
+	sparc-* | *-sun)
+		os=-sunos4.1.1
+		;;
+	*-be)
+		os=-beos
+		;;
+	*-haiku)
+		os=-haiku
+		;;
+	*-ibm)
+		os=-aix
+		;;
+    	*-knuth)
+		os=-mmixware
+		;;
+	*-wec)
+		os=-proelf
+		;;
+	*-winbond)
+		os=-proelf
+		;;
+	*-oki)
+		os=-proelf
+		;;
+	*-hp)
+		os=-hpux
+		;;
+	*-hitachi)
+		os=-hiux
+		;;
+	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+		os=-sysv
+		;;
+	*-cbm)
+		os=-amigaos
+		;;
+	*-dg)
+		os=-dgux
+		;;
+	*-dolphin)
+		os=-sysv3
+		;;
+	m68k-ccur)
+		os=-rtu
+		;;
+	m88k-omron*)
+		os=-luna
+		;;
+	*-next )
+		os=-nextstep
+		;;
+	*-sequent)
+		os=-ptx
+		;;
+	*-crds)
+		os=-unos
+		;;
+	*-ns)
+		os=-genix
+		;;
+	i370-*)
+		os=-mvs
+		;;
+	*-next)
+		os=-nextstep3
+		;;
+	*-gould)
+		os=-sysv
+		;;
+	*-highlevel)
+		os=-bsd
+		;;
+	*-encore)
+		os=-bsd
+		;;
+	*-sgi)
+		os=-irix
+		;;
+	*-siemens)
+		os=-sysv4
+		;;
+	*-masscomp)
+		os=-rtu
+		;;
+	f30[01]-fujitsu | f700-fujitsu)
+		os=-uxpv
+		;;
+	*-rom68k)
+		os=-coff
+		;;
+	*-*bug)
+		os=-coff
+		;;
+	*-apple)
+		os=-macos
+		;;
+	*-atari*)
+		os=-mint
+		;;
+	*)
+		os=-none
+		;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+	*-unknown)
+		case $os in
+			-riscix*)
+				vendor=acorn
+				;;
+			-sunos*)
+				vendor=sun
+				;;
+			-aix*)
+				vendor=ibm
+				;;
+			-beos*)
+				vendor=be
+				;;
+			-hpux*)
+				vendor=hp
+				;;
+			-mpeix*)
+				vendor=hp
+				;;
+			-hiux*)
+				vendor=hitachi
+				;;
+			-unos*)
+				vendor=crds
+				;;
+			-dgux*)
+				vendor=dg
+				;;
+			-luna*)
+				vendor=omron
+				;;
+			-genix*)
+				vendor=ns
+				;;
+			-mvs* | -opened*)
+				vendor=ibm
+				;;
+			-os400*)
+				vendor=ibm
+				;;
+			-ptx*)
+				vendor=sequent
+				;;
+			-tpf*)
+				vendor=ibm
+				;;
+			-vxsim* | -vxworks* | -windiss*)
+				vendor=wrs
+				;;
+			-aux*)
+				vendor=apple
+				;;
+			-hms*)
+				vendor=hitachi
+				;;
+			-mpw* | -macos*)
+				vendor=apple
+				;;
+			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+				vendor=atari
+				;;
+			-vos*)
+				vendor=stratus
+				;;
+		esac
+		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+		;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
Index: /vendor/prefix-portage/current/configure
===================================================================
--- /vendor/prefix-portage/current/configure	(revision 3489)
+++ /vendor/prefix-portage/current/configure	(revision 3489)
@@ -0,0 +1,7988 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.61 for portage 2.1.20.
+#
+# Report bugs to <grobian@gentoo.org>.
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" ""	$as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+case $0 in
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+if test "x$CONFIG_SHELL" = x; then
+  if (eval ":") 2>/dev/null; then
+  as_have_required=yes
+else
+  as_have_required=no
+fi
+
+  if test $as_have_required = yes && 	 (eval ":
+(as_func_return () {
+  (exit \$1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0) || { (exit 1); exit 1; }
+
+(
+  as_lineno_1=\$LINENO
+  as_lineno_2=\$LINENO
+  test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
+  test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
+") 2> /dev/null; then
+  :
+else
+  as_candidate_shells=
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  case $as_dir in
+	 /*)
+	   for as_base in sh bash ksh sh5; do
+	     as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+	   done;;
+       esac
+done
+IFS=$as_save_IFS
+
+
+      for as_shell in $as_candidate_shells $SHELL; do
+	 # Try only shells that exist, to save several forks.
+	 if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+		{ ("$as_shell") 2> /dev/null <<\_ASEOF
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+:
+_ASEOF
+}; then
+  CONFIG_SHELL=$as_shell
+	       as_have_required=yes
+	       if { "$as_shell" 2> /dev/null <<\_ASEOF
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+:
+(as_func_return () {
+  (exit $1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = "$1" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test $exitcode = 0) || { (exit 1); exit 1; }
+
+(
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
+
+_ASEOF
+}; then
+  break
+fi
+
+fi
+
+      done
+
+      if test "x$CONFIG_SHELL" != x; then
+  for as_var in BASH_ENV ENV
+        do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+        done
+        export CONFIG_SHELL
+        exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+
+    if test $as_have_required = no; then
+  echo This script requires a shell more modern than all the
+      echo shells that I found on your system.  Please install a
+      echo modern shell, or manually run the script under such a
+      echo shell if you do have one.
+      { (exit 1); exit 1; }
+fi
+
+
+fi
+
+fi
+
+
+
+(eval "as_func_return () {
+  (exit \$1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0") || {
+  echo No shell found that supports shell functions.
+  echo Please tell autoconf@gnu.org about your system,
+  echo including any error possibly output before this
+  echo message
+}
+
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line after each line using $LINENO; the second 'sed'
+  # does the real work.  The second script uses 'N' to pair each
+  # line-number line with the line containing $LINENO, and appends
+  # trailing '-' during substitution so that $LINENO is not a special
+  # case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # scripts with optimization help from Paolo Bonzini.  Blame Lee
+  # E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    ' >$as_me.lineno &&
+  chmod +x "$as_me.lineno" ||
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+  case `echo 'x\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  *)   ECHO_C='\c';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir
+fi
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s='ln -s'
+  # ... but there are two gotchas:
+  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+  # In both cases, we have to default to `cp -p'.
+  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+    as_ln_s='cp -p'
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+        test -d "$1/.";
+      else
+	case $1 in
+        -*)set "./$1";;
+	esac;
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+	???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+
+exec 7<&0 </dev/null 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Identity of this package.
+PACKAGE_NAME='portage'
+PACKAGE_TARNAME='portage-prefix'
+PACKAGE_VERSION='2.1.20'
+PACKAGE_STRING='portage 2.1.20'
+PACKAGE_BUGREPORT='grobian@gentoo.org'
+
+ac_default_prefix=/usr
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL
+PATH_SEPARATOR
+PACKAGE_NAME
+PACKAGE_TARNAME
+PACKAGE_VERSION
+PACKAGE_STRING
+PACKAGE_BUGREPORT
+exec_prefix
+prefix
+program_transform_name
+bindir
+sbindir
+libexecdir
+datarootdir
+datadir
+sysconfdir
+sharedstatedir
+localstatedir
+includedir
+oldincludedir
+docdir
+infodir
+htmldir
+dvidir
+pdfdir
+psdir
+libdir
+localedir
+mandir
+DEFS
+ECHO_C
+ECHO_N
+ECHO_T
+LIBS
+build_alias
+host_alias
+target_alias
+build
+build_cpu
+build_vendor
+build_os
+host
+host_cpu
+host_vendor
+host_os
+target
+target_cpu
+target_vendor
+target_os
+INSTALL_PROGRAM
+INSTALL_SCRIPT
+INSTALL_DATA
+am__isrc
+CYGPATH_W
+PACKAGE
+VERSION
+ACLOCAL
+AUTOCONF
+AUTOMAKE
+AUTOHEADER
+MAKEINFO
+install_sh
+STRIP
+INSTALL_STRIP_PROGRAM
+mkdir_p
+AWK
+SET_MAKE
+am__leading_dot
+AMTAR
+am__tar
+am__untar
+CC
+CFLAGS
+LDFLAGS
+CPPFLAGS
+ac_ct_CC
+EXEEXT
+OBJEXT
+DEPDIR
+am__include
+am__quote
+AMDEP_TRUE
+AMDEP_FALSE
+AMDEPBACKSLASH
+CCDEPMODE
+am__fastdepCC_TRUE
+am__fastdepCC_FALSE
+LN_S
+GREP
+EGREP
+XCU_ID
+PYTHON
+RM
+MV
+BASENAME
+DIRNAME
+BASH
+SED
+WGET
+FIND
+XARGS
+CPP
+ALLOCA
+portageuser
+portagegroup
+wheelgid
+rootuser
+rootuid
+DOMAIN_PREFIX
+DEFAULT_PATH
+ARCH
+PORTAGE_BASE
+INSTALL_PYTHON_SOURCES_TRUE
+INSTALL_PYTHON_SOURCES_FALSE
+BUILD_TBZ2TOOL_TRUE
+BUILD_TBZ2TOOL_FALSE
+BUILD_MISSINGOS_TRUE
+BUILD_MISSINGOS_FALSE
+LIBOBJS
+LTLIBOBJS'
+ac_subst_files=''
+      ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval $ac_prev=\$ac_option
+    ac_prev=
+    continue
+  fi
+
+  case $ac_option in
+  *=*)	ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+  *)	ac_optarg=yes ;;
+  esac
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case $ac_dashdash$ac_option in
+  --)
+    ac_dashdash=yes ;;
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir=$ac_optarg ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build_alias=$ac_optarg ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file=$ac_optarg ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
+
+  -datadir | --datadir | --datadi | --datad)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=*)
+    datadir=$ac_optarg ;;
+
+  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+  | --dataroo | --dataro | --datar)
+    ac_prev=datarootdir ;;
+  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+    datarootdir=$ac_optarg ;;
+
+  -disable-* | --disable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
+    eval enable_$ac_feature=no ;;
+
+  -docdir | --docdir | --docdi | --doc | --do)
+    ac_prev=docdir ;;
+  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+    docdir=$ac_optarg ;;
+
+  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+    ac_prev=dvidir ;;
+  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+    dvidir=$ac_optarg ;;
+
+  -enable-* | --enable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
+    eval enable_$ac_feature=\$ac_optarg ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix=$ac_optarg ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he | -h)
+    ac_init_help=long ;;
+  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+    ac_init_help=recursive ;;
+  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+    ac_init_help=short ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host_alias ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host_alias=$ac_optarg ;;
+
+  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+    ac_prev=htmldir ;;
+  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+  | --ht=*)
+    htmldir=$ac_optarg ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir=$ac_optarg ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir=$ac_optarg ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir=$ac_optarg ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir=$ac_optarg ;;
+
+  -localedir | --localedir | --localedi | --localed | --locale)
+    ac_prev=localedir ;;
+  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+    localedir=$ac_optarg ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst | --locals)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+    localstatedir=$ac_optarg ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir=$ac_optarg ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir=$ac_optarg ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix=$ac_optarg ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix=$ac_optarg ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix=$ac_optarg ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name=$ac_optarg ;;
+
+  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+    ac_prev=pdfdir ;;
+  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+    pdfdir=$ac_optarg ;;
+
+  -psdir | --psdir | --psdi | --psd | --ps)
+    ac_prev=psdir ;;
+  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+    psdir=$ac_optarg ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir=$ac_optarg ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir=$ac_optarg ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site=$ac_optarg ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir=$ac_optarg ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir=$ac_optarg ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target_alias ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target_alias=$ac_optarg ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
+
+  -with-* | --with-*)
+    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
+    eval with_$ac_package=\$ac_optarg ;;
+
+  -without-* | --without-*)
+    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
+    eval with_$ac_package=no ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes=$ac_optarg ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries=$ac_optarg ;;
+
+  -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; }
+    ;;
+
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+   { (exit 1); exit 1; }; }
+    eval $ac_envvar=\$ac_optarg
+    export $ac_envvar ;;
+
+  *)
+    # FIXME: should be removed in autoconf 3.0.
+    echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  { echo "$as_me: error: missing argument to $ac_option" >&2
+   { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute directory names.
+for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
+		datadir sysconfdir sharedstatedir localstatedir includedir \
+		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+		libdir localedir mandir
+do
+  eval ac_val=\$$ac_var
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* )  continue;;
+    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+  esac
+  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; }
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+    echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used." >&2
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+  { echo "$as_me: error: Working directory cannot be determined" >&2
+   { (exit 1); exit 1; }; }
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+  { echo "$as_me: error: pwd does not report name of working directory" >&2
+   { (exit 1); exit 1; }; }
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then the parent directory.
+  ac_confdir=`$as_dirname -- "$0" ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$0" : 'X\(//\)[^/]' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$0" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  srcdir=$ac_confdir
+  if test ! -r "$srcdir/$ac_unique_file"; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+  { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+   { (exit 1); exit 1; }; }
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+	cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
+   { (exit 1); exit 1; }; }
+	pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+  srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+  eval ac_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_env_${ac_var}_value=\$${ac_var}
+  eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+  # Omit some internal or obsolete options to make the list less imposing.
+  # This message is too long to be a string in the A/UX 3.1 sh.
+  cat <<_ACEOF
+\`configure' configures portage 2.1.20 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print \`checking...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+			  [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+			  [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR           user executables [EPREFIX/bin]
+  --sbindir=DIR          system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR       program executables [EPREFIX/libexec]
+  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
+  --libdir=DIR           object code libraries [EPREFIX/lib]
+  --includedir=DIR       C header files [PREFIX/include]
+  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
+  --datarootdir=DIR      read-only arch.-independent data root [PREFIX/share]
+  --datadir=DIR          read-only architecture-independent data [DATAROOTDIR]
+  --infodir=DIR          info documentation [DATAROOTDIR/info]
+  --localedir=DIR        locale-dependent data [DATAROOTDIR/locale]
+  --mandir=DIR           man documentation [DATAROOTDIR/man]
+  --docdir=DIR           documentation root [DATAROOTDIR/doc/portage-prefix]
+  --htmldir=DIR          html documentation [DOCDIR]
+  --dvidir=DIR           dvi documentation [DOCDIR]
+  --pdfdir=DIR           pdf documentation [DOCDIR]
+  --psdir=DIR            ps documentation [DOCDIR]
+_ACEOF
+
+  cat <<\_ACEOF
+
+Program names:
+  --program-prefix=PREFIX            prepend PREFIX to installed program names
+  --program-suffix=SUFFIX            append SUFFIX to installed program names
+  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+  --target=TARGET   configure for building compilers for TARGET [HOST]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of portage 2.1.20:";;
+   esac
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors
+  --enable-tbz2tool       build tbz2tool, tool for creating binpkgs (default
+                          yes)
+  --enable-missingos      build compatibility missingos code for python 2.2
+                          (default auto)
+  --enable-just-compiled-sources
+                          install just the bytecode, not the sources (default
+                          no)
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-user=me          use user 'me' for portage to work as (default
+                          portage)
+  --with-group=mygroup    use group 'mygroup' for portage to work as (default
+                          portage)
+  --with-wheelgid=wheelgid
+                          let portage use 'wheelgid' as wheel group (default
+                          0)
+  --with-rootuser=me      declares 'me' as the portage owner (default root)
+  --with-offset-prefix    specify the installation prefix for all packages ,
+                          defaults to /
+  --with-default-path     specify additional PATHs available to the portage
+                          build environment
+
+Some influential environment variables:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  LIBS        libraries to pass to the linker, e.g. -l<library>
+  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+              you have headers in a nonstandard directory <include dir>
+  CPP         C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <grobian@gentoo.org>.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d "$ac_dir" || continue
+    ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+    cd "$ac_dir" || { ac_status=$?; continue; }
+    # Check for guested configure.
+    if test -f "$ac_srcdir/configure.gnu"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+    elif test -f "$ac_srcdir/configure"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure" --help=recursive
+    else
+      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi || ac_status=$?
+    cd "$ac_pwd" || { ac_status=$?; break; }
+  done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+  cat <<\_ACEOF
+portage configure 2.1.20
+generated by GNU Autoconf 2.61
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit
+fi
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by portage $as_me 2.1.20, which was
+generated by GNU Autoconf 2.61.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  echo "PATH: $as_dir"
+done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *\'*)
+      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+    2)
+      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+	ac_must_keep_next=false # Got value, back to normal.
+      else
+	case $ac_arg in
+	  *=* | --config-cache | -C | -disable-* | --disable-* \
+	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+	  | -with-* | --with-* | -without-* | --without-* | --x)
+	    case "$ac_configure_args0 " in
+	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+	    esac
+	    ;;
+	  -* ) ac_must_keep_next=true ;;
+	esac
+      fi
+      ac_configure_args="$ac_configure_args '$ac_arg'"
+      ;;
+    esac
+  done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
+
+    cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+(
+  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      *) $as_unset $ac_var ;;
+      esac ;;
+    esac
+  done
+  (set) 2>&1 |
+    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      sed -n \
+	"s/'\''/'\''\\\\'\'''\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+      ;; #(
+    *)
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+)
+    echo
+
+    cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=\$$ac_var
+      case $ac_val in
+      *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      esac
+      echo "$ac_var='\''$ac_val'\''"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      cat <<\_ASBOX
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
+_ASBOX
+      echo
+      for ac_var in $ac_subst_files
+      do
+	eval ac_val=\$$ac_var
+	case $ac_val in
+	*\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+	esac
+	echo "$ac_var='\''$ac_val'\''"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+      echo
+      cat confdefs.h
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      echo "$as_me: caught signal $ac_signal"
+    echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core core.conftest.* &&
+    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -n "$CONFIG_SITE"; then
+  set x "$CONFIG_SITE"
+elif test "x$prefix" != xNONE; then
+  set x "$prefix/share/config.site" "$prefix/etc/config.site"
+else
+  set x "$ac_default_prefix/share/config.site" \
+	"$ac_default_prefix/etc/config.site"
+fi
+shift
+for ac_site_file
+do
+  if test -r "$ac_site_file"; then
+    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file"
+  fi
+done
+
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special
+  # files actually), so we avoid doing that.
+  if test -f "$cache_file"; then
+    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . "$cache_file";;
+      *)                      . "./$cache_file";;
+    esac
+  fi
+else
+  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val=\$ac_cv_env_${ac_var}_value
+  eval ac_new_val=\$ac_env_${ac_var}_value
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+	{ echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+	{ echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
+echo "$as_me:   former value:  $ac_old_val" >&2;}
+	{ echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
+echo "$as_me:   current value: $ac_new_val" >&2;}
+	ac_cache_corrupted=:
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+case "${prefix}" in
+	'') 	{ { echo "$as_me:$LINENO: error: bad value ${prefix} for --prefix, must not be empty" >&5
+echo "$as_me: error: bad value ${prefix} for --prefix, must not be empty" >&2;}
+   { (exit 1); exit 1; }; } ;;
+	*/)		{ { echo "$as_me:$LINENO: error: bad value ${prefix} for --prefix, must not end with '/'" >&5
+echo "$as_me: error: bad value ${prefix} for --prefix, must not end with '/'" >&2;}
+   { (exit 1); exit 1; }; } ;;
+	/*|NONE) ;;
+	*) 		{ { echo "$as_me:$LINENO: error: bad value ${prefix} for --prefix, must start with /" >&5
+echo "$as_me: error: bad value ${prefix} for --prefix, must start with /" >&2;}
+   { (exit 1); exit 1; }; } ;;
+esac
+
+ac_aux_dir=
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+  if test -f "$ac_dir/install-sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f "$ac_dir/install.sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f "$ac_dir/shtool"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
+echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
+
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
+echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
+   { (exit 1); exit 1; }; }
+
+{ echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6; }
+if test "${ac_cv_build+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+   { (exit 1); exit 1; }; }
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+  { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
+echo "$as_me: error: invalid value of canonical build" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6; }
+if test "${ac_cv_host+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "x$host_alias" = x; then
+  ac_cv_host=$ac_cv_build
+else
+  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+    { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
+echo "$as_me: error: invalid value of canonical host" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+{ echo "$as_me:$LINENO: checking target system type" >&5
+echo $ECHO_N "checking target system type... $ECHO_C" >&6; }
+if test "${ac_cv_target+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "x$target_alias" = x; then
+  ac_cv_target=$ac_cv_host
+else
+  ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
+    { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_target" >&5
+echo "${ECHO_T}$ac_cv_target" >&6; }
+case $ac_cv_target in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical target" >&5
+echo "$as_me: error: invalid value of canonical target" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
+target=$ac_cv_target
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_target
+shift
+target_cpu=$1
+target_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+target_os=$*
+IFS=$ac_save_IFS
+case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac
+
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+test -n "$target_alias" &&
+  test "$program_prefix$program_suffix$program_transform_name" = \
+    NONENONEs,x,x, &&
+  program_prefix=${target_alias}-
+
+am__api_version='1.10'
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+  ./ | .// | /cC/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+	  if test $ac_prog = install &&
+	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
+	  else
+	    ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+	    break 3
+	  fi
+	fi
+      done
+    done
+    ;;
+esac
+done
+IFS=$as_save_IFS
+
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    INSTALL=$ac_install_sh
+  fi
+fi
+{ echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; }
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$*" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$*" != "X $srcdir/configure conftest.file" \
+      && test "$*" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      { { echo "$as_me:$LINENO: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&5
+echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&2;}
+   { (exit 1); exit 1; }; }
+   fi
+
+   test "$2" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+test "$program_prefix" != NONE &&
+  program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.  echo might interpret backslashes.
+# By default was `s,x,x', remove it if useless.
+cat <<\_ACEOF >conftest.sed
+s/[\\$]/&&/g;s/;s,x,x,$//
+_ACEOF
+program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
+rm -f conftest.sed
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+{ echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
+echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; }
+if test -z "$MKDIR_P"; then
+  if test "${ac_cv_path_mkdir+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in mkdir gmkdir; do
+	 for ac_exec_ext in '' $ac_executable_extensions; do
+	   { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+	   case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+	     'mkdir (GNU coreutils) '* | \
+	     'mkdir (coreutils) '* | \
+	     'mkdir (fileutils) '4.1*)
+	       ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+	       break 3;;
+	   esac
+	 done
+       done
+done
+IFS=$as_save_IFS
+
+fi
+
+  if test "${ac_cv_path_mkdir+set}" = set; then
+    MKDIR_P="$ac_cv_path_mkdir -p"
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for MKDIR_P within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    test -d ./--version && rmdir ./--version
+    MKDIR_P="$ac_install_sh -d"
+  fi
+fi
+{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5
+echo "${ECHO_T}$MKDIR_P" >&6; }
+
+mkdir_p="$MKDIR_P"
+case $mkdir_p in
+  [\\/$]* | ?:[\\/]*) ;;
+  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+
+for ac_prog in gawk mawk nawk awk
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_AWK+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_AWK="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  { echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$AWK" && break
+done
+
+{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; }
+set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+	@echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+  *@@@%%%=?*=@@@%%%*)
+    eval ac_cv_prog_make_${ac_make}_set=yes;;
+  *)
+    eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+  SET_MAKE=
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+  # is not polluted with repeated "-I."
+  am__isrc=' -I$(srcdir)'
+  # test to see if srcdir already configured
+  if test -f $srcdir/config.status; then
+    { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='portage-prefix'
+ VERSION='2.1.20'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    STRIP=$ac_ct_STRIP
+  fi
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+
+
+if test "x$CFLAGS" != "x"
+then
+CFLAGS=$CFLAGS
+fi
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  fi
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -V >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; }
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+#
+# List of possible output files, starting from the most likely.
+# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
+# only as a last resort.  b.out is created by i960 compilers.
+ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
+#
+# The IRIX 6 linker writes into existing files which may not be
+# executable, retaining their permissions.  Remove them first so a
+# subsequent execution test works.
+ac_rmfiles=
+for ac_file in $ac_files
+do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+  esac
+done
+rm -f $ac_rmfiles
+
+if { (ac_try="$ac_link_default"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link_default") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile.  We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
+	;;
+    [ab].out )
+	# We found the default executable, but exeext='' is most
+	# certainly right.
+	break;;
+    *.* )
+        if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+	then :; else
+	   ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	fi
+	# We set ac_cv_exeext here because the later test for it is not
+	# safe: cross compilers may not add the suffix if given an `-o'
+	# argument, so we may need to know it at that point already.
+	# Even if this section looks crufty: it has the advantage of
+	# actually working.
+	break;;
+    * )
+	break;;
+  esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+  ac_file=''
+fi
+
+{ echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6; }
+if test -z "$ac_file"; then
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; }
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+  if { ac_try='./$ac_file'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+	cross_compiling=yes
+    else
+	{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+  fi
+fi
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6; }
+
+{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	  break;;
+    * ) break;;
+  esac
+done
+else
+  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
+if test "${ac_cv_objext+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  for ac_file in conftest.o conftest.obj conftest.*; do
+  test -f "$ac_file" || continue;
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	CFLAGS=""
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_c_werror_flag=$ac_save_c_werror_flag
+	 CFLAGS="-g"
+	 cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_c89=$ac_arg
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6; } ;;
+  xno)
+    { echo "$as_me:$LINENO: result: unsupported" >&5
+echo "${ECHO_T}unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+	@echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+
+
+{ echo "$as_me:$LINENO: result: $_am_result" >&5
+echo "${ECHO_T}$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then
+  enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+  AMDEP_TRUE=
+  AMDEP_FALSE='#'
+else
+  AMDEP_TRUE='#'
+  AMDEP_FALSE=
+fi
+
+
+
+depcc="$CC"   am_compiler_list=
+
+{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CC_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+  am__fastdepCC_TRUE=
+  am__fastdepCC_FALSE='#'
+else
+  am__fastdepCC_TRUE='#'
+  am__fastdepCC_FALSE=
+fi
+
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+  ./ | .// | /cC/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+	  if test $ac_prog = install &&
+	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
+	  else
+	    ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+	    break 3
+	  fi
+	fi
+      done
+    done
+    ;;
+esac
+done
+IFS=$as_save_IFS
+
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    INSTALL=$ac_install_sh
+  fi
+fi
+{ echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6; }
+fi
+
+{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
+echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # Extract the first word of "grep ggrep" to use in msg output
+if test -z "$GREP"; then
+set dummy grep ggrep; ac_prog_name=$2
+if test "${ac_cv_path_GREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_path_GREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in grep ggrep; do
+  for ac_exec_ext in '' $ac_executable_extensions; do
+    ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+    { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+    # Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    ac_count=`expr $ac_count + 1`
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+    $ac_path_GREP_found && break 3
+  done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+GREP="$ac_cv_path_GREP"
+if test -z "$GREP"; then
+  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+else
+  ac_cv_path_GREP=$GREP
+fi
+
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
+echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     # Extract the first word of "egrep" to use in msg output
+if test -z "$EGREP"; then
+set dummy egrep; ac_prog_name=$2
+if test "${ac_cv_path_EGREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_path_EGREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in egrep; do
+  for ac_exec_ext in '' $ac_executable_extensions; do
+    ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+    { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+    # Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    ac_count=`expr $ac_count + 1`
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+    $ac_path_EGREP_found && break 3
+  done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+EGREP="$ac_cv_path_EGREP"
+if test -z "$EGREP"; then
+  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+else
+  ac_cv_path_EGREP=$EGREP
+fi
+
+
+   fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+
+
+  # Extract the first word of "id", so it can be a program name with args.
+set dummy id; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_XCU_ID+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $XCU_ID in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_XCU_ID="$XCU_ID" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_XCU_ID="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_XCU_ID" && ac_cv_path_XCU_ID="no"
+  ;;
+esac
+fi
+XCU_ID=$ac_cv_path_XCU_ID
+if test -n "$XCU_ID"; then
+  { echo "$as_me:$LINENO: result: $XCU_ID" >&5
+echo "${ECHO_T}$XCU_ID" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+
+    if test "$PYTHON" = "no" ; then
+    { { echo "$as_me:$LINENO: error: no python found in your path" >&5
+echo "$as_me: error: no python found in your path" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+
+    { echo "$as_me:$LINENO: checking whether $XCU_ID is good enough" >&5
+echo $ECHO_N "checking whether $XCU_ID is good enough... $ECHO_C" >&6; }
+  for a in '' '-G' '-Gn' '-g' '-gn' '-gr' '-gnr' '-u' '-un' '-ur' '-unr' ; do
+    "$XCU_ID" $a >/dev/null 2>&1 || { XCU_ID=no ; break ; }
+  done
+  if test "$XCU_ID" != "no" ; then
+    { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+  else
+    { { echo "$as_me:$LINENO: error: $XCU_ID doesn't understand $a" >&5
+echo "$as_me: error: $XCU_ID doesn't understand $a" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+
+
+  # Extract the first word of "python", so it can be a program name with args.
+set dummy python; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_PYTHON+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $PYTHON in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_PYTHON" && ac_cv_path_PYTHON="no"
+  ;;
+esac
+fi
+PYTHON=$ac_cv_path_PYTHON
+if test -n "$PYTHON"; then
+  { echo "$as_me:$LINENO: result: $PYTHON" >&5
+echo "${ECHO_T}$PYTHON" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+
+    if test "$PYTHON" = "no" ; then
+    { { echo "$as_me:$LINENO: error: no python found in your path" >&5
+echo "$as_me: error: no python found in your path" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+
+    ver=`$PYTHON -c 'import sys; print sys.version.split(" ")[0]'`
+  { echo "$as_me:$LINENO: checking whether $PYTHON $ver >= 2.4" >&5
+echo $ECHO_N "checking whether $PYTHON $ver >= 2.4... $ECHO_C" >&6; }
+  cmp=`$PYTHON -c 'import sys; print sys.version.split(" ")[0] >= "2.4"'`
+  if test "$cmp" = "True" ; then
+    { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+  else
+    { { echo "$as_me:$LINENO: error: need at least version 2.4 of python" >&5
+echo "$as_me: error: need at least version 2.4 of python" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+
+
+# Extract the first word of "rm", so it can be a program name with args.
+set dummy rm; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_RM+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $RM in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_RM="$RM" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_RM="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_RM" && ac_cv_path_RM="no"
+  ;;
+esac
+fi
+RM=$ac_cv_path_RM
+if test -n "$RM"; then
+  { echo "$as_me:$LINENO: result: $RM" >&5
+echo "${ECHO_T}$RM" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+# Extract the first word of "mv", so it can be a program name with args.
+set dummy mv; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_MV+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $MV in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_MV="$MV" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_MV="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_MV" && ac_cv_path_MV="no"
+  ;;
+esac
+fi
+MV=$ac_cv_path_MV
+if test -n "$MV"; then
+  { echo "$as_me:$LINENO: result: $MV" >&5
+echo "${ECHO_T}$MV" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+# Extract the first word of "basename", so it can be a program name with args.
+set dummy basename; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_BASENAME+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $BASENAME in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BASENAME="$BASENAME" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_BASENAME="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_BASENAME" && ac_cv_path_BASENAME="no"
+  ;;
+esac
+fi
+BASENAME=$ac_cv_path_BASENAME
+if test -n "$BASENAME"; then
+  { echo "$as_me:$LINENO: result: $BASENAME" >&5
+echo "${ECHO_T}$BASENAME" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+# Extract the first word of "dirname", so it can be a program name with args.
+set dummy dirname; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_DIRNAME+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $DIRNAME in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_DIRNAME="$DIRNAME" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_DIRNAME="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_DIRNAME" && ac_cv_path_DIRNAME="no"
+  ;;
+esac
+fi
+DIRNAME=$ac_cv_path_DIRNAME
+if test -n "$DIRNAME"; then
+  { echo "$as_me:$LINENO: result: $DIRNAME" >&5
+echo "${ECHO_T}$DIRNAME" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+unset BASH
+
+  # Extract the first word of "bash", so it can be a program name with args.
+set dummy bash; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_BASH+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $BASH in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BASH="$BASH" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_BASH="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_BASH" && ac_cv_path_BASH="no"
+  ;;
+esac
+fi
+BASH=$ac_cv_path_BASH
+if test -n "$BASH"; then
+  { echo "$as_me:$LINENO: result: $BASH" >&5
+echo "${ECHO_T}$BASH" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+
+    tool="`eval echo \$BASH`"
+  if test "$tool" = "no" ; then
+    { { echo "$as_me:$LINENO: error: BASH was not found in your path" >&5
+echo "$as_me: error: BASH was not found in your path" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+
+    { echo "$as_me:$LINENO: checking whether $tool is GNU bash" >&5
+echo $ECHO_N "checking whether $tool is GNU bash... $ECHO_C" >&6; }
+  ver=`$tool --version 2>/dev/null | head -n 1`
+  case $ver in
+    *GNU*)
+      { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+    ;;
+    *)
+      { { echo "$as_me:$LINENO: error: no" >&5
+echo "$as_me: error: no" >&2;}
+   { (exit 1); exit 1; }; }
+    ;;
+  esac
+
+
+  # Extract the first word of "sed", so it can be a program name with args.
+set dummy sed; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_SED+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $SED in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_SED="$SED" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_SED="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_SED" && ac_cv_path_SED="no"
+  ;;
+esac
+fi
+SED=$ac_cv_path_SED
+if test -n "$SED"; then
+  { echo "$as_me:$LINENO: result: $SED" >&5
+echo "${ECHO_T}$SED" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+
+    tool="`eval echo \$SED`"
+  if test "$tool" = "no" ; then
+    { { echo "$as_me:$LINENO: error: SED was not found in your path" >&5
+echo "$as_me: error: SED was not found in your path" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+
+    { echo "$as_me:$LINENO: checking whether $tool is GNU sed" >&5
+echo $ECHO_N "checking whether $tool is GNU sed... $ECHO_C" >&6; }
+  ver=`$tool --version 2>/dev/null | head -n 1`
+  case $ver in
+    *GNU*)
+      { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+    ;;
+    *)
+      { { echo "$as_me:$LINENO: error: no" >&5
+echo "$as_me: error: no" >&2;}
+   { (exit 1); exit 1; }; }
+    ;;
+  esac
+
+
+  # Extract the first word of "wget", so it can be a program name with args.
+set dummy wget; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_WGET+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $WGET in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_WGET="$WGET" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_WGET="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_WGET" && ac_cv_path_WGET="no"
+  ;;
+esac
+fi
+WGET=$ac_cv_path_WGET
+if test -n "$WGET"; then
+  { echo "$as_me:$LINENO: result: $WGET" >&5
+echo "${ECHO_T}$WGET" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+
+    tool="`eval echo \$WGET`"
+  if test "$tool" = "no" ; then
+    { { echo "$as_me:$LINENO: error: WGET was not found in your path" >&5
+echo "$as_me: error: WGET was not found in your path" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+
+    { echo "$as_me:$LINENO: checking whether $tool is GNU wget" >&5
+echo $ECHO_N "checking whether $tool is GNU wget... $ECHO_C" >&6; }
+  ver=`$tool --version 2>/dev/null | head -n 1`
+  case $ver in
+    *GNU*)
+      { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+    ;;
+    *)
+      { { echo "$as_me:$LINENO: error: no" >&5
+echo "$as_me: error: no" >&2;}
+   { (exit 1); exit 1; }; }
+    ;;
+  esac
+
+
+  # Extract the first word of "find", so it can be a program name with args.
+set dummy find; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_FIND+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $FIND in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_FIND="$FIND" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_FIND="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_FIND" && ac_cv_path_FIND="no"
+  ;;
+esac
+fi
+FIND=$ac_cv_path_FIND
+if test -n "$FIND"; then
+  { echo "$as_me:$LINENO: result: $FIND" >&5
+echo "${ECHO_T}$FIND" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+
+    tool="`eval echo \$FIND`"
+  if test "$tool" = "no" ; then
+    { { echo "$as_me:$LINENO: error: FIND was not found in your path" >&5
+echo "$as_me: error: FIND was not found in your path" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+
+    { echo "$as_me:$LINENO: checking whether $tool is GNU find" >&5
+echo $ECHO_N "checking whether $tool is GNU find... $ECHO_C" >&6; }
+  ver=`$tool --version 2>/dev/null | head -n 1`
+  case $ver in
+    *GNU*)
+      { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+    ;;
+    *)
+      { { echo "$as_me:$LINENO: error: no" >&5
+echo "$as_me: error: no" >&2;}
+   { (exit 1); exit 1; }; }
+    ;;
+  esac
+
+
+  # Extract the first word of "xargs", so it can be a program name with args.
+set dummy xargs; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_XARGS+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $XARGS in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_XARGS="$XARGS" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_XARGS="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_XARGS" && ac_cv_path_XARGS="no"
+  ;;
+esac
+fi
+XARGS=$ac_cv_path_XARGS
+if test -n "$XARGS"; then
+  { echo "$as_me:$LINENO: result: $XARGS" >&5
+echo "${ECHO_T}$XARGS" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+
+    tool="`eval echo \$XARGS`"
+  if test "$tool" = "no" ; then
+    { { echo "$as_me:$LINENO: error: XARGS was not found in your path" >&5
+echo "$as_me: error: XARGS was not found in your path" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+
+    { echo "$as_me:$LINENO: checking whether $tool is GNU xargs" >&5
+echo $ECHO_N "checking whether $tool is GNU xargs... $ECHO_C" >&6; }
+  ver=`$tool --version 2>/dev/null | head -n 1`
+  case $ver in
+    *GNU*)
+      { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+    ;;
+    *)
+      { { echo "$as_me:$LINENO: error: no" >&5
+echo "$as_me: error: no" >&2;}
+   { (exit 1); exit 1; }; }
+    ;;
+  esac
+
+
+  # Extract the first word of "grep", so it can be a program name with args.
+set dummy grep; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $GREP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_GREP="$GREP" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_GREP="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_GREP" && ac_cv_path_GREP="no"
+  ;;
+esac
+fi
+GREP=$ac_cv_path_GREP
+if test -n "$GREP"; then
+  { echo "$as_me:$LINENO: result: $GREP" >&5
+echo "${ECHO_T}$GREP" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+
+    tool="`eval echo \$GREP`"
+  if test "$tool" = "no" ; then
+    { { echo "$as_me:$LINENO: error: GREP was not found in your path" >&5
+echo "$as_me: error: GREP was not found in your path" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+
+    { echo "$as_me:$LINENO: checking whether $tool is GNU grep" >&5
+echo $ECHO_N "checking whether $tool is GNU grep... $ECHO_C" >&6; }
+  ver=`$tool --version 2>/dev/null | head -n 1`
+  case $ver in
+    *GNU*)
+      { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+    ;;
+    *)
+      { { echo "$as_me:$LINENO: error: no" >&5
+echo "$as_me: error: no" >&2;}
+   { (exit 1); exit 1; }; }
+    ;;
+  esac
+
+
+
+
+{ echo "$as_me:$LINENO: checking for main in -lc" >&5
+echo $ECHO_N "checking for main in -lc... $ECHO_C" >&6; }
+if test "${ac_cv_lib_c_main+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lc  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+
+int
+main ()
+{
+return main ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_c_main=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_c_main=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_c_main" >&5
+echo "${ECHO_T}$ac_cv_lib_c_main" >&6; }
+if test $ac_cv_lib_c_main = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBC 1
+_ACEOF
+
+  LIBS="-lc $LIBS"
+
+fi
+
+
+{ echo "$as_me:$LINENO: checking for main in -ldl" >&5
+echo $ECHO_N "checking for main in -ldl... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dl_main+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+
+int
+main ()
+{
+return main ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dl_main=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_dl_main=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_main" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_main" >&6; }
+if test $ac_cv_lib_dl_main = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBDL 1
+_ACEOF
+
+  LIBS="-ldl $LIBS"
+
+fi
+
+
+{ echo "$as_me:$LINENO: checking for main in -lgcc" >&5
+echo $ECHO_N "checking for main in -lgcc... $ECHO_C" >&6; }
+if test "${ac_cv_lib_gcc_main+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lgcc  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+
+int
+main ()
+{
+return main ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_gcc_main=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_gcc_main=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_gcc_main" >&5
+echo "${ECHO_T}$ac_cv_lib_gcc_main" >&6; }
+if test $ac_cv_lib_gcc_main = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBGCC 1
+_ACEOF
+
+  LIBS="-lgcc $LIBS"
+
+fi
+
+
+{ echo "$as_me:$LINENO: checking for main in -lpthread" >&5
+echo $ECHO_N "checking for main in -lpthread... $ECHO_C" >&6; }
+if test "${ac_cv_lib_pthread_main+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpthread  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+
+int
+main ()
+{
+return main ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_pthread_main=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_pthread_main=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_main" >&5
+echo "${ECHO_T}$ac_cv_lib_pthread_main" >&6; }
+if test $ac_cv_lib_pthread_main = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBPTHREAD 1
+_ACEOF
+
+  LIBS="-lpthread $LIBS"
+
+fi
+
+
+
+
+
+
+
+ac_header_dirent=no
+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
+  as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5
+echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <$ac_hdr>
+
+int
+main ()
+{
+if ((DIR *) 0)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	eval "$as_ac_Header=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
+_ACEOF
+
+ac_header_dirent=$ac_hdr; break
+fi
+
+done
+# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
+if test $ac_header_dirent = dirent.h; then
+  { echo "$as_me:$LINENO: checking for library containing opendir" >&5
+echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6; }
+if test "${ac_cv_search_opendir+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char opendir ();
+int
+main ()
+{
+return opendir ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' dir; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_search_opendir=$ac_res
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext
+  if test "${ac_cv_search_opendir+set}" = set; then
+  break
+fi
+done
+if test "${ac_cv_search_opendir+set}" = set; then
+  :
+else
+  ac_cv_search_opendir=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
+echo "${ECHO_T}$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+else
+  { echo "$as_me:$LINENO: checking for library containing opendir" >&5
+echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6; }
+if test "${ac_cv_search_opendir+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char opendir ();
+int
+main ()
+{
+return opendir ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' x; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_search_opendir=$ac_res
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext
+  if test "${ac_cv_search_opendir+set}" = set; then
+  break
+fi
+done
+if test "${ac_cv_search_opendir+set}" = set; then
+  :
+else
+  ac_cv_search_opendir=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
+echo "${ECHO_T}$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if test "${ac_cv_prog_CPP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+{ echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  :
+else
+  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_header_stdc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_header_stdc=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then
+  :
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      return 2;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+{ echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6; }
+if test "${ac_cv_header_sys_wait_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <sys/wait.h>
+#ifndef WEXITSTATUS
+# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8)
+#endif
+#ifndef WIFEXITED
+# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#endif
+
+int
+main ()
+{
+  int s;
+  wait (&s);
+  s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_header_sys_wait_h=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_header_sys_wait_h=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6; }
+if test $ac_cv_header_sys_wait_h = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_SYS_WAIT_H 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+		  inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	eval "$as_ac_Header=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+
+
+
+
+
+for ac_header in fcntl.h limits.h strings.h sys/file.h sys/time.h unistd.h getopt.h stdio.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    ( cat <<\_ASBOX
+## --------------------------------- ##
+## Report this to grobian@gentoo.org ##
+## --------------------------------- ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+{ echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; }
+if test "${ac_cv_c_const+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+  /* Ultrix mips cc rejects this.  */
+  typedef int charset[2];
+  const charset cs;
+  /* SunOS 4.1.1 cc rejects this.  */
+  char const *const *pcpcc;
+  char **ppc;
+  /* NEC SVR4.0.2 mips cc rejects this.  */
+  struct point {int x, y;};
+  static struct point const zero = {0,0};
+  /* AIX XL C 1.02.0.0 rejects this.
+     It does not let you subtract one const X* pointer from another in
+     an arm of an if-expression whose if-part is not a constant
+     expression */
+  const char *g = "string";
+  pcpcc = &g + (g ? g-g : 0);
+  /* HPUX 7.0 cc rejects these. */
+  ++pcpcc;
+  ppc = (char**) pcpcc;
+  pcpcc = (char const *const *) ppc;
+  { /* SCO 3.2v4 cc rejects this.  */
+    char *t;
+    char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+    *t++ = 0;
+    if (s) return 0;
+  }
+  { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
+    int x[] = {25, 17};
+    const int *foo = &x[0];
+    ++foo;
+  }
+  { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+    typedef const int *iptr;
+    iptr p = 0;
+    ++p;
+  }
+  { /* AIX XL C 1.02.0.0 rejects this saying
+       "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+    struct s { int j; const int *ap[3]; };
+    struct s *b; b->j = 5;
+  }
+  { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+    const int foo = 10;
+    if (!foo) return 0;
+  }
+  return !cs[0] && !zero.x;
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_c_const=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_c_const=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+echo "${ECHO_T}$ac_cv_c_const" >&6; }
+if test $ac_cv_c_const = no; then
+
+cat >>confdefs.h <<\_ACEOF
+#define const
+_ACEOF
+
+fi
+
+{ echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5
+echo $ECHO_N "checking for uid_t in sys/types.h... $ECHO_C" >&6; }
+if test "${ac_cv_type_uid_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "uid_t" >/dev/null 2>&1; then
+  ac_cv_type_uid_t=yes
+else
+  ac_cv_type_uid_t=no
+fi
+rm -f conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5
+echo "${ECHO_T}$ac_cv_type_uid_t" >&6; }
+if test $ac_cv_type_uid_t = no; then
+
+cat >>confdefs.h <<\_ACEOF
+#define uid_t int
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define gid_t int
+_ACEOF
+
+fi
+
+{ echo "$as_me:$LINENO: checking for mode_t" >&5
+echo $ECHO_N "checking for mode_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_mode_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef mode_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_mode_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_mode_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_mode_t" >&5
+echo "${ECHO_T}$ac_cv_type_mode_t" >&6; }
+if test $ac_cv_type_mode_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define mode_t int
+_ACEOF
+
+fi
+
+{ echo "$as_me:$LINENO: checking for size_t" >&5
+echo $ECHO_N "checking for size_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_size_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+typedef size_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_size_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_size_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
+echo "${ECHO_T}$ac_cv_type_size_t" >&6; }
+if test $ac_cv_type_size_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned int
+_ACEOF
+
+fi
+
+
+# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
+# for constant arguments.  Useless!
+{ echo "$as_me:$LINENO: checking for working alloca.h" >&5
+echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6; }
+if test "${ac_cv_working_alloca_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <alloca.h>
+int
+main ()
+{
+char *p = (char *) alloca (2 * sizeof (int));
+			  if (p) return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_working_alloca_h=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_working_alloca_h=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5
+echo "${ECHO_T}$ac_cv_working_alloca_h" >&6; }
+if test $ac_cv_working_alloca_h = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ALLOCA_H 1
+_ACEOF
+
+fi
+
+{ echo "$as_me:$LINENO: checking for alloca" >&5
+echo $ECHO_N "checking for alloca... $ECHO_C" >&6; }
+if test "${ac_cv_func_alloca_works+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# ifdef _MSC_VER
+#  include <malloc.h>
+#  define alloca _alloca
+# else
+#  ifdef HAVE_ALLOCA_H
+#   include <alloca.h>
+#  else
+#   ifdef _AIX
+ #pragma alloca
+#   else
+#    ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+#    endif
+#   endif
+#  endif
+# endif
+#endif
+
+int
+main ()
+{
+char *p = (char *) alloca (1);
+				    if (p) return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_func_alloca_works=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_func_alloca_works=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5
+echo "${ECHO_T}$ac_cv_func_alloca_works" >&6; }
+
+if test $ac_cv_func_alloca_works = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ALLOCA 1
+_ACEOF
+
+else
+  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
+# that cause trouble.  Some versions do not even contain alloca or
+# contain a buggy version.  If you still want to use their alloca,
+# use ar to extract alloca.o from them instead of compiling alloca.c.
+
+ALLOCA=\${LIBOBJDIR}alloca.$ac_objext
+
+cat >>confdefs.h <<\_ACEOF
+#define C_ALLOCA 1
+_ACEOF
+
+
+{ echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5
+echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6; }
+if test "${ac_cv_os_cray+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#if defined CRAY && ! defined CRAY2
+webecray
+#else
+wenotbecray
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "webecray" >/dev/null 2>&1; then
+  ac_cv_os_cray=yes
+else
+  ac_cv_os_cray=no
+fi
+rm -f conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5
+echo "${ECHO_T}$ac_cv_os_cray" >&6; }
+if test $ac_cv_os_cray = yes; then
+  for ac_func in _getb67 GETB67 getb67; do
+    as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	eval "$as_ac_var=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define CRAY_STACKSEG_END $ac_func
+_ACEOF
+
+    break
+fi
+
+  done
+fi
+
+{ echo "$as_me:$LINENO: checking stack direction for C alloca" >&5
+echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6; }
+if test "${ac_cv_c_stack_direction+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_c_stack_direction=0
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+find_stack_direction ()
+{
+  static char *addr = 0;
+  auto char dummy;
+  if (addr == 0)
+    {
+      addr = &dummy;
+      return find_stack_direction ();
+    }
+  else
+    return (&dummy > addr) ? 1 : -1;
+}
+
+int
+main ()
+{
+  return find_stack_direction () < 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_c_stack_direction=1
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_c_stack_direction=-1
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5
+echo "${ECHO_T}$ac_cv_c_stack_direction" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define STACK_DIRECTION $ac_cv_c_stack_direction
+_ACEOF
+
+
+fi
+
+{ echo "$as_me:$LINENO: checking return type of signal handlers" >&5
+echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6; }
+if test "${ac_cv_type_signal+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <signal.h>
+
+int
+main ()
+{
+return *(signal (0, 0)) (0) == 1;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_signal=int
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_signal=void
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5
+echo "${ECHO_T}$ac_cv_type_signal" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define RETSIGTYPE $ac_cv_type_signal
+_ACEOF
+
+
+
+
+
+
+
+
+
+
+for ac_func in getcwd mkdir regcomp rmdir strdup strerror strspn strstr
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	eval "$as_ac_var=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+# Check whether --enable-tbz2tool was given.
+if test "${enable_tbz2tool+set}" = set; then
+  enableval=$enable_tbz2tool; case "${enableval}" in
+  yes)  enable_tbz2tool=true;;
+  no)	enable_tbz2tool=false;;
+  *)	{ { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-tbz2tool" >&5
+echo "$as_me: error: bad value ${enableval} for --enable-tbz2tool" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
+else
+  enable_tbz2tool=true
+fi
+
+
+# Check whether --enable-missingos was given.
+if test "${enable_missingos+set}" = set; then
+  enableval=$enable_missingos; case "${enableval}" in
+  yes)	enable_missingos=true;;
+  no)	enable_missingos=false;;
+  auto)	enable_missingos=auto;;
+  *)	{ { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-missingos" >&5
+echo "$as_me: error: bad value ${enableval} for --enable-missingos" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
+else
+  enable_missingos=auto
+fi
+
+
+# Check whether --enable-just-compiled-sources was given.
+if test "${enable_just_compiled_sources+set}" = set; then
+  enableval=$enable_just_compiled_sources; case "${enableval}" in
+  yes)	enable_py_sources=false;;
+  no)	enable_py_sources=true;;
+  *)	{ { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-just-compiled-sources" >&5
+echo "$as_me: error: bad value ${enableval} for --enable-just-compiled-sources" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
+else
+  enable_py_sources=true
+fi
+
+
+
+# Check whether --with-user was given.
+if test "${with_user+set}" = set; then
+  withval=$with_user; case "${withval}" in
+  ""|yes) { { echo "$as_me:$LINENO: error: bad value ${withval} for --with-user" >&5
+echo "$as_me: error: bad value ${withval} for --with-user" >&2;}
+   { (exit 1); exit 1; }; };;
+  *) portageuser="${withval}";;
+esac
+else
+  portageuser="portage"
+fi
+
+
+
+# Check whether --with-group was given.
+if test "${with_group+set}" = set; then
+  withval=$with_group; case "${withval}" in
+  ""|yes) { { echo "$as_me:$LINENO: error: bad value ${withval} for --with-group" >&5
+echo "$as_me: error: bad value ${withval} for --with-group" >&2;}
+   { (exit 1); exit 1; }; };;
+  *) portagegroup="${withval}";;
+esac
+else
+  portagegroup="portage"
+fi
+
+
+
+# Check whether --with-wheelgid was given.
+if test "${with_wheelgid+set}" = set; then
+  withval=$with_wheelgid; case "${withval}" in
+  ""|yes) { { echo "$as_me:$LINENO: error: bad value ${withval} for --with-wheelgid" >&5
+echo "$as_me: error: bad value ${withval} for --with-wheelgid" >&2;}
+   { (exit 1); exit 1; }; };;
+  *) wheelgid="${withval}";;
+esac
+else
+  wheelgid="0"
+fi
+
+
+
+# Check whether --with-rootuser was given.
+if test "${with_rootuser+set}" = set; then
+  withval=$with_rootuser; case "${withval}" in
+  ""|yes) { { echo "$as_me:$LINENO: error: bad value ${withval} for --with-rootuser" >&5
+echo "$as_me: error: bad value ${withval} for --with-rootuser" >&2;}
+   { (exit 1); exit 1; }; };;
+  *) rootuser=${withval}
+     rootuid=`id -u ${withval}`;;
+esac
+else
+  rootuser=root
+fi
+
+
+{ echo "$as_me:$LINENO: checking for user id of ${rootuser}" >&5
+echo $ECHO_N "checking for user id of ${rootuser}... $ECHO_C" >&6; }
+rootuid=`${XCU_ID} -u ${rootuser}`
+if [ `echo ${rootuid} | ${EGREP} '^[[:digit:]]+$'` ]
+then
+	{ echo "$as_me:$LINENO: result: ${rootuid}" >&5
+echo "${ECHO_T}${rootuid}" >&6; }
+else
+	{ { echo "$as_me:$LINENO: error: error finding the user id of ${rootuser}" >&5
+echo "$as_me: error: error finding the user id of ${rootuser}" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+
+# Check whether --with-offset-prefix was given.
+if test "${with_offset_prefix+set}" = set; then
+  withval=$with_offset_prefix; DOMAIN_PREFIX=$withval
+else
+  DOMAIN_PREFIX='/'
+fi
+
+
+DEFAULT_PATH="${DOMAIN_PREFIX}/usr/bin:${DOMAIN_PREFIX}/usr/sbin:${DOMAIN_PREFIX}/bin:${DOMAIN_PREFIX}/sbin:${prefix}/bin"
+
+# Check whether --with-default-path was given.
+if test "${with_default_path+set}" = set; then
+  withval=$with_default_path; DEFAULT_PATH="${DEFAULT_PATH}":$withval
+else
+  DEFAULT_PATH="${DEFAULT_PATH}"
+fi
+
+
+
+if test x$enable_missingos = xauto
+then
+  pyver=`python -c 'import sys;print sys.version[0:3]';`
+  case ${pyver} in
+    2.4)  ;;
+    2.3)  ;;
+    2.2)  enable_missingos=true;;
+    *)    { echo "$as_me:$LINENO: WARNING: unable to determine python version, ${pyver}" >&5
+echo "$as_me: WARNING: unable to determine python version, ${pyver}" >&2;};;
+  esac
+fi
+
+{ echo "$as_me:$LINENO: checking for ARCH to be used" >&5
+echo $ECHO_N "checking for ARCH to be used... $ECHO_C" >&6; }
+case "${target_cpu}" in
+i?86) ARCH=x86 ;;
+sparc*) ARCH=sparc ;;
+hppa*) ARCH=hppa ;;
+powerpc*) ARCH=ppc ;;
+*) { echo "$as_me:$LINENO: result: unknown" >&5
+echo "${ECHO_T}unknown" >&6; }
+   { echo "$as_me:$LINENO: checking for default ARCH to be used" >&5
+echo $ECHO_N "checking for default ARCH to be used... $ECHO_C" >&6; }
+   ARCH=${target_cpu} ;;
+esac
+{ echo "$as_me:$LINENO: result: ${ARCH}" >&5
+echo "${ECHO_T}${ARCH}" >&6; }
+
+ac_config_files="$ac_config_files Makefile"
+
+ac_config_files="$ac_config_files subst-install"
+
+ac_config_files="$ac_config_files subst-install.vars.in"
+
+ac_config_files="$ac_config_files src/Makefile"
+
+ac_config_files="$ac_config_files man/Makefile"
+
+ac_config_files="$ac_config_files src/python-missingos/Makefile"
+
+ac_config_files="$ac_config_files bin/Makefile"
+
+ac_config_files="$ac_config_files pym/Makefile"
+
+ac_config_files="$ac_config_files cnf/Makefile"
+
+
+
+
+
+
+
+
+
+
+PORTAGE_BASE='${exec_prefix}/lib/portage'
+
+ if test x$enable_py_sources = xtrue; then
+  INSTALL_PYTHON_SOURCES_TRUE=
+  INSTALL_PYTHON_SOURCES_FALSE='#'
+else
+  INSTALL_PYTHON_SOURCES_TRUE='#'
+  INSTALL_PYTHON_SOURCES_FALSE=
+fi
+
+ if test x$enable_tbz2tool = xtrue; then
+  BUILD_TBZ2TOOL_TRUE=
+  BUILD_TBZ2TOOL_FALSE='#'
+else
+  BUILD_TBZ2TOOL_TRUE='#'
+  BUILD_TBZ2TOOL_FALSE=
+fi
+
+ if test x$enable_missingos = xtrue; then
+  BUILD_MISSINGOS_TRUE=
+  BUILD_MISSINGOS_FALSE='#'
+else
+  BUILD_MISSINGOS_TRUE='#'
+  BUILD_MISSINGOS_FALSE=
+fi
+
+#AM_CONDITIONAL(BUILD_FILTER_ENV, test x$enable_filter_env = xtrue)
+
+{ echo "$as_me:$LINENO: checking for a list of variables known by configure" >&5
+echo $ECHO_N "checking for a list of variables known by configure... $ECHO_C" >&6; }
+pt_configvars=`sed -n -e "/^ac_subst_vars='/,/'$/p" ${srcdir}/configure | sed -e "s/^ac_subst_vars='//" -e "s/'$//"`
+{
+	pt_all_configurevars=
+	for pt_configvar in ${pt_configvars}
+	do
+		echo "${pt_configvar}=@${pt_configvar}@"
+		pt_all_configurevars="${pt_all_configurevars} ${pt_configvar}"
+	done
+
+	echo "all_configurevars='${pt_all_configurevars}'"
+
+} > subst-install.vars.in.in
+$as_unset pt_configvar pt_configvars pt_all_configurevars
+{ echo "$as_me:$LINENO: result: ok" >&5
+echo "${ECHO_T}ok" >&6; }
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+  for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      *) $as_unset $ac_var ;;
+      esac ;;
+    esac
+  done
+
+  (set) 2>&1 |
+    case $as_nl`(ac_space=' '; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      # `set' does not quote correctly, so add quotes (double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \).
+      sed -n \
+	"s/'/'\\\\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;; #(
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+) |
+  sed '
+     /^ac_cv_env_/b end
+     t clear
+     :clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+  if test -w "$cache_file"; then
+    test "x$cache_file" != "x/dev/null" &&
+      { echo "$as_me:$LINENO: updating cache $cache_file" >&5
+echo "$as_me: updating cache $cache_file" >&6;}
+    cat confcache >$cache_file
+  else
+    { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+  fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then branch to the quote section.  Otherwise,
+# look for a macro that doesn't take arguments.
+ac_script='
+t clear
+:clear
+s/^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 (][^	 (]*([^)]*)\)[	 ]*\(.*\)/-D\1=\2/g
+t quote
+s/^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 ][^	 ]*\)[	 ]*\(.*\)/-D\1=\2/g
+t quote
+b any
+:quote
+s/[	 `~#$^&*(){}\\|;'\''"<>?]/\\&/g
+s/\[/\\&/g
+s/\]/\\&/g
+s/\$/$$/g
+H
+:any
+${
+	g
+	s/^\n//
+	s/\n/ /g
+	p
+}
+'
+DEFS=`sed -n "$ac_script" confdefs.h`
+
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+  ac_i=`echo "$ac_i" | sed "$ac_script"`
+  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
+  #    will be set to the directory where LIBOBJS objects are built.
+  ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${INSTALL_PYTHON_SOURCES_TRUE}" && test -z "${INSTALL_PYTHON_SOURCES_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"INSTALL_PYTHON_SOURCES\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"INSTALL_PYTHON_SOURCES\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_TBZ2TOOL_TRUE}" && test -z "${BUILD_TBZ2TOOL_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"BUILD_TBZ2TOOL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_TBZ2TOOL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_MISSINGOS_TRUE}" && test -z "${BUILD_MISSINGOS_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"BUILD_MISSINGOS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_MISSINGOS\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" ""	$as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+case $0 in
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line after each line using $LINENO; the second 'sed'
+  # does the real work.  The second script uses 'N' to pair each
+  # line-number line with the line containing $LINENO, and appends
+  # trailing '-' during substitution so that $LINENO is not a special
+  # case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # scripts with optimization help from Paolo Bonzini.  Blame Lee
+  # E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    ' >$as_me.lineno &&
+  chmod +x "$as_me.lineno" ||
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+  case `echo 'x\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  *)   ECHO_C='\c';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir
+fi
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s='ln -s'
+  # ... but there are two gotchas:
+  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+  # In both cases, we have to default to `cp -p'.
+  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+    as_ln_s='cp -p'
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+        test -d "$1/.";
+      else
+	case $1 in
+        -*)set "./$1";;
+	esac;
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+	???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+
+# Save the log message, to keep $[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by portage $as_me 2.1.20, which was
+generated by GNU Autoconf 2.61.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number and configuration settings, then exit
+  -q, --quiet      do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+  --file=FILE[:TEMPLATE]
+		   instantiate the configuration file FILE
+
+Configuration files:
+$config_files
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf@gnu.org>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+portage config.status 2.1.20
+configured by $0, generated by GNU Autoconf 2.61,
+  with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2006 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value.  By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=*)
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  *)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+    echo "$ac_cs_version"; exit ;;
+  --debug | --debu | --deb | --de | --d | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+    ac_need_defaults=false;;
+  --he | --h |  --help | --hel | -h )
+    echo "$ac_cs_usage"; exit ;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) { echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; } ;;
+
+  *) ac_config_targets="$ac_config_targets $1"
+     ac_need_defaults=false ;;
+
+  esac
+  shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+  echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+  CONFIG_SHELL=$SHELL
+  export CONFIG_SHELL
+  exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+  echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS
+#
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+  case $ac_config_target in
+    "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+    "subst-install") CONFIG_FILES="$CONFIG_FILES subst-install" ;;
+    "subst-install.vars.in") CONFIG_FILES="$CONFIG_FILES subst-install.vars.in" ;;
+    "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+    "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;;
+    "src/python-missingos/Makefile") CONFIG_FILES="$CONFIG_FILES src/python-missingos/Makefile" ;;
+    "bin/Makefile") CONFIG_FILES="$CONFIG_FILES bin/Makefile" ;;
+    "pym/Makefile") CONFIG_FILES="$CONFIG_FILES pym/Makefile" ;;
+    "cnf/Makefile") CONFIG_FILES="$CONFIG_FILES cnf/Makefile" ;;
+
+  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+  tmp=
+  trap 'exit_status=$?
+  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=./conf$$-$RANDOM
+  (umask 077 && mkdir "$tmp")
+} ||
+{
+   echo "$me: cannot create a temporary directory in ." >&2
+   { (exit 1); exit 1; }
+}
+
+#
+# Set up the sed scripts for CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "$CONFIG_FILES"; then
+
+_ACEOF
+
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  cat >conf$$subs.sed <<_ACEOF
+SHELL!$SHELL$ac_delim
+PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
+PACKAGE_NAME!$PACKAGE_NAME$ac_delim
+PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
+PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
+PACKAGE_STRING!$PACKAGE_STRING$ac_delim
+PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
+exec_prefix!$exec_prefix$ac_delim
+prefix!$prefix$ac_delim
+program_transform_name!$program_transform_name$ac_delim
+bindir!$bindir$ac_delim
+sbindir!$sbindir$ac_delim
+libexecdir!$libexecdir$ac_delim
+datarootdir!$datarootdir$ac_delim
+datadir!$datadir$ac_delim
+sysconfdir!$sysconfdir$ac_delim
+sharedstatedir!$sharedstatedir$ac_delim
+localstatedir!$localstatedir$ac_delim
+includedir!$includedir$ac_delim
+oldincludedir!$oldincludedir$ac_delim
+docdir!$docdir$ac_delim
+infodir!$infodir$ac_delim
+htmldir!$htmldir$ac_delim
+dvidir!$dvidir$ac_delim
+pdfdir!$pdfdir$ac_delim
+psdir!$psdir$ac_delim
+libdir!$libdir$ac_delim
+localedir!$localedir$ac_delim
+mandir!$mandir$ac_delim
+DEFS!$DEFS$ac_delim
+ECHO_C!$ECHO_C$ac_delim
+ECHO_N!$ECHO_N$ac_delim
+ECHO_T!$ECHO_T$ac_delim
+LIBS!$LIBS$ac_delim
+build_alias!$build_alias$ac_delim
+host_alias!$host_alias$ac_delim
+target_alias!$target_alias$ac_delim
+build!$build$ac_delim
+build_cpu!$build_cpu$ac_delim
+build_vendor!$build_vendor$ac_delim
+build_os!$build_os$ac_delim
+host!$host$ac_delim
+host_cpu!$host_cpu$ac_delim
+host_vendor!$host_vendor$ac_delim
+host_os!$host_os$ac_delim
+target!$target$ac_delim
+target_cpu!$target_cpu$ac_delim
+target_vendor!$target_vendor$ac_delim
+target_os!$target_os$ac_delim
+INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
+INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
+INSTALL_DATA!$INSTALL_DATA$ac_delim
+am__isrc!$am__isrc$ac_delim
+CYGPATH_W!$CYGPATH_W$ac_delim
+PACKAGE!$PACKAGE$ac_delim
+VERSION!$VERSION$ac_delim
+ACLOCAL!$ACLOCAL$ac_delim
+AUTOCONF!$AUTOCONF$ac_delim
+AUTOMAKE!$AUTOMAKE$ac_delim
+AUTOHEADER!$AUTOHEADER$ac_delim
+MAKEINFO!$MAKEINFO$ac_delim
+install_sh!$install_sh$ac_delim
+STRIP!$STRIP$ac_delim
+INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim
+mkdir_p!$mkdir_p$ac_delim
+AWK!$AWK$ac_delim
+SET_MAKE!$SET_MAKE$ac_delim
+am__leading_dot!$am__leading_dot$ac_delim
+AMTAR!$AMTAR$ac_delim
+am__tar!$am__tar$ac_delim
+am__untar!$am__untar$ac_delim
+CC!$CC$ac_delim
+CFLAGS!$CFLAGS$ac_delim
+LDFLAGS!$LDFLAGS$ac_delim
+CPPFLAGS!$CPPFLAGS$ac_delim
+ac_ct_CC!$ac_ct_CC$ac_delim
+EXEEXT!$EXEEXT$ac_delim
+OBJEXT!$OBJEXT$ac_delim
+DEPDIR!$DEPDIR$ac_delim
+am__include!$am__include$ac_delim
+am__quote!$am__quote$ac_delim
+AMDEP_TRUE!$AMDEP_TRUE$ac_delim
+AMDEP_FALSE!$AMDEP_FALSE$ac_delim
+AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim
+CCDEPMODE!$CCDEPMODE$ac_delim
+am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim
+am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim
+LN_S!$LN_S$ac_delim
+GREP!$GREP$ac_delim
+EGREP!$EGREP$ac_delim
+XCU_ID!$XCU_ID$ac_delim
+PYTHON!$PYTHON$ac_delim
+RM!$RM$ac_delim
+MV!$MV$ac_delim
+BASENAME!$BASENAME$ac_delim
+DIRNAME!$DIRNAME$ac_delim
+BASH!$BASH$ac_delim
+_ACEOF
+
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
+    break
+  elif $ac_last_try; then
+    { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+   { (exit 1); exit 1; }; }
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+  ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+  ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+CEOF$ac_eof
+_ACEOF
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  cat >conf$$subs.sed <<_ACEOF
+SED!$SED$ac_delim
+WGET!$WGET$ac_delim
+FIND!$FIND$ac_delim
+XARGS!$XARGS$ac_delim
+CPP!$CPP$ac_delim
+ALLOCA!$ALLOCA$ac_delim
+portageuser!$portageuser$ac_delim
+portagegroup!$portagegroup$ac_delim
+wheelgid!$wheelgid$ac_delim
+rootuser!$rootuser$ac_delim
+rootuid!$rootuid$ac_delim
+DOMAIN_PREFIX!$DOMAIN_PREFIX$ac_delim
+DEFAULT_PATH!$DEFAULT_PATH$ac_delim
+ARCH!$ARCH$ac_delim
+PORTAGE_BASE!$PORTAGE_BASE$ac_delim
+INSTALL_PYTHON_SOURCES_TRUE!$INSTALL_PYTHON_SOURCES_TRUE$ac_delim
+INSTALL_PYTHON_SOURCES_FALSE!$INSTALL_PYTHON_SOURCES_FALSE$ac_delim
+BUILD_TBZ2TOOL_TRUE!$BUILD_TBZ2TOOL_TRUE$ac_delim
+BUILD_TBZ2TOOL_FALSE!$BUILD_TBZ2TOOL_FALSE$ac_delim
+BUILD_MISSINGOS_TRUE!$BUILD_MISSINGOS_TRUE$ac_delim
+BUILD_MISSINGOS_FALSE!$BUILD_MISSINGOS_FALSE$ac_delim
+LIBOBJS!$LIBOBJS$ac_delim
+LTLIBOBJS!$LTLIBOBJS$ac_delim
+_ACEOF
+
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 23; then
+    break
+  elif $ac_last_try; then
+    { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+   { (exit 1); exit 1; }; }
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+  ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+  ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
+_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+:end
+s/|#_!!_#|//g
+CEOF$ac_eof
+_ACEOF
+
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[	 ]*VPATH[	 ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[	 ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[	 ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+fi # test -n "$CONFIG_FILES"
+
+
+for ac_tag in  :F $CONFIG_FILES      :C $CONFIG_COMMANDS
+do
+  case $ac_tag in
+  :[FHLC]) ac_mode=$ac_tag; continue;;
+  esac
+  case $ac_mode$ac_tag in
+  :[FHL]*:*);;
+  :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
+echo "$as_me: error: Invalid tag $ac_tag." >&2;}
+   { (exit 1); exit 1; }; };;
+  :[FH]-) ac_tag=-:-;;
+  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+  esac
+  ac_save_IFS=$IFS
+  IFS=:
+  set x $ac_tag
+  IFS=$ac_save_IFS
+  shift
+  ac_file=$1
+  shift
+
+  case $ac_mode in
+  :L) ac_source=$1;;
+  :[FH])
+    ac_file_inputs=
+    for ac_f
+    do
+      case $ac_f in
+      -) ac_f="$tmp/stdin";;
+      *) # Look for the file first in the build tree, then in the source tree
+	 # (if the path is not absolute).  The absolute path cannot be DOS-style,
+	 # because $ac_f cannot contain `:'.
+	 test -f "$ac_f" ||
+	   case $ac_f in
+	   [\\/$]*) false;;
+	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+	   esac ||
+	   { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+   { (exit 1); exit 1; }; };;
+      esac
+      ac_file_inputs="$ac_file_inputs $ac_f"
+    done
+
+    # Let's still pretend it is `configure' which instantiates (i.e., don't
+    # use $as_me), people would be surprised to read:
+    #    /* config.h.  Generated by config.status.  */
+    configure_input="Generated from "`IFS=:
+	  echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
+    if test x"$ac_file" != x-; then
+      configure_input="$ac_file.  $configure_input"
+      { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    fi
+
+    case $ac_tag in
+    *:-:* | *:-) cat >"$tmp/stdin";;
+    esac
+    ;;
+  esac
+
+  ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$ac_file" : 'X\(//\)[^/]' \| \
+	 X"$ac_file" : 'X\(//\)$' \| \
+	 X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  { as_dir="$ac_dir"
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+echo "$as_me: error: cannot create directory $as_dir" >&2;}
+   { (exit 1); exit 1; }; }; }
+  ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+  case $ac_mode in
+  :F)
+  #
+  # CONFIG_FILE
+  #
+
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+  esac
+  ac_MKDIR_P=$MKDIR_P
+  case $MKDIR_P in
+  [\\/$]* | ?:[\\/]* ) ;;
+  */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+  esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+
+case `sed -n '/datarootdir/ {
+  p
+  q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p
+' $ac_file_inputs` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+  { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+  ac_datarootdir_hack='
+  s&@datadir@&$datadir&g
+  s&@docdir@&$docdir&g
+  s&@infodir@&$infodir&g
+  s&@localedir@&$localedir&g
+  s&@mandir@&$mandir&g
+    s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF
+  sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s&@configure_input@&$configure_input&;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+s&@MKDIR_P@&$ac_MKDIR_P&;t t
+$ac_datarootdir_hack
+" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+  { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined." >&5
+echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined." >&2;}
+
+  rm -f "$tmp/stdin"
+  case $ac_file in
+  -) cat "$tmp/out"; rm -f "$tmp/out";;
+  *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
+  esac
+ ;;
+
+
+  :C)  { echo "$as_me:$LINENO: executing $ac_file commands" >&5
+echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+  esac
+
+
+  case $ac_file$ac_mode in
+    "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # Grep'ing the whole file is not good either: AIX grep has a line
+  # limit of 2048, but all sed's we know have understand at least 4000.
+  if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then
+    dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$mf" : 'X\(//\)[^/]' \| \
+	 X"$mf" : 'X\(//\)$' \| \
+	 X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$mf" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  else
+    continue
+  fi
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n 's/^U = //p' < "$mf"`
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$file" : 'X\(//\)[^/]' \| \
+	 X"$file" : 'X\(//\)$' \| \
+	 X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+    { as_dir=$dirpart/$fdir
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+echo "$as_me: error: cannot create directory $as_dir" >&2;}
+   { (exit 1); exit 1; }; }; }
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+ ;;
+
+  esac
+done # for ac_tag
+
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded.  So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status.  When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+  ac_cs_success=:
+  ac_config_status_args=
+  test "$silent" = yes &&
+    ac_config_status_args="$ac_config_status_args --quiet"
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+  exec 5>>config.log
+  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+  # would make configure fail if this is the last instruction.
+  $ac_cs_success || { (exit 1); exit 1; }
+fi
+
Index: /vendor/prefix-portage/current/configure.in
===================================================================
--- /vendor/prefix-portage/current/configure.in	(revision 3489)
+++ /vendor/prefix-portage/current/configure.in	(revision 3489)
@@ -0,0 +1,224 @@
+dnl Process this file with autoconf to produce a configure script.
+AC_INIT(portage, 2.1.20, grobian@gentoo.org, portage-prefix)
+
+AC_PREREQ([2.61])
+
+case "${prefix}" in
+	'') 	AC_MSG_ERROR([bad value ${prefix} for --prefix, must not be empty]) ;;
+	*/)		AC_MSG_ERROR([bad value ${prefix} for --prefix, must not end with '/']) ;;
+	/*|NONE) ;;
+	*) 		AC_MSG_ERROR([bad value ${prefix} for --prefix, must start with /]) ;;
+esac
+
+AC_CANONICAL_BUILD
+AC_CANONICAL_HOST
+AC_CANONICAL_TARGET
+
+AM_INIT_AUTOMAKE
+
+dnl Checks for programs.
+dnl store clfags prior, otherwise it's not propagated.
+if test "x$CFLAGS" != "x"
+then
+CFLAGS=$CFLAGS
+fi
+
+AC_PREFIX_DEFAULT([/usr])
+
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_EGREP
+
+GENTOO_PATH_XCU_ID()
+GENTOO_PATH_PYTHON([2.4])
+
+AC_PATH_PROG(RM, [rm], no)
+AC_PATH_PROG(MV, [mv], no)
+AC_PATH_PROG(BASENAME, [basename], no)
+AC_PATH_PROG(DIRNAME, [dirname], no)
+dnl avoid bash internal variable messing up things here
+unset BASH
+GENTOO_PATH_GNUPROG(BASH, [bash])
+GENTOO_PATH_GNUPROG(SED, [sed])
+GENTOO_PATH_GNUPROG(WGET, [wget])
+GENTOO_PATH_GNUPROG(FIND, [find])
+GENTOO_PATH_GNUPROG(XARGS, [xargs])
+GENTOO_PATH_GNUPROG(GREP, [grep])
+
+dnl Checks for libraries.
+dnl Replace `main' with a function in -lc:
+AC_CHECK_LIB(c, main)
+dnl Replace `main' with a function in -ldl:
+AC_CHECK_LIB(dl, main)
+dnl Replace `main' with a function in -lgcc:
+AC_CHECK_LIB(gcc, main)
+dnl Replace `main' with a function in -lpthread:
+AC_CHECK_LIB(pthread, main)
+
+dnl Checks for header files.
+AC_HEADER_DIRENT
+AC_HEADER_STDC
+AC_HEADER_SYS_WAIT
+AC_CHECK_HEADERS(fcntl.h limits.h strings.h sys/file.h sys/time.h unistd.h getopt.h stdio.h)
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_TYPE_UID_T
+AC_TYPE_MODE_T
+AC_TYPE_SIZE_T
+
+dnl Checks for library functions.
+AC_FUNC_ALLOCA
+AC_TYPE_SIGNAL
+AC_CHECK_FUNCS(getcwd mkdir regcomp rmdir strdup strerror strspn strstr)
+
+AC_ARG_ENABLE(tbz2tool,
+AC_HELP_STRING([--enable-tbz2tool],[build tbz2tool, tool for creating binpkgs (default yes)]),
+[case "${enableval}" in
+  yes)  enable_tbz2tool=true;;
+  no)	enable_tbz2tool=false;;
+  *)	AC_MSG_ERROR(bad value ${enableval} for --enable-tbz2tool);;
+esac],
+[enable_tbz2tool=true])
+
+AC_ARG_ENABLE(missingos,
+AC_HELP_STRING([--enable-missingos],[build compatibility missingos code for python 2.2 (default auto)]),
+[case "${enableval}" in
+  yes)	enable_missingos=true;;
+  no)	enable_missingos=false;;
+  auto)	enable_missingos=auto;;
+  *)	AC_MSG_ERROR(bad value ${enableval} for --enable-missingos);;
+esac],
+[enable_missingos=auto])
+
+AC_ARG_ENABLE(just-compiled-sources,
+AC_HELP_STRING([--enable-just-compiled-sources],[install just the bytecode, not the sources (default no)]),
+[case "${enableval}" in
+  yes)	enable_py_sources=false;;
+  no)	enable_py_sources=true;;
+  *)	AC_MSG_ERROR(bad value ${enableval} for --enable-just-compiled-sources);;
+esac],
+[enable_py_sources=true])
+
+AC_ARG_WITH(user,
+AC_HELP_STRING([--with-user=me],[use user 'me' for portage to work as (default portage)]),
+[case "${withval}" in
+  ""|yes) AC_MSG_ERROR(bad value ${withval} for --with-user);;
+  *) portageuser="${withval}";;
+esac],
+[portageuser="portage"])
+
+AC_ARG_WITH(group,
+AC_HELP_STRING([--with-group=mygroup],[use group 'mygroup' for portage to work as (default portage)]),
+[case "${withval}" in
+  ""|yes) AC_MSG_ERROR(bad value ${withval} for --with-group);;
+  *) portagegroup="${withval}";;
+esac],
+[portagegroup="portage"])
+
+AC_ARG_WITH(wheelgid,
+AC_HELP_STRING([--with-wheelgid=wheelgid],[let portage use 'wheelgid' as wheel group (default 0)]),
+[case "${withval}" in
+  ""|yes) AC_MSG_ERROR(bad value ${withval} for --with-wheelgid);;
+  *) wheelgid="${withval}";;
+esac],
+[wheelgid="0"])
+
+AC_ARG_WITH(rootuser,
+AC_HELP_STRING([--with-rootuser=me],[declares 'me' as the portage owner (default root)]),
+[case "${withval}" in
+  ""|yes) AC_MSG_ERROR(bad value ${withval} for --with-rootuser);;
+  *) rootuser=${withval}
+     rootuid=`id -u ${withval}`;;
+esac],
+[rootuser=root])
+
+AC_MSG_CHECKING([for user id of ${rootuser}])
+dnl grab uid of rootuser
+rootuid=`${XCU_ID} -u ${rootuser}`
+if [[ `echo ${rootuid} | ${EGREP} '^[[:digit:]]+$'` ]]
+then
+	AC_MSG_RESULT([${rootuid}])
+else
+	AC_MSG_ERROR([error finding the user id of ${rootuser}])
+fi
+
+AC_ARG_WITH(offset-prefix, 
+AC_HELP_STRING([--with-offset-prefix], [specify the installation prefix for all packages , defaults to /]),
+[DOMAIN_PREFIX=$withval],
+[DOMAIN_PREFIX='/'])
+
+DEFAULT_PATH="${DOMAIN_PREFIX}/usr/bin:${DOMAIN_PREFIX}/usr/sbin:${DOMAIN_PREFIX}/bin:${DOMAIN_PREFIX}/sbin:${prefix}/bin"
+AC_ARG_WITH(default-path, 
+AC_HELP_STRING([--with-default-path], [specify additional PATHs available to the portage build environment ]),
+[DEFAULT_PATH="${DEFAULT_PATH}":$withval],
+[DEFAULT_PATH="${DEFAULT_PATH}"])
+
+
+if test x$enable_missingos = xauto
+then
+  pyver=[`python -c 'import sys;print sys.version[0:3]';`]
+  case ${pyver} in
+    2.4)  ;;
+    2.3)  ;;
+    2.2)  enable_missingos=true;;
+    *)    AC_MSG_WARN([unable to determine python version, ${pyver}]);;
+  esac
+fi
+
+AC_MSG_CHECKING([for ARCH to be used])
+dnl detect ARCH from target_cpu
+case "${target_cpu}" in
+i?86) ARCH=x86 ;;
+sparc*) ARCH=sparc ;;
+hppa*) ARCH=hppa ;;
+powerpc*) ARCH=ppc ;;
+dnl don't know more target_cpus yet...
+*) AC_MSG_RESULT([unknown])
+   AC_MSG_CHECKING([for default ARCH to be used])
+   ARCH=${target_cpu} ;;
+esac
+AC_MSG_RESULT([${ARCH}])
+
+AC_CONFIG_FILES([ Makefile ])
+AC_CONFIG_FILES([ subst-install ])
+AC_CONFIG_FILES([ subst-install.vars.in ])
+AC_CONFIG_FILES([ src/Makefile ])
+AC_CONFIG_FILES([ man/Makefile ])
+AC_CONFIG_FILES([ src/python-missingos/Makefile ])
+AC_CONFIG_FILES([ bin/Makefile ])
+AC_CONFIG_FILES([ pym/Makefile ])
+AC_CONFIG_FILES([ cnf/Makefile ])
+
+AC_SUBST(portageuser)
+AC_SUBST(portagegroup)
+AC_SUBST(wheelgid)
+AC_SUBST(rootuser)
+AC_SUBST(rootuid)
+AC_SUBST(DOMAIN_PREFIX)
+AC_SUBST(DEFAULT_PATH)
+AC_SUBST(ARCH)
+AC_SUBST(PORTAGE_BASE,['${exec_prefix}/lib/portage'])
+AM_CONDITIONAL(INSTALL_PYTHON_SOURCES, test x$enable_py_sources = xtrue)
+AM_CONDITIONAL(BUILD_TBZ2TOOL, test x$enable_tbz2tool = xtrue)
+AM_CONDITIONAL(BUILD_MISSINGOS, test x$enable_missingos = xtrue)
+#AM_CONDITIONAL(BUILD_FILTER_ENV, test x$enable_filter_env = xtrue)
+
+AC_MSG_CHECKING([for a list of variables known by configure])
+pt_configvars=`sed -n -e "/^ac_subst_vars='/,/'$/p" ${srcdir}/configure | sed -e "s/^ac_subst_vars='//" -e "s/'$//"`
+{
+	pt_all_configurevars=
+	for pt_configvar in ${pt_configvars}
+	do
+		echo "${pt_configvar}=@${pt_configvar}@"
+		pt_all_configurevars="${pt_all_configurevars} ${pt_configvar}"
+	done
+
+	echo "all_configurevars='${pt_all_configurevars}'"
+
+} > subst-install.vars.in.in
+$as_unset pt_configvar pt_configvars pt_all_configurevars
+AC_MSG_RESULT([ok])
+
+AC_OUTPUT
Index: /vendor/prefix-portage/current/depcomp
===================================================================
--- /vendor/prefix-portage/current/depcomp	(revision 3489)
+++ /vendor/prefix-portage/current/depcomp	(revision 3489)
@@ -0,0 +1,584 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2006-10-15.18
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software
+# Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+  depmode     Dependency tracking mode.
+  source      Source file read by `PROGRAMS ARGS'.
+  object      Object file output by `PROGRAMS ARGS'.
+  DEPDIR      directory where to store dependencies.
+  depfile     Dependency file to output.
+  tmpdepfile  Temporary file to use when outputing dependencies.
+  libtool     Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "depcomp $scriptversion"
+    exit $?
+    ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+  echo "depcomp: Variables source, object and depmode must be set" 1>&2
+  exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags.  We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write.  Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+  # HP compiler uses -M and no extra arg.
+  gccflag=-M
+  depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+   # This is just like dashmstdout with a different argument.
+   dashmflag=-xM
+   depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+## Unfortunately, FreeBSD c89 acceptance of flags depends upon
+## the command line argument order; so add the flags where they
+## appear in depend2.am.  Note that the slowdown incurred here
+## affects only configure: in makefiles, %FASTDEP% shortcuts this.
+  for arg
+  do
+    case $arg in
+    -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
+    *)  set fnord "$@" "$arg" ;;
+    esac
+    shift # fnord
+    shift # $arg
+  done
+  "$@"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  mv "$tmpdepfile" "$depfile"
+  ;;
+
+gcc)
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
+  if test -z "$gccflag"; then
+    gccflag=-MD,
+  fi
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+  sed -e 's/^[^:]*: / /' \
+      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header).  We avoid this by adding
+## dummy dependencies for each header file.  Too bad gcc doesn't do
+## this for us directly.
+  tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'.  On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like `#:fec' to the end of the
+    # dependency line.
+    tr ' ' '
+' < "$tmpdepfile" \
+    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+    tr '
+' ' ' >> $depfile
+    echo >> $depfile
+
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' '
+' < "$tmpdepfile" \
+   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+   >> $depfile
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+aix)
+  # The C for AIX Compiler uses -M and outputs the dependencies
+  # in a .u file.  In older versions, this file always lives in the
+  # current directory.  Also, the AIX compiler puts `$object:' at the
+  # start of each line; $object doesn't have directory information.
+  # Version 6 uses the directory in both cases.
+  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
+  tmpdepfile="$stripped.u"
+  if test "$libtool" = yes; then
+    "$@" -Wc,-M
+  else
+    "$@" -M
+  fi
+  stat=$?
+
+  if test -f "$tmpdepfile"; then :
+  else
+    stripped=`echo "$stripped" | sed 's,^.*/,,'`
+    tmpdepfile="$stripped.u"
+  fi
+
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+
+  if test -f "$tmpdepfile"; then
+    outname="$stripped.o"
+    # Each line is of the form `foo.o: dependent.h'.
+    # Do two passes, one to just change these to
+    # `$object: dependent.h' and one to simply `dependent.h:'.
+    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+icc)
+  # Intel's C compiler understands `-MD -MF file'.  However on
+  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+  # ICC 7.0 will fill foo.d with something like
+  #    foo.o: sub/foo.c
+  #    foo.o: sub/foo.h
+  # which is wrong.  We want:
+  #    sub/foo.o: sub/foo.c
+  #    sub/foo.o: sub/foo.h
+  #    sub/foo.c:
+  #    sub/foo.h:
+  # ICC 7.1 will output
+  #    foo.o: sub/foo.c sub/foo.h
+  # and will wrap long lines using \ :
+  #    foo.o: sub/foo.c ... \
+  #     sub/foo.h ... \
+  #     ...
+
+  "$@" -MD -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  # Each line is of the form `foo.o: dependent.h',
+  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+  # Do two passes, one to just change these to
+  # `$object: dependent.h' and one to simply `dependent.h:'.
+  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+    sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp2)
+  # The "hp" stanza above does not work with aCC (C++) and HP's ia64
+  # compilers, which have integrated preprocessors.  The correct option
+  # to use with these is +Maked; it writes dependencies to a file named
+  # 'foo.d', which lands next to the object file, wherever that
+  # happens to be.
+  # Much of this is similar to the tru64 case; see comments there.
+  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+  test "x$dir" = "x$object" && dir=
+  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+  if test "$libtool" = yes; then
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir.libs/$base.d
+    "$@" -Wc,+Maked
+  else
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir$base.d
+    "$@" +Maked
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+     rm -f "$tmpdepfile1" "$tmpdepfile2"
+     exit $stat
+  fi
+
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
+  do
+    test -f "$tmpdepfile" && break
+  done
+  if test -f "$tmpdepfile"; then
+    sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
+    # Add `dependent.h:' lines.
+    sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
+  else
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile" "$tmpdepfile2"
+  ;;
+
+tru64)
+   # The Tru64 compiler uses -MD to generate dependencies as a side
+   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+   # dependencies in `foo.d' instead, so we check for that too.
+   # Subdirectories are respected.
+   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+   test "x$dir" = "x$object" && dir=
+   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+   if test "$libtool" = yes; then
+      # With Tru64 cc, shared objects can also be used to make a
+      # static library.  This mechanism is used in libtool 1.4 series to
+      # handle both shared and static libraries in a single compilation.
+      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+      #
+      # With libtool 1.5 this exception was removed, and libtool now
+      # generates 2 separate objects for the 2 libraries.  These two
+      # compilations output dependencies in $dir.libs/$base.o.d and
+      # in $dir$base.o.d.  We have to check for both files, because
+      # one of the two compilations can be disabled.  We should prefer
+      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+      # automatically cleaned when .libs/ is deleted, while ignoring
+      # the former would cause a distcleancheck panic.
+      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
+      tmpdepfile2=$dir$base.o.d          # libtool 1.5
+      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
+      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
+      "$@" -Wc,-MD
+   else
+      tmpdepfile1=$dir$base.o.d
+      tmpdepfile2=$dir$base.d
+      tmpdepfile3=$dir$base.d
+      tmpdepfile4=$dir$base.d
+      "$@" -MD
+   fi
+
+   stat=$?
+   if test $stat -eq 0; then :
+   else
+      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+      exit $stat
+   fi
+
+   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+   do
+     test -f "$tmpdepfile" && break
+   done
+   if test -f "$tmpdepfile"; then
+      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+      # That's a tab and a space in the [].
+      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+   else
+      echo "#dummy" > "$depfile"
+   fi
+   rm -f "$tmpdepfile"
+   ;;
+
+#nosideeffect)
+  # This comment above is used by automake to tell side-effect
+  # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  test -z "$dashmflag" && dashmflag=-M
+  # Require at least two characters before searching for `:'
+  # in the target name.  This is to cope with DOS-style filenames:
+  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+  "$@" $dashmflag |
+    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+dashXmstdout)
+  # This case only exists to satisfy depend.m4.  It is never actually
+  # run, as this mode is specially recognized in the preamble.
+  exit 1
+  ;;
+
+makedepend)
+  "$@" || exit $?
+  # Remove any Libtool call
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+  # X makedepend
+  shift
+  cleared=no
+  for arg in "$@"; do
+    case $cleared in
+    no)
+      set ""; shift
+      cleared=yes ;;
+    esac
+    case "$arg" in
+    -D*|-I*)
+      set fnord "$@" "$arg"; shift ;;
+    # Strip any option that makedepend may not understand.  Remove
+    # the object too, otherwise makedepend will parse it as a source file.
+    -*|$object)
+      ;;
+    *)
+      set fnord "$@" "$arg"; shift ;;
+    esac
+  done
+  obj_suffix="`echo $object | sed 's/^.*\././'`"
+  touch "$tmpdepfile"
+  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
+cpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  "$@" -E |
+    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed '$ s: \\$::' > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvisualcpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  "$@" || exit $?
+  IFS=" "
+  for arg
+  do
+    case "$arg" in
+    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+	set fnord "$@"
+	shift
+	shift
+	;;
+    *)
+	set fnord "$@" "$arg"
+	shift
+	shift
+	;;
+    esac
+  done
+  "$@" -E |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
+  echo "	" >> "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+none)
+  exec "$@"
+  ;;
+
+*)
+  echo "Unknown depmode $depmode" 1>&2
+  exit 1
+  ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
Index: /vendor/prefix-portage/current/doc/Makefile
===================================================================
--- /vendor/prefix-portage/current/doc/Makefile	(revision 3489)
+++ /vendor/prefix-portage/current/doc/Makefile	(revision 3489)
@@ -0,0 +1,11 @@
+all: xhtml xhtml-nochunks
+
+XMLTO_FLAGS_man = -x custom.xsl
+man pdf txt xhtml xhtml-nochunks:
+	xmlto $@ $(XMLTO_FLAGS_$@) portage.docbook
+
+clean distclean:
+	rm -f *.1 *.html
+
+.PHONY: all clean distclean \
+        man pdf txt xhtml xhtml-nochunks
Index: /vendor/prefix-portage/current/doc/fragment/version
===================================================================
--- /vendor/prefix-portage/current/doc/fragment/version	(revision 3489)
+++ /vendor/prefix-portage/current/doc/fragment/version	(revision 3489)
@@ -0,0 +1,1 @@
+<releaseinfo>svn-trunk</releaseinfo>
Index: /vendor/prefix-portage/current/doc/portage.docbook
===================================================================
--- /vendor/prefix-portage/current/doc/portage.docbook	(revision 3489)
+++ /vendor/prefix-portage/current/doc/portage.docbook	(revision 3489)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.4//EN"
+	"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
+
+	<!ENTITY date SYSTEM "fragment/date">
+	<!ENTITY version SYSTEM "fragment/version">
+
+	<!ENTITY project "portage">
+
+	<!ENTITY qa SYSTEM "qa.docbook">
+]>
+
+<book id="portage" lang="en">
+
+<bookinfo>
+ <title>Portage Documentation</title>
+
+ <authorgroup>
+  <author>
+   <firstname>Mike</firstname>
+   <surname>Frysinger</surname>
+   <email>vapier@gentoo.org</email>
+  </author>
+ </authorgroup>
+
+ &version;
+ &date;
+</bookinfo>
+
+&qa;
+
+</book>
Index: /vendor/prefix-portage/current/doc/qa.docbook
===================================================================
--- /vendor/prefix-portage/current/doc/qa.docbook	(revision 3489)
+++ /vendor/prefix-portage/current/doc/qa.docbook	(revision 3489)
@@ -0,0 +1,361 @@
+<chapter id='qa-notices'>
+ <title>QA Notices</title>
+ <para>
+  Here we'll go over each QA notice and what you (as a developer) can do to fix
+  the issue.  If you're a user, you should of course go 
+  <ulink url="http://bugs.gentoo.org/">file a bug</ulink>.  We'll only cover the
+  non-obvious notices here.
+ </para>
+ <para>
+  In pretty much all cases, you should try and get these issues resolved
+  upstream rather than simply fixing them in our ebuilds.
+ </para>
+
+ <sect1 id='qa-scanelf-runpath'>
+  <title>Scanelf: Insecure RUNPATHs</title>
+  <para>
+   <programlisting>
+    QA Notice: The following files contain insecure RUNPATH's
+   </programlisting>
+  </para>
+  <para>
+   Some of the ELFs that would be installed on the system have insecure dynamic
+   RUNPATH tags.  RUNPATH tags are a hardcoded list of filesystem paths that
+   will be searched at runtime when the ELF is executed.  If the ELF has a
+   world accessible directory hardcoded in it, then a malicious person can
+   inject code at runtime by adding their own libraries to the directory.
+  </para>
+  <para>
+   Here are some of the common problems and their solutions.
+   <itemizedlist>
+    <listitem>
+     <para>Libtool - old versions of libtool would use too many -rpath flags</para>
+     <para>Solution: Regenerate the autotool code</para>
+    </listitem>
+    <listitem>
+     <para>Perl - some versions of perl would use incorrect -rpath flags</para>
+     <para>Solution: upgrade system perl build modules</para>
+    </listitem>
+    <listitem>
+     <para>Crappy build system - the custom build system uses -rpath incorrectly</para>
+     <para>Solution: review the LDFLAGS in the build system and make them not suck</para>
+    </listitem>
+    <listitem>
+     <para>Crappy ebuild - the ebuild installs ELFs instead of using the package's build system</para>
+     <para>Solution: fix the crappy ebuild to use the package's build system</para>
+    </listitem>
+   </itemizedlist>
+  </para>
+ </sect1>
+
+ <sect1 id='qa-scanelf-textrel'>
+  <title>Scanelf: Runtime Text Relocations (TEXTRELS)</title>
+  <para>
+   <programlisting>
+    QA Notice: The following files contain runtime text relocations
+   </programlisting>
+  </para>
+  <para>
+   Please see the Gentoo Hardened <ulink url="http://hardened.gentoo.org/pic-fix-guide.xml">PIC Fix Guide</ulink>.
+  </para>
+ </sect1>
+
+ <sect1 id='qa-scanelf-execstack'>
+  <title>Scanelf: Executable Stack (EXECSTACK)</title>
+  <para>
+   <programlisting>
+    QA Notice: The following files contain executable stacks
+   </programlisting>
+  </para>
+  <para>
+   Please see the Gentoo Hardened <ulink url="http://hardened.gentoo.org/gnu-stack.xml">GNU Stack Guide</ulink>.
+  </para>
+ </sect1>
+
+ <sect1 id='qa-scanelf-soname'>
+  <title>Scanelf: Missing Shared Object Name (SONAME)</title>
+  <para>
+   <programlisting>
+    QA Notice: The following shared libraries lack a SONAME
+   </programlisting>
+  </para>
+  <para>
+   A shared library that you would link against lacks an ELF SONAME tag.  With
+   simpler libraries, this can be acceptable, but with any sort of ABI sane
+   setup, you need the SONAME tag.  This tag is how the system linker tells the
+   loader what libraries a program needs at runtime.  With a missing SONAME,
+   the linker needs to guess and with many cases, this guess will not work for
+   long.
+  </para>
+  <para>
+   To fix this issue, make sure the shared library is linked with the proper
+   <option>-Wl,-soname,...</option> flag.  You will need to replace the
+   <replaceable>...</replaceable> part with the actual ABI name.  For example,
+   if the library is named <filename>libfoo.so.1.2.3</filename>, you will
+   probably want to specify <option>-Wl,-soname,libfoo.so.1</option>.
+  </para>
+  <para>
+   Note that this warning only applies to shared libraries that you would link
+   against.  It certainly does not apply to plugins that you would dynamically
+   load.  However, plugins should not exist in the main library directory, but
+   rather an application specific subdirectory in the library directory.  In
+   other words, it should be <filename>/usr/lib/app/plugin.so</filename> rather
+   than <filename>/usr/lib/plugin.so</filename>.
+  </para>
+ </sect1>
+
+ <sect1 id='qa-scanelf-needed'>
+  <title>Scanelf: Missing Needed Entries</title>
+  <para>
+   <programlisting>
+    QA Notice: The following shared libraries lack NEEDED entries
+   </programlisting>
+  </para>
+  <para>
+   This warning comes up when a library does not actually seem to need any
+   other libraries in order to run.  Rarely is this true as almost every
+   library will need at least the system C library.
+  </para>
+  <para>
+   Once you've determined that the library is indeed being generated
+   incorrectly, you will need to dig into the build system to make sure that
+   it pulls in the libraries it needs.  Often times, this is because the
+   build system invokes the system linker (<command>ld</command>) directly
+   instead of the system compiler driver (<command>gcc</command>).
+  </para>
+ </sect1>
+
+ <sect1 id='qa-abs-lib-link'>
+  <title>Absolute Symlink In Library Directory</title>
+  <para>
+   <programlisting>
+    QA Notice: Found an absolute symlink in a library directory
+   </programlisting>
+  </para>
+  <para>
+   If you want to use symlinks in library directories, please use either a
+   relative symlink or a linker script.  This can cause problems when working
+   with cross-compiler systems or when accessing systems in a different ROOT
+   directory.
+  </para>
+  <para>
+   If you have a library installed into <filename>/lib/</filename> and you want
+   to have it accessible in <filename>/usr/lib/</filename>, then you should
+   generate a linker script so that the system toolchain can handle it properly.
+   Please see the <link linkend="qa-missing-ldscript">linker script section</link>
+   for more information.
+  </para>
+ </sect1>
+
+ <sect1 id='qa-missing-ldscript'>
+  <title>Missing Linker Script</title>
+  <para>
+   <programlisting>
+    QA Notice: Missing gen_usr_ldscript
+   </programlisting>
+  </para>
+  <para>
+   If you have a shared library in <filename>/lib/</filename> and a static
+   library in <filename>/usr/lib/</filename>, but no linker script in
+   <filename>/usr/lib/</filename>, then the toolchain will choose the incorrect
+   version when linking.  The system linker will find the static library first
+   and not bother searching for a dynamic version.  To overcome this, you need
+   to use the <command>gen_usr_ldscript</command> function found in the
+   <funcsynopsisinfo>toolchain-funcs.eclass</funcsynopsisinfo>.  Refer to the
+   man page for information on how to use it.  See this
+   <ulink url="http://bugs.gentoo.org/4411">bug report</ulink> for some history
+   on this issue.
+  </para>
+ </sect1>
+
+ <sect1 id='qa-root-cruft'>
+  <title>Excessive Files in /</title>
+  <para>
+   <programlisting>
+    QA Notice: Excessive files found in the / partition
+   </programlisting>
+  </para>
+  <para>
+   You should not store files that are not critical to boot and recovery in
+   the root filesystem.  This means that static libraries and libtool scripts do
+   not belong in the <filename>/lib/</filename> directory.  Fix your ebuild so
+   it does not install there.
+  </para>
+ </sect1>
+
+ <sect1 id='qa-tempdir-libtool'>
+  <title>Portage Tempdir In Libtool Scripts</title>
+  <para>
+   <programlisting>
+    QA Notice: ... appears to contain PORTAGE_TMPDIR paths
+   </programlisting>
+  </para>
+  <para>
+   Older versions of libtool would incorrectly record the build and/or install
+   directory in the libtool script (*.la).  This would lead to problems when
+   building other things against your package as libtool would be confused by
+   the old paths.
+  </para>
+  <para>
+   You may be able to cheat and use the <command>elibtoolize</command> function
+   in the <funcsynopsisinfo>libtool.eclass</funcsynopsisinfo>.  However, if
+   that does not help, you will probably need to regenerate all of the autotool
+   files.
+  </para>
+ </sect1>
+
+ <sect1 id='qa-build-strict-aliasing'>
+  <title>Build Warning: Strict Aliasing</title>
+  <para>
+   <programlisting>
+    QA Notice: Package has poor programming practices which may compile
+               fine but exhibit random runtime failures.
+    ...: warning: dereferencing type-punned pointer will break strict-aliasing rules
+   </programlisting>
+  </para>
+  <para>
+   This warning crops up when code starts casting distinct pointer types and
+   then dereferencing them.  Generally, this is a violation of aliasing rules
+   which are part of the C standard.  Historically, these warnings did not show
+   up as the optimization was not turned on by default.  With gcc-4.1.x and
+   newer though, the -O2 optimization level enables strict aliasing support.
+   For information, please review these links:
+   <ulink url="http://mail-index.netbsd.org/tech-kern/2003/08/11/0001.html">NetBSD Explanation</ulink>,
+   <ulink url="http://thread.gmane.org/gmane.linux.gentoo.devel/39495">Gentoo Dev Thread</ulink>,
+   <ulink url="http://gcc.gnu.org/bugs.html#nonbugs_c">GCC Docs</ulink>
+  </para>
+  <para>
+   To fix this issue, use the methods proposed in the links mentioned earlier.
+   If you're unable to do so, then a work around would be to append the gcc
+   -fno-strict-aliasing flag to CFLAGS in the ebuild.
+  </para>
+ </sect1>
+
+ <sect1 id='qa-build-implicit-decl'>
+  <title>Build Warning: Implicit Declarations</title>
+  <para>
+   <programlisting>
+    QA Notice: Package has poor programming practices which may compile
+               fine but exhibit random runtime failures.
+    ...: warning: implicit declaration of function ...
+    ...: warning: incompatible implicit declaration of built-in function ...
+   </programlisting>
+  </para>
+  <para>
+   Your code is calling functions which lack prototypes.  In C++, this would
+   have been a build failure, but C is lazy so you just get a warning.  This
+   can be a problem as gcc has to guess at what sort of arguments a function
+   takes based upon how it was called and often times, this is not the same
+   as what the function actually takes.  The function return type is also
+   unknown so it's just assumed to be an integer (which is often times wrong).
+   This can get to be a problem when the size of the types guessed do not
+   actually match the size of the types the function expects.  Generally, this
+   corresponds directly to proper coding practices (and the lack thereof).
+   Also, by including proper prototypes, the compiler often helps by checking
+   types used, proper number of arguments passed, etc...
+  </para>
+  <para>
+   To fix this, just include the proper header files for the functions in
+   question.  If the function is a package-specific one, then you may have to
+   create a header/function prototype for it.
+  </para>
+ </sect1>
+
+ <sect1 id='qa-build-uninitialized'>
+  <title>Build Warning: Used Uninitialized</title>
+  <para>
+   <programlisting>
+    QA Notice: Package has poor programming practices which may compile
+               fine but exhibit random runtime failures.
+    ...: warning: is used uninitialized in this function
+   </programlisting>
+  </para>
+  <para>
+   This means code uses a variable without actually setting it first.  In other
+   words, the code is basically using random garbage.
+  </para>
+  <para>
+   The fix here is simple: make sure variables are initialized properly before
+   using them.
+  </para>
+ </sect1>
+
+ <sect1 id='qa-build-math-compare'>
+  <title>Build Warning: Invalid X&lt;=Y&lt;=Z Comparisons</title>
+  <para>
+   <programlisting>
+    QA Notice: Package has poor programming practices which may compile
+               fine but exhibit random runtime failures.
+    ...: warning: comparisons like X&lt;=Y&lt;=Z do not have their mathematical meaning
+   </programlisting>
+  </para>
+  <para>
+   This warning crops up either when the programmer expected the expression
+   to work or they just forgot to use sufficient parentheses.  For example,
+   the following code snippets are wrong (we won't get into the technical
+   argument of this being valid C code; just change the code to not be
+   ambiguous).
+   <programlisting>
+    if (x &lt;= y &lt;= z)
+      ...;
+    if (a &lt; b &lt;= c)
+      ...;
+   </programlisting>
+  </para>
+  <para>
+   To fix this, read the code to figure out what exactly the programmer meant.
+  </para>
+ </sect1>
+
+ <sect1 id='qa-build-non-null'>
+  <title>Build Warning: Non-Null Required</title>
+  <para>
+   <programlisting>
+    QA Notice: Package has poor programming practices which may compile
+               fine but exhibit random runtime failures.
+    ...: warning: null argument where non-null required
+   </programlisting>
+  </para>
+  <para>
+   Many functions take pointers as arguments and require that the pointer never
+   be NULL.  To this end, you can declare function prototypes that instruct the
+   compiler to do simple checks to make sure people do not incorrectly call the
+   function with NULL values.  This warning pops up when someone calls a
+   function and they use NULL when they should not.  Depending on the library,
+   the function may actually crash (they told you not to use NULL after-all, so
+   it's your fault :P).
+  </para>
+  <para>
+   You will need to read the code and fix it so that it does not incorrectly
+   call the relevant functions with NULL values.
+  </para>
+ </sect1>
+
+ <sect1 id='qa-build-pointer-trunc'>
+  <title>Build Warning: Truncating Pointers</title>
+  <para>
+   <programlisting>
+    QA Notice: Package has poor programming practices which may compile
+               but will almost certainly crash on 64bit architectures.
+   </programlisting>
+  </para>
+  <para>
+   A large portion of code in the open source world is developed on the 32bit
+   x86 architecture.  Unfortunately, this has led to many pieces of code not
+   handling pointer types properly.  When compiled and run on a 64bit
+   architecture, the code in question will probably crash horribly.  Some
+   common examples are assuming that an integer type is large enough to hold
+   pointers.  This is true on 32bit architectures (an integer can hold 32bits
+   and a pointer is 32bits big), but not true on 64bit architectures (an
+   integer still holds just 32bits, but a pointer is 64bits big).
+  </para>
+  <para>
+   Since this issue can manifest itself in many ways (as there are many ways to
+   improperly truncate a pointer), you will need to read the source code
+   starting with the displayed warning.  Make sure types are declared, used,
+   and passed properly.  Make sure that all function prototypes are found (see
+   the <link linkend="qa-build-implicit-decl">Implicit Declarations</link>
+   section for more information).  So on and so forth.
+  </para>
+ </sect1>
+</chapter>
Index: /vendor/prefix-portage/current/install-sh
===================================================================
--- /vendor/prefix-portage/current/install-sh	(revision 3489)
+++ /vendor/prefix-portage/current/install-sh	(revision 3489)
@@ -0,0 +1,507 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2006-10-14.15
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+nl='
+'
+IFS=" ""	$nl"
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+if test -z "$doit"; then
+  doit_exec=exec
+else
+  doit_exec=$doit
+fi
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+posix_glob=
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chmodcmd=$chmodprog
+chowncmd=
+chgrpcmd=
+stripcmd=
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=
+dst=
+dir_arg=
+dstarg=
+no_target_directory=
+
+usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+-c         (ignored)
+-d         create directories instead of installing files.
+-g GROUP   $chgrpprog installed files to GROUP.
+-m MODE    $chmodprog installed files to MODE.
+-o USER    $chownprog installed files to USER.
+-s         $stripprog installed files.
+-t DIRECTORY  install into DIRECTORY.
+-T         report an error if DSTFILE is a directory.
+--help     display this help and exit.
+--version  display version info and exit.
+
+Environment variables override the default commands:
+  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+  case $1 in
+    -c) shift
+        continue;;
+
+    -d) dir_arg=true
+        shift
+        continue;;
+
+    -g) chgrpcmd="$chgrpprog $2"
+        shift
+        shift
+        continue;;
+
+    --help) echo "$usage"; exit $?;;
+
+    -m) mode=$2
+        shift
+        shift
+	case $mode in
+	  *' '* | *'	'* | *'
+'*	  | *'*'* | *'?'* | *'['*)
+	    echo "$0: invalid mode: $mode" >&2
+	    exit 1;;
+	esac
+        continue;;
+
+    -o) chowncmd="$chownprog $2"
+        shift
+        shift
+        continue;;
+
+    -s) stripcmd=$stripprog
+        shift
+        continue;;
+
+    -t) dstarg=$2
+	shift
+	shift
+	continue;;
+
+    -T) no_target_directory=true
+	shift
+	continue;;
+
+    --version) echo "$0 $scriptversion"; exit $?;;
+
+    --)	shift
+	break;;
+
+    -*)	echo "$0: invalid option: $1" >&2
+	exit 1;;
+
+    *)  break;;
+  esac
+done
+
+if test $# -ne 0 && test -z "$dir_arg$dstarg"; then
+  # When -d is used, all remaining arguments are directories to create.
+  # When -t is used, the destination is already specified.
+  # Otherwise, the last argument is the destination.  Remove it from $@.
+  for arg
+  do
+    if test -n "$dstarg"; then
+      # $@ is not empty: it contains at least $arg.
+      set fnord "$@" "$dstarg"
+      shift # fnord
+    fi
+    shift # arg
+    dstarg=$arg
+  done
+fi
+
+if test $# -eq 0; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
+    exit 1
+  fi
+  # It's OK to call `install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
+fi
+
+if test -z "$dir_arg"; then
+  trap '(exit $?); exit' 1 2 13 15
+
+  # Set umask so as not to create temps with too-generous modes.
+  # However, 'strip' requires both read and write access to temps.
+  case $mode in
+    # Optimize common cases.
+    *644) cp_umask=133;;
+    *755) cp_umask=22;;
+
+    *[0-7])
+      if test -z "$stripcmd"; then
+	u_plus_rw=
+      else
+	u_plus_rw='% 200'
+      fi
+      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+    *)
+      if test -z "$stripcmd"; then
+	u_plus_rw=
+      else
+	u_plus_rw=,u+rw
+      fi
+      cp_umask=$mode$u_plus_rw;;
+  esac
+fi
+
+for src
+do
+  # Protect names starting with `-'.
+  case $src in
+    -*) src=./$src ;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    dstdir=$dst
+    test -d "$dstdir"
+    dstdir_status=$?
+  else
+
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
+
+    if test -z "$dstarg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
+
+    dst=$dstarg
+    # Protect names starting with `-'.
+    case $dst in
+      -*) dst=./$dst ;;
+    esac
+
+    # If destination is a directory, append the input filename; won't work
+    # if double slashes aren't ignored.
+    if test -d "$dst"; then
+      if test -n "$no_target_directory"; then
+	echo "$0: $dstarg: Is a directory" >&2
+	exit 1
+      fi
+      dstdir=$dst
+      dst=$dstdir/`basename "$src"`
+      dstdir_status=0
+    else
+      # Prefer dirname, but fall back on a substitute if dirname fails.
+      dstdir=`
+	(dirname "$dst") 2>/dev/null ||
+	expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	     X"$dst" : 'X\(//\)[^/]' \| \
+	     X"$dst" : 'X\(//\)$' \| \
+	     X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+	echo X"$dst" |
+	    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\/\)[^/].*/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\/\)$/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\).*/{
+		   s//\1/
+		   q
+		 }
+		 s/.*/./; q'
+      `
+
+      test -d "$dstdir"
+      dstdir_status=$?
+    fi
+  fi
+
+  obsolete_mkdir_used=false
+
+  if test $dstdir_status != 0; then
+    case $posix_mkdir in
+      '')
+	# Create intermediate dirs using mode 755 as modified by the umask.
+	# This is like FreeBSD 'install' as of 1997-10-28.
+	umask=`umask`
+	case $stripcmd.$umask in
+	  # Optimize common cases.
+	  *[2367][2367]) mkdir_umask=$umask;;
+	  .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+	  *[0-7])
+	    mkdir_umask=`expr $umask + 22 \
+	      - $umask % 100 % 40 + $umask % 20 \
+	      - $umask % 10 % 4 + $umask % 2
+	    `;;
+	  *) mkdir_umask=$umask,go-w;;
+	esac
+
+	# With -d, create the new directory with the user-specified mode.
+	# Otherwise, rely on $mkdir_umask.
+	if test -n "$dir_arg"; then
+	  mkdir_mode=-m$mode
+	else
+	  mkdir_mode=
+	fi
+
+	posix_mkdir=false
+	case $umask in
+	  *[123567][0-7][0-7])
+	    # POSIX mkdir -p sets u+wx bits regardless of umask, which
+	    # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+	    ;;
+	  *)
+	    tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+	    trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+	    if (umask $mkdir_umask &&
+		exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+	    then
+	      if test -z "$dir_arg" || {
+		   # Check for POSIX incompatibilities with -m.
+		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+		   # other-writeable bit of parent directory when it shouldn't.
+		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
+		   case $ls_ld_tmpdir in
+		     d????-?r-*) different_mode=700;;
+		     d????-?--*) different_mode=755;;
+		     *) false;;
+		   esac &&
+		   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+		     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+		     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+		   }
+		 }
+	      then posix_mkdir=:
+	      fi
+	      rmdir "$tmpdir/d" "$tmpdir"
+	    else
+	      # Remove any dirs left behind by ancient mkdir implementations.
+	      rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+	    fi
+	    trap '' 0;;
+	esac;;
+    esac
+
+    if
+      $posix_mkdir && (
+	umask $mkdir_umask &&
+	$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+      )
+    then :
+    else
+
+      # The umask is ridiculous, or mkdir does not conform to POSIX,
+      # or it failed possibly due to a race condition.  Create the
+      # directory the slow way, step by step, checking for races as we go.
+
+      case $dstdir in
+	/*) prefix=/ ;;
+	-*) prefix=./ ;;
+	*)  prefix= ;;
+      esac
+
+      case $posix_glob in
+        '')
+	  if (set -f) 2>/dev/null; then
+	    posix_glob=true
+	  else
+	    posix_glob=false
+	  fi ;;
+      esac
+
+      oIFS=$IFS
+      IFS=/
+      $posix_glob && set -f
+      set fnord $dstdir
+      shift
+      $posix_glob && set +f
+      IFS=$oIFS
+
+      prefixes=
+
+      for d
+      do
+	test -z "$d" && continue
+
+	prefix=$prefix$d
+	if test -d "$prefix"; then
+	  prefixes=
+	else
+	  if $posix_mkdir; then
+	    (umask=$mkdir_umask &&
+	     $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+	    # Don't fail if two instances are running concurrently.
+	    test -d "$prefix" || exit 1
+	  else
+	    case $prefix in
+	      *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+	      *) qprefix=$prefix;;
+	    esac
+	    prefixes="$prefixes '$qprefix'"
+	  fi
+	fi
+	prefix=$prefix/
+      done
+
+      if test -n "$prefixes"; then
+	# Don't fail if two instances are running concurrently.
+	(umask $mkdir_umask &&
+	 eval "\$doit_exec \$mkdirprog $prefixes") ||
+	  test -d "$dstdir" || exit 1
+	obsolete_mkdir_used=true
+      fi
+    fi
+  fi
+
+  if test -n "$dir_arg"; then
+    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+  else
+
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
+
+    # Trap to clean up those temp files at exit.
+    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+    # Copy the file name to the temp name.
+    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+    # and set any options; do chmod last to preserve setuid bits.
+    #
+    # If any of these fail, we abort the whole thing.  If we want to
+    # ignore errors from any of these, just make sure not to ignore
+    # errors from the above "$doit $cpprog $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+    # Now rename the file to the real destination.
+    { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
+      || {
+	   # The rename failed, perhaps because mv can't rename something else
+	   # to itself, or perhaps because mv is so ancient that it does not
+	   # support -f.
+
+	   # Now remove or move aside any old file at destination location.
+	   # We try this two ways since rm can't unlink itself on some
+	   # systems and the destination file might be busy for other
+	   # reasons.  In this case, the final cleanup might fail but the new
+	   # file should still install successfully.
+	   {
+	     if test -f "$dst"; then
+	       $doit $rmcmd -f "$dst" 2>/dev/null \
+	       || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \
+		     && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\
+	       || {
+		 echo "$0: cannot unlink or rename $dst" >&2
+		 (exit 1); exit 1
+	       }
+	     else
+	       :
+	     fi
+	   } &&
+
+	   # Now rename the file to the real destination.
+	   $doit $mvcmd "$dsttmp" "$dst"
+	 }
+    } || exit 1
+
+    trap '' 0
+  fi
+done
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
Index: /vendor/prefix-portage/current/ltmain.sh
===================================================================
--- /vendor/prefix-portage/current/ltmain.sh	(revision 3489)
+++ /vendor/prefix-portage/current/ltmain.sh	(revision 3489)
@@ -0,0 +1,6994 @@
+# ltmain.sh - Provide generalized library-building support services.
+# NOTE: Changing this file will not affect anything until you rerun configure.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
+# 2007  Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+basename="s,^.*/,,g"
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
+
+# The name of this program:
+progname=`echo "$progpath" | $SED $basename`
+modename="$progname"
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION=1.5.23b
+TIMESTAMP=" (1.1220.2.437 2007/02/17 09:08:45)"
+
+# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Check that we have a working $echo.
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell, and then maybe $echo will work.
+  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+$*
+EOF
+  exit $EXIT_SUCCESS
+fi
+
+default_mode=
+help="Try \`$progname --help' for more information."
+magic="%%%MAGIC variable%%%"
+mkdir="mkdir"
+mv="mv -f"
+rm="rm -f"
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+  SP2NL='tr \040 \012'
+  NL2SP='tr \015\012 \040\040'
+  ;;
+ *) # EBCDIC based system
+  SP2NL='tr \100 \n'
+  NL2SP='tr \r\n \100\100'
+  ;;
+esac
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+# We save the old values to restore during execute mode.
+for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+do
+  eval "if test \"\${$lt_var+set}\" = set; then
+	  save_$lt_var=\$$lt_var
+	  $lt_var=C
+	  export $lt_var
+	fi"
+done
+
+# Make sure IFS has a sensible default
+lt_nl='
+'
+IFS=" 	$lt_nl"
+
+if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+  $echo "$modename: not configured to build any kind of library" 1>&2
+  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
+  exit $EXIT_FAILURE
+fi
+
+# Global variables.
+mode=$default_mode
+nonopt=
+prev=
+prevopt=
+run=
+show="$echo"
+show_help=
+execute_dlfiles=
+duplicate_deps=no
+preserve_args=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+extracted_archives=
+extracted_serial=0
+
+#####################################
+# Shell function definitions:
+# This seems to be the best place for them
+
+# func_mktempdir [string]
+# Make a temporary directory that won't clash with other running
+# libtool processes, and avoids race conditions if possible.  If
+# given, STRING is the basename for that directory.
+func_mktempdir ()
+{
+    my_template="${TMPDIR-/tmp}/${1-$progname}"
+
+    if test "$run" = ":"; then
+      # Return a directory name, but don't create it in dry-run mode
+      my_tmpdir="${my_template}-$$"
+    else
+
+      # If mktemp works, use that first and foremost
+      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
+
+      if test ! -d "$my_tmpdir"; then
+	# Failing that, at least try and use $RANDOM to avoid a race
+	my_tmpdir="${my_template}-${RANDOM-0}$$"
+
+	save_mktempdir_umask=`umask`
+	umask 0077
+	$mkdir "$my_tmpdir"
+	umask $save_mktempdir_umask
+      fi
+
+      # If we're not in dry-run mode, bomb out on failure
+      test -d "$my_tmpdir" || {
+        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
+	exit $EXIT_FAILURE
+      }
+    fi
+
+    $echo "X$my_tmpdir" | $Xsed
+}
+
+
+# func_win32_libid arg
+# return the library type of file 'arg'
+#
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+func_win32_libid ()
+{
+  win32_libid_type="unknown"
+  win32_fileres=`file -L $1 2>/dev/null`
+  case $win32_fileres in
+  *ar\ archive\ import\ library*) # definitely import
+    win32_libid_type="x86 archive import"
+    ;;
+  *ar\ archive*) # could be an import, or static
+    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
+      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
+      win32_nmres=`eval $NM -f posix -A $1 | \
+	$SED -n -e '1,100{
+		/ I /{
+			s,.*,import,
+			p
+			q
+			}
+		}'`
+      case $win32_nmres in
+      import*)  win32_libid_type="x86 archive import";;
+      *)        win32_libid_type="x86 archive static";;
+      esac
+    fi
+    ;;
+  *DLL*)
+    win32_libid_type="x86 DLL"
+    ;;
+  *executable*) # but shell scripts are "executable" too...
+    case $win32_fileres in
+    *MS\ Windows\ PE\ Intel*)
+      win32_libid_type="x86 DLL"
+      ;;
+    esac
+    ;;
+  esac
+  $echo $win32_libid_type
+}
+
+
+# func_infer_tag arg
+# Infer tagged configuration to use if any are available and
+# if one wasn't chosen via the "--tag" command line option.
+# Only attempt this if the compiler in the base compile
+# command doesn't match the default compiler.
+# arg is usually of the form 'gcc ...'
+func_infer_tag ()
+{
+    if test -n "$available_tags" && test -z "$tagname"; then
+      CC_quoted=
+      for arg in $CC; do
+	case $arg in
+	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	  arg="\"$arg\""
+	  ;;
+	esac
+	CC_quoted="$CC_quoted $arg"
+      done
+      case $@ in
+      # Blanks in the command may have been stripped by the calling shell,
+      # but not from the CC environment variable when configure was run.
+      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
+      # Blanks at the start of $base_compile will cause this to fail
+      # if we don't check for them as well.
+      *)
+	for z in $available_tags; do
+	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
+	    # Evaluate the configuration.
+	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+	    CC_quoted=
+	    for arg in $CC; do
+	    # Double-quote args containing other shell metacharacters.
+	    case $arg in
+	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	      arg="\"$arg\""
+	      ;;
+	    esac
+	    CC_quoted="$CC_quoted $arg"
+	  done
+	    # user sometimes does CC=<HOST>-gcc so we need to match that to 'gcc'
+	    trimedcc=`echo ${CC} | $SED -e "s/${host}-//g"`
+	    # and sometimes libtool has CC=<HOST>-gcc but user does CC=gcc
+	    extendcc=${host}-${CC}
+	    # and sometimes libtool has CC=<OLDHOST>-gcc but user has CC=<NEWHOST>-gcc  
+	    # (Gentoo-specific hack because we always export $CHOST)
+	    mungedcc=${CHOST-${host}}-${trimedcc}
+	    case "$@ " in
+	      "cc "* | " cc "* | "${host}-cc "* | " ${host}-cc "*|\
+	      "gcc "* | " gcc "* | "${host}-gcc "* | " ${host}-gcc "*)
+	      tagname=CC
+	      break ;;
+	      "$trimedcc "* | " $trimedcc "* | "`$echo $trimedcc` "* | " `$echo $trimedcc` "*|\
+	      "$extendcc "* | " $extendcc "* | "`$echo $extendcc` "* | " `$echo $extendcc` "*|\
+	      "$mungedcc "* | " $mungedcc "* | "`$echo $mungedcc` "* | " `$echo $mungedcc` "*|\
+	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
+	      # The compiler in the base compile command matches
+	      # the one in the tagged configuration.
+	      # Assume this is the tagged configuration we want.
+	      tagname=$z
+	      break
+	      ;;
+	    esac
+	  fi
+	done
+	# If $tagname still isn't set, then no tagged configuration
+	# was found and let the user know that the "--tag" command
+	# line option must be used.
+	if test -z "$tagname"; then
+	  $echo "$modename: unable to infer tagged configuration"
+	  $echo "$modename: specify a tag with \`--tag'" 1>&2
+	  exit $EXIT_FAILURE
+#        else
+#          $echo "$modename: using $tagname tagged configuration"
+	fi
+	;;
+      esac
+    fi
+}
+
+
+# func_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+    f_ex_an_ar_dir="$1"; shift
+    f_ex_an_ar_oldlib="$1"
+
+    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
+    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
+    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+     :
+    else
+      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
+      exit $EXIT_FAILURE
+    fi
+}
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
+{
+    my_gentop="$1"; shift
+    my_oldlibs=${1+"$@"}
+    my_oldobjs=""
+    my_xlib=""
+    my_xabs=""
+    my_xdir=""
+    my_status=""
+
+    $show "${rm}r $my_gentop"
+    $run ${rm}r "$my_gentop"
+    $show "$mkdir $my_gentop"
+    $run $mkdir "$my_gentop"
+    my_status=$?
+    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
+      exit $my_status
+    fi
+
+    for my_xlib in $my_oldlibs; do
+      # Extract the objects.
+      case $my_xlib in
+	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+	*) my_xabs=`pwd`"/$my_xlib" ;;
+      esac
+      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
+      my_xlib_u=$my_xlib
+      while :; do
+        case " $extracted_archives " in
+	*" $my_xlib_u "*)
+	  extracted_serial=`expr $extracted_serial + 1`
+	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
+	*) break ;;
+	esac
+      done
+      extracted_archives="$extracted_archives $my_xlib_u"
+      my_xdir="$my_gentop/$my_xlib_u"
+
+      $show "${rm}r $my_xdir"
+      $run ${rm}r "$my_xdir"
+      $show "$mkdir $my_xdir"
+      $run $mkdir "$my_xdir"
+      exit_status=$?
+      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
+	exit $exit_status
+      fi
+      case $host in
+      *-darwin*)
+	$show "Extracting $my_xabs"
+	# Do not bother doing anything if just a dry run
+	if test -z "$run"; then
+	  darwin_orig_dir=`pwd`
+	  cd $my_xdir || exit $?
+	  darwin_archive=$my_xabs
+	  darwin_curdir=`pwd`
+	  darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
+	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
+	  if test -n "$darwin_arches"; then 
+	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
+	    darwin_arch=
+	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
+	    for darwin_arch in  $darwin_arches ; do
+	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
+	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
+	      cd "$darwin_curdir"
+	      $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
+	    done # $darwin_arches
+      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
+	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
+	    darwin_file=
+	    darwin_files=
+	    for darwin_file in $darwin_filelist; do
+	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
+	      lipo -create -output "$darwin_file" $darwin_files
+	    done # $darwin_filelist
+	    ${rm}r unfat-$$
+	    cd "$darwin_orig_dir"
+	  else
+	    cd "$darwin_orig_dir"
+ 	    func_extract_an_archive "$my_xdir" "$my_xabs"
+	  fi # $darwin_arches
+	fi # $run
+	;;
+      *)
+        func_extract_an_archive "$my_xdir" "$my_xabs"
+        ;;
+      esac
+      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+    done
+    func_extract_archives_result="$my_oldobjs"
+}
+# End of Shell function definitions
+#####################################
+
+# Darwin sucks
+eval std_shrext=\"$shrext_cmds\"
+
+disable_libs=no
+
+# Parse our command line options once, thoroughly.
+while test "$#" -gt 0
+do
+  arg="$1"
+  shift
+
+  case $arg in
+  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) optarg= ;;
+  esac
+
+  # If the previous option needs an argument, assign it.
+  if test -n "$prev"; then
+    case $prev in
+    execute_dlfiles)
+      execute_dlfiles="$execute_dlfiles $arg"
+      ;;
+    tag)
+      tagname="$arg"
+      preserve_args="${preserve_args}=$arg"
+
+      # Check whether tagname contains only valid characters
+      case $tagname in
+      *[!-_A-Za-z0-9,/]*)
+	$echo "$progname: invalid tag name: $tagname" 1>&2
+	exit $EXIT_FAILURE
+	;;
+      esac
+
+      case $tagname in
+      CC)
+	# Don't test for the "default" C tag, as we know, it's there, but
+	# not specially marked.
+	;;
+      *)
+	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
+	  taglist="$taglist $tagname"
+	  # Evaluate the configuration.
+	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
+	else
+	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
+	fi
+	;;
+      esac
+      ;;
+    *)
+      eval "$prev=\$arg"
+      ;;
+    esac
+
+    prev=
+    prevopt=
+    continue
+  fi
+
+  # Have we seen a non-optional argument yet?
+  case $arg in
+  --help)
+    show_help=yes
+    ;;
+
+  --version)
+    echo "\
+$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
+
+Copyright (C) 2007  Free Software Foundation, Inc.
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+    exit $?
+    ;;
+
+  --config)
+    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
+    # Now print the configurations for the tags.
+    for tagname in $taglist; do
+      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
+    done
+    exit $?
+    ;;
+
+  --debug)
+    $echo "$progname: enabling shell trace mode"
+    set -x
+    preserve_args="$preserve_args $arg"
+    ;;
+
+  --dry-run | -n)
+    run=:
+    ;;
+
+  --features)
+    $echo "host: $host"
+    if test "$build_libtool_libs" = yes; then
+      $echo "enable shared libraries"
+    else
+      $echo "disable shared libraries"
+    fi
+    if test "$build_old_libs" = yes; then
+      $echo "enable static libraries"
+    else
+      $echo "disable static libraries"
+    fi
+    exit $?
+    ;;
+
+  --finish) mode="finish" ;;
+
+  --mode) prevopt="--mode" prev=mode ;;
+  --mode=*) mode="$optarg" ;;
+
+  --preserve-dup-deps) duplicate_deps="yes" ;;
+
+  --quiet | --silent)
+    show=:
+    preserve_args="$preserve_args $arg"
+    ;;
+
+  --tag)
+    prevopt="--tag"
+    prev=tag
+    preserve_args="$preserve_args --tag"
+    ;;
+  --tag=*)
+    set tag "$optarg" ${1+"$@"}
+    shift
+    prev=tag
+    preserve_args="$preserve_args --tag"
+    ;;
+
+  -dlopen)
+    prevopt="-dlopen"
+    prev=execute_dlfiles
+    ;;
+
+  -*)
+    $echo "$modename: unrecognized option \`$arg'" 1>&2
+    $echo "$help" 1>&2
+    exit $EXIT_FAILURE
+    ;;
+
+  *)
+    nonopt="$arg"
+    break
+    ;;
+  esac
+done
+
+if test -n "$prevopt"; then
+  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
+  $echo "$help" 1>&2
+  exit $EXIT_FAILURE
+fi
+
+case $disable_libs in
+no) 
+  ;;
+shared)
+  build_libtool_libs=no
+  build_old_libs=yes
+  ;;
+static)
+  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
+  ;;
+esac
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end.  This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+if test -z "$show_help"; then
+
+  # Infer the operation mode.
+  if test -z "$mode"; then
+    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
+    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
+    case $nonopt in
+    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
+      mode=link
+      for arg
+      do
+	case $arg in
+	-c)
+	   mode=compile
+	   break
+	   ;;
+	esac
+      done
+      ;;
+    *db | *dbx | *strace | *truss)
+      mode=execute
+      ;;
+    *install*|cp|mv)
+      mode=install
+      ;;
+    *rm)
+      mode=uninstall
+      ;;
+    *)
+      # If we have no mode, but dlfiles were specified, then do execute mode.
+      test -n "$execute_dlfiles" && mode=execute
+
+      # Just use the default operation mode.
+      if test -z "$mode"; then
+	if test -n "$nonopt"; then
+	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
+	else
+	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
+	fi
+      fi
+      ;;
+    esac
+  fi
+
+  # Only execute mode is allowed to have -dlopen flags.
+  if test -n "$execute_dlfiles" && test "$mode" != execute; then
+    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
+    $echo "$help" 1>&2
+    exit $EXIT_FAILURE
+  fi
+
+  # Change the help message to a mode-specific one.
+  generic_help="$help"
+  help="Try \`$modename --help --mode=$mode' for more information."
+
+  # These modes are in order of execution frequency so that they run quickly.
+  case $mode in
+  # libtool compile mode
+  compile)
+    modename="$modename: compile"
+    # Get the compilation command and the source file.
+    base_compile=
+    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
+    suppress_opt=yes
+    suppress_output=
+    arg_mode=normal
+    libobj=
+    later=
+
+    for arg
+    do
+      case $arg_mode in
+      arg  )
+	# do not "continue".  Instead, add this to base_compile
+	lastarg="$arg"
+	arg_mode=normal
+	;;
+
+      target )
+	libobj="$arg"
+	arg_mode=normal
+	continue
+	;;
+
+      normal )
+	# Accept any command-line options.
+	case $arg in
+	-o)
+	  if test -n "$libobj" ; then
+	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	  arg_mode=target
+	  continue
+	  ;;
+
+	-static | -prefer-pic | -prefer-non-pic)
+	  later="$later $arg"
+	  continue
+	  ;;
+
+	-no-suppress)
+	  suppress_opt=no
+	  continue
+	  ;;
+
+	-Xcompiler)
+	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
+	  continue      #  The current "srcfile" will either be retained or
+	  ;;            #  replaced later.  I would guess that would be a bug.
+
+	-Wc,*)
+	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
+	  lastarg=
+	  save_ifs="$IFS"; IFS=','
+ 	  for arg in $args; do
+	    IFS="$save_ifs"
+
+	    # Double-quote args containing other shell metacharacters.
+	    # Many Bourne shells cannot handle close brackets correctly
+	    # in scan sets, so we specify it separately.
+	    case $arg in
+	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	      arg="\"$arg\""
+	      ;;
+	    esac
+	    lastarg="$lastarg $arg"
+	  done
+	  IFS="$save_ifs"
+	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
+
+	  # Add the arguments to base_compile.
+	  base_compile="$base_compile $lastarg"
+	  continue
+	  ;;
+
+	* )
+	  # Accept the current argument as the source file.
+	  # The previous "srcfile" becomes the current argument.
+	  #
+	  lastarg="$srcfile"
+	  srcfile="$arg"
+	  ;;
+	esac  #  case $arg
+	;;
+      esac    #  case $arg_mode
+
+      # Aesthetically quote the previous argument.
+      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
+
+      case $lastarg in
+      # Double-quote args containing other shell metacharacters.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, and some SunOS ksh mistreat backslash-escaping
+      # in scan sets (worked around with variable expansion),
+      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
+      # at all, so we specify them separately.
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	lastarg="\"$lastarg\""
+	;;
+      esac
+
+      base_compile="$base_compile $lastarg"
+    done # for arg
+
+    case $arg_mode in
+    arg)
+      $echo "$modename: you must specify an argument for -Xcompile"
+      exit $EXIT_FAILURE
+      ;;
+    target)
+      $echo "$modename: you must specify a target with \`-o'" 1>&2
+      exit $EXIT_FAILURE
+      ;;
+    *)
+      # Get the name of the library object.
+      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
+      ;;
+    esac
+
+    # Recognize several different file suffixes.
+    # If the user specifies -o file.o, it is replaced with file.lo
+    xform='[cCFSifmso]'
+    case $libobj in
+    *.ada) xform=ada ;;
+    *.adb) xform=adb ;;
+    *.ads) xform=ads ;;
+    *.asm) xform=asm ;;
+    *.c++) xform=c++ ;;
+    *.cc) xform=cc ;;
+    *.ii) xform=ii ;;
+    *.class) xform=class ;;
+    *.cpp) xform=cpp ;;
+    *.cxx) xform=cxx ;;
+    *.[fF][09]?) xform=[fF][09]. ;;
+    *.for) xform=for ;;
+    *.java) xform=java ;;
+    *.obj) xform=obj ;;
+    esac
+
+    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
+
+    case $libobj in
+    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
+    *)
+      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
+      exit $EXIT_FAILURE
+      ;;
+    esac
+
+    func_infer_tag $base_compile
+
+    for arg in $later; do
+      case $arg in
+      -static)
+	build_old_libs=yes
+	continue
+	;;
+
+      -prefer-pic)
+	pic_mode=yes
+	continue
+	;;
+
+      -prefer-non-pic)
+	pic_mode=no
+	continue
+	;;
+      esac
+    done
+
+    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
+    case $qlibobj in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	qlibobj="\"$qlibobj\"" ;;
+    esac
+    test "X$libobj" != "X$qlibobj" \
+	&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' 	&()|`$[]' \
+	&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
+    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+    if test "X$xdir" = "X$obj"; then
+      xdir=
+    else
+      xdir=$xdir/
+    fi
+    lobj=${xdir}$objdir/$objname
+
+    if test -z "$base_compile"; then
+      $echo "$modename: you must specify a compilation command" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    # Delete any leftover library objects.
+    if test "$build_old_libs" = yes; then
+      removelist="$obj $lobj $libobj ${libobj}T"
+    else
+      removelist="$lobj $libobj ${libobj}T"
+    fi
+
+    $run $rm $removelist
+    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
+
+    # On Cygwin there's no "real" PIC flag so we must build both object types
+    case $host_os in
+    cygwin* | mingw* | pw32* | os2*)
+      pic_mode=default
+      ;;
+    esac
+    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+      # non-PIC code in shared libraries is not supported
+      pic_mode=default
+    fi
+
+    # Calculate the filename of the output object if compiler does
+    # not support -o with -c
+    if test "$compiler_c_o" = no; then
+      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
+      lockfile="$output_obj.lock"
+      removelist="$removelist $output_obj $lockfile"
+      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
+    else
+      output_obj=
+      need_locks=no
+      lockfile=
+    fi
+
+    # Lock this critical section if it is needed
+    # We use this script file to make the link, it avoids creating a new file
+    if test "$need_locks" = yes; then
+      until $run ln "$srcfile" "$lockfile" 2>/dev/null; do
+	$show "Waiting for $lockfile to be removed"
+	sleep 2
+      done
+    elif test "$need_locks" = warn; then
+      if test -f "$lockfile"; then
+	$echo "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$run $rm $removelist
+	exit $EXIT_FAILURE
+      fi
+      $echo "$srcfile" > "$lockfile"
+    fi
+
+    if test -n "$fix_srcfile_path"; then
+      eval srcfile=\"$fix_srcfile_path\"
+    fi
+    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
+    case $qsrcfile in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+      qsrcfile="\"$qsrcfile\"" ;;
+    esac
+
+    $run $rm "$libobj" "${libobj}T"
+
+    # Create a libtool object file (analogous to a ".la" file),
+    # but don't create it if we're doing a dry run.
+    test -z "$run" && cat > ${libobj}T <<EOF
+# $libobj - a libtool object file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+EOF
+
+    # Only build a PIC object if we are building libtool libraries.
+    if test "$build_libtool_libs" = yes; then
+      # Without this assignment, base_compile gets emptied.
+      fbsd_hideous_sh_bug=$base_compile
+
+      if test "$pic_mode" != no; then
+	command="$base_compile $qsrcfile $pic_flag"
+      else
+	# Don't build PIC code
+	command="$base_compile $qsrcfile"
+      fi
+
+      if test ! -d "${xdir}$objdir"; then
+	$show "$mkdir ${xdir}$objdir"
+	$run $mkdir ${xdir}$objdir
+	exit_status=$?
+	if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
+	  exit $exit_status
+	fi
+      fi
+
+      if test -z "$output_obj"; then
+	# Place PIC objects in $objdir
+	command="$command -o $lobj"
+      fi
+
+      $run $rm "$lobj" "$output_obj"
+
+      $show "$command"
+      if $run eval "$command"; then :
+      else
+	test -n "$output_obj" && $run $rm $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      if test "$need_locks" = warn &&
+	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+	$echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$run $rm $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed, then go on to compile the next one
+      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
+	$show "$mv $output_obj $lobj"
+	if $run $mv $output_obj $lobj; then :
+	else
+	  error=$?
+	  $run $rm $removelist
+	  exit $error
+	fi
+      fi
+
+      # Append the name of the PIC object to the libtool object file.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object='$objdir/$objname'
+
+EOF
+
+      # Allow error messages only from the first compilation.
+      if test "$suppress_opt" = yes; then
+        suppress_output=' >/dev/null 2>&1'
+      fi
+    else
+      # No PIC object so indicate it doesn't exist in the libtool
+      # object file.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object=none
+
+EOF
+    fi
+
+    # Only build a position-dependent object if we build old libraries.
+    if test "$build_old_libs" = yes; then
+      if test "$pic_mode" != yes; then
+	# Don't build PIC code
+	command="$base_compile $qsrcfile"
+      else
+	command="$base_compile $qsrcfile $pic_flag"
+      fi
+      if test "$compiler_c_o" = yes; then
+	command="$command -o $obj"
+      fi
+
+      # Suppress compiler output if we already did a PIC compilation.
+      command="$command$suppress_output"
+      $run $rm "$obj" "$output_obj"
+      $show "$command"
+      if $run eval "$command"; then :
+      else
+	$run $rm $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      if test "$need_locks" = warn &&
+	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+	$echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$run $rm $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed
+      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
+	$show "$mv $output_obj $obj"
+	if $run $mv $output_obj $obj; then :
+	else
+	  error=$?
+	  $run $rm $removelist
+	  exit $error
+	fi
+      fi
+
+      # Append the name of the non-PIC object the libtool object file.
+      # Only append if the libtool object file exists.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object='$objname'
+
+EOF
+    else
+      # Append the name of the non-PIC object the libtool object file.
+      # Only append if the libtool object file exists.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object=none
+
+EOF
+    fi
+
+    $run $mv "${libobj}T" "${libobj}"
+
+    # Unlock the critical section if it was locked
+    if test "$need_locks" != no; then
+      $run $rm "$lockfile"
+    fi
+
+    exit $EXIT_SUCCESS
+    ;;
+
+  # libtool link mode
+  link | relink)
+    modename="$modename: link"
+    case $host in
+    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+      # It is impossible to link a dll without this setting, and
+      # we shouldn't force the makefile maintainer to figure out
+      # which system we are compiling for in order to pass an extra
+      # flag for every libtool invocation.
+      # allow_undefined=no
+
+      # FIXME: Unfortunately, there are problems with the above when trying
+      # to make a dll which has undefined symbols, in which case not
+      # even a static library is built.  For now, we need to specify
+      # -no-undefined on the libtool link line when we can be certain
+      # that all symbols are satisfied, otherwise we get a static library.
+      allow_undefined=yes
+      ;;
+    *)
+      allow_undefined=yes
+      ;;
+    esac
+    libtool_args="$nonopt"
+    base_compile="$nonopt $@"
+    compile_command="$nonopt"
+    finalize_command="$nonopt"
+
+    compile_rpath=
+    finalize_rpath=
+    compile_shlibpath=
+    finalize_shlibpath=
+    convenience=
+    old_convenience=
+    deplibs=
+    old_deplibs=
+    compiler_flags=
+    linker_flags=
+    dllsearchpath=
+    lib_search_path=`pwd`
+    inst_prefix_dir=
+
+    avoid_version=no
+    dlfiles=
+    dlprefiles=
+    dlself=no
+    export_dynamic=no
+    export_symbols=
+    export_symbols_regex=
+    generated=
+    libobjs=
+    ltlibs=
+    module=no
+    no_install=no
+    objs=
+    non_pic_objects=
+    notinst_path= # paths that contain not-installed libtool libraries
+    precious_files_regex=
+    prefer_static_libs=no
+    preload=no
+    prev=
+    prevarg=
+    release=
+    rpath=
+    xrpath=
+    perm_rpath=
+    temp_rpath=
+    thread_safe=no
+    vinfo=
+    vinfo_number=no
+
+    func_infer_tag $base_compile
+
+    # We need to know -static, to get the right output filenames.
+    for arg
+    do
+      case $arg in
+      -all-static | -static | -static-libtool-libs)
+	case $arg in
+	-all-static)
+	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
+	  fi
+	  if test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	  prefer_static_libs=yes
+	  ;;
+	-static)
+	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	  prefer_static_libs=built
+	  ;;
+	-static-libtool-libs)
+	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	  prefer_static_libs=yes
+	  ;;
+	esac
+	build_libtool_libs=no
+	build_old_libs=yes
+	break
+	;;
+      esac
+    done
+
+    # See if our shared archives depend on static archives.
+    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+    # Go through the arguments, transforming them on the way.
+    while test "$#" -gt 0; do
+      arg="$1"
+      shift
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
+	;;
+      *) qarg=$arg ;;
+      esac
+      libtool_args="$libtool_args $qarg"
+
+      # If the previous option needs an argument, assign it.
+      if test -n "$prev"; then
+	case $prev in
+	output)
+	  compile_command="$compile_command @OUTPUT@"
+	  finalize_command="$finalize_command @OUTPUT@"
+	  ;;
+	esac
+
+	case $prev in
+	dlfiles|dlprefiles)
+	  if test "$preload" = no; then
+	    # Add the symbol object into the linking commands.
+	    compile_command="$compile_command @SYMFILE@"
+	    finalize_command="$finalize_command @SYMFILE@"
+	    preload=yes
+	  fi
+	  case $arg in
+	  *.la | *.lo) ;;  # We handle these cases below.
+	  force)
+	    if test "$dlself" = no; then
+	      dlself=needless
+	      export_dynamic=yes
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  self)
+	    if test "$prev" = dlprefiles; then
+	      dlself=yes
+	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+	      dlself=yes
+	    else
+	      dlself=needless
+	      export_dynamic=yes
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  *)
+	    if test "$prev" = dlfiles; then
+	      dlfiles="$dlfiles $arg"
+	    else
+	      dlprefiles="$dlprefiles $arg"
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  esac
+	  ;;
+	expsyms)
+	  export_symbols="$arg"
+	  if test ! -f "$arg"; then
+	    $echo "$modename: symbol file \`$arg' does not exist"
+	    exit $EXIT_FAILURE
+	  fi
+	  prev=
+	  continue
+	  ;;
+	expsyms_regex)
+	  export_symbols_regex="$arg"
+	  prev=
+	  continue
+	  ;;
+	inst_prefix)
+	  inst_prefix_dir="$arg"
+	  prev=
+	  continue
+	  ;;
+	precious_regex)
+	  precious_files_regex="$arg"
+	  prev=
+	  continue
+	  ;;
+	release)
+	  release="-$arg"
+	  prev=
+	  continue
+	  ;;
+	objectlist)
+	  if test -f "$arg"; then
+	    save_arg=$arg
+	    moreargs=
+	    for fil in `cat $save_arg`
+	    do
+#	      moreargs="$moreargs $fil"
+	      arg=$fil
+	      # A libtool-controlled object.
+
+	      # Check to see that this really is a libtool object.
+	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+		pic_object=
+		non_pic_object=
+
+		# Read the .lo file
+		# If there is no directory component, then add one.
+		case $arg in
+		*/* | *\\*) . $arg ;;
+		*) . ./$arg ;;
+		esac
+
+		if test -z "$pic_object" || \
+		   test -z "$non_pic_object" ||
+		   test "$pic_object" = none && \
+		   test "$non_pic_object" = none; then
+		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+		  exit $EXIT_FAILURE
+		fi
+
+		# Extract subdirectory from the argument.
+		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+		if test "X$xdir" = "X$arg"; then
+		  xdir=
+		else
+		  xdir="$xdir/"
+		fi
+
+		if test "$pic_object" != none; then
+		  # Prepend the subdirectory the object is found in.
+		  pic_object="$xdir$pic_object"
+
+		  if test "$prev" = dlfiles; then
+		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+		      dlfiles="$dlfiles $pic_object"
+		      prev=
+		      continue
+		    else
+		      # If libtool objects are unsupported, then we need to preload.
+		      prev=dlprefiles
+		    fi
+		  fi
+
+		  # CHECK ME:  I think I busted this.  -Ossama
+		  if test "$prev" = dlprefiles; then
+		    # Preload the old-style object.
+		    dlprefiles="$dlprefiles $pic_object"
+		    prev=
+		  fi
+
+		  # A PIC object.
+		  libobjs="$libobjs $pic_object"
+		  arg="$pic_object"
+		fi
+
+		# Non-PIC object.
+		if test "$non_pic_object" != none; then
+		  # Prepend the subdirectory the object is found in.
+		  non_pic_object="$xdir$non_pic_object"
+
+		  # A standard non-PIC object
+		  non_pic_objects="$non_pic_objects $non_pic_object"
+		  if test -z "$pic_object" || test "$pic_object" = none ; then
+		    arg="$non_pic_object"
+		  fi
+		else
+		  # If the PIC object exists, use it instead.
+		  # $xdir was prepended to $pic_object above.
+		  non_pic_object="$pic_object"
+		  non_pic_objects="$non_pic_objects $non_pic_object"
+		fi
+	      else
+		# Only an error if not doing a dry-run.
+		if test -z "$run"; then
+		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+		  exit $EXIT_FAILURE
+		else
+		  # Dry-run case.
+
+		  # Extract subdirectory from the argument.
+		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+		  if test "X$xdir" = "X$arg"; then
+		    xdir=
+		  else
+		    xdir="$xdir/"
+		  fi
+
+		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+		  libobjs="$libobjs $pic_object"
+		  non_pic_objects="$non_pic_objects $non_pic_object"
+		fi
+	      fi
+	    done
+	  else
+	    $echo "$modename: link input file \`$save_arg' does not exist"
+	    exit $EXIT_FAILURE
+	  fi
+	  arg=$save_arg
+	  prev=
+	  continue
+	  ;;
+	rpath | xrpath)
+	  # We need an absolute path.
+	  case $arg in
+	  [\\/]* | [A-Za-z]:[\\/]*) ;;
+	  *)
+	    $echo "$modename: only absolute run-paths are allowed" 1>&2
+	    exit $EXIT_FAILURE
+	    ;;
+	  esac
+	  if test "$prev" = rpath; then
+	    case "$rpath " in
+	    *" $arg "*) ;;
+	    *) rpath="$rpath $arg" ;;
+	    esac
+	  else
+	    case "$xrpath " in
+	    *" $arg "*) ;;
+	    *) xrpath="$xrpath $arg" ;;
+	    esac
+	  fi
+	  prev=
+	  continue
+	  ;;
+	xcompiler)
+	  compiler_flags="$compiler_flags $qarg"
+	  prev=
+	  compile_command="$compile_command $qarg"
+	  finalize_command="$finalize_command $qarg"
+	  continue
+	  ;;
+	xlinker)
+	  linker_flags="$linker_flags $qarg"
+	  compiler_flags="$compiler_flags $wl$qarg"
+	  prev=
+	  compile_command="$compile_command $wl$qarg"
+	  finalize_command="$finalize_command $wl$qarg"
+	  continue
+	  ;;
+	xcclinker)
+	  linker_flags="$linker_flags $qarg"
+	  compiler_flags="$compiler_flags $qarg"
+	  prev=
+	  compile_command="$compile_command $qarg"
+	  finalize_command="$finalize_command $qarg"
+	  continue
+	  ;;
+	shrext)
+  	  shrext_cmds="$arg"
+	  prev=
+	  continue
+	  ;;
+	darwin_framework|darwin_framework_skip)
+	  test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
+	  compile_command="$compile_command $arg"
+	  finalize_command="$finalize_command $arg"
+	  prev=
+	  continue
+	  ;;
+	*)
+	  eval "$prev=\"\$arg\""
+	  prev=
+	  continue
+	  ;;
+	esac
+      fi # test -n "$prev"
+
+      prevarg="$arg"
+
+      case $arg in
+      -all-static)
+	if test -n "$link_static_flag"; then
+	  compile_command="$compile_command $link_static_flag"
+	  finalize_command="$finalize_command $link_static_flag"
+	fi
+	continue
+	;;
+
+      -allow-undefined)
+	# FIXME: remove this flag sometime in the future.
+	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
+	continue
+	;;
+
+      -avoid-version)
+	avoid_version=yes
+	continue
+	;;
+
+      -dlopen)
+	prev=dlfiles
+	continue
+	;;
+
+      -dlpreopen)
+	prev=dlprefiles
+	continue
+	;;
+
+      -export-dynamic)
+	export_dynamic=yes
+	continue
+	;;
+
+      -export-symbols | -export-symbols-regex)
+	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+	  $echo "$modename: more than one -exported-symbols argument is not allowed"
+	  exit $EXIT_FAILURE
+	fi
+	if test "X$arg" = "X-export-symbols"; then
+	  prev=expsyms
+	else
+	  prev=expsyms_regex
+	fi
+	continue
+	;;
+
+      -framework|-arch|-isysroot)
+	case " $CC " in
+	  *" ${arg} ${1} "* | *" ${arg}	${1} "*) 
+		prev=darwin_framework_skip ;;
+	  *) compiler_flags="$compiler_flags $arg"
+	     prev=darwin_framework ;;
+	esac
+	compile_command="$compile_command $arg"
+	finalize_command="$finalize_command $arg"
+	continue
+	;;
+
+      -inst-prefix-dir)
+	prev=inst_prefix
+	continue
+	;;
+
+      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+      # so, if we see these flags be careful not to treat them like -L
+      -L[A-Z][A-Z]*:*)
+	case $with_gcc/$host in
+	no/*-*-irix* | /*-*-irix*)
+	  compile_command="$compile_command $arg"
+	  finalize_command="$finalize_command $arg"
+	  ;;
+	esac
+	continue
+	;;
+
+      -L*)
+	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
+	# We need an absolute path.
+	case $dir in
+	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	*)
+	  absdir=`cd "$dir" && pwd`
+	  if test -z "$absdir"; then
+	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
+	    absdir="$dir"
+	    notinst_path="$notinst_path $dir"
+	  fi
+	  dir="$absdir"
+	  ;;
+	esac
+	case "$deplibs " in
+	*" -L$dir "*) ;;
+	*)
+	  deplibs="$deplibs -L$dir"
+	  lib_search_path="$lib_search_path $dir"
+	  ;;
+	esac
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+	  testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
+	  case :$dllsearchpath: in
+	  *":$dir:"*) ;;
+	  *) dllsearchpath="$dllsearchpath:$dir";;
+	  esac
+	  case :$dllsearchpath: in
+	  *":$testbindir:"*) ;;
+	  *) dllsearchpath="$dllsearchpath:$testbindir";;
+	  esac
+	  ;;
+	esac
+	continue
+	;;
+
+      -l*)
+	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+	  case $host in
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
+	    # These systems don't actually have a C or math library (as such)
+	    continue
+	    ;;
+	  *-*-os2*)
+	    # These systems don't actually have a C library (as such)
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+	    # Do not include libc due to us having libc/libc_r.
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-rhapsody* | *-*-darwin1.[012])
+	    # Rhapsody C and math libraries are in the System framework
+	    deplibs="$deplibs -framework System"
+	    continue
+	    ;;
+	  *-*-sco3.2v5* | *-*-sco5v6*)
+	    # Causes problems with __ctype
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+	    # Compiler inserts libc in the correct place for threads to work
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  esac
+	elif test "X$arg" = "X-lc_r"; then
+	 case $host in
+	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+	   # Do not include libc_r directly, use -pthread flag.
+	   continue
+	   ;;
+	 esac
+	fi
+	deplibs="$deplibs $arg"
+	continue
+	;;
+
+      # Tru64 UNIX uses -model [arg] to determine the layout of C++
+      # classes, name mangling, and exception handling.
+      -model)
+	compile_command="$compile_command $arg"
+	compiler_flags="$compiler_flags $arg"
+	finalize_command="$finalize_command $arg"
+	prev=xcompiler
+	continue
+	;;
+
+     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+	compiler_flags="$compiler_flags $arg"
+	compile_command="$compile_command $arg"
+	finalize_command="$finalize_command $arg"
+	continue
+	;;
+
+      -module)
+	module=yes
+	continue
+	;;
+
+      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
+      # -r[0-9][0-9]* specifies the processor on the SGI compiler
+      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
+      # +DA*, +DD* enable 64-bit mode on the HP compiler
+      # -q* pass through compiler args for the IBM compiler
+      # -m* pass through architecture-specific compiler args for GCC
+      # -m*, -t[45]*, -txscale* pass through architecture-specific
+      # compiler args for GCC
+      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
+      # -F/path gives path to uninstalled frameworks, gcc on darwin
+      # @file GCC response files
+      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
+
+	# Unknown arguments in both finalize_command and compile_command need
+	# to be aesthetically quoted because they are evaled later.
+	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+	case $arg in
+	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	  arg="\"$arg\""
+	  ;;
+	esac
+        compile_command="$compile_command $arg"
+        finalize_command="$finalize_command $arg"
+        compiler_flags="$compiler_flags $arg"
+        continue
+        ;;
+
+      -shrext)
+	prev=shrext
+	continue
+	;;
+
+      -no-fast-install)
+	fast_install=no
+	continue
+	;;
+
+      -no-install)
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+	  # The PATH hackery in wrapper scripts is required on Windows
+	  # in order for the loader to find any dlls it needs.
+	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
+	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
+	  fast_install=no
+	  ;;
+	*) no_install=yes ;;
+	esac
+	continue
+	;;
+
+      -no-undefined)
+	allow_undefined=no
+	continue
+	;;
+
+      -objectlist)
+	prev=objectlist
+	continue
+	;;
+
+      -o) prev=output ;;
+
+      -precious-files-regex)
+	prev=precious_regex
+	continue
+	;;
+
+      -release)
+	prev=release
+	continue
+	;;
+
+      -rpath)
+	prev=rpath
+	continue
+	;;
+
+      -R)
+	prev=xrpath
+	continue
+	;;
+
+      -R*)
+	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
+	# We need an absolute path.
+	case $dir in
+	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	*)
+	  $echo "$modename: only absolute run-paths are allowed" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+	case "$xrpath " in
+	*" $dir "*) ;;
+	*) xrpath="$xrpath $dir" ;;
+	esac
+	continue
+	;;
+
+      -static | -static-libtool-libs)
+	# The effects of -static are defined in a previous loop.
+	# We used to do the same as -all-static on platforms that
+	# didn't have a PIC flag, but the assumption that the effects
+	# would be equivalent was wrong.  It would break on at least
+	# Digital Unix and AIX.
+	continue
+	;;
+
+      -thread-safe)
+	thread_safe=yes
+	continue
+	;;
+
+      -version-info)
+	prev=vinfo
+	continue
+	;;
+      -version-number)
+	prev=vinfo
+	vinfo_number=yes
+	continue
+	;;
+
+      -Wc,*)
+	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
+	arg=
+	save_ifs="$IFS"; IFS=','
+	for flag in $args; do
+	  IFS="$save_ifs"
+	  case $flag in
+	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	    flag="\"$flag\""
+	    ;;
+	  esac
+	  arg="$arg $wl$flag"
+	  compiler_flags="$compiler_flags $flag"
+	done
+	IFS="$save_ifs"
+	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+	;;
+
+      -Wl,*)
+	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
+	arg=
+	save_ifs="$IFS"; IFS=','
+	for flag in $args; do
+	  IFS="$save_ifs"
+	  case $flag in
+	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	    flag="\"$flag\""
+	    ;;
+	  esac
+	  arg="$arg $wl$flag"
+	  compiler_flags="$compiler_flags $wl$flag"
+	  linker_flags="$linker_flags $flag"
+	done
+	IFS="$save_ifs"
+	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+	;;
+
+      -Xcompiler)
+	prev=xcompiler
+	continue
+	;;
+
+      -Xlinker)
+	prev=xlinker
+	continue
+	;;
+
+      -XCClinker)
+	prev=xcclinker
+	continue
+	;;
+
+      # Some other compiler flag.
+      -* | +*)
+	# Unknown arguments in both finalize_command and compile_command need
+	# to be aesthetically quoted because they are evaled later.
+	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+	case $arg in
+	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	  arg="\"$arg\""
+	  ;;
+	esac
+	;;
+
+      *.$objext)
+	# A standard object.
+	objs="$objs $arg"
+	;;
+
+      *.lo)
+	# A libtool-controlled object.
+
+	# Check to see that this really is a libtool object.
+	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+	  pic_object=
+	  non_pic_object=
+
+	  # Read the .lo file
+	  # If there is no directory component, then add one.
+	  case $arg in
+	  */* | *\\*) . $arg ;;
+	  *) . ./$arg ;;
+	  esac
+
+	  if test -z "$pic_object" || \
+	     test -z "$non_pic_object" ||
+	     test "$pic_object" = none && \
+	     test "$non_pic_object" = none; then
+	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+
+	  # Extract subdirectory from the argument.
+	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+	  if test "X$xdir" = "X$arg"; then
+	    xdir=
+ 	  else
+	    xdir="$xdir/"
+	  fi
+
+	  if test "$pic_object" != none; then
+	    # Prepend the subdirectory the object is found in.
+	    pic_object="$xdir$pic_object"
+
+	    if test "$prev" = dlfiles; then
+	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+		dlfiles="$dlfiles $pic_object"
+		prev=
+		continue
+	      else
+		# If libtool objects are unsupported, then we need to preload.
+		prev=dlprefiles
+	      fi
+	    fi
+
+	    # CHECK ME:  I think I busted this.  -Ossama
+	    if test "$prev" = dlprefiles; then
+	      # Preload the old-style object.
+	      dlprefiles="$dlprefiles $pic_object"
+	      prev=
+	    fi
+
+	    # A PIC object.
+	    libobjs="$libobjs $pic_object"
+	    arg="$pic_object"
+	  fi
+
+	  # Non-PIC object.
+	  if test "$non_pic_object" != none; then
+	    # Prepend the subdirectory the object is found in.
+	    non_pic_object="$xdir$non_pic_object"
+
+	    # A standard non-PIC object
+	    non_pic_objects="$non_pic_objects $non_pic_object"
+	    if test -z "$pic_object" || test "$pic_object" = none ; then
+	      arg="$non_pic_object"
+	    fi
+	  else
+	    # If the PIC object exists, use it instead.
+	    # $xdir was prepended to $pic_object above.
+	    non_pic_object="$pic_object"
+	    non_pic_objects="$non_pic_objects $non_pic_object"
+	  fi
+	else
+	  # Only an error if not doing a dry-run.
+	  if test -z "$run"; then
+	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+	    exit $EXIT_FAILURE
+	  else
+	    # Dry-run case.
+
+	    # Extract subdirectory from the argument.
+	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+	    if test "X$xdir" = "X$arg"; then
+	      xdir=
+	    else
+	      xdir="$xdir/"
+	    fi
+
+	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+	    libobjs="$libobjs $pic_object"
+	    non_pic_objects="$non_pic_objects $non_pic_object"
+	  fi
+	fi
+	;;
+
+      *.$libext)
+	# An archive.
+	deplibs="$deplibs $arg"
+	old_deplibs="$old_deplibs $arg"
+	continue
+	;;
+
+      *.la)
+	# A libtool-controlled library.
+
+	if test "$prev" = dlfiles; then
+	  # This library was specified with -dlopen.
+	  dlfiles="$dlfiles $arg"
+	  prev=
+	elif test "$prev" = dlprefiles; then
+	  # The library was specified with -dlpreopen.
+	  dlprefiles="$dlprefiles $arg"
+	  prev=
+	else
+	  deplibs="$deplibs $arg"
+	fi
+	continue
+	;;
+
+      # Some other compiler argument.
+      *)
+	# Unknown arguments in both finalize_command and compile_command need
+	# to be aesthetically quoted because they are evaled later.
+	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+	case $arg in
+	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	  arg="\"$arg\""
+	  ;;
+	esac
+	;;
+      esac # arg
+
+      # Now actually substitute the argument into the commands.
+      if test -n "$arg"; then
+	compile_command="$compile_command $arg"
+	finalize_command="$finalize_command $arg"
+      fi
+    done # argument parsing loop
+
+    if test -n "$prev"; then
+      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+      eval arg=\"$export_dynamic_flag_spec\"
+      compile_command="$compile_command $arg"
+      finalize_command="$finalize_command $arg"
+    fi
+
+    oldlibs=
+    # calculate the name of the file, without its directory
+    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
+    libobjs_save="$libobjs"
+
+    if test -n "$shlibpath_var"; then
+      # get the directories listed in $shlibpath_var
+      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+    else
+      shlib_search_path=
+    fi
+    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+    if test "X$output_objdir" = "X$output"; then
+      output_objdir="$objdir"
+    else
+      output_objdir="$output_objdir/$objdir"
+    fi
+    # Create the object directory.
+    if test ! -d "$output_objdir"; then
+      $show "$mkdir $output_objdir"
+      $run $mkdir $output_objdir
+      exit_status=$?
+      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
+	exit $exit_status
+      fi
+    fi
+
+    # Determine the type of output
+    case $output in
+    "")
+      $echo "$modename: you must specify an output file" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+      ;;
+    *.$libext) linkmode=oldlib ;;
+    *.lo | *.$objext) linkmode=obj ;;
+    *.la) linkmode=lib ;;
+    *) linkmode=prog ;; # Anything else should be a program.
+    esac
+
+    case $host in
+    *cygwin* | *mingw* | *pw32*)
+      # don't eliminate duplications in $postdeps and $predeps
+      duplicate_compiler_generated_deps=yes
+      ;;
+    *)
+      duplicate_compiler_generated_deps=$duplicate_deps
+      ;;
+    esac
+    specialdeplibs=
+
+    libs=
+    # Find all interdependent deplibs by searching for libraries
+    # that are linked more than once (e.g. -la -lb -la)
+    for deplib in $deplibs; do
+      if test "X$duplicate_deps" = "Xyes" ; then
+	case "$libs " in
+	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	esac
+      fi
+      libs="$libs $deplib"
+    done
+
+    if test "$linkmode" = lib; then
+      libs="$predeps $libs $compiler_lib_search_path $postdeps"
+
+      # Compute libraries that are listed more than once in $predeps
+      # $postdeps and mark them as special (i.e., whose duplicates are
+      # not to be eliminated).
+      pre_post_deps=
+      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
+	for pre_post_dep in $predeps $postdeps; do
+	  case "$pre_post_deps " in
+	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
+	  esac
+	  pre_post_deps="$pre_post_deps $pre_post_dep"
+	done
+      fi
+      pre_post_deps=
+    fi
+
+    deplibs=
+    newdependency_libs=
+    newlib_search_path=
+    need_relink=no # whether we're linking any uninstalled libtool libraries
+    notinst_deplibs= # not-installed libtool libraries
+    case $linkmode in
+    lib)
+	passes="conv link"
+	for file in $dlfiles $dlprefiles; do
+	  case $file in
+	  *.la) ;;
+	  *)
+	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
+	    exit $EXIT_FAILURE
+	    ;;
+	  esac
+	done
+	;;
+    prog)
+	compile_deplibs=
+	finalize_deplibs=
+	alldeplibs=no
+	newdlfiles=
+	newdlprefiles=
+	passes="conv scan dlopen dlpreopen link"
+	;;
+    *)  passes="conv"
+	;;
+    esac
+    for pass in $passes; do
+      if test "$linkmode,$pass" = "lib,link" ||
+	 test "$linkmode,$pass" = "prog,scan"; then
+	libs="$deplibs"
+	deplibs=
+      fi
+      if test "$linkmode" = prog; then
+	case $pass in
+	dlopen) libs="$dlfiles" ;;
+	dlpreopen) libs="$dlprefiles" ;;
+	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+	esac
+      fi
+      if test "$pass" = dlopen; then
+	# Collect dlpreopened libraries
+	save_deplibs="$deplibs"
+	deplibs=
+      fi
+      for deplib in $libs; do
+	lib=
+	found=no
+	case $deplib in
+	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+	  if test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$deplib $compile_deplibs"
+	    finalize_deplibs="$deplib $finalize_deplibs"
+	  else
+	    compiler_flags="$compiler_flags $deplib"
+	  fi
+	  continue
+	  ;;
+	-l*)
+	  if test "$linkmode" != lib && test "$linkmode" != prog; then
+	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
+	    continue
+	  fi
+	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
+	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
+	    for search_ext in .la $std_shrext .so .a; do
+	      # Search the libtool library
+	      lib="$searchdir/lib${name}${search_ext}"
+	      if test -f "$lib"; then
+		if test "$search_ext" = ".la"; then
+		  found=yes
+		else
+		  found=no
+		fi
+		break 2
+	      fi
+	    done
+	  done
+	  if test "$found" != yes; then
+	    # deplib doesn't seem to be a libtool library
+	    if test "$linkmode,$pass" = "prog,link"; then
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    else
+	      deplibs="$deplib $deplibs"
+	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    continue
+	  else # deplib is a libtool library
+	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
+	    # We need to do some special things here, and not later.
+	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+	      case " $predeps $postdeps " in
+	      *" $deplib "*)
+		if (${SED} -e '2q' $lib |
+                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+		  library_names=
+		  old_library=
+		  case $lib in
+		  */* | *\\*) . $lib ;;
+		  *) . ./$lib ;;
+		  esac
+		  for l in $old_library $library_names; do
+		    ll="$l"
+		  done
+		  if test "X$ll" = "X$old_library" ; then # only static version available
+		    found=no
+		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+		    test "X$ladir" = "X$lib" && ladir="."
+		    lib=$ladir/$old_library
+		    if test "$linkmode,$pass" = "prog,link"; then
+		      compile_deplibs="$deplib $compile_deplibs"
+		      finalize_deplibs="$deplib $finalize_deplibs"
+		    else
+		      deplibs="$deplib $deplibs"
+		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+		    fi
+		    continue
+		  fi
+		fi
+	        ;;
+	      *) ;;
+	      esac
+	    fi
+	  fi
+	  ;; # -l
+	-L*)
+	  case $linkmode in
+	  lib)
+	    deplibs="$deplib $deplibs"
+	    test "$pass" = conv && continue
+	    newdependency_libs="$deplib $newdependency_libs"
+	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+	    ;;
+	  prog)
+	    if test "$pass" = conv; then
+	      deplibs="$deplib $deplibs"
+	      continue
+	    fi
+	    if test "$pass" = scan; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+	    ;;
+	  *)
+	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
+	    ;;
+	  esac # linkmode
+	  continue
+	  ;; # -L
+	-R*)
+	  if test "$pass" = link; then
+	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
+	    # Make sure the xrpath contains only unique directories.
+	    case "$xrpath " in
+	    *" $dir "*) ;;
+	    *) xrpath="$xrpath $dir" ;;
+	    esac
+	  fi
+	  deplibs="$deplib $deplibs"
+	  continue
+	  ;;
+	*.la) lib="$deplib" ;;
+	*.$libext)
+	  if test "$pass" = conv; then
+	    deplibs="$deplib $deplibs"
+	    continue
+	  fi
+	  case $linkmode in
+	  lib)
+	    valid_a_lib=no
+	    case $deplibs_check_method in
+	      match_pattern*)
+		set dummy $deplibs_check_method
+	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+		if eval $echo \"$deplib\" 2>/dev/null \
+		    | $SED 10q \
+		    | $EGREP "$match_pattern_regex" > /dev/null; then
+		  valid_a_lib=yes
+		fi
+		;;
+	      pass_all)
+		valid_a_lib=yes
+		;;
+            esac
+	    if test "$valid_a_lib" != yes; then
+	      $echo
+	      $echo "*** Warning: Trying to link with static lib archive $deplib."
+	      $echo "*** I have the capability to make that library automatically link in when"
+	      $echo "*** you link to this library.  But I can only do this if you have a"
+	      $echo "*** shared version of the library, which you do not appear to have"
+	      $echo "*** because the file extensions .$libext of this argument makes me believe"
+	      $echo "*** that it is just a static archive that I should not used here."
+	    else
+	      $echo
+	      $echo "*** Warning: Linking the shared library $output against the"
+	      $echo "*** static library $deplib is not portable!"
+	      deplibs="$deplib $deplibs"
+	    fi
+	    continue
+	    ;;
+	  prog)
+	    if test "$pass" != link; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    continue
+	    ;;
+	  esac # linkmode
+	  ;; # *.$libext
+	*.lo | *.$objext)
+	  if test "$pass" = conv; then
+	    deplibs="$deplib $deplibs"
+	  elif test "$linkmode" = prog; then
+	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+	      # If there is no dlopen support or we're linking statically,
+	      # we need to preload.
+	      newdlprefiles="$newdlprefiles $deplib"
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    else
+	      newdlfiles="$newdlfiles $deplib"
+	    fi
+	  fi
+	  continue
+	  ;;
+	%DEPLIBS%)
+	  alldeplibs=yes
+	  continue
+	  ;;
+	esac # case $deplib
+	if test "$found" = yes || test -f "$lib"; then :
+	else
+	  $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	# Check to see that this really is a libtool archive.
+	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+	else
+	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+	test "X$ladir" = "X$lib" && ladir="."
+
+	dlname=
+	dlopen=
+	dlpreopen=
+	libdir=
+	library_names=
+	old_library=
+	# If the library was installed with an old release of libtool,
+	# it will not redefine variables installed, or shouldnotlink
+	installed=yes
+	shouldnotlink=no
+	avoidtemprpath=
+
+
+	# Read the .la file
+	case $lib in
+	*/* | *\\*) . $lib ;;
+	*) . ./$lib ;;
+	esac
+
+	if test "$linkmode,$pass" = "lib,link" ||
+	   test "$linkmode,$pass" = "prog,scan" ||
+	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
+	fi
+
+	if test "$pass" = conv; then
+	  # Only check for convenience libraries
+	  deplibs="$lib $deplibs"
+	  if test -z "$libdir"; then
+	    if test -z "$old_library"; then
+	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+	      exit $EXIT_FAILURE
+	    fi
+	    # It is a libtool convenience library, so add in its objects.
+	    convenience="$convenience $ladir/$objdir/$old_library"
+	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
+	    tmp_libs=
+	    for deplib in $dependency_libs; do
+	      deplibs="$deplib $deplibs"
+              if test "X$duplicate_deps" = "Xyes" ; then
+	        case "$tmp_libs " in
+	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	        esac
+              fi
+	      tmp_libs="$tmp_libs $deplib"
+	    done
+	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
+	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	  continue
+	fi # $pass = conv
+
+
+	# Get the name of the library we link against.
+	linklib=
+	for l in $old_library $library_names; do
+	  linklib="$l"
+	done
+	if test -z "$linklib"; then
+	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	# This library was specified with -dlopen.
+	if test "$pass" = dlopen; then
+	  if test -z "$libdir"; then
+	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	  if test -z "$dlname" ||
+	     test "$dlopen_support" != yes ||
+	     test "$build_libtool_libs" = no; then
+	    # If there is no dlname, no dlopen support or we're linking
+	    # statically, we need to preload.  We also need to preload any
+	    # dependent libraries so libltdl's deplib preloader doesn't
+	    # bomb out in the load deplibs phase.
+	    dlprefiles="$dlprefiles $lib $dependency_libs"
+	  else
+	    newdlfiles="$newdlfiles $lib"
+	  fi
+	  continue
+	fi # $pass = dlopen
+
+	# We need an absolute path.
+	case $ladir in
+	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+	*)
+	  abs_ladir=`cd "$ladir" && pwd`
+	  if test -z "$abs_ladir"; then
+	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
+	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
+	    abs_ladir="$ladir"
+	  fi
+	  ;;
+	esac
+	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+
+	# Find the relevant object directory and library name.
+	if test "X$installed" = Xyes; then
+	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
+	    dir="$ladir"
+	    absdir="$abs_ladir"
+	    libdir="$abs_ladir"
+	  else
+	    dir="$libdir"
+	    absdir="$libdir"
+	  fi
+	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
+	else
+	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	    dir="$ladir"
+	    absdir="$abs_ladir"
+	    # Remove this search path later
+	    notinst_path="$notinst_path $abs_ladir"
+	  else
+	    dir="$ladir/$objdir"
+	    absdir="$abs_ladir/$objdir"
+	    # Remove this search path later
+	    notinst_path="$notinst_path $abs_ladir"
+	  fi
+	fi # $installed = yes
+	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+
+	# This library was specified with -dlpreopen.
+	if test "$pass" = dlpreopen; then
+	  if test -z "$libdir"; then
+	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	  # Prefer using a static library (so that no silly _DYNAMIC symbols
+	  # are required to link).
+	  if test -n "$old_library"; then
+	    newdlprefiles="$newdlprefiles $dir/$old_library"
+	  # Otherwise, use the dlname, so that lt_dlopen finds it.
+	  elif test -n "$dlname"; then
+	    newdlprefiles="$newdlprefiles $dir/$dlname"
+	  else
+	    newdlprefiles="$newdlprefiles $dir/$linklib"
+	  fi
+	fi # $pass = dlpreopen
+
+	if test -z "$libdir"; then
+	  # Link the convenience library
+	  if test "$linkmode" = lib; then
+	    deplibs="$dir/$old_library $deplibs"
+	  elif test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$dir/$old_library $compile_deplibs"
+	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
+	  else
+	    deplibs="$lib $deplibs" # used for prog,scan pass
+	  fi
+	  continue
+	fi
+
+
+	if test "$linkmode" = prog && test "$pass" != link; then
+	  newlib_search_path="$newlib_search_path $ladir"
+	  deplibs="$lib $deplibs"
+
+	  linkalldeplibs=no
+	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
+	     test "$build_libtool_libs" = no; then
+	    linkalldeplibs=yes
+	  fi
+
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    case $deplib in
+	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
+	    esac
+	    # Need to link against all dependency_libs?
+	    if test "$linkalldeplibs" = yes; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      # Need to hardcode shared library paths
+	      # or/and link against static libraries
+	      newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    if test "X$duplicate_deps" = "Xyes" ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      esac
+	    fi
+	    tmp_libs="$tmp_libs $deplib"
+	  done # for deplib
+	  continue
+	fi # $linkmode = prog...
+
+	if test "$linkmode,$pass" = "prog,link"; then
+	  if test -n "$library_names" &&
+	     { { test "$prefer_static_libs" = no ||
+		 test "$prefer_static_libs,$installed" = "built,yes"; } ||
+	       test -z "$old_library"; }; then
+	    # We need to hardcode the library path
+	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
+	      # Make sure the rpath contains only unique directories.
+	      case "$temp_rpath " in
+	      *" $dir "*) ;;
+	      *" $absdir "*) ;;
+	      *) temp_rpath="$temp_rpath $absdir" ;;
+	      esac
+	    fi
+
+	    # Hardcode the library path.
+	    # Skip directories that are in the system default run-time
+	    # search path.
+	    case " $sys_lib_dlsearch_path " in
+	    *" $absdir "*) ;;
+	    *)
+	      case "$compile_rpath " in
+	      *" $absdir "*) ;;
+	      *) compile_rpath="$compile_rpath $absdir"
+	      esac
+	      ;;
+	    esac
+	    case " $sys_lib_dlsearch_path " in
+	    *" $libdir "*) ;;
+	    *)
+	      case "$finalize_rpath " in
+	      *" $libdir "*) ;;
+	      *) finalize_rpath="$finalize_rpath $libdir"
+	      esac
+	      ;;
+	    esac
+	  fi # $linkmode,$pass = prog,link...
+
+	  if test "$alldeplibs" = yes &&
+	     { test "$deplibs_check_method" = pass_all ||
+	       { test "$build_libtool_libs" = yes &&
+		 test -n "$library_names"; }; }; then
+	    # We only need to search for static libraries
+	    continue
+	  fi
+	fi
+
+	link_static=no # Whether the deplib will be linked statically
+	use_static_libs=$prefer_static_libs
+	if test "$use_static_libs" = built && test "$installed" = yes ; then
+	  use_static_libs=no
+	fi
+	if test -n "$library_names" &&
+	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
+	  if test "$installed" = no; then
+	    notinst_deplibs="$notinst_deplibs $lib"
+	    need_relink=yes
+	  fi
+	  # This is a shared library
+
+	  # Warn about portability, can't link against -module's on
+	  # some systems (darwin)
+	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
+	    $echo
+	    if test "$linkmode" = prog; then
+	      $echo "*** Warning: Linking the executable $output against the loadable module"
+	    else
+	      $echo "*** Warning: Linking the shared library $output against the loadable module"
+	    fi
+	    $echo "*** $linklib is not portable!"
+	  fi
+	  if test "$linkmode" = lib &&
+	     test "$hardcode_into_libs" = yes; then
+	    # Hardcode the library path.
+	    # Skip directories that are in the system default run-time
+	    # search path.
+	    case " $sys_lib_dlsearch_path " in
+	    *" $absdir "*) ;;
+	    *)
+	      case "$compile_rpath " in
+	      *" $absdir "*) ;;
+	      *) compile_rpath="$compile_rpath $absdir"
+	      esac
+	      ;;
+	    esac
+	    case " $sys_lib_dlsearch_path " in
+	    *" $libdir "*) ;;
+	    *)
+	      case "$finalize_rpath " in
+	      *" $libdir "*) ;;
+	      *) finalize_rpath="$finalize_rpath $libdir"
+	      esac
+	      ;;
+	    esac
+	  fi
+
+	  if test -n "$old_archive_from_expsyms_cmds"; then
+	    # figure out the soname
+	    set dummy $library_names
+	    realname="$2"
+	    shift; shift
+	    libname=`eval \\$echo \"$libname_spec\"`
+	    # use dlname if we got it. it's perfectly good, no?
+	    if test -n "$dlname"; then
+	      soname="$dlname"
+	    elif test -n "$soname_spec"; then
+	      # bleh windows
+	      case $host in
+	      *cygwin* | mingw*)
+		major=`expr $current - $age`
+		versuffix="-$major"
+		;;
+	      esac
+	      eval soname=\"$soname_spec\"
+	    else
+	      soname="$realname"
+	    fi
+
+	    # Make a new name for the extract_expsyms_cmds to use
+	    soroot="$soname"
+	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
+	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
+
+	    # If the library has no export list, then create one now
+	    if test -f "$output_objdir/$soname-def"; then :
+	    else
+	      $show "extracting exported symbol list from \`$soname'"
+	      save_ifs="$IFS"; IFS='~'
+	      cmds=$extract_expsyms_cmds
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		eval cmd=\"$cmd\"
+		$show "$cmd"
+		$run eval "$cmd" || exit $?
+	      done
+	      IFS="$save_ifs"
+	    fi
+
+	    # Create $newlib
+	    if test -f "$output_objdir/$newlib"; then :; else
+	      $show "generating import library for \`$soname'"
+	      save_ifs="$IFS"; IFS='~'
+	      cmds=$old_archive_from_expsyms_cmds
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		eval cmd=\"$cmd\"
+		$show "$cmd"
+		$run eval "$cmd" || exit $?
+	      done
+	      IFS="$save_ifs"
+	    fi
+	    # make sure the library variables are pointing to the new library
+	    dir=$output_objdir
+	    linklib=$newlib
+	  fi # test -n "$old_archive_from_expsyms_cmds"
+
+	  if test "$linkmode" = prog || test "$mode" != relink; then
+	    add_shlibpath=
+	    add_dir=
+	    add=
+	    lib_linked=yes
+	    case $hardcode_action in
+	    immediate | unsupported)
+	      if test "$hardcode_direct" = no; then
+		add="$dir/$linklib"
+		case $host in
+		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
+		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
+		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
+		    *-*-unixware7*) add_dir="-L$dir" ;;
+		  *-*-darwin* )
+		    # if the lib is a module then we can not link against
+		    # it, someone is ignoring the new warnings I added
+		    if /usr/bin/file -L $add 2> /dev/null |
+                      $EGREP ": [^:]* bundle" >/dev/null ; then
+		      $echo "** Warning, lib $linklib is a module, not a shared library"
+		      if test -z "$old_library" ; then
+		        $echo
+		        $echo "** And there doesn't seem to be a static archive available"
+		        $echo "** The link will probably fail, sorry"
+		      else
+		        add="$dir/$old_library"
+		      fi
+		    fi
+		esac
+	      elif test "$hardcode_minus_L" = no; then
+		case $host in
+		*-*-sunos*) add_shlibpath="$dir" ;;
+		esac
+		add_dir="-L$dir"
+		add="-l$name"
+	      elif test "$hardcode_shlibpath_var" = no; then
+		add_shlibpath="$dir"
+		add="-l$name"
+	      else
+		lib_linked=no
+	      fi
+	      ;;
+	    relink)
+	      if test "$hardcode_direct" = yes; then
+		add="$dir/$linklib"
+	      elif test "$hardcode_minus_L" = yes; then
+		add_dir="-L$dir"
+		# Try looking first in the location we're being installed to.
+		if test -n "$inst_prefix_dir"; then
+		  case $libdir in
+		    [\\/]*)
+		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
+		      ;;
+		  esac
+		fi
+		add="-l$name"
+	      elif test "$hardcode_shlibpath_var" = yes; then
+		add_shlibpath="$dir"
+		add="-l$name"
+	      else
+		lib_linked=no
+	      fi
+	      ;;
+	    *) lib_linked=no ;;
+	    esac
+
+	    if test "$lib_linked" != yes; then
+	      $echo "$modename: configuration error: unsupported hardcode properties"
+	      exit $EXIT_FAILURE
+	    fi
+
+	    if test -n "$add_shlibpath"; then
+	      case :$compile_shlibpath: in
+	      *":$add_shlibpath:"*) ;;
+	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
+	      esac
+	    fi
+	    if test "$linkmode" = prog; then
+	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
+	    else
+	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
+	      test -n "$add" && deplibs="$add $deplibs"
+	      if test "$hardcode_direct" != yes && \
+		 test "$hardcode_minus_L" != yes && \
+		 test "$hardcode_shlibpath_var" = yes; then
+		case :$finalize_shlibpath: in
+		*":$libdir:"*) ;;
+		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+		esac
+	      fi
+	    fi
+	  fi
+
+	  if test "$linkmode" = prog || test "$mode" = relink; then
+	    add_shlibpath=
+	    add_dir=
+	    add=
+	    # Finalize command for both is simple: just hardcode it.
+	    if test "$hardcode_direct" = yes; then
+	      add="$libdir/$linklib"
+	    elif test "$hardcode_minus_L" = yes; then
+	      add_dir="-L$libdir"
+	      add="-l$name"
+	    elif test "$hardcode_shlibpath_var" = yes; then
+	      case :$finalize_shlibpath: in
+	      *":$libdir:"*) ;;
+	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+	      esac
+	      add="-l$name"
+	    elif test "$hardcode_automatic" = yes; then
+	      if test -n "$inst_prefix_dir" &&
+		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
+	        add="$inst_prefix_dir$libdir/$linklib"
+	      else
+	        add="$libdir/$linklib"
+	      fi
+	    else
+	      # We cannot seem to hardcode it, guess we'll fake it.
+	      add_dir="-L$libdir"
+	      # Try looking first in the location we're being installed to.
+	      if test -n "$inst_prefix_dir"; then
+		case $libdir in
+		  [\\/]*)
+		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
+		    ;;
+		esac
+	      fi
+	      add="-l$name"
+	    fi
+
+	    if test "$linkmode" = prog; then
+	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+	    else
+	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
+	      test -n "$add" && deplibs="$add $deplibs"
+	    fi
+	  fi
+	elif test "$linkmode" = prog; then
+	  # Here we assume that one of hardcode_direct or hardcode_minus_L
+	  # is not unsupported.  This is valid on all known static and
+	  # shared platforms.
+	  if test "$hardcode_direct" != unsupported; then
+	    test -n "$old_library" && linklib="$old_library"
+	    compile_deplibs="$dir/$linklib $compile_deplibs"
+	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
+	  else
+	    compile_deplibs="-l$name -L$dir $compile_deplibs"
+	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+	  fi
+	elif test "$build_libtool_libs" = yes; then
+	  # Not a shared library
+	  if test "$deplibs_check_method" != pass_all; then
+	    # We're trying link a shared library against a static one
+	    # but the system doesn't support it.
+
+	    # Just print a warning and add the library to dependency_libs so
+	    # that the program can be linked against the static library.
+	    $echo
+	    $echo "*** Warning: This system can not link to static lib archive $lib."
+	    $echo "*** I have the capability to make that library automatically link in when"
+	    $echo "*** you link to this library.  But I can only do this if you have a"
+	    $echo "*** shared version of the library, which you do not appear to have."
+	    if test "$module" = yes; then
+	      $echo "*** But as you try to build a module library, libtool will still create "
+	      $echo "*** a static module, that should work as long as the dlopening application"
+	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+	      if test -z "$global_symbol_pipe"; then
+		$echo
+		$echo "*** However, this would only work if libtool was able to extract symbol"
+		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+		$echo "*** not find such a program.  So, this module is probably useless."
+		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
+	      fi
+	      if test "$build_old_libs" = no; then
+		build_libtool_libs=module
+		build_old_libs=yes
+	      else
+		build_libtool_libs=no
+	      fi
+	    fi
+	  else
+	    deplibs="$dir/$old_library $deplibs"
+	    link_static=yes
+	  fi
+	fi # link shared/static library?
+
+	if test "$linkmode" = lib; then
+	  if test -n "$dependency_libs" &&
+	     { test "$hardcode_into_libs" != yes ||
+	       test "$build_old_libs" = yes ||
+	       test "$link_static" = yes; }; then
+	    # Extract -R from dependency_libs
+	    temp_deplibs=
+	    for libdir in $dependency_libs; do
+	      case $libdir in
+	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
+		   case " $xrpath " in
+		   *" $temp_xrpath "*) ;;
+		   *) xrpath="$xrpath $temp_xrpath";;
+		   esac;;
+	      *) temp_deplibs="$temp_deplibs $libdir";;
+	      esac
+	    done
+	    dependency_libs="$temp_deplibs"
+	  fi
+
+	  newlib_search_path="$newlib_search_path $absdir"
+	  # Link against this library
+	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+	  # ... and its dependency_libs
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    newdependency_libs="$deplib $newdependency_libs"
+	    if test "X$duplicate_deps" = "Xyes" ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      esac
+	    fi
+	    tmp_libs="$tmp_libs $deplib"
+	  done
+
+	  if test "$link_all_deplibs" != no; then
+	    # Add the search paths of all dependency libraries
+	    for deplib in $dependency_libs; do
+	      case $deplib in
+	      -L*) path="$deplib" ;;
+	      *.la)
+		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
+		test "X$dir" = "X$deplib" && dir="."
+		# We need an absolute path.
+		case $dir in
+		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+		*)
+		  absdir=`cd "$dir" && pwd`
+		  if test -z "$absdir"; then
+		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
+		    absdir="$dir"
+		  fi
+		  ;;
+		esac
+		if grep "^installed=no" $deplib > /dev/null; then
+		  path="$absdir/$objdir"
+		else
+		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		  if test -z "$libdir"; then
+		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+		    exit $EXIT_FAILURE
+		  fi
+		  if test "$absdir" != "$libdir"; then
+		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
+		  fi
+		  path="$absdir"
+		fi
+		depdepl=
+		case $host in
+		*-*-darwin*)
+		  # we do not want to link against static libs,
+		  # but need to link against shared
+		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+		  if test -n "$deplibrary_names" ; then
+		    for tmp in $deplibrary_names ; do
+		      depdepl=$tmp
+		    done
+		    if test -f "$path/$depdepl" ; then
+		      depdepl="$path/$depdepl"
+		    fi
+		    # do not add paths which are already there
+		    case " $newlib_search_path " in
+		    *" $path "*) ;;
+		    *) newlib_search_path="$newlib_search_path $path";;
+		    esac
+		  fi
+		  path=""
+		  ;;
+		*)
+		  path="-L$path"
+		  ;;
+		esac
+		;;
+	      -l*)
+		case $host in
+		*-*-darwin*)
+		  # Again, we only want to link against shared libraries
+		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
+		  for tmp in $newlib_search_path ; do
+		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
+		      eval depdepl="$tmp/lib$tmp_libs.dylib"
+		      break
+		    fi
+		  done
+		  path=""
+		  ;;
+		*) continue ;;
+		esac
+		;;
+	      *) continue ;;
+	      esac
+	      case " $deplibs " in
+	      *" $path "*) ;;
+	      *) deplibs="$path $deplibs" ;;
+	      esac
+	      case " $deplibs " in
+	      *" $depdepl "*) ;;
+	      *) deplibs="$depdepl $deplibs" ;;
+	      esac
+	    done
+	  fi # link_all_deplibs != no
+	fi # linkmode = lib
+      done # for deplib in $libs
+      dependency_libs="$newdependency_libs"
+      if test "$pass" = dlpreopen; then
+	# Link the dlpreopened libraries before other libraries
+	for deplib in $save_deplibs; do
+	  deplibs="$deplib $deplibs"
+	done
+      fi
+      if test "$pass" != dlopen; then
+	if test "$pass" != conv; then
+	  # Make sure lib_search_path contains only unique directories.
+	  lib_search_path=
+	  for dir in $newlib_search_path; do
+	    case "$lib_search_path " in
+	    *" $dir "*) ;;
+	    *) lib_search_path="$lib_search_path $dir" ;;
+	    esac
+	  done
+	  newlib_search_path=
+	fi
+
+	if test "$linkmode,$pass" != "prog,link"; then
+	  vars="deplibs"
+	else
+	  vars="compile_deplibs finalize_deplibs"
+	fi
+	for var in $vars dependency_libs; do
+	  # Add libraries to $var in reverse order
+	  eval tmp_libs=\"\$$var\"
+	  new_libs=
+	  for deplib in $tmp_libs; do
+	    # FIXME: Pedantically, this is the right thing to do, so
+	    #        that some nasty dependency loop isn't accidentally
+	    #        broken:
+	    #new_libs="$deplib $new_libs"
+	    # Pragmatically, this seems to cause very few problems in
+	    # practice:
+	    case $deplib in
+	    -L*) new_libs="$deplib $new_libs" ;;
+	    -R*) ;;
+	    *)
+	      # And here is the reason: when a library appears more
+	      # than once as an explicit dependence of a library, or
+	      # is implicitly linked in more than once by the
+	      # compiler, it is considered special, and multiple
+	      # occurrences thereof are not removed.  Compare this
+	      # with having the same library being listed as a
+	      # dependency of multiple other libraries: in this case,
+	      # we know (pedantically, we assume) the library does not
+	      # need to be listed more than once, so we keep only the
+	      # last copy.  This is not always right, but it is rare
+	      # enough that we require users that really mean to play
+	      # such unportable linking tricks to link the library
+	      # using -Wl,-lname, so that libtool does not consider it
+	      # for duplicate removal.
+	      case " $specialdeplibs " in
+	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
+	      *)
+		case " $new_libs " in
+		*" $deplib "*) ;;
+		*) new_libs="$deplib $new_libs" ;;
+		esac
+		;;
+	      esac
+	      ;;
+	    esac
+	  done
+	  tmp_libs=
+	  for deplib in $new_libs; do
+	    case $deplib in
+	    -L*)
+	      case " $tmp_libs " in
+	      *" $deplib "*) ;;
+	      *) tmp_libs="$tmp_libs $deplib" ;;
+	      esac
+	      ;;
+	    *) tmp_libs="$tmp_libs $deplib" ;;
+	    esac
+	  done
+	  eval $var=\"$tmp_libs\"
+	done # for var
+      fi
+      # Last step: remove runtime libs from dependency_libs
+      # (they stay in deplibs)
+      tmp_libs=
+      for i in $dependency_libs ; do
+	case " $predeps $postdeps $compiler_lib_search_path " in
+	*" $i "*)
+	  i=""
+	  ;;
+	esac
+	if test -n "$i" ; then
+	  tmp_libs="$tmp_libs $i"
+	fi
+      done
+      dependency_libs=$tmp_libs
+    done # for pass
+    if test "$linkmode" = prog; then
+      dlfiles="$newdlfiles"
+      dlprefiles="$newdlprefiles"
+    fi
+
+    case $linkmode in
+    oldlib)
+      if test -n "$deplibs"; then
+	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
+      fi
+
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$rpath"; then
+	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$xrpath"; then
+	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$vinfo"; then
+	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$release"; then
+	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
+      fi
+
+      # Now set the variables for building old libraries.
+      build_libtool_libs=no
+      oldlibs="$output"
+      objs="$objs$old_deplibs"
+      ;;
+
+    lib)
+      # Make sure we only generate libraries of the form `libNAME.la'.
+      case $outputname in
+      lib*)
+	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+	eval shared_ext=\"$shrext_cmds\"
+	eval libname=\"$libname_spec\"
+	;;
+      *)
+	if test "$module" = no; then
+	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+	if test "$need_lib_prefix" != no; then
+	  # Add the "lib" prefix for modules if required
+	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+	  eval shared_ext=\"$shrext_cmds\"
+	  eval libname=\"$libname_spec\"
+	else
+	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+	fi
+	;;
+      esac
+
+      if test -n "$objs"; then
+	if test "$deplibs_check_method" != pass_all; then
+	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
+	  exit $EXIT_FAILURE
+	else
+	  $echo
+	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
+	  $echo "*** objects $objs is not portable!"
+	  libobjs="$libobjs $objs"
+	fi
+      fi
+
+      if test "$dlself" != no; then
+	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
+      fi
+
+      set dummy $rpath
+      if test "$#" -gt 2; then
+	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
+      fi
+      install_libdir="$2"
+
+      oldlibs=
+      if test -z "$rpath"; then
+	if test "$build_libtool_libs" = yes; then
+	  # Building a libtool convenience library.
+	  # Some compilers have problems with a `.al' extension so
+	  # convenience libraries should have the same extension an
+	  # archive normally would.
+	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
+	  build_libtool_libs=convenience
+	  build_old_libs=yes
+	fi
+
+	if test -n "$vinfo"; then
+	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
+	fi
+
+	if test -n "$release"; then
+	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
+	fi
+      else
+
+	# Parse the version information argument.
+	save_ifs="$IFS"; IFS=':'
+	set dummy $vinfo 0 0 0
+	IFS="$save_ifs"
+
+	if test -n "$8"; then
+	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	# convert absolute version numbers to libtool ages
+	# this retains compatibility with .la files and attempts
+	# to make the code below a bit more comprehensible
+
+	case $vinfo_number in
+	yes)
+	  number_major="$2"
+	  number_minor="$3"
+	  number_revision="$4"
+	  #
+	  # There are really only two kinds -- those that
+	  # use the current revision as the major version
+	  # and those that subtract age and use age as
+	  # a minor version.  But, then there is irix
+	  # which has an extra 1 added just for fun
+	  #
+	  case $version_type in
+	  darwin|linux|osf|windows|none)
+	    current=`expr $number_major + $number_minor`
+	    age="$number_minor"
+	    revision="$number_revision"
+	    ;;
+	  freebsd-aout|freebsd-elf|sunos)
+	    current="$number_major"
+	    revision="$number_minor"
+	    age="0"
+	    ;;
+	  irix|nonstopux)
+	    current=`expr $number_major + $number_minor - 1`
+	    age="$number_minor"
+	    revision="$number_minor"
+	    ;;
+	  esac
+	  ;;
+	no)
+	  current="$2"
+	  revision="$3"
+	  age="$4"
+	  ;;
+	esac
+
+	# Check that each of the things are valid numbers.
+	case $current in
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+	*)
+	  $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
+	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+
+	case $revision in
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+	*)
+	  $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
+	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+
+	case $age in
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+	*)
+	  $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
+	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+
+	if test "$age" -gt "$current"; then
+	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
+	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	# Calculate the version variables.
+	major=
+	versuffix=
+	verstring=
+	case $version_type in
+	none) ;;
+
+	darwin)
+	  # Like Linux, but with the current version available in
+	  # verstring for coding it into the library header
+	  major=.`expr $current - $age`
+	  versuffix="$major.$age.$revision"
+	  # Darwin ld doesn't like 0 for these options...
+	  minor_current=`expr $current + 1`
+	  verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+	  ;;
+
+	freebsd-aout)
+	  major=".$current"
+	  versuffix=".$current.$revision";
+	  ;;
+
+	freebsd-elf)
+	  major=".$current"
+	  versuffix=".$current";
+	  ;;
+
+	irix | nonstopux)
+	  major=`expr $current - $age + 1`
+
+	  case $version_type in
+	    nonstopux) verstring_prefix=nonstopux ;;
+	    *)         verstring_prefix=sgi ;;
+	  esac
+	  verstring="$verstring_prefix$major.$revision"
+
+	  # Add in all the interfaces that we are compatible with.
+	  loop=$revision
+	  while test "$loop" -ne 0; do
+	    iface=`expr $revision - $loop`
+	    loop=`expr $loop - 1`
+	    verstring="$verstring_prefix$major.$iface:$verstring"
+	  done
+
+	  # Before this point, $major must not contain `.'.
+	  major=.$major
+	  versuffix="$major.$revision"
+	  ;;
+
+	linux)
+	  major=.`expr $current - $age`
+	  versuffix="$major.$age.$revision"
+	  ;;
+
+	osf)
+	  major=.`expr $current - $age`
+	  versuffix=".$current.$age.$revision"
+	  verstring="$current.$age.$revision"
+
+	  # Add in all the interfaces that we are compatible with.
+	  loop=$age
+	  while test "$loop" -ne 0; do
+	    iface=`expr $current - $loop`
+	    loop=`expr $loop - 1`
+	    verstring="$verstring:${iface}.0"
+	  done
+
+	  # Make executables depend on our current version.
+	  verstring="$verstring:${current}.0"
+	  ;;
+
+	sunos)
+	  major=".$current"
+	  versuffix=".$current.$revision"
+	  ;;
+
+	windows)
+	  # Use '-' rather than '.', since we only want one
+	  # extension on DOS 8.3 filesystems.
+	  major=`expr $current - $age`
+	  versuffix="-$major"
+	  ;;
+
+	*)
+	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
+	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+
+	# Clear the version info if we defaulted, and they specified a release.
+	if test -z "$vinfo" && test -n "$release"; then
+	  major=
+	  case $version_type in
+	  darwin)
+	    # we can't check for "0.0" in archive_cmds due to quoting
+	    # problems, so we reset it completely
+	    verstring=
+	    ;;
+	  *)
+	    verstring="0.0"
+	    ;;
+	  esac
+	  if test "$need_version" = no; then
+	    versuffix=
+	  else
+	    versuffix=".0.0"
+	  fi
+	fi
+
+	# Remove version info from name if versioning should be avoided
+	if test "$avoid_version" = yes && test "$need_version" = no; then
+	  major=
+	  versuffix=
+	  verstring=""
+	fi
+
+	# Check to see if the archive will have undefined symbols.
+	if test "$allow_undefined" = yes; then
+	  if test "$allow_undefined_flag" = unsupported; then
+	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
+	    build_libtool_libs=no
+	    build_old_libs=yes
+	  fi
+	else
+	  # Don't allow undefined symbols.
+	  allow_undefined_flag="$no_undefined_flag"
+	fi
+      fi
+
+      if test "$mode" != relink; then
+	# Remove our outputs, but don't remove object files since they
+	# may have been created when compiling PIC objects.
+	removelist=
+	tempremovelist=`$echo "$output_objdir/*"`
+	for p in $tempremovelist; do
+	  case $p in
+	    *.$objext)
+	       ;;
+	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+	       if test "X$precious_files_regex" != "X"; then
+	         if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+	         then
+		   continue
+		 fi
+	       fi
+	       removelist="$removelist $p"
+	       ;;
+	    *) ;;
+	  esac
+	done
+	if test -n "$removelist"; then
+	  $show "${rm}r $removelist"
+	  $run ${rm}r $removelist
+	fi
+      fi
+
+      # Now set the variables for building old libraries.
+      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+	oldlibs="$oldlibs $output_objdir/$libname.$libext"
+
+	# Transform .lo files to .o files.
+	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
+      fi
+
+      # Eliminate all temporary directories.
+      #for path in $notinst_path; do
+      #	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
+      #	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
+      #	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
+      #done
+
+      if test -n "$xrpath"; then
+	# If the user specified any rpath flags, then add them.
+	temp_xrpath=
+	for libdir in $xrpath; do
+	  temp_xrpath="$temp_xrpath -R$libdir"
+	  case "$finalize_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_rpath="$finalize_rpath $libdir" ;;
+	  esac
+	done
+	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
+	  dependency_libs="$temp_xrpath $dependency_libs"
+	fi
+      fi
+
+      # Make sure dlfiles contains only unique files that won't be dlpreopened
+      old_dlfiles="$dlfiles"
+      dlfiles=
+      for lib in $old_dlfiles; do
+	case " $dlprefiles $dlfiles " in
+	*" $lib "*) ;;
+	*) dlfiles="$dlfiles $lib" ;;
+	esac
+      done
+
+      # Make sure dlprefiles contains only unique files
+      old_dlprefiles="$dlprefiles"
+      dlprefiles=
+      for lib in $old_dlprefiles; do
+	case "$dlprefiles " in
+	*" $lib "*) ;;
+	*) dlprefiles="$dlprefiles $lib" ;;
+	esac
+      done
+
+      if test "$build_libtool_libs" = yes; then
+	if test -n "$rpath"; then
+	  case $host in
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
+	    # these systems don't actually have a c library (as such)!
+	    ;;
+	  *-*-rhapsody* | *-*-darwin1.[012])
+	    # Rhapsody C library is in the System framework
+	    deplibs="$deplibs -framework System"
+	    ;;
+	  *-*-netbsd*)
+	    # Don't link with libc until the a.out ld.so is fixed.
+	    ;;
+	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+	    # Do not include libc due to us having libc/libc_r.
+	    ;;
+	  *-*-sco3.2v5* | *-*-sco5v6*)
+	    # Causes problems with __ctype
+	    ;;
+	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+	    # Compiler inserts libc in the correct place for threads to work
+	    ;;
+ 	  *)
+	    # Add libc to deplibs on all other systems if necessary.
+	    if test "$build_libtool_need_lc" = "yes"; then
+	      deplibs="$deplibs -lc"
+	    fi
+	    ;;
+	  esac
+	fi
+
+	# Transform deplibs into only deplibs that can be linked in shared.
+	name_save=$name
+	libname_save=$libname
+	release_save=$release
+	versuffix_save=$versuffix
+	major_save=$major
+	# I'm not sure if I'm treating the release correctly.  I think
+	# release should show up in the -l (ie -lgmp5) so we don't want to
+	# add it in twice.  Is that correct?
+	release=""
+	versuffix=""
+	major=""
+	newdeplibs=
+	droppeddeps=no
+	case $deplibs_check_method in
+	pass_all)
+	  # Don't check for shared/static.  Everything works.
+	  # This might be a little naive.  We might want to check
+	  # whether the library exists or not.  But this is on
+	  # osf3 & osf4 and I'm not really sure... Just
+	  # implementing what was already the behavior.
+	  newdeplibs=$deplibs
+	  ;;
+	test_compile)
+	  # This code stresses the "libraries are programs" paradigm to its
+	  # limits. Maybe even breaks it.  We compile a program, linking it
+	  # against the deplibs as a proxy for the library.  Then we can check
+	  # whether they linked in statically or dynamically with ldd.
+	  $rm conftest.c
+	  cat > conftest.c <<EOF
+	  int main() { return 0; }
+EOF
+	  $rm conftest
+	  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
+	    ldd_output=`ldd conftest`
+	    for i in $deplibs; do
+	      name=`expr $i : '-l\(.*\)'`
+	      # If $name is empty we are operating on a -L argument.
+              if test "$name" != "" && test "$name" != "0"; then
+		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		  case " $predeps $postdeps " in
+		  *" $i "*)
+		    newdeplibs="$newdeplibs $i"
+		    i=""
+		    ;;
+		  esac
+	        fi
+		if test -n "$i" ; then
+		  libname=`eval \\$echo \"$libname_spec\"`
+		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
+		  set dummy $deplib_matches
+		  deplib_match=$2
+		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+		    newdeplibs="$newdeplibs $i"
+		  else
+		    droppeddeps=yes
+		    $echo
+		    $echo "*** Warning: dynamic linker does not accept needed library $i."
+		    $echo "*** I have the capability to make that library automatically link in when"
+		    $echo "*** you link to this library.  But I can only do this if you have a"
+		    $echo "*** shared version of the library, which I believe you do not have"
+		    $echo "*** because a test_compile did reveal that the linker did not use it for"
+		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
+		  fi
+		fi
+	      else
+		newdeplibs="$newdeplibs $i"
+	      fi
+	    done
+	  else
+	    # Error occurred in the first compile.  Let's try to salvage
+	    # the situation: Compile a separate program for each library.
+	    for i in $deplibs; do
+	      name=`expr $i : '-l\(.*\)'`
+	      # If $name is empty we are operating on a -L argument.
+              if test "$name" != "" && test "$name" != "0"; then
+		$rm conftest
+		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
+		  ldd_output=`ldd conftest`
+		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		    case " $predeps $postdeps " in
+		    *" $i "*)
+		      newdeplibs="$newdeplibs $i"
+		      i=""
+		      ;;
+		    esac
+		  fi
+		  if test -n "$i" ; then
+		    libname=`eval \\$echo \"$libname_spec\"`
+		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
+		    set dummy $deplib_matches
+		    deplib_match=$2
+		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+		      newdeplibs="$newdeplibs $i"
+		    else
+		      droppeddeps=yes
+		      $echo
+		      $echo "*** Warning: dynamic linker does not accept needed library $i."
+		      $echo "*** I have the capability to make that library automatically link in when"
+		      $echo "*** you link to this library.  But I can only do this if you have a"
+		      $echo "*** shared version of the library, which you do not appear to have"
+		      $echo "*** because a test_compile did reveal that the linker did not use this one"
+		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+		    fi
+		  fi
+		else
+		  droppeddeps=yes
+		  $echo
+		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
+		  $echo "*** make it link in!  You will probably need to install it or some"
+		  $echo "*** library that it depends on before this library will be fully"
+		  $echo "*** functional.  Installing it before continuing would be even better."
+		fi
+	      else
+		newdeplibs="$newdeplibs $i"
+	      fi
+	    done
+	  fi
+	  ;;
+	file_magic*)
+	  set dummy $deplibs_check_method
+	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+	  for a_deplib in $deplibs; do
+	    name=`expr $a_deplib : '-l\(.*\)'`
+	    # If $name is empty we are operating on a -L argument.
+            if test "$name" != "" && test  "$name" != "0"; then
+	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		case " $predeps $postdeps " in
+		*" $a_deplib "*)
+		  newdeplibs="$newdeplibs $a_deplib"
+		  a_deplib=""
+		  ;;
+		esac
+	      fi
+	      if test -n "$a_deplib" ; then
+		libname=`eval \\$echo \"$libname_spec\"`
+		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+		  for potent_lib in $potential_libs; do
+		      # Follow soft links.
+		      if ls -lLd "$potent_lib" 2>/dev/null \
+			 | grep " -> " >/dev/null; then
+			continue
+		      fi
+		      # The statement above tries to avoid entering an
+		      # endless loop below, in case of cyclic links.
+		      # We might still enter an endless loop, since a link
+		      # loop can be closed while we follow links,
+		      # but so what?
+		      potlib="$potent_lib"
+		      while test -h "$potlib" 2>/dev/null; do
+			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+			case $potliblink in
+			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+			esac
+		      done
+		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
+			 | ${SED} 10q \
+			 | $EGREP "$file_magic_regex" > /dev/null; then
+			newdeplibs="$newdeplibs $a_deplib"
+			a_deplib=""
+			break 2
+		      fi
+		  done
+		done
+	      fi
+	      if test -n "$a_deplib" ; then
+		droppeddeps=yes
+		$echo
+		$echo "*** Warning: linker path does not have real file for library $a_deplib."
+		$echo "*** I have the capability to make that library automatically link in when"
+		$echo "*** you link to this library.  But I can only do this if you have a"
+		$echo "*** shared version of the library, which you do not appear to have"
+		$echo "*** because I did check the linker path looking for a file starting"
+		if test -z "$potlib" ; then
+		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
+		else
+		  $echo "*** with $libname and none of the candidates passed a file format test"
+		  $echo "*** using a file magic. Last file checked: $potlib"
+		fi
+	      fi
+	    else
+	      # Add a -L argument.
+	      newdeplibs="$newdeplibs $a_deplib"
+	    fi
+	  done # Gone through all deplibs.
+	  ;;
+	match_pattern*)
+	  set dummy $deplibs_check_method
+	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+	  for a_deplib in $deplibs; do
+	    name=`expr $a_deplib : '-l\(.*\)'`
+	    # If $name is empty we are operating on a -L argument.
+	    if test -n "$name" && test "$name" != "0"; then
+	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		case " $predeps $postdeps " in
+		*" $a_deplib "*)
+		  newdeplibs="$newdeplibs $a_deplib"
+		  a_deplib=""
+		  ;;
+		esac
+	      fi
+	      if test -n "$a_deplib" ; then
+		libname=`eval \\$echo \"$libname_spec\"`
+		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+		  for potent_lib in $potential_libs; do
+		    potlib="$potent_lib" # see symlink-check above in file_magic test
+		    if eval $echo \"$potent_lib\" 2>/dev/null \
+		        | ${SED} 10q \
+		        | $EGREP "$match_pattern_regex" > /dev/null; then
+		      newdeplibs="$newdeplibs $a_deplib"
+		      a_deplib=""
+		      break 2
+		    fi
+		  done
+		done
+	      fi
+	      if test -n "$a_deplib" ; then
+		droppeddeps=yes
+		$echo
+		$echo "*** Warning: linker path does not have real file for library $a_deplib."
+		$echo "*** I have the capability to make that library automatically link in when"
+		$echo "*** you link to this library.  But I can only do this if you have a"
+		$echo "*** shared version of the library, which you do not appear to have"
+		$echo "*** because I did check the linker path looking for a file starting"
+		if test -z "$potlib" ; then
+		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
+		else
+		  $echo "*** with $libname and none of the candidates passed a file format test"
+		  $echo "*** using a regex pattern. Last file checked: $potlib"
+		fi
+	      fi
+	    else
+	      # Add a -L argument.
+	      newdeplibs="$newdeplibs $a_deplib"
+	    fi
+	  done # Gone through all deplibs.
+	  ;;
+	none | unknown | *)
+	  newdeplibs=""
+	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
+	    -e 's/ -[LR][^ ]*//g'`
+	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+	    for i in $predeps $postdeps ; do
+	      # can't use Xsed below, because $i might contain '/'
+	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
+	    done
+	  fi
+	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
+	    | grep . >/dev/null; then
+	    $echo
+	    if test "X$deplibs_check_method" = "Xnone"; then
+	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
+	    else
+	      $echo "*** Warning: inter-library dependencies are not known to be supported."
+	    fi
+	    $echo "*** All declared inter-library dependencies are being dropped."
+	    droppeddeps=yes
+	  fi
+	  ;;
+	esac
+	versuffix=$versuffix_save
+	major=$major_save
+	release=$release_save
+	libname=$libname_save
+	name=$name_save
+
+	case $host in
+	*-*-rhapsody* | *-*-darwin1.[012])
+	  # On Rhapsody replace the C library is the System framework
+	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
+	  ;;
+	esac
+
+	if test "$droppeddeps" = yes; then
+	  if test "$module" = yes; then
+	    $echo
+	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
+	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
+	    $echo "*** a static module, that should work as long as the dlopening"
+	    $echo "*** application is linked with the -dlopen flag."
+	    if test -z "$global_symbol_pipe"; then
+	      $echo
+	      $echo "*** However, this would only work if libtool was able to extract symbol"
+	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+	      $echo "*** not find such a program.  So, this module is probably useless."
+	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
+	    fi
+	    if test "$build_old_libs" = no; then
+	      oldlibs="$output_objdir/$libname.$libext"
+	      build_libtool_libs=module
+	      build_old_libs=yes
+	    else
+	      build_libtool_libs=no
+	    fi
+	  else
+	    $echo "*** The inter-library dependencies that have been dropped here will be"
+	    $echo "*** automatically added whenever a program is linked with this library"
+	    $echo "*** or is declared to -dlopen it."
+
+	    if test "$allow_undefined" = no; then
+	      $echo
+	      $echo "*** Since this library must not contain undefined symbols,"
+	      $echo "*** because either the platform does not support them or"
+	      $echo "*** it was explicitly requested with -no-undefined,"
+	      $echo "*** libtool will only create a static version of it."
+	      if test "$build_old_libs" = no; then
+		oldlibs="$output_objdir/$libname.$libext"
+		build_libtool_libs=module
+		build_old_libs=yes
+	      else
+		build_libtool_libs=no
+	      fi
+	    fi
+	  fi
+	fi
+	# Done checking deplibs!
+	deplibs=$newdeplibs
+      fi
+
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+	case " $new_libs " in
+	*" -L$path/$objdir "*) ;;
+	*)
+	  case " $deplibs " in
+	  *" -L$path/$objdir "*)
+	    new_libs="$new_libs -L$path/$objdir" ;;
+	  esac
+	  ;;
+	esac
+      done
+      for deplib in $deplibs; do
+	case $deplib in
+	-L*)
+	  case " $new_libs " in
+	  *" $deplib "*) ;;
+	  *) new_libs="$new_libs $deplib" ;;
+	  esac
+	  ;;
+	*) new_libs="$new_libs $deplib" ;;
+	esac
+      done
+      deplibs="$new_libs"
+
+
+      # All the library-specific variables (install_libdir is set above).
+      library_names=
+      old_library=
+      dlname=
+
+      # Test again, we may have decided not to build it any more
+      if test "$build_libtool_libs" = yes; then
+	if test "$hardcode_into_libs" = yes; then
+	  # Hardcode the library paths
+	  hardcode_libdirs=
+	  dep_rpath=
+	  rpath="$finalize_rpath"
+	  test "$mode" != relink && rpath="$compile_rpath$rpath"
+	  for libdir in $rpath; do
+	    if test -n "$hardcode_libdir_flag_spec"; then
+	      if test -n "$hardcode_libdir_separator"; then
+		if test -z "$hardcode_libdirs"; then
+		  hardcode_libdirs="$libdir"
+		else
+		  # Just accumulate the unique libdirs.
+		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		    ;;
+		  *)
+		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		    ;;
+		  esac
+		fi
+	      else
+		eval flag=\"$hardcode_libdir_flag_spec\"
+		dep_rpath="$dep_rpath $flag"
+	      fi
+	    elif test -n "$runpath_var"; then
+	      case "$perm_rpath " in
+	      *" $libdir "*) ;;
+	      *) perm_rpath="$perm_rpath $libdir" ;;
+	      esac
+	    fi
+	  done
+	  # Substitute the hardcoded libdirs into the rpath.
+	  if test -n "$hardcode_libdir_separator" &&
+	     test -n "$hardcode_libdirs"; then
+	    libdir="$hardcode_libdirs"
+	    if test -n "$hardcode_libdir_flag_spec_ld"; then
+	      case $archive_cmds in
+	      *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
+	      *)      eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
+	      esac
+	    else
+	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
+	    fi
+	  fi
+	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
+	    # We should set the runpath_var.
+	    rpath=
+	    for dir in $perm_rpath; do
+	      rpath="$rpath$dir:"
+	    done
+	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+	  fi
+	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+	fi
+
+	shlibpath="$finalize_shlibpath"
+	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+	if test -n "$shlibpath"; then
+	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+	fi
+
+	# Get the real and link names of the library.
+	eval shared_ext=\"$shrext_cmds\"
+	eval library_names=\"$library_names_spec\"
+	set dummy $library_names
+	realname="$2"
+	shift; shift
+
+	if test -n "$soname_spec"; then
+	  eval soname=\"$soname_spec\"
+	else
+	  soname="$realname"
+	fi
+	if test -z "$dlname"; then
+	  dlname=$soname
+	fi
+
+	lib="$output_objdir/$realname"
+	linknames=
+	for link
+	do
+	  linknames="$linknames $link"
+	done
+
+	# Use standard objects if they are pic
+	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+
+	# Prepare the list of exported symbols
+	if test -z "$export_symbols"; then
+	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+	    $show "generating symbol list for \`$libname.la'"
+	    export_symbols="$output_objdir/$libname.exp"
+	    $run $rm $export_symbols
+	    cmds=$export_symbols_cmds
+	    save_ifs="$IFS"; IFS='~'
+	    for cmd in $cmds; do
+	      IFS="$save_ifs"
+	      eval cmd=\"$cmd\"
+	      if len=`expr "X$cmd" : ".*"` &&
+	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	        $show "$cmd"
+	        $run eval "$cmd" || exit $?
+	        skipped_export=false
+	      else
+	        # The command line is too long to execute in one step.
+	        $show "using reloadable object file for export list..."
+	        skipped_export=:
+		# Break out early, otherwise skipped_export may be
+		# set to false by a later but shorter cmd.
+		break
+	      fi
+	    done
+	    IFS="$save_ifs"
+	    if test -n "$export_symbols_regex"; then
+	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
+	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
+	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
+	    fi
+	  fi
+	fi
+
+	if test -n "$export_symbols" && test -n "$include_expsyms"; then
+	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
+	fi
+
+	tmp_deplibs=
+	for test_deplib in $deplibs; do
+		case " $convenience " in
+		*" $test_deplib "*) ;;
+		*)
+			tmp_deplibs="$tmp_deplibs $test_deplib"
+			;;
+		esac
+	done
+	deplibs="$tmp_deplibs"
+
+	if test -n "$convenience"; then
+	  if test -n "$whole_archive_flag_spec"; then
+	    save_libobjs=$libobjs
+	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+	  else
+	    gentop="$output_objdir/${outputname}x"
+	    generated="$generated $gentop"
+
+	    func_extract_archives $gentop $convenience
+	    libobjs="$libobjs $func_extract_archives_result"
+	  fi
+	fi
+	
+	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+	  eval flag=\"$thread_safe_flag_spec\"
+	  linker_flags="$linker_flags $flag"
+	fi
+
+	# Make a backup of the uninstalled library when relinking
+	if test "$mode" = relink; then
+	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
+	fi
+
+	# Do each of the archive commands.
+	if test "$module" = yes && test -n "$module_cmds" ; then
+	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+	    eval test_cmds=\"$module_expsym_cmds\"
+	    cmds=$module_expsym_cmds
+	  else
+	    eval test_cmds=\"$module_cmds\"
+	    cmds=$module_cmds
+	  fi
+	else
+	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+	  eval test_cmds=\"$archive_expsym_cmds\"
+	  cmds=$archive_expsym_cmds
+	else
+	  eval test_cmds=\"$archive_cmds\"
+	  cmds=$archive_cmds
+	  fi
+	fi
+
+	if test "X$skipped_export" != "X:" &&
+	   len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	  :
+	else
+	  # The command line is too long to link in one step, link piecewise.
+	  $echo "creating reloadable object files..."
+
+	  # Save the value of $output and $libobjs because we want to
+	  # use them later.  If we have whole_archive_flag_spec, we
+	  # want to use save_libobjs as it was before
+	  # whole_archive_flag_spec was expanded, because we can't
+	  # assume the linker understands whole_archive_flag_spec.
+	  # This may have to be revisited, in case too many
+	  # convenience libraries get linked in and end up exceeding
+	  # the spec.
+	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+	    save_libobjs=$libobjs
+	  fi
+	  save_output=$output
+	  output_la=`$echo "X$output" | $Xsed -e "$basename"`
+
+	  # Clear the reloadable object creation command queue and
+	  # initialize k to one.
+	  test_cmds=
+	  concat_cmds=
+	  objlist=
+	  delfiles=
+	  last_robj=
+	  k=1
+	  output=$output_objdir/$output_la-${k}.$objext
+	  # Loop over the list of objects to be linked.
+	  for obj in $save_libobjs
+	  do
+	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
+	    if test "X$objlist" = X ||
+	       { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+		 test "$len" -le "$max_cmd_len"; }; then
+	      objlist="$objlist $obj"
+	    else
+	      # The command $test_cmds is almost too long, add a
+	      # command to the queue.
+	      if test "$k" -eq 1 ; then
+		# The first file doesn't have a previous command to add.
+		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
+	      else
+		# All subsequent reloadable object files will link in
+		# the last one created.
+		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
+	      fi
+	      last_robj=$output_objdir/$output_la-${k}.$objext
+	      k=`expr $k + 1`
+	      output=$output_objdir/$output_la-${k}.$objext
+	      objlist=$obj
+	      len=1
+	    fi
+	  done
+	  # Handle the remaining objects by creating one last
+	  # reloadable object file.  All subsequent reloadable object
+	  # files will link in the last one created.
+	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
+
+	  if ${skipped_export-false}; then
+	    $show "generating symbol list for \`$libname.la'"
+	    export_symbols="$output_objdir/$libname.exp"
+	    $run $rm $export_symbols
+	    libobjs=$output
+	    # Append the command to create the export file.
+	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
+          fi
+
+	  # Set up a command to remove the reloadable object files
+	  # after they are used.
+	  i=0
+	  while test "$i" -lt "$k"
+	  do
+	    i=`expr $i + 1`
+	    delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
+	  done
+
+	  $echo "creating a temporary reloadable object file: $output"
+
+	  # Loop through the commands generated above and execute them.
+	  save_ifs="$IFS"; IFS='~'
+	  for cmd in $concat_cmds; do
+	    IFS="$save_ifs"
+	    $show "$cmd"
+	    $run eval "$cmd" || exit $?
+	  done
+	  IFS="$save_ifs"
+
+	  libobjs=$output
+	  # Restore the value of output.
+	  output=$save_output
+
+	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+	  fi
+	  # Expand the library linking commands again to reset the
+	  # value of $libobjs for piecewise linking.
+
+	  # Do each of the archive commands.
+	  if test "$module" = yes && test -n "$module_cmds" ; then
+	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+	      cmds=$module_expsym_cmds
+	    else
+	      cmds=$module_cmds
+	    fi
+	  else
+	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+	    cmds=$archive_expsym_cmds
+	  else
+	    cmds=$archive_cmds
+	    fi
+	  fi
+
+	  # Append the command to remove the reloadable object files
+	  # to the just-reset $cmds.
+	  eval cmds=\"\$cmds~\$rm $delfiles\"
+	fi
+	save_ifs="$IFS"; IFS='~'
+	for cmd in $cmds; do
+	  IFS="$save_ifs"
+	  eval cmd=\"$cmd\"
+	  $show "$cmd"
+	  $run eval "$cmd" || {
+	    lt_exit=$?
+
+	    # Restore the uninstalled library and exit
+	    if test "$mode" = relink; then
+	      $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
+	    fi
+
+	    exit $lt_exit
+	  }
+	done
+	IFS="$save_ifs"
+
+	# Restore the uninstalled library and exit
+	if test "$mode" = relink; then
+	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
+
+	  if test -n "$convenience"; then
+	    if test -z "$whole_archive_flag_spec"; then
+	      $show "${rm}r $gentop"
+	      $run ${rm}r "$gentop"
+	    fi
+	  fi
+
+	  exit $EXIT_SUCCESS
+	fi
+
+	# Create links to the real library.
+	for linkname in $linknames; do
+	  if test "$realname" != "$linkname"; then
+	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
+	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
+	  fi
+	done
+
+	# If -module or -export-dynamic was specified, set the dlname.
+	if test "$module" = yes || test "$export_dynamic" = yes; then
+	  # On all known operating systems, these are identical.
+	  dlname="$soname"
+	fi
+      fi
+      ;;
+
+    obj)
+      if test -n "$deplibs"; then
+	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
+      fi
+
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$rpath"; then
+	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$xrpath"; then
+	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$vinfo"; then
+	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$release"; then
+	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
+      fi
+
+      case $output in
+      *.lo)
+	if test -n "$objs$old_deplibs"; then
+	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+	libobj="$output"
+	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
+	;;
+      *)
+	libobj=
+	obj="$output"
+	;;
+      esac
+
+      # Delete the old objects.
+      $run $rm $obj $libobj
+
+      # Objects from convenience libraries.  This assumes
+      # single-version convenience libraries.  Whenever we create
+      # different ones for PIC/non-PIC, this we'll have to duplicate
+      # the extraction.
+      reload_conv_objs=
+      gentop=
+      # reload_cmds runs $LD directly, so let us get rid of
+      # -Wl from whole_archive_flag_spec and hope we can get by with
+      # turning comma into space..
+      wl=
+
+      if test -n "$convenience"; then
+	if test -n "$whole_archive_flag_spec"; then
+	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
+	  reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
+	else
+	  gentop="$output_objdir/${obj}x"
+	  generated="$generated $gentop"
+
+	  func_extract_archives $gentop $convenience
+	  reload_conv_objs="$reload_objs $func_extract_archives_result"
+	fi
+      fi
+
+      # Create the old-style object.
+      reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+      output="$obj"
+      cmds=$reload_cmds
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+	IFS="$save_ifs"
+	eval cmd=\"$cmd\"
+	$show "$cmd"
+	$run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+
+      # Exit if we aren't doing a library object file.
+      if test -z "$libobj"; then
+	if test -n "$gentop"; then
+	  $show "${rm}r $gentop"
+	  $run ${rm}r $gentop
+	fi
+
+	exit $EXIT_SUCCESS
+      fi
+
+      if test "$build_libtool_libs" != yes; then
+	if test -n "$gentop"; then
+	  $show "${rm}r $gentop"
+	  $run ${rm}r $gentop
+	fi
+
+	# Create an invalid libtool object if no PIC, so that we don't
+	# accidentally link it into a program.
+	# $show "echo timestamp > $libobj"
+	# $run eval "echo timestamp > $libobj" || exit $?
+	exit $EXIT_SUCCESS
+      fi
+
+      if test -n "$pic_flag" || test "$pic_mode" != default; then
+	# Only do commands if we really have different PIC objects.
+	reload_objs="$libobjs $reload_conv_objs"
+	output="$libobj"
+	cmds=$reload_cmds
+	save_ifs="$IFS"; IFS='~'
+	for cmd in $cmds; do
+	  IFS="$save_ifs"
+	  eval cmd=\"$cmd\"
+	  $show "$cmd"
+	  $run eval "$cmd" || exit $?
+	done
+	IFS="$save_ifs"
+      fi
+
+      if test -n "$gentop"; then
+	$show "${rm}r $gentop"
+	$run ${rm}r $gentop
+      fi
+
+      exit $EXIT_SUCCESS
+      ;;
+
+    prog)
+      case $host in
+	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
+      esac
+      if test -n "$vinfo"; then
+	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
+      fi
+
+      if test -n "$release"; then
+	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
+      fi
+
+      if test "$preload" = yes; then
+	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
+	   test "$dlopen_self_static" = unknown; then
+	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
+	fi
+      fi
+
+      case $host in
+      *-*-rhapsody* | *-*-darwin1.[012])
+	# On Rhapsody replace the C library is the System framework
+	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+	;;
+      esac
+
+      case $host in
+      *darwin*)
+        # Don't allow lazy linking, it breaks C++ global constructors
+        if test "$tagname" = CXX ; then
+        compile_command="$compile_command ${wl}-bind_at_load"
+        finalize_command="$finalize_command ${wl}-bind_at_load"
+        fi
+        ;;
+      esac
+
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+	case " $new_libs " in
+	*" -L$path/$objdir "*) ;;
+	*)
+	  case " $compile_deplibs " in
+	  *" -L$path/$objdir "*)
+	    new_libs="$new_libs -L$path/$objdir" ;;
+	  esac
+	  ;;
+	esac
+      done
+      for deplib in $compile_deplibs; do
+	case $deplib in
+	-L*)
+	  case " $new_libs " in
+	  *" $deplib "*) ;;
+	  *) new_libs="$new_libs $deplib" ;;
+	  esac
+	  ;;
+	*) new_libs="$new_libs $deplib" ;;
+	esac
+      done
+      compile_deplibs="$new_libs"
+
+
+      compile_command="$compile_command $compile_deplibs"
+      finalize_command="$finalize_command $finalize_deplibs"
+
+      if test -n "$rpath$xrpath"; then
+	# If the user specified any rpath flags, then add them.
+	for libdir in $rpath $xrpath; do
+	  # This is the magic to use -rpath.
+	  case "$finalize_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_rpath="$finalize_rpath $libdir" ;;
+	  esac
+	done
+      fi
+
+      # Now hardcode the library paths
+      rpath=
+      hardcode_libdirs=
+      for libdir in $compile_rpath $finalize_rpath; do
+	if test -n "$hardcode_libdir_flag_spec"; then
+	  if test -n "$hardcode_libdir_separator"; then
+	    if test -z "$hardcode_libdirs"; then
+	      hardcode_libdirs="$libdir"
+	    else
+	      # Just accumulate the unique libdirs.
+	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		;;
+	      *)
+		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		;;
+	      esac
+	    fi
+	  else
+	    eval flag=\"$hardcode_libdir_flag_spec\"
+	    rpath="$rpath $flag"
+	  fi
+	elif test -n "$runpath_var"; then
+	  case "$perm_rpath " in
+	  *" $libdir "*) ;;
+	  *) perm_rpath="$perm_rpath $libdir" ;;
+	  esac
+	fi
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+	  testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
+	  case :$dllsearchpath: in
+	  *":$libdir:"*) ;;
+	  *) dllsearchpath="$dllsearchpath:$libdir";;
+	  esac
+	  case :$dllsearchpath: in
+	  *":$testbindir:"*) ;;
+	  *) dllsearchpath="$dllsearchpath:$testbindir";;
+	  esac
+	  ;;
+	esac
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+	 test -n "$hardcode_libdirs"; then
+	libdir="$hardcode_libdirs"
+	eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      compile_rpath="$rpath"
+
+      rpath=
+      hardcode_libdirs=
+      for libdir in $finalize_rpath; do
+	if test -n "$hardcode_libdir_flag_spec"; then
+	  if test -n "$hardcode_libdir_separator"; then
+	    if test -z "$hardcode_libdirs"; then
+	      hardcode_libdirs="$libdir"
+	    else
+	      # Just accumulate the unique libdirs.
+	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		;;
+	      *)
+		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		;;
+	      esac
+	    fi
+	  else
+	    eval flag=\"$hardcode_libdir_flag_spec\"
+	    rpath="$rpath $flag"
+	  fi
+	elif test -n "$runpath_var"; then
+	  case "$finalize_perm_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+	  esac
+	fi
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+	 test -n "$hardcode_libdirs"; then
+	libdir="$hardcode_libdirs"
+	eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      finalize_rpath="$rpath"
+
+      if test -n "$libobjs" && test "$build_old_libs" = yes; then
+	# Transform all the library objects into standard objects.
+	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+      fi
+
+      dlsyms=
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	if test -n "$NM" && test -n "$global_symbol_pipe"; then
+	  dlsyms="${outputname}S.c"
+	else
+	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
+	fi
+      fi
+
+      if test -n "$dlsyms"; then
+	case $dlsyms in
+	"") ;;
+	*.c)
+	  # Discover the nlist of each of the dlfiles.
+	  nlist="$output_objdir/${outputname}.nm"
+
+	  $show "$rm $nlist ${nlist}S ${nlist}T"
+	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
+
+	  # Parse the name list into a source file.
+	  $show "creating $output_objdir/$dlsyms"
+
+	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
+/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
+/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* Prevent the only kind of declaration conflicts we can make. */
+#define lt_preloaded_symbols some_other_symbol
+
+/* External symbol declarations for the compiler. */\
+"
+
+	  if test "$dlself" = yes; then
+	    $show "generating symbol list for \`$output'"
+
+	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
+
+	    # Add our own program objects to the symbol list.
+	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	    for arg in $progfiles; do
+	      $show "extracting global C symbols from \`$arg'"
+	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+	    done
+
+	    if test -n "$exclude_expsyms"; then
+	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+	      $run eval '$mv "$nlist"T "$nlist"'
+	    fi
+
+	    if test -n "$export_symbols_regex"; then
+	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+	      $run eval '$mv "$nlist"T "$nlist"'
+	    fi
+
+	    # Prepare the list of exported symbols
+	    if test -z "$export_symbols"; then
+	      export_symbols="$output_objdir/$outputname.exp"
+	      $run $rm $export_symbols
+	      $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+              case $host in
+              *cygwin* | *mingw* )
+	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+		$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
+                ;;
+              esac
+	    else
+	      $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+	      $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
+	      $run eval 'mv "$nlist"T "$nlist"'
+              case $host in
+              *cygwin* | *mingw* )
+	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+		$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
+                ;;
+              esac
+	    fi
+	  fi
+
+	  for arg in $dlprefiles; do
+	    $show "extracting global C symbols from \`$arg'"
+	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
+	    $run eval '$echo ": $name " >> "$nlist"'
+	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+	  done
+
+	  if test -z "$run"; then
+	    # Make sure we have at least an empty file.
+	    test -f "$nlist" || : > "$nlist"
+
+	    if test -n "$exclude_expsyms"; then
+	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+	      $mv "$nlist"T "$nlist"
+	    fi
+
+	    # Try sorting and uniquifying the output.
+	    if grep -v "^: " < "$nlist" |
+		if sort -k 3 </dev/null >/dev/null 2>&1; then
+		  sort -k 3
+		else
+		  sort +2
+		fi |
+		uniq > "$nlist"S; then
+	      :
+	    else
+	      grep -v "^: " < "$nlist" > "$nlist"S
+	    fi
+
+	    if test -f "$nlist"S; then
+	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
+	    else
+	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
+	    fi
+
+	    $echo >> "$output_objdir/$dlsyms" "\
+
+#undef lt_preloaded_symbols
+
+#if defined (__STDC__) && __STDC__
+# define lt_ptr void *
+#else
+# define lt_ptr char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+"
+
+	    case $host in
+	    *cygwin* | *mingw* )
+	  $echo >> "$output_objdir/$dlsyms" "\
+/* DATA imports from DLLs on WIN32 can't be const, because
+   runtime relocations are performed -- see ld's documentation
+   on pseudo-relocs */
+struct {
+"
+	      ;;
+	    * )
+	  $echo >> "$output_objdir/$dlsyms" "\
+const struct {
+"
+	      ;;
+	    esac
+
+
+	  $echo >> "$output_objdir/$dlsyms" "\
+  const char *name;
+  lt_ptr address;
+}
+lt_preloaded_symbols[] =
+{\
+"
+
+	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
+
+	    $echo >> "$output_objdir/$dlsyms" "\
+  {0, (lt_ptr) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+	  fi
+
+	  pic_flag_for_symtable=
+	  case $host in
+	  # compiling the symbol table file with pic_flag works around
+	  # a FreeBSD bug that causes programs to crash when -lm is
+	  # linked before any other PIC object.  But we must not use
+	  # pic_flag when linking with -static.  The problem exists in
+	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+	    case "$compile_command " in
+	    *" -static "*) ;;
+	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
+	    esac;;
+	  *-*-hpux*)
+	    case "$compile_command " in
+	    *" -static "*) ;;
+	    *) pic_flag_for_symtable=" $pic_flag";;
+	    esac
+	  esac
+
+	  # Now compile the dynamic symbol file.
+	  $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
+	  $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
+
+	  # Clean up the generated files.
+	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
+	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
+
+	  # Transform the symbol file into the correct name.
+          case $host in
+          *cygwin* | *mingw* )
+            if test -f "$output_objdir/${outputname}.def" ; then
+              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
+              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
+            else
+              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+             fi
+            ;;
+          * )
+            compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+            finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+            ;;
+          esac
+	  ;;
+	*)
+	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+      else
+	# We keep going just in case the user didn't refer to
+	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
+	# really was required.
+
+	# Nullify the symbol file.
+	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
+	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
+      fi
+
+      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+	# Replace the output file specification.
+	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
+	link_command="$compile_command$compile_rpath"
+
+	# We have no uninstalled library dependencies, so finalize right now.
+	$show "$link_command"
+	$run eval "$link_command"
+	exit_status=$?
+
+	# Delete the generated files.
+	if test -n "$dlsyms"; then
+	  $show "$rm $output_objdir/${outputname}S.${objext}"
+	  $run $rm "$output_objdir/${outputname}S.${objext}"
+	fi
+
+	exit $exit_status
+      fi
+
+      if test -n "$shlibpath_var"; then
+	# We should set the shlibpath_var
+	rpath=
+	for dir in $temp_rpath; do
+	  case $dir in
+	  [\\/]* | [A-Za-z]:[\\/]*)
+	    # Absolute path.
+	    rpath="$rpath$dir:"
+	    ;;
+	  *)
+	    # Relative path: add a thisdir entry.
+	    rpath="$rpath\$thisdir/$dir:"
+	    ;;
+	  esac
+	done
+	temp_rpath="$rpath"
+      fi
+
+      if test -n "$compile_shlibpath$finalize_shlibpath"; then
+	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+      fi
+      if test -n "$finalize_shlibpath"; then
+	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+      fi
+
+      compile_var=
+      finalize_var=
+      if test -n "$runpath_var"; then
+	if test -n "$perm_rpath"; then
+	  # We should set the runpath_var.
+	  rpath=
+	  for dir in $perm_rpath; do
+	    rpath="$rpath$dir:"
+	  done
+	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+	fi
+	if test -n "$finalize_perm_rpath"; then
+	  # We should set the runpath_var.
+	  rpath=
+	  for dir in $finalize_perm_rpath; do
+	    rpath="$rpath$dir:"
+	  done
+	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+	fi
+      fi
+
+      if test "$no_install" = yes; then
+	# We don't need to create a wrapper script.
+	link_command="$compile_var$compile_command$compile_rpath"
+	# Replace the output file specification.
+	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+	# Delete the old output file.
+	$run $rm $output
+	# Link the executable and exit
+	$show "$link_command"
+	$run eval "$link_command" || exit $?
+	exit $EXIT_SUCCESS
+      fi
+
+      if test "$hardcode_action" = relink; then
+	# Fast installation is not supported
+	link_command="$compile_var$compile_command$compile_rpath"
+	relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
+	$echo "$modename: \`$output' will be relinked during installation" 1>&2
+      else
+	if test "$fast_install" != no; then
+	  link_command="$finalize_var$compile_command$finalize_rpath"
+	  if test "$fast_install" = yes; then
+	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
+	  else
+	    # fast_install is set to needless
+	    relink_command=
+	  fi
+	else
+	  link_command="$compile_var$compile_command$compile_rpath"
+	  relink_command="$finalize_var$finalize_command$finalize_rpath"
+	fi
+      fi
+
+      # Replace the output file specification.
+      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+      # Delete the old output files.
+      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+      $show "$link_command"
+      $run eval "$link_command" || exit $?
+
+      # Now create the wrapper script.
+      $show "creating $output"
+
+      # Quote the relink command for shipping.
+      if test -n "$relink_command"; then
+	# Preserve any variables that may affect compiler behavior
+	for var in $variables_saved_for_relink; do
+	  if eval test -z \"\${$var+set}\"; then
+	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+	  elif eval var_value=\$$var; test -z "$var_value"; then
+	    relink_command="$var=; export $var; $relink_command"
+	  else
+	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
+	  fi
+	done
+	relink_command="(cd `pwd`; $relink_command)"
+	relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
+      fi
+
+      # Quote $echo for shipping.
+      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
+	case $progpath in
+	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
+	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
+	esac
+	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
+      else
+	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
+      fi
+
+      # Only actually do things if our run command is non-null.
+      if test -z "$run"; then
+	# win32 will think the script is a binary if it has
+	# a .exe suffix, so we strip it off here.
+	case $output in
+	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
+	esac
+	# test for cygwin because mv fails w/o .exe extensions
+	case $host in
+	  *cygwin*)
+	    exeext=.exe
+	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
+	  *) exeext= ;;
+	esac
+	case $host in
+	  *cygwin* | *mingw* )
+            output_name=`basename $output`
+            output_path=`dirname $output`
+            cwrappersource="$output_path/$objdir/lt-$output_name.c"
+            cwrapper="$output_path/$output_name.exe"
+            $rm $cwrappersource $cwrapper
+            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+
+	    cat > $cwrappersource <<EOF
+
+/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
+   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+
+   The $output program cannot be directly executed until all the libtool
+   libraries that it depends on are installed.
+
+   This wrapper executable should never be moved out of the build directory.
+   If it is, it will not operate correctly.
+
+   Currently, it simply execs the wrapper *script* "/bin/sh $output",
+   but could eventually absorb all of the scripts functionality and
+   exec $objdir/$outputname directly.
+*/
+EOF
+	    cat >> $cwrappersource<<"EOF"
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <sys/stat.h>
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef DIR_SEPARATOR
+# define DIR_SEPARATOR '/'
+# define PATH_SEPARATOR ':'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+  defined (__OS2__)
+# define HAVE_DOS_BASED_FILE_SYSTEM
+# ifndef DIR_SEPARATOR_2
+#  define DIR_SEPARATOR_2 '\\'
+# endif
+# ifndef PATH_SEPARATOR_2
+#  define PATH_SEPARATOR_2 ';'
+# endif
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+#ifndef PATH_SEPARATOR_2
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
+#else /* PATH_SEPARATOR_2 */
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
+#endif /* PATH_SEPARATOR_2 */
+
+#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+  if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+/* -DDEBUG is fairly common in CFLAGS.  */
+#undef DEBUG
+#if defined DEBUGWRAPPER
+# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
+#else
+# define DEBUG(format, ...)
+#endif
+
+const char *program_name = NULL;
+
+void * xmalloc (size_t num);
+char * xstrdup (const char *string);
+const char * base_name (const char *name);
+char * find_executable(const char *wrapper);
+int    check_executable(const char *path);
+char * strendzap(char *str, const char *pat);
+void lt_fatal (const char *message, ...);
+
+int
+main (int argc, char *argv[])
+{
+  char **newargz;
+  int i;
+
+  program_name = (char *) xstrdup (base_name (argv[0]));
+  DEBUG("(main) argv[0]      : %s\n",argv[0]);
+  DEBUG("(main) program_name : %s\n",program_name);
+  newargz = XMALLOC(char *, argc+2);
+EOF
+
+            cat >> $cwrappersource <<EOF
+  newargz[0] = (char *) xstrdup("$SHELL");
+EOF
+
+            cat >> $cwrappersource <<"EOF"
+  newargz[1] = find_executable(argv[0]);
+  if (newargz[1] == NULL)
+    lt_fatal("Couldn't find %s", argv[0]);
+  DEBUG("(main) found exe at : %s\n",newargz[1]);
+  /* we know the script has the same name, without the .exe */
+  /* so make sure newargz[1] doesn't end in .exe */
+  strendzap(newargz[1],".exe");
+  for (i = 1; i < argc; i++)
+    newargz[i+1] = xstrdup(argv[i]);
+  newargz[argc+1] = NULL;
+
+  for (i=0; i<argc+1; i++)
+  {
+    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
+    ;
+  }
+
+EOF
+
+            case $host_os in
+              mingw*)
+                cat >> $cwrappersource <<EOF
+  execv("$SHELL",(char const **)newargz);
+EOF
+              ;;
+              *)
+                cat >> $cwrappersource <<EOF
+  execv("$SHELL",newargz);
+EOF
+              ;;
+            esac
+
+            cat >> $cwrappersource <<"EOF"
+  return 127;
+}
+
+void *
+xmalloc (size_t num)
+{
+  void * p = (void *) malloc (num);
+  if (!p)
+    lt_fatal ("Memory exhausted");
+
+  return p;
+}
+
+char *
+xstrdup (const char *string)
+{
+  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
+;
+}
+
+const char *
+base_name (const char *name)
+{
+  const char *base;
+
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  /* Skip over the disk name in MSDOS pathnames. */
+  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
+    name += 2;
+#endif
+
+  for (base = name; *name; name++)
+    if (IS_DIR_SEPARATOR (*name))
+      base = name + 1;
+  return base;
+}
+
+int
+check_executable(const char * path)
+{
+  struct stat st;
+
+  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
+  if ((!path) || (!*path))
+    return 0;
+
+  if ((stat (path, &st) >= 0) &&
+      (
+        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
+#if defined (S_IXOTH)
+       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
+#endif
+#if defined (S_IXGRP)
+       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
+#endif
+       ((st.st_mode & S_IXUSR) == S_IXUSR))
+      )
+    return 1;
+  else
+    return 0;
+}
+
+/* Searches for the full path of the wrapper.  Returns
+   newly allocated full path name if found, NULL otherwise */
+char *
+find_executable (const char* wrapper)
+{
+  int has_slash = 0;
+  const char* p;
+  const char* p_next;
+  /* static buffer for getcwd */
+  char tmp[LT_PATHMAX + 1];
+  int tmp_len;
+  char* concat_name;
+
+  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
+
+  if ((wrapper == NULL) || (*wrapper == '\0'))
+    return NULL;
+
+  /* Absolute path? */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
+  {
+    concat_name = xstrdup (wrapper);
+    if (check_executable(concat_name))
+      return concat_name;
+    XFREE(concat_name);
+  }
+  else
+  {
+#endif
+    if (IS_DIR_SEPARATOR (wrapper[0]))
+    {
+      concat_name = xstrdup (wrapper);
+      if (check_executable(concat_name))
+        return concat_name;
+      XFREE(concat_name);
+    }
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  }
+#endif
+
+  for (p = wrapper; *p; p++)
+    if (*p == '/')
+    {
+      has_slash = 1;
+      break;
+    }
+  if (!has_slash)
+  {
+    /* no slashes; search PATH */
+    const char* path = getenv ("PATH");
+    if (path != NULL)
+    {
+      for (p = path; *p; p = p_next)
+      {
+        const char* q;
+        size_t p_len;
+        for (q = p; *q; q++)
+          if (IS_PATH_SEPARATOR(*q))
+            break;
+        p_len = q - p;
+        p_next = (*q == '\0' ? q : q + 1);
+        if (p_len == 0)
+        {
+          /* empty path: current directory */
+          if (getcwd (tmp, LT_PATHMAX) == NULL)
+            lt_fatal ("getcwd failed");
+          tmp_len = strlen(tmp);
+          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
+          memcpy (concat_name, tmp, tmp_len);
+          concat_name[tmp_len] = '/';
+          strcpy (concat_name + tmp_len + 1, wrapper);
+        }
+        else
+        {
+          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
+          memcpy (concat_name, p, p_len);
+          concat_name[p_len] = '/';
+          strcpy (concat_name + p_len + 1, wrapper);
+        }
+        if (check_executable(concat_name))
+          return concat_name;
+        XFREE(concat_name);
+      }
+    }
+    /* not found in PATH; assume curdir */
+  }
+  /* Relative path | not found in path: prepend cwd */
+  if (getcwd (tmp, LT_PATHMAX) == NULL)
+    lt_fatal ("getcwd failed");
+  tmp_len = strlen(tmp);
+  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
+  memcpy (concat_name, tmp, tmp_len);
+  concat_name[tmp_len] = '/';
+  strcpy (concat_name + tmp_len + 1, wrapper);
+
+  if (check_executable(concat_name))
+    return concat_name;
+  XFREE(concat_name);
+  return NULL;
+}
+
+char *
+strendzap(char *str, const char *pat)
+{
+  size_t len, patlen;
+
+  assert(str != NULL);
+  assert(pat != NULL);
+
+  len = strlen(str);
+  patlen = strlen(pat);
+
+  if (patlen <= len)
+  {
+    str += len - patlen;
+    if (strcmp(str, pat) == 0)
+      *str = '\0';
+  }
+  return str;
+}
+
+static void
+lt_error_core (int exit_status, const char * mode,
+          const char * message, va_list ap)
+{
+  fprintf (stderr, "%s: %s: ", program_name, mode);
+  vfprintf (stderr, message, ap);
+  fprintf (stderr, ".\n");
+
+  if (exit_status >= 0)
+    exit (exit_status);
+}
+
+void
+lt_fatal (const char *message, ...)
+{
+  va_list ap;
+  va_start (ap, message);
+  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
+  va_end (ap);
+}
+EOF
+          # we should really use a build-platform specific compiler
+          # here, but OTOH, the wrappers (shell script and this C one)
+          # are only useful if you want to execute the "real" binary.
+          # Since the "real" binary is built for $host, then this
+          # wrapper might as well be built for $host, too.
+          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
+          ;;
+        esac
+        $rm $output
+        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
+
+	$echo > $output "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='${SED} -e 1s/^X//'
+sed_quote_subst='$sed_quote_subst'
+
+# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
+if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
+else
+  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+  # install mode needs the following variable:
+  notinst_deplibs='$notinst_deplibs'
+else
+  # When we are sourced in execute mode, \$file and \$echo are already set.
+  if test \"\$libtool_execute_magic\" != \"$magic\"; then
+    echo=\"$qecho\"
+    file=\"\$0\"
+    # Make sure echo works.
+    if test \"X\$1\" = X--no-reexec; then
+      # Discard the --no-reexec flag, and continue.
+      shift
+    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
+      # Yippee, \$echo works!
+      :
+    else
+      # Restart under the correct shell, and then maybe \$echo will work.
+      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+    fi
+  fi\
+"
+	$echo >> $output "\
+
+  # Find the directory that this script lives in.
+  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+  # Follow symbolic links until we get to the real thisdir.
+  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
+  while test -n \"\$file\"; do
+    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+
+    # If there was a directory component, then change thisdir.
+    if test \"x\$destdir\" != \"x\$file\"; then
+      case \"\$destdir\" in
+      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+      *) thisdir=\"\$thisdir/\$destdir\" ;;
+      esac
+    fi
+
+    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
+  done
+
+  # Try to get the absolute directory name.
+  absdir=\`cd \"\$thisdir\" && pwd\`
+  test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+	if test "$fast_install" = yes; then
+	  $echo >> $output "\
+  program=lt-'$outputname'$exeext
+  progdir=\"\$thisdir/$objdir\"
+
+  if test ! -f \"\$progdir/\$program\" || \\
+     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+    file=\"\$\$-\$program\"
+
+    if test ! -d \"\$progdir\"; then
+      $mkdir \"\$progdir\"
+    else
+      $rm \"\$progdir/\$file\"
+    fi"
+
+	  $echo >> $output "\
+
+    # relink executable if necessary
+    if test -n \"\$relink_command\"; then
+      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+      else
+	$echo \"\$relink_command_output\" >&2
+	$rm \"\$progdir/\$file\"
+	exit $EXIT_FAILURE
+      fi
+    fi
+
+    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+    { $rm \"\$progdir/\$program\";
+      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+    $rm \"\$progdir/\$file\"
+  fi"
+	else
+	  $echo >> $output "\
+  program='$outputname'
+  progdir=\"\$thisdir/$objdir\"
+"
+	fi
+
+	$echo >> $output "\
+
+  if test -f \"\$progdir/\$program\"; then"
+
+	# Export our shlibpath_var if we have one.
+	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+	  $echo >> $output "\
+    # Add our own library path to $shlibpath_var
+    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+    # Some systems cannot cope with colon-terminated $shlibpath_var
+    # The second colon is a workaround for a bug in BeOS R4 sed
+    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+
+    export $shlibpath_var
+"
+	fi
+
+	# fixup the dll searchpath if we need to.
+	if test -n "$dllsearchpath"; then
+	  $echo >> $output "\
+    # Add the dll search path components to the executable PATH
+    PATH=$dllsearchpath:\$PATH
+"
+	fi
+
+	$echo >> $output "\
+    if test \"\$libtool_execute_magic\" != \"$magic\"; then
+      # Run the actual program with our arguments.
+
+      # Make sure env LD_LIBRARY_PATH does not mess us up
+      if test -n \"\${LD_LIBRARY_PATH+set}\"; then
+        export LD_LIBRARY_PATH=\$progdir:\$LD_LIBRARY_PATH
+      fi
+"
+	case $host in
+	# Backslashes separate directories on plain windows
+	*-*-mingw | *-*-os2*)
+	  $echo >> $output "\
+      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+	  ;;
+
+	*)
+	  $echo >> $output "\
+      exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+	  ;;
+	esac
+	$echo >> $output "\
+      \$echo \"\$0: cannot exec \$program \$*\"
+      exit $EXIT_FAILURE
+    fi
+  else
+    # The program doesn't exist.
+    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
+    \$echo \"This script is just a wrapper for \$program.\" 1>&2
+    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
+    exit $EXIT_FAILURE
+  fi
+fi\
+"
+	chmod +x $output
+      fi
+      exit $EXIT_SUCCESS
+      ;;
+    esac
+
+    # See if we need to build an old-fashioned archive.
+    for oldlib in $oldlibs; do
+
+      if test "$build_libtool_libs" = convenience; then
+	oldobjs="$libobjs_save"
+	addlibs="$convenience"
+	build_libtool_libs=no
+      else
+	if test "$build_libtool_libs" = module; then
+	  oldobjs="$libobjs_save"
+	  build_libtool_libs=no
+	else
+	  oldobjs="$old_deplibs $non_pic_objects"
+	fi
+	addlibs="$old_convenience"
+      fi
+
+      if test -n "$addlibs"; then
+	gentop="$output_objdir/${outputname}x"
+	generated="$generated $gentop"
+
+	func_extract_archives $gentop $addlibs
+	oldobjs="$oldobjs $func_extract_archives_result"
+      fi
+
+      # Do each command in the archive commands.
+      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+       cmds=$old_archive_from_new_cmds
+      else
+	# POSIX demands no paths to be encoded in archives.  We have
+	# to avoid creating archives with duplicate basenames if we
+	# might have to extract them afterwards, e.g., when creating a
+	# static archive out of a convenience library, or when linking
+	# the entirety of a libtool archive into another (currently
+	# not supported by libtool).
+	if (for obj in $oldobjs
+	    do
+	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
+	    done | sort | sort -uc >/dev/null 2>&1); then
+	  :
+	else
+	  $echo "copying selected object files to avoid basename conflicts..."
+
+	  if test -z "$gentop"; then
+	    gentop="$output_objdir/${outputname}x"
+	    generated="$generated $gentop"
+
+	    $show "${rm}r $gentop"
+	    $run ${rm}r "$gentop"
+	    $show "$mkdir $gentop"
+	    $run $mkdir "$gentop"
+	    exit_status=$?
+	    if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
+	      exit $exit_status
+	    fi
+	  fi
+
+	  save_oldobjs=$oldobjs
+	  oldobjs=
+	  counter=1
+	  for obj in $save_oldobjs
+	  do
+	    objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+	    case " $oldobjs " in
+	    " ") oldobjs=$obj ;;
+	    *[\ /]"$objbase "*)
+	      while :; do
+		# Make sure we don't pick an alternate name that also
+		# overlaps.
+		newobj=lt$counter-$objbase
+		counter=`expr $counter + 1`
+		case " $oldobjs " in
+		*[\ /]"$newobj "*) ;;
+		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
+		esac
+	      done
+	      $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
+	      $run ln "$obj" "$gentop/$newobj" ||
+	      $run cp "$obj" "$gentop/$newobj"
+	      oldobjs="$oldobjs $gentop/$newobj"
+	      ;;
+	    *) oldobjs="$oldobjs $obj" ;;
+	    esac
+	  done
+	fi
+
+	eval cmds=\"$old_archive_cmds\"
+
+	if len=`expr "X$cmds" : ".*"` &&
+	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	  cmds=$old_archive_cmds
+	else
+	  # the command line is too long to link in one step, link in parts
+	  $echo "using piecewise archive linking..."
+	  save_RANLIB=$RANLIB
+	  RANLIB=:
+	  objlist=
+	  concat_cmds=
+	  save_oldobjs=$oldobjs
+
+	  # Is there a better way of finding the last object in the list?
+	  for obj in $save_oldobjs
+	  do
+	    last_oldobj=$obj
+	  done
+	  for obj in $save_oldobjs
+	  do
+	    oldobjs="$objlist $obj"
+	    objlist="$objlist $obj"
+	    eval test_cmds=\"$old_archive_cmds\"
+	    if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+	       test "$len" -le "$max_cmd_len"; then
+	      :
+	    else
+	      # the above command should be used before it gets too long
+	      oldobjs=$objlist
+	      if test "$obj" = "$last_oldobj" ; then
+	        RANLIB=$save_RANLIB
+	      fi
+	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+	      objlist=
+	    fi
+	  done
+	  RANLIB=$save_RANLIB
+	  oldobjs=$objlist
+	  if test "X$oldobjs" = "X" ; then
+	    eval cmds=\"\$concat_cmds\"
+	  else
+	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
+	  fi
+	fi
+      fi
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+        eval cmd=\"$cmd\"
+	IFS="$save_ifs"
+	$show "$cmd"
+	$run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+    done
+
+    if test -n "$generated"; then
+      $show "${rm}r$generated"
+      $run ${rm}r$generated
+    fi
+
+    # Now create the libtool archive.
+    case $output in
+    *.la)
+      old_library=
+      test "$build_old_libs" = yes && old_library="$libname.$libext"
+      $show "creating $output"
+
+      # Preserve any variables that may affect compiler behavior
+      for var in $variables_saved_for_relink; do
+	if eval test -z \"\${$var+set}\"; then
+	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+	elif eval var_value=\$$var; test -z "$var_value"; then
+	  relink_command="$var=; export $var; $relink_command"
+	else
+	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
+	fi
+      done
+      # Quote the link command for shipping.
+      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
+      if test "$hardcode_automatic" = yes ; then
+	relink_command=
+      fi
+
+
+      # Only create the output if not a dry run.
+      if test -z "$run"; then
+	for installed in no yes; do
+	  if test "$installed" = yes; then
+	    if test -z "$install_libdir"; then
+	      break
+	    fi
+	    output="$output_objdir/$outputname"i
+	    # Replace all uninstalled libtool libraries with the installed ones
+	    newdependency_libs=
+	    for deplib in $dependency_libs; do
+	      case $deplib in
+	      *.la)
+		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
+		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		if test -z "$libdir"; then
+		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+		  exit $EXIT_FAILURE
+		fi
+		if test "X$EGREP" = X ; then
+			EGREP=egrep
+		fi
+		# We do not want portage's install root ($D) present.  Check only for
+		# this if the .la is being installed.
+		if test "$installed" = yes && test "$D"; then
+		  eval mynewdependency_lib=`echo "$libdir/$name" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
+		else
+		  mynewdependency_lib="$libdir/$name"
+		fi
+		# Do not add duplicates
+		if test "$mynewdependency_lib"; then
+		  my_little_ninja_foo_1=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
+		  if test -z "$my_little_ninja_foo_1"; then
+		    newdependency_libs="$newdependency_libs $mynewdependency_lib"
+		  fi
+		fi
+		;;
+		  *)
+		if test "$installed" = yes; then
+		  # Rather use S=WORKDIR if our version of portage supports it.
+		  # This is because some ebuild (gcc) do not use $S as buildroot.
+		  if test "$PWORKDIR"; then
+		    S="$PWORKDIR"
+		  fi
+		  # We do not want portage's build root ($S) present.
+		  my_little_ninja_foo_2=`echo $deplib |$EGREP -e "$S"`
+		  # We do not want portage's install root ($D) present.
+		  my_little_ninja_foo_3=`echo $deplib |$EGREP -e "$D"`
+		  if test -n "$my_little_ninja_foo_2" && test "$S"; then
+		    mynewdependency_lib=""
+		  elif test -n "$my_little_ninja_foo_3" && test "$D"; then
+		    eval mynewdependency_lib=`echo "$deplib" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
+		  else
+		    mynewdependency_lib="$deplib"
+		  fi
+		else
+		  mynewdependency_lib="$deplib"
+		fi
+		# Do not add duplicates
+		if test "$mynewdependency_lib"; then
+		  my_little_ninja_foo_4=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
+		  if test -z "$my_little_ninja_foo_4"; then
+			newdependency_libs="$newdependency_libs $mynewdependency_lib"
+		  fi
+		fi
+		;;
+	      esac
+	    done
+	    dependency_libs="$newdependency_libs"
+	    newdlfiles=
+	    for lib in $dlfiles; do
+	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+	      if test -z "$libdir"; then
+		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+		exit $EXIT_FAILURE
+	      fi
+	      newdlfiles="$newdlfiles $libdir/$name"
+	    done
+	    dlfiles="$newdlfiles"
+	    newdlprefiles=
+	    for lib in $dlprefiles; do
+	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+	      if test -z "$libdir"; then
+		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+		exit $EXIT_FAILURE
+	      fi
+	      newdlprefiles="$newdlprefiles $libdir/$name"
+	    done
+	    dlprefiles="$newdlprefiles"
+	  else
+	    newdlfiles=
+	    for lib in $dlfiles; do
+	      case $lib in
+		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+		*) abs=`pwd`"/$lib" ;;
+	      esac
+	      newdlfiles="$newdlfiles $abs"
+	    done
+	    dlfiles="$newdlfiles"
+	    newdlprefiles=
+	    for lib in $dlprefiles; do
+	      case $lib in
+		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+		*) abs=`pwd`"/$lib" ;;
+	      esac
+	      newdlprefiles="$newdlprefiles $abs"
+	    done
+	    dlprefiles="$newdlprefiles"
+	  fi
+	  $rm $output
+	  # place dlname in correct position for cygwin
+	  tdlname=$dlname
+	  case $host,$output,$installed,$module,$dlname in
+	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+	  esac
+	  # Do not add duplicates
+	  if test "$installed" = yes && test "$D"; then
+	    install_libdir=`echo "$install_libdir" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
+	  fi
+	  $echo > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=$module
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+	  if test "$installed" = no && test "$need_relink" = yes; then
+	    $echo >> $output "\
+relink_command=\"$relink_command\""
+	  fi
+	done
+      fi
+
+      # Do a symbolic link so that the libtool archive can be found in
+      # LD_LIBRARY_PATH before the program is installed.
+      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
+      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
+      ;;
+    esac
+    exit $EXIT_SUCCESS
+    ;;
+
+  # libtool install mode
+  install)
+    modename="$modename: install"
+
+    # There may be an optional sh(1) argument at the beginning of
+    # install_prog (especially on Windows NT).
+    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+       # Allow the use of GNU shtool's install command.
+       $echo "X$nonopt" | grep shtool > /dev/null; then
+      # Aesthetically quote it.
+      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	arg="\"$arg\""
+	;;
+      esac
+      install_prog="$arg "
+      arg="$1"
+      shift
+    else
+      install_prog=
+      arg=$nonopt
+    fi
+
+    # The real first argument should be the name of the installation program.
+    # Aesthetically quote it.
+    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+    case $arg in
+    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+      arg="\"$arg\""
+      ;;
+    esac
+    install_prog="$install_prog$arg"
+
+    # We need to accept at least all the BSD install flags.
+    dest=
+    files=
+    opts=
+    prev=
+    install_type=
+    isdir=no
+    stripme=
+    for arg
+    do
+      if test -n "$dest"; then
+	files="$files $dest"
+	dest=$arg
+	continue
+      fi
+
+      case $arg in
+      -d) isdir=yes ;;
+      -f) 
+      	case " $install_prog " in
+	*[\\\ /]cp\ *) ;;
+	*) prev=$arg ;;
+	esac
+	;;
+      -g | -m | -o) prev=$arg ;;
+      -s)
+	stripme=" -s"
+	continue
+	;;
+      -*)
+	;;
+      *)
+	# If the previous option needed an argument, then skip it.
+	if test -n "$prev"; then
+	  prev=
+	else
+	  dest=$arg
+	  continue
+	fi
+	;;
+      esac
+
+      # Aesthetically quote the argument.
+      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	arg="\"$arg\""
+	;;
+      esac
+      install_prog="$install_prog $arg"
+    done
+
+    if test -z "$install_prog"; then
+      $echo "$modename: you must specify an install program" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    if test -n "$prev"; then
+      $echo "$modename: the \`$prev' option requires an argument" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    if test -z "$files"; then
+      if test -z "$dest"; then
+	$echo "$modename: no file or destination specified" 1>&2
+      else
+	$echo "$modename: you must specify a destination" 1>&2
+      fi
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    # Strip any trailing slash from the destination.
+    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
+
+    # Check to see that the destination is a directory.
+    test -d "$dest" && isdir=yes
+    if test "$isdir" = yes; then
+      destdir="$dest"
+      destname=
+    else
+      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
+      test "X$destdir" = "X$dest" && destdir=.
+      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
+
+      # Not a directory, so check to see that there is only one file specified.
+      set dummy $files
+      if test "$#" -gt 2; then
+	$echo "$modename: \`$dest' is not a directory" 1>&2
+	$echo "$help" 1>&2
+	exit $EXIT_FAILURE
+      fi
+    fi
+    case $destdir in
+    [\\/]* | [A-Za-z]:[\\/]*) ;;
+    *)
+      for file in $files; do
+	case $file in
+	*.lo) ;;
+	*)
+	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+      done
+      ;;
+    esac
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    staticlibs=
+    future_libdirs=
+    current_libdirs=
+    for file in $files; do
+
+      # Do each installation.
+      case $file in
+      *.$libext)
+	# Do the static libraries later.
+	staticlibs="$staticlibs $file"
+	;;
+
+      *.la)
+	# Check to see that this really is a libtool archive.
+	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+	else
+	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	library_names=
+	old_library=
+	relink_command=
+	# If there is no directory component, then add one.
+	case $file in
+	*/* | *\\*) . $file ;;
+	*) . ./$file ;;
+	esac
+
+	# Add the libdir to current_libdirs if it is the destination.
+	if test "X$destdir" = "X$libdir"; then
+	  case "$current_libdirs " in
+	  *" $libdir "*) ;;
+	  *) current_libdirs="$current_libdirs $libdir" ;;
+	  esac
+	else
+	  # Note the libdir as a future libdir.
+	  case "$future_libdirs " in
+	  *" $libdir "*) ;;
+	  *) future_libdirs="$future_libdirs $libdir" ;;
+	  esac
+	fi
+
+	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
+	test "X$dir" = "X$file/" && dir=
+	dir="$dir$objdir"
+
+	if test -n "$relink_command"; then
+	  # Determine the prefix the user has applied to our future dir.
+	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
+
+	  # Don't allow the user to place us outside of our expected
+	  # location b/c this prevents finding dependent libraries that
+	  # are installed to the same prefix.
+	  # At present, this check doesn't affect windows .dll's that
+	  # are installed into $libdir/../bin (currently, that works fine)
+	  # but it's something to keep an eye on.
+	  if test "$inst_prefix_dir" = "$destdir"; then
+	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+
+	  if test -n "$inst_prefix_dir"; then
+	    # Stick the inst_prefix_dir data into the link command.
+	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
+	  else
+	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
+	  fi
+
+	  $echo "$modename: warning: relinking \`$file'" 1>&2
+	  $show "$relink_command"
+	  if $run eval "$relink_command"; then :
+	  else
+	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	fi
+
+	# See the names of the shared library.
+	set dummy $library_names
+	if test -n "$2"; then
+	  realname="$2"
+	  shift
+	  shift
+
+	  srcname="$realname"
+	  test -n "$relink_command" && srcname="$realname"T
+
+	  # Install the shared library and build the symlinks.
+	  $show "$install_prog $dir/$srcname $destdir/$realname"
+	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
+	  if test -n "$stripme" && test -n "$striplib"; then
+	    $show "$striplib $destdir/$realname"
+	    $run eval "$striplib $destdir/$realname" || exit $?
+	  fi
+
+	  if test "$#" -gt 0; then
+	    # Delete the old symlinks, and create new ones.
+	    # Try `ln -sf' first, because the `ln' binary might depend on
+	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
+	    # so we also need to try rm && ln -s.
+	    for linkname
+	    do
+	      if test "$linkname" != "$realname"; then
+                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
+                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
+	      fi
+	    done
+	  fi
+
+	  # Do each command in the postinstall commands.
+	  lib="$destdir/$realname"
+	  cmds=$postinstall_cmds
+	  save_ifs="$IFS"; IFS='~'
+	  for cmd in $cmds; do
+	    IFS="$save_ifs"
+	    eval cmd=\"$cmd\"
+	    $show "$cmd"
+	    $run eval "$cmd" || {
+	      lt_exit=$?
+
+	      # Restore the uninstalled library and exit
+	      if test "$mode" = relink; then
+		$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
+	      fi
+
+	      exit $lt_exit
+	    }
+	  done
+	  IFS="$save_ifs"
+	fi
+
+	# Install the pseudo-library for information purposes.
+	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+	instname="$dir/$name"i
+	$show "$install_prog $instname $destdir/$name"
+	$run eval "$install_prog $instname $destdir/$name" || exit $?
+
+	# Maybe install the static library, too.
+	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+	;;
+
+      *.lo)
+	# Install (i.e. copy) a libtool object.
+
+	# Figure out destination file name, if it wasn't already specified.
+	if test -n "$destname"; then
+	  destfile="$destdir/$destname"
+	else
+	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+	  destfile="$destdir/$destfile"
+	fi
+
+	# Deduce the name of the destination old-style object file.
+	case $destfile in
+	*.lo)
+	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
+	  ;;
+	*.$objext)
+	  staticdest="$destfile"
+	  destfile=
+	  ;;
+	*)
+	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	  ;;
+	esac
+
+	# Install the libtool object if requested.
+	if test -n "$destfile"; then
+	  $show "$install_prog $file $destfile"
+	  $run eval "$install_prog $file $destfile" || exit $?
+	fi
+
+	# Install the old object if enabled.
+	if test "$build_old_libs" = yes; then
+	  # Deduce the name of the old-style object file.
+	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
+
+	  $show "$install_prog $staticobj $staticdest"
+	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
+	fi
+	exit $EXIT_SUCCESS
+	;;
+
+      *)
+	# Figure out destination file name, if it wasn't already specified.
+	if test -n "$destname"; then
+	  destfile="$destdir/$destname"
+	else
+	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+	  destfile="$destdir/$destfile"
+	fi
+
+	# If the file is missing, and there is a .exe on the end, strip it
+	# because it is most likely a libtool script we actually want to
+	# install
+	stripped_ext=""
+	case $file in
+	  *.exe)
+	    if test ! -f "$file"; then
+	      file=`$echo $file|${SED} 's,.exe$,,'`
+	      stripped_ext=".exe"
+	    fi
+	    ;;
+	esac
+
+	# Do a test to see if this is really a libtool program.
+	case $host in
+	*cygwin*|*mingw*)
+	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
+	    ;;
+	*)
+	    wrapper=$file
+	    ;;
+	esac
+	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
+	  notinst_deplibs=
+	  relink_command=
+
+	  # Note that it is not necessary on cygwin/mingw to append a dot to
+	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
+	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
+	  # `FILE.' does not work on cygwin managed mounts.
+	  #
+	  # If there is no directory component, then add one.
+	  case $wrapper in
+	  */* | *\\*) . ${wrapper} ;;
+	  *) . ./${wrapper} ;;
+	  esac
+
+	  # Check the variables that should have been set.
+	  if test -z "$notinst_deplibs"; then
+	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+
+	  finalize=yes
+	  for lib in $notinst_deplibs; do
+	    # Check to see that each library is installed.
+	    libdir=
+	    if test -f "$lib"; then
+	      # If there is no directory component, then add one.
+	      case $lib in
+	      */* | *\\*) . $lib ;;
+	      *) . ./$lib ;;
+	      esac
+	    fi
+	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+	    if test -n "$libdir" && test ! -f "$libfile"; then
+	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
+	      finalize=no
+	    fi
+	  done
+
+	  relink_command=
+	  # Note that it is not necessary on cygwin/mingw to append a dot to
+	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
+	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
+	  # `FILE.' does not work on cygwin managed mounts.
+	  #
+	  # If there is no directory component, then add one.
+	  case $wrapper in
+	  */* | *\\*) . ${wrapper} ;;
+	  *) . ./${wrapper} ;;
+	  esac
+
+	  outputname=
+	  if test "$fast_install" = no && test -n "$relink_command"; then
+	    if test "$finalize" = yes && test -z "$run"; then
+	      tmpdir=`func_mktempdir`
+	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
+	      outputname="$tmpdir/$file"
+	      # Replace the output file specification.
+	      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
+
+	      $show "$relink_command"
+	      if $run eval "$relink_command"; then :
+	      else
+		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+		${rm}r "$tmpdir"
+		continue
+	      fi
+	      file="$outputname"
+	    else
+	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
+	    fi
+	  else
+	    # Install the binary that we compiled earlier.
+	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+	  fi
+	fi
+
+	# remove .exe since cygwin /usr/bin/install will append another
+	# one anyway 
+	case $install_prog,$host in
+	*/usr/bin/install*,*cygwin*)
+	  case $file:$destfile in
+	  *.exe:*.exe)
+	    # this is ok
+	    ;;
+	  *.exe:*)
+	    destfile=$destfile.exe
+	    ;;
+	  *:*.exe)
+	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
+	    ;;
+	  esac
+	  ;;
+	esac
+	$show "$install_prog$stripme $file $destfile"
+	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
+	test -n "$outputname" && ${rm}r "$tmpdir"
+	;;
+      esac
+    done
+
+    for file in $staticlibs; do
+      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+      # Set up the ranlib parameters.
+      oldlib="$destdir/$name"
+
+      $show "$install_prog $file $oldlib"
+      $run eval "$install_prog \$file \$oldlib" || exit $?
+
+      if test -n "$stripme" && test -n "$old_striplib"; then
+	$show "$old_striplib $oldlib"
+	$run eval "$old_striplib $oldlib" || exit $?
+      fi
+
+      # Do each command in the postinstall commands.
+      cmds=$old_postinstall_cmds
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+	IFS="$save_ifs"
+	eval cmd=\"$cmd\"
+	$show "$cmd"
+	$run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+    done
+
+    if test -n "$future_libdirs"; then
+      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
+    fi
+
+    if test -n "$current_libdirs"; then
+      # Maybe just do a dry run.
+      test -n "$run" && current_libdirs=" -n$current_libdirs"
+      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+    else
+      exit $EXIT_SUCCESS
+    fi
+    ;;
+
+  # libtool finish mode
+  finish)
+    modename="$modename: finish"
+    libdirs="$nonopt"
+    admincmds=
+
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      for dir
+      do
+	libdirs="$libdirs $dir"
+      done
+
+      for libdir in $libdirs; do
+	if test -n "$finish_cmds"; then
+	  # Do each command in the finish commands.
+	  cmds=$finish_cmds
+	  save_ifs="$IFS"; IFS='~'
+	  for cmd in $cmds; do
+	    IFS="$save_ifs"
+	    eval cmd=\"$cmd\"
+	    $show "$cmd"
+	    $run eval "$cmd" || admincmds="$admincmds
+       $cmd"
+	  done
+	  IFS="$save_ifs"
+	fi
+	if test -n "$finish_eval"; then
+	  # Do the single finish_eval.
+	  eval cmds=\"$finish_eval\"
+	  $run eval "$cmds" || admincmds="$admincmds
+       $cmds"
+	fi
+      done
+    fi
+
+    # Exit here if they wanted silent mode.
+    test "$show" = : && exit $EXIT_SUCCESS
+
+    $echo "X----------------------------------------------------------------------" | $Xsed
+    $echo "Libraries have been installed in:"
+    for libdir in $libdirs; do
+      $echo "   $libdir"
+    done
+    $echo
+    $echo "If you ever happen to want to link against installed libraries"
+    $echo "in a given directory, LIBDIR, you must either use libtool, and"
+    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+    $echo "flag during linking and do at least one of the following:"
+    if test -n "$shlibpath_var"; then
+      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
+      $echo "     during execution"
+    fi
+    if test -n "$runpath_var"; then
+      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
+      $echo "     during linking"
+    fi
+    if test -n "$hardcode_libdir_flag_spec"; then
+      libdir=LIBDIR
+      eval flag=\"$hardcode_libdir_flag_spec\"
+
+      $echo "   - use the \`$flag' linker flag"
+    fi
+    if test -n "$admincmds"; then
+      $echo "   - have your system administrator run these commands:$admincmds"
+    fi
+    if test -f /etc/ld.so.conf; then
+      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+    fi
+    $echo
+    $echo "See any operating system documentation about shared libraries for"
+    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
+    $echo "X----------------------------------------------------------------------" | $Xsed
+    exit $EXIT_SUCCESS
+    ;;
+
+  # libtool execute mode
+  execute)
+    modename="$modename: execute"
+
+    # The first argument is the command name.
+    cmd="$nonopt"
+    if test -z "$cmd"; then
+      $echo "$modename: you must specify a COMMAND" 1>&2
+      $echo "$help"
+      exit $EXIT_FAILURE
+    fi
+
+    # Handle -dlopen flags immediately.
+    for file in $execute_dlfiles; do
+      if test ! -f "$file"; then
+	$echo "$modename: \`$file' is not a file" 1>&2
+	$echo "$help" 1>&2
+	exit $EXIT_FAILURE
+      fi
+
+      dir=
+      case $file in
+      *.la)
+	# Check to see that this really is a libtool archive.
+	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+	else
+	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+	  $echo "$help" 1>&2
+	  exit $EXIT_FAILURE
+	fi
+
+	# Read the libtool library.
+	dlname=
+	library_names=
+
+	# If there is no directory component, then add one.
+	case $file in
+	*/* | *\\*) . $file ;;
+	*) . ./$file ;;
+	esac
+
+	# Skip this library if it cannot be dlopened.
+	if test -z "$dlname"; then
+	  # Warn if it was a shared library.
+	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
+	  continue
+	fi
+
+	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+	test "X$dir" = "X$file" && dir=.
+
+	if test -f "$dir/$objdir/$dlname"; then
+	  dir="$dir/$objdir"
+	else
+	  if test ! -f "$dir/$dlname"; then
+	    $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
+	    exit $EXIT_FAILURE
+	  fi
+	fi
+	;;
+
+      *.lo)
+	# Just add the directory containing the .lo file.
+	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+	test "X$dir" = "X$file" && dir=.
+	;;
+
+      *)
+	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
+	continue
+	;;
+      esac
+
+      # Get the absolute pathname.
+      absdir=`cd "$dir" && pwd`
+      test -n "$absdir" && dir="$absdir"
+
+      # Now add the directory to shlibpath_var.
+      if eval "test -z \"\$$shlibpath_var\""; then
+	eval "$shlibpath_var=\"\$dir\""
+      else
+	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+      fi
+    done
+
+    # This variable tells wrapper scripts just to set shlibpath_var
+    # rather than running their programs.
+    libtool_execute_magic="$magic"
+
+    # Check if any of the arguments is a wrapper script.
+    args=
+    for file
+    do
+      case $file in
+      -*) ;;
+      *)
+	# Do a test to see if this is really a libtool program.
+	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+	  # If there is no directory component, then add one.
+	  case $file in
+	  */* | *\\*) . $file ;;
+	  *) . ./$file ;;
+	  esac
+
+	  # Transform arg to wrapped name.
+	  file="$progdir/$program"
+	fi
+	;;
+      esac
+      # Quote arguments (to preserve shell metacharacters).
+      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
+      args="$args \"$file\""
+    done
+
+    if test -z "$run"; then
+      if test -n "$shlibpath_var"; then
+	# Export the shlibpath_var.
+	eval "export $shlibpath_var"
+      fi
+
+      # Restore saved environment variables
+      for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+      do
+	eval "if test \"\${save_$lt_var+set}\" = set; then
+		$lt_var=\$save_$lt_var; export $lt_var
+	      else
+		$lt_unset $lt_var
+	      fi"
+      done
+
+      # Now prepare to actually exec the command.
+      exec_cmd="\$cmd$args"
+    else
+      # Display what would be done.
+      if test -n "$shlibpath_var"; then
+	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
+	$echo "export $shlibpath_var"
+      fi
+      $echo "$cmd$args"
+      exit $EXIT_SUCCESS
+    fi
+    ;;
+
+  # libtool clean and uninstall mode
+  clean | uninstall)
+    modename="$modename: $mode"
+    rm="$nonopt"
+    files=
+    rmforce=
+    exit_status=0
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    for arg
+    do
+      case $arg in
+      -f) rm="$rm $arg"; rmforce=yes ;;
+      -*) rm="$rm $arg" ;;
+      *) files="$files $arg" ;;
+      esac
+    done
+
+    if test -z "$rm"; then
+      $echo "$modename: you must specify an RM program" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    rmdirs=
+
+    origobjdir="$objdir"
+    for file in $files; do
+      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+      if test "X$dir" = "X$file"; then
+	dir=.
+	objdir="$origobjdir"
+      else
+	objdir="$dir/$origobjdir"
+      fi
+      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+      test "$mode" = uninstall && objdir="$dir"
+
+      # Remember objdir for removal later, being careful to avoid duplicates
+      if test "$mode" = clean; then
+	case " $rmdirs " in
+	  *" $objdir "*) ;;
+	  *) rmdirs="$rmdirs $objdir" ;;
+	esac
+      fi
+
+      # Don't error if the file doesn't exist and rm -f was used.
+      if (test -L "$file") >/dev/null 2>&1 \
+	|| (test -h "$file") >/dev/null 2>&1 \
+	|| test -f "$file"; then
+	:
+      elif test -d "$file"; then
+	exit_status=1
+	continue
+      elif test "$rmforce" = yes; then
+	continue
+      fi
+
+      rmfiles="$file"
+
+      case $name in
+      *.la)
+	# Possibly a libtool archive, so verify it.
+	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+	  . $dir/$name
+
+	  # Delete the libtool libraries and symlinks.
+	  for n in $library_names; do
+	    rmfiles="$rmfiles $objdir/$n"
+	  done
+	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+
+	  case "$mode" in
+	  clean)
+	    case "  $library_names " in
+	    # "  " in the beginning catches empty $dlname
+	    *" $dlname "*) ;;
+	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
+	    esac
+	     test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+	    ;;
+	  uninstall)
+	    if test -n "$library_names"; then
+	      # Do each command in the postuninstall commands.
+	      cmds=$postuninstall_cmds
+	      save_ifs="$IFS"; IFS='~'
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		eval cmd=\"$cmd\"
+		$show "$cmd"
+		$run eval "$cmd"
+		if test "$?" -ne 0 && test "$rmforce" != yes; then
+		  exit_status=1
+		fi
+	      done
+	      IFS="$save_ifs"
+	    fi
+
+	    if test -n "$old_library"; then
+	      # Do each command in the old_postuninstall commands.
+	      cmds=$old_postuninstall_cmds
+	      save_ifs="$IFS"; IFS='~'
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		eval cmd=\"$cmd\"
+		$show "$cmd"
+		$run eval "$cmd"
+		if test "$?" -ne 0 && test "$rmforce" != yes; then
+		  exit_status=1
+		fi
+	      done
+	      IFS="$save_ifs"
+	    fi
+	    # FIXME: should reinstall the best remaining shared library.
+	    ;;
+	  esac
+	fi
+	;;
+
+      *.lo)
+	# Possibly a libtool object, so verify it.
+	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+
+	  # Read the .lo file
+	  . $dir/$name
+
+	  # Add PIC object to the list of files to remove.
+	  if test -n "$pic_object" \
+	     && test "$pic_object" != none; then
+	    rmfiles="$rmfiles $dir/$pic_object"
+	  fi
+
+	  # Add non-PIC object to the list of files to remove.
+	  if test -n "$non_pic_object" \
+	     && test "$non_pic_object" != none; then
+	    rmfiles="$rmfiles $dir/$non_pic_object"
+	  fi
+	fi
+	;;
+
+      *)
+	if test "$mode" = clean ; then
+	  noexename=$name
+	  case $file in
+	  *.exe)
+	    file=`$echo $file|${SED} 's,.exe$,,'`
+	    noexename=`$echo $name|${SED} 's,.exe$,,'`
+	    # $file with .exe has already been added to rmfiles,
+	    # add $file without .exe
+	    rmfiles="$rmfiles $file"
+	    ;;
+	  esac
+	  # Do a test to see if this is a libtool program.
+	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+	    relink_command=
+	    . $dir/$noexename
+
+	    # note $name still contains .exe if it was in $file originally
+	    # as does the version of $file that was added into $rmfiles
+	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
+	    if test "$fast_install" = yes && test -n "$relink_command"; then
+	      rmfiles="$rmfiles $objdir/lt-$name"
+	    fi
+	    if test "X$noexename" != "X$name" ; then
+	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
+	    fi
+	  fi
+	fi
+	;;
+      esac
+      $show "$rm $rmfiles"
+      $run $rm $rmfiles || exit_status=1
+    done
+    objdir="$origobjdir"
+
+    # Try to remove the ${objdir}s in the directories where we deleted files
+    for dir in $rmdirs; do
+      if test -d "$dir"; then
+	$show "rmdir $dir"
+	$run rmdir $dir >/dev/null 2>&1
+      fi
+    done
+
+    exit $exit_status
+    ;;
+
+  "")
+    $echo "$modename: you must specify a MODE" 1>&2
+    $echo "$generic_help" 1>&2
+    exit $EXIT_FAILURE
+    ;;
+  esac
+
+  if test -z "$exec_cmd"; then
+    $echo "$modename: invalid operation mode \`$mode'" 1>&2
+    $echo "$generic_help" 1>&2
+    exit $EXIT_FAILURE
+  fi
+fi # test -z "$show_help"
+
+if test -n "$exec_cmd"; then
+  eval exec $exec_cmd
+  exit $EXIT_FAILURE
+fi
+
+# We need to display help for each of the modes.
+case $mode in
+"") $echo \
+"Usage: $modename [OPTION]... [MODE-ARG]...
+
+Provide generalized library-building support services.
+
+    --config          show all configuration variables
+    --debug           enable verbose shell tracing
+-n, --dry-run         display commands without modifying any files
+    --features        display basic configuration information and exit
+    --finish          same as \`--mode=finish'
+    --help            display this help message and exit
+    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
+    --quiet           same as \`--silent'
+    --silent          don't print informational messages
+    --tag=TAG         use configuration variables from tag TAG
+    --version         print version information
+
+MODE must be one of the following:
+
+      clean           remove files from the build directory
+      compile         compile a source file into a libtool object
+      execute         automatically set library path, then run a program
+      finish          complete the installation of libtool libraries
+      install         install libraries or executables
+      link            create a library or an executable
+      uninstall       remove libraries from an installed directory
+
+MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
+a more detailed description of MODE.
+
+Report bugs to <bug-libtool@gnu.org>."
+  exit $EXIT_SUCCESS
+  ;;
+
+clean)
+  $echo \
+"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+  ;;
+
+compile)
+  $echo \
+"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
+  -prefer-pic       try to building PIC objects only
+  -prefer-non-pic   try to building non-PIC objects only
+  -static           always build a \`.o' file suitable for static linking
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+  ;;
+
+execute)
+  $echo \
+"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+  -dlopen FILE      add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+  ;;
+
+finish)
+  $echo \
+"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges.  Use
+the \`--dry-run' option if you just want to see what would be executed."
+  ;;
+
+install)
+  $echo \
+"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command.  The first component should be
+either the \`install' or \`cp' program.
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+  ;;
+
+link)
+  $echo \
+"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+  -all-static       do not do any dynamic linking at all
+  -avoid-version    do not add a version suffix if possible
+  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
+  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
+  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+  -export-symbols SYMFILE
+                    try to export only the symbols listed in SYMFILE
+  -export-symbols-regex REGEX
+                    try to export only the symbols matching REGEX
+  -LLIBDIR          search LIBDIR for required installed libraries
+  -lNAME            OUTPUT-FILE requires the installed library libNAME
+  -module           build a library that can dlopened
+  -no-fast-install  disable the fast-install mode
+  -no-install       link a not-installable executable
+  -no-undefined     declare that a library does not refer to external symbols
+  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
+  -objectlist FILE  Use a list of object files found in FILE to specify objects
+  -precious-files-regex REGEX
+                    don't remove output files matching REGEX
+  -release RELEASE  specify package release information
+  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
+  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
+  -static           do not do any dynamic linking of uninstalled libtool libraries
+  -static-libtool-libs
+                    do not do any dynamic linking of libtool libraries
+  -version-info CURRENT[:REVISION[:AGE]]
+                    specify library version info [each variable defaults to 0]
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename.  Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+  ;;
+
+uninstall)
+  $echo \
+"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+  ;;
+
+*)
+  $echo "$modename: invalid operation mode \`$mode'" 1>&2
+  $echo "$help" 1>&2
+  exit $EXIT_FAILURE
+  ;;
+esac
+
+$echo
+$echo "Try \`$modename --help' for more information about other modes."
+
+exit $?
+
+# The TAGs below are defined such that we never get into a situation
+# in which we disable both kinds of libraries.  Given conflicting
+# choices, we go for a static library, that is the most portable,
+# since we can't tell whether shared libraries were disabled because
+# the user asked for that or because the platform doesn't support
+# them.  This is particularly important on AIX, because we don't
+# support having both static and shared libraries enabled at the same
+# time on that platform, so we default to a shared-only configuration.
+# If a disable-shared tag is given, we'll fallback to a static-only
+# configuration.  But we'll never go from static-only to shared-only.
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
+disable_libs=shared
+# ### END LIBTOOL TAG CONFIG: disable-shared
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-static
+disable_libs=static
+# ### END LIBTOOL TAG CONFIG: disable-static
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
Index: /vendor/prefix-portage/current/make.conf.txt
===================================================================
--- /vendor/prefix-portage/current/make.conf.txt	(revision 3489)
+++ /vendor/prefix-portage/current/make.conf.txt	(revision 3489)
@@ -0,0 +1,718 @@
+make.conf
+*********
+
+Available make.conf settings for portage
+
+SYNOPSIS
+========
+
+/etc/make.conf
+
+DESCRIPTION
+===========
+
+This file contains various variables that are used by Portage.
+Portage will check the currently-defined environment variables
+first for any settings.  If no environment settings are found,
+Portage then checks /etc/make.conf.  If no setting is found
+in /etc/make.conf, Portage checks the profile's default setting
+from /etc/make.profile/make.defaults. If no setting is found there, 
+it finally checks /etc/make.globals. Please note that all user
+settings should be made in the environment or in /etc/make.conf,
+which is intended to be customized by the user.
+
+VARIABLES
+=========
+
+ACCEPT_KEYWORDS
+---------------
+
+:suggest: |accept_keywords|
+:valdesc: space delimited list of KEYWORDS
+
+Enable testing of ebuilds that have not yet been deemed 'stable'.  Users
+of the 'x86' architecture would set this to '~x86' while ppc users would
+set this to '~ppc'.  This is an incremental variable.
+
+CCACHE_DIR
+----------
+
+:suggest: ${PORTAGE_TMPDIR}/ccache
+:valdesc: path
+
+Defines the location of the ccache working directory. See the ccache(1) man 
+page for more information.
+
+CCACHE_SIZE
+-----------
+
+:valdesc: size
+
+This controls the space use limitations for ccache.  The default is 2 gigabytes 
+('2G').  Sizes are specified with 'G', 'M', or 'K'.
+
+CFLAGS
+------
+
+:suggest: |cflags|
+:valdesc: valid gcc flags, see gcc manual
+
+Use these variables to set the desired optimization/CPU instruction settings
+for applications that you compile.  Nearly all ebuild files will take advantage
+of your custom settings, resulting in a Gentoo Linux that is fully customized
+to your specifications.  Please use sane settings as some packages will fail to
+compile/run if the optimizations are too extreme.
+
+CXXFLAGS
+--------
+
+:suggest: ${CFLAGS}
+:valdesc: valid gcc flags, see gcc manual
+
+`CFLAGS`_
+
+CHOST
+-----
+
+:suggest: |chost|
+
+This variable is passed by the ebuild scripts to the configure step as 
+--host=${CHOST}.  This way you can force the build-host.
+
+CLEAN_DELAY
+-----------
+
+:default: 5
+:valdesc: integer
+
+Determines how long the countdown delay will be for unmerge operations (including 
+autoclean).
+
+COLLISION_IGNORE
+----------------
+
+:valdesc: space delimited list of files and/or directories
+
+This variable allows the user to disable `collision-protect`_ for specific files 
+and/or directories.
+
+CONFIG_PROTECT
+--------------
+
+:default: /etc
+:valdesc: space delimited list of files and/or directories
+
+All  files  and/or  directories  that are defined here will have "config file 
+protection" enabled for them (unless overridden by _`CONFIG_PROTECT_MASK`).
+
+CONFIG_PROTECT_MASK
+-------------------
+
+:default: /etc/env.d
+:valdesc: space delimited list of files and/or directories
+
+All  files  and/or  directories  that are defined here will have "config file 
+protection" disabled for them.
+
+DISTCC_DIR
+----------
+
+:suggest: ${PORTAGE_TMPDIR}/.distcc
+:valdesc: path
+
+Defines the location of the distcc working directory. See the distcc(1) man 
+page for more information.
+
+DISTDIR
+-------
+
+:default: |portdir|/distfiles
+:valdesc: path
+
+Defines the location of your local source file repository.
+
+EBEEP_IGNORE
+------------
+
+Defines whether or not to ignore audible beeps when displaying important 
+informational messages.  This variable is unset by default.
+
+EMERGE_DEFAULT_OPTS
+-------------------
+
+:valdesc: emerge options
+
+Options  to append to the end of the emerge(1) command line on every invocation.
+These options will not be appended to the command line if --ignore-default-opts 
+is specified.
+
+EPAUSE_IGNORE
+-------------
+
+Defines whether or not to ignore short pauses that occur when displaying 
+important informational messages.  This variable is unset by default.
+
+FEATURES
+--------
+
+:default: sandbox distlocks metadata-transfer
+:suggest: userpriv usersandbox
+:valdesc: space separated list of feature flags
+
+Various settings affecting portage behavior. Don't disable the defaults without
+a good reason. This is an incremental variable. It can take a combination of the
+following flags:
+
+_`assume-digests`
+	When commiting work to cvs with repoman(1), assume that all existing SRC_URI 
+	digests are correct.  This feature also affects digest generation via 
+	ebuild(1) and emerge(1) (emerge generates digests only when the digest 
+	feature is enabled).
+
+_`buildpkg`
+	Binary packages will be created for all packages that are merged.
+
+_`buildsyspkg`
+	Build binary packages for just packages in the system set.
+
+_`ccache`
+	Enable portage support for the ccache package.  If ${CCACHE_DIR} is not set 
+	in the users environment, then  portage will default to ${PORTAGE_TMPDIR}/ccache 
+	(with userpriv) and to /root/.ccache otherwise.
+
+_`collision-protect`
+	A QA-feature to ensure that a package doesn't overwrite files it doesn't own.
+	The `COLLISION_IGNORE`_ variable can be used to selectively disable this feature.
+
+_`digest`
+	Autogenerate digests for packages when running the emerge(1) command. If
+	the `assume-digests`_ feature is also enabled then existing SRC_URI digests
+	will be reused whenever they are available.
+
+_`distcc`
+	Enable portage support for the distcc package.
+
+_`distlocks`
+	Portage uses lockfiles to ensure competing instances don't clobber
+	each other's files. This feature is enabled by default but may cause
+	heartache on less intelligent remote filesystems like NFSv2 and some
+	strangely configured Samba server (oplocks off, NFS re\-export). A tool
+	/usr/lib/portage/bin/clean_locks exists to help handle lock issues
+	when a problem arises (normally due to a crash or disconnect).
+
+_`fixpackages`
+	Updates dependencies in binary packages to match the current tree, for 
+	example after package moves. This can take a ot of time if you have many
+	binary packages in `PKGDIR`_.
+
+_`getbinpkg`
+	Force emerges to always try to fetch files from the `PORTAGE_BINHOST`_.
+
+_`installsources`
+	Install source code into /usr/src/debug/${CATEGORY}/${PF} (also see
+	`splitdebug`_). This feature works only if debugedit is installed.
+
+_`keeptemp`
+	Do not delete the temporary ebuild directory ${T} after the merge process.
+
+_`keepwork`
+	Do not delete the build directory ${WORKDIR} after the merge process. This
+	may occupy a lot of diskspace.
+
+_`metadata-transfer`
+	Automatically perform a metadata transfer when emerge --sync is run.
+
+_`mirror`
+	This will cause `FETCHCOMMAND`_ to always be run even if the file already 
+	exists in `DISTDIR`_.
+
+_`noauto`
+	When utilizing ebuild(1), only run the requested function.
+
+_`noclean`
+	Do no delete the source and temporary files after the merge process.
+
+_`nodoc`
+	Do not install documentation files in /usr/share/doc.
+
+_`noinfo`
+	Do not install info pages.
+
+_`noman`
+	Do not install manpages.
+
+_`nostrip`
+	Prevents the stripping of binaries that are merged to the live filesystem.
+
+_`notitles`
+	Disables xterm titlebar updates (which contains status info).
+
+_`parallel-fetch`
+	Fetch in the background while compiling.
+
+_`sandbox`
+	Use sys-apps/sandbox when building packages to protect the live filesystem.
+
+_`sfperms`
+	Stands for Smart Filesystem Permissions. Before merging packages to the
+	live filesystem, automatically search for and set permissions on setuid
+	and setgid files. Files that are setuid have the group and other read
+	bits removed while files that are setgid have the other read bit removed.
+	See also `suidctl`_ below.
+
+_`sign`
+	When commiting work to cvs with repoman(1), sign the Manifest with 
+	a GPG key. Read about the `PORTAGE_GPG_KEY`_ variable.
+
+_`splitdebug`
+	Prior to stripping ELF etdyn and etexec files, the debugging info is 
+	stored for later use by debuggers. This feature is disabled by
+	`nostrip`_. For installation of source code, see `installsources`_.
+
+_`strict`
+	Have portage react strongly to conditions that have the potential to be 
+	dangerous (like missing or incorrect Manifests entries).
+
+_`stricter`
+	Have portage react strongly to conditions that may conflict with system
+	security provisions (for example textrels, executable stack). Read about
+	the `QA_STRICT`_ variables below.
+
+_`suidctl`
+	Before merging packages to the live filesystem, automatically strip setuid 
+	bits from any file that is not listed in /etc/portage/suidctl.conf.
+
+_`test`
+	Run package-specific tests during each merge to help make sure 
+	the package compiled properly.  See *test* in ebuild(1) 
+	and *src_test()* in ebuild(5).
+
+_`userfetch`
+	When portage is run as root, drop privileges to portage:portage during the
+	fetching of package sources.
+
+_`userpriv`
+	Allow portage to drop root privileges and compile packages as 
+	portage:portage without `sandbox`_ (unless `usersandbox`_ is also used).
+
+_`usersandbox`
+	Enable the sandbox in the compile phase, when running without root privs 
+	(`userpriv`_).
+
+FETCHCOMMAND
+------------
+
+:default: /usr/bin/wget -t 5 -T 60 --passive-ftp -P \${DISTDIR} \${URI}
+:suggest: /usr/bin/wget -t 5 -T 60 --passive-ftp --limit-rate=200k \${URI} -P \${DISTDIR}
+
+This variable contains the command used for fetching package sources from
+the internet. It must contain the full path to the executable as well as the
+place-holders \${DISTDIR} and \${URI}.
+
+GENTOO_MIRRORS
+--------------
+
+:default: http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo
+:valdesc: space separated list of mirror locations
+
+Insert your space-seperated list of local mirrors here. These locations are 
+used to download files before the ones listed in the ebuild scripts. Merging 
+'app-portage/mirrorselect' can help to select an appropriate mirror.
+
+INSTALL_MASK
+------------
+
+:valdesc: space delimited list of file names
+
+Use this variable if you want to selectively prevent certain files from being
+copied into your file system tree.  This does not work on symlinks, but only on
+actual files.  Useful if you wish to filter out files like HACKING.gz and
+TODO.gz.
+
+MAKEOPTS
+--------
+
+:suggest: -j2
+:valdesc: make options
+
+Use this variable if you want to use parallel make. For example, if you
+have a dual-processor system, set this variable to "-j2" or "-j3" for 
+enhanced build performance with many packages. Suggested settings are
+between CPUs+1 and 2*CPUs+1. For more information, see make(1).
+
+NOCOLOR
+-------
+
+:default: false
+:valdesc: true | false
+
+Defines if color should be disabled (this is overridden by CLI options).
+
+PKGDIR
+------
+
+:default: |portdir|/packages
+:valdesc: path
+
+Defines the location where created .tbz2 binary packages will be stored.
+
+PORT_LOGDIR
+-----------
+
+:suggest: /var/log/portage
+:valdesc: path
+
+This variable defines the directory in which per-ebuild logs are kept.
+Logs are created only when this is set and writable.
+
+PORTAGE_BINHOST
+---------------
+
+:suggest: ftp://login:pass@grp.mirror.site/pub/grp/i686/athlon-xp
+:valdesc: URI to a binary package server
+
+This is the host from which portage will grab prebuilt-binary packages.
+The list is a single entry specifying the full address of the directory 
+serving the tbz2's for your system.  This is only used when running with 
+the get binary pkg options are given to emerge.  Review emerge(1) 
+for more information.  Note that it should point to the 'All' directory on 
+the host that creates the binary packages and not to the root of the `PKGDIR`_.
+
+PORTAGE_ELOG_CLASSES
+--------------------
+
+:default: log warn error
+:valdesc: space separated list of logging levels
+
+This variable defines which ebuild messages should be logged by the elog 
+subsystem. Possible values are info, log, warn and error.
+
+PORTAGE_ELOG_SYSTEM
+-------------------
+
+:suggest: save mail
+:valdesc: space separated list of elog handlers
+
+Selects which elog message handlers are invoked by portage to deliver messages
+captured by elog. If no handler is specified logging is effectively disabled.
+Default handlers (other packages may contain additional handlers) are:
+
+save
+	saves one logfile per package in ${PORT_LOGDIR}/elog, /var/log/portage/elog 
+	if `PORT_LOGDIR`_ is unset
+
+custom
+	passes all messages to `PORTAGE_ELOG_COMMAND`_
+
+syslog
+	sends all messages to syslog
+
+mail
+	sends all messages to the address configured in `PORTAGE_ELOG_MAILURI`_
+
+PORTAGE_ELOG_COMMAND
+--------------------
+
+:suggest: /path/to/logprocessor -p '\${PACKAGE}' -f '\${LOGFILE}'
+
+Only used with the "custom" logging module. Specifies a command
+to process log messages. Two variables are expanded:
+
+${PACKAGE}
+	expands to the cpv entry of the processed package (see PVR in ebuild(5))
+
+${LOGFILE}
+	absolute path to the logfile
+
+Both variables have to be quoted with single quotes
+
+PORTAGE_ELOG_MAILURI
+--------------------
+
+:default: root
+:suggest: user@some.domain mail.some.domain
+
+This variable holds all important settings for the mail module. In most cases 
+listing the recipient address andthe receiving mailserver should be sufficient,
+but you can also use advanced settings like authentication or TLS. The full 
+syntax is:
+``address [[user:passwd@]mailserver[:port]]``
+where
+
+address
+	recipient address
+
+user
+	username for smtp auth (defaults to none)
+
+passwd
+	password for smtp auth (defaults to none)
+
+mailserver
+	SMTP server that should be used to deliver the mail (defaults to localhost).
+	Alternatively this can also be a the path to a sendmail binary if you don't
+	want to use SMTP (e.g. if you only need local delivery to a mbox).
+
+port
+	port to use on the given SMTP server (defaults to 25, values > 100000 
+	indicate that starttls should be used on (port-100000))
+
+PORTAGE_ELOG_MAILFROM
+---------------------
+
+:default: portage
+:suggest: portage@some.domain
+:valdesc: sender address
+
+You can set the from-address of logmails with this variable, if unset mails 
+are sent by "portage" (this default may fail in some environments).
+
+PORTAGE_ELOG_MAILSUBJECT
+------------------------
+
+:default: [portage] ebuild log for \${PACKAGE} on \${HOST}
+:suggest: package \${PACKAGE} merged on \${HOST} with notice
+:valdesc: mail subject template
+
+Template string to be used as subject for logmails. The following variables 
+are exanded:
+
+${PACKAGE}
+	see description of `PORTAGE_ELOG_COMMAND`_
+
+${HOST}
+	FQDN of the host portage is running on
+
+PORTAGE_GPG_KEY
+---------------
+
+:valdesc: GPG key id
+
+This variable tells repoman which GPG key to use for signing Manifests.
+
+PORTAGE_NICENESS
+----------------
+
+:suggest: 3
+:valdesc: integer
+
+The value of this variable will be added to the current nice level that 
+emerge is running at. In other words, this will not set the nice level, 
+it will increment it. For more information about nice levels and what 
+are acceptable ranges, see nice(1).
+
+PORTAGE_RSYNC_EXTRA_OPTS
+------------------------
+
+:suggest: --exclude=/etc/portage/rsync_exclude
+:valdesc: rsync options
+
+Additional rsync options to be used by emerge --sync.
+
+PORTAGE_RSYNC_OPTS
+------------------
+
+:default: --recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages
+:valdesc: rsync options
+
+Default rsync options to be used by emerge --sync. **Don't change this unless
+you know exactly what you're doing!**
+
+PORTAGE_RSYNC_RETRIES
+---------------------
+
+:default: 3
+:valdesc: integer
+
+The number of times rsync should retry on failed connections before giving up.
+
+PORTAGE_TMPDIR
+--------------
+
+:default: /var/tmp
+:valdesc: path
+
+Defines the location of the temporary build directories.
+
+PORTDIR
+-------
+
+:default: |portdir|
+:valdesc: path
+
+Defines the location of your Portage tree.
+
+PORTDIR_OVERLAY
+---------------
+
+:suggest: |portdir|/local
+:valdesc: space separated list of overlay paths
+
+Defines the directories in which user made ebuilds are be stored.
+
+RESUMECOMMAND
+-------------
+
+:default: /usr/bin/wget -c -t 5 -T 60 --passive-ftp -P \${DISTDIR} \${URI}
+:suggest: /usr/bin/wget -c -t 5 -T 60 --passive-ftp --limit-rate=200k \${URI} -P \${DISTDIR}
+
+This variable contains the command used for resuming package sources that
+have been partially downloaded. It should be defined using the same format
+as `FETCHCOMMAND`_.
+
+.. _QA_STRICT:
+
+QA_STRICT_EXECSTACK
+-------------------
+
+:suggest: set
+
+Set this to instruct portage to ignore any QA_EXECSTACK override settings from
+ebuilds. See also ebuild(5).
+
+QA_STRICT_WX_LOAD
+-----------------
+
+:suggest: set
+
+Set this to instruct portage to ignore any QA_WX_LOAD override settings from
+ebuilds. See also ebuild(5).
+
+QA_STRICT_TEXTRELS
+------------------
+
+:suggest: set
+
+Set this to instruct portage to ignore any QA_TEXTRELS override settings from
+ebuilds. See also ebuild(5).
+
+ROOT
+----
+
+:default: /
+:valdesc: path
+
+Use this variable to specify the target root filesystem to be used for merging 
+packages or ebuilds. All RDEPEND and PDEPEND will be installed 
+into ROOT while all DEPEND will be still be installed into /.  
+Typically, you should set this setting in the environment rather than in 
+/etc/make.conf itself. It's commonly used for creating new build 
+images. Make sure you use an absolute path.
+
+RPMDIR
+------
+
+:default: |portdir|/rpm
+:valdesc: path
+
+Defines the location where created RPM packages will be stored. Note that RPM 
+support in portage is experimental at best.
+
+SYNC
+----
+
+:default: rsync://rsync.gentoo.org/gentoo-portage
+:valdesc: URI to a portage tree server (rsync or cvs)
+
+Insert your preferred rsync mirror here.  This rsync server is used to sync 
+the local portage tree when emerge --sync is run. Only one server can be 
+specified.
+
+USE
+---
+
+:suggest: X gtk gnome -alsa
+:valdesc: space delimited list of USE items
+
+This variable contains options that control the build behavior of several
+packages.  More information in ebuild(5).  Possible USE values
+can be found in |portdir|/profiles/use.desc and |portdir|/profiles/use.local.desc.
+
+USE_EXPAND
+----------
+
+:suggest: LINGUAS VIDEO_CARDS
+:valdesc: space separated list of variable names
+
+Any variable listed here will be used to augment `USE`_ by inserting a new flag
+for every value in that variable, so USE_EXPAND="FOO" and FOO="bar bla" results
+in USE="foo_bar foo_bla".
+
+USE_EXPAND_HIDDEN
+-----------------
+
+:valdesc: space separated list of variable names
+
+Names of `USE_EXPAND`_ variables that should not be shown in the verbose merge
+list output of the emerge(1) command.
+
+USE_ORDER
+---------
+
+:default: env:pkg:conf:defaults:pkginternal
+:valdesc: colon separated list of portage config layers
+
+Determines the precedence of layers in the incremental stacking of the USE
+variable. Precedence decreases from left to right such that env overrides
+pkg, pkg overrides conf, and so forth. *Don't change this unless you know what 
+you're doing!* Available layers are:
+
+env
+	USE from the current USE environment variable if it exists
+
+pkg
+	Per-package USE from /etc/portage/package.use (see portage(5))
+
+conf
+	USE from make.conf
+
+defaults
+	USE from make.defaults and package.use in the profile (see portage(5))
+
+pkginternal
+	USE from ebuild IUSE defaults (flags enabled via a + prefix; see ebuild(5))
+
+REPORTING BUGS
+==============
+
+Please report bugs via http://bugs.gentoo.org/
+
+AUTHORS
+=======
+
+- Daniel Robbins <drobbins@gentoo.org>
+- Nicholas Jones <carpaski@gentoo.org>
+- Mike Frysinger <vapier@gentoo.org>
+- Saleem Abdulrasool <compnerd@gentoo.org>
+- Marius Mauch <genone@gentoo.org>
+
+FILES
+=====
+
+/etc/make.conf
+	Contains user-supplied variables and overwrites those in make.defaults.
+
+/etc/make.globals
+	Contains portage defaults for many variables listed here. Don't change this,
+	edit /etc/make.conf instead.
+
+|portdir|/profiles/use.desc
+	Contains a list of all global USE flags with brief descriptions.
+
+|portdir|/profiles/use.local.desc
+	Contains a list of all local USE variables with brief descriptions.
+
+SEE ALSO
+========
+
+- emerge(1)
+- portage(5)
+- ebuild(1)
+- ebuild(5)
+
+.. Substitutions:
+.. |accept_keywords| replace:: ~x86
+.. |cflags| replace:: -march=i686 -O2 -pipe
+.. |chost| replace:: i686-gentoo-linux-gnu
+.. |portdir| replace:: /usr/portage
+
Index: /vendor/prefix-portage/current/man/Makefile.am
===================================================================
--- /vendor/prefix-portage/current/man/Makefile.am	(revision 3489)
+++ /vendor/prefix-portage/current/man/Makefile.am	(revision 3489)
@@ -0,0 +1,12 @@
+man_MANS = dispatch-conf.1  \
+		ebuild.1  \
+		ebuild.5  \
+		emerge.1  \
+		env-update.1  \
+		etc-update.1  \
+		make.conf.5  \
+		portage.5  \
+		quickpkg.1  \
+		repoman.1
+
+EXTRA_DIST = $(man_MANS)
Index: /vendor/prefix-portage/current/man/Makefile.in
===================================================================
--- /vendor/prefix-portage/current/man/Makefile.in	(revision 3489)
+++ /vendor/prefix-portage/current/man/Makefile.in	(revision 3489)
@@ -0,0 +1,440 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = man
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+man1dir = $(mandir)/man1
+am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)"
+man5dir = $(mandir)/man5
+NROFF = nroff
+MANS = $(man_MANS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+ARCH = @ARCH@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASENAME = @BASENAME@
+BASH = @BASH@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFAULT_PATH = @DEFAULT_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DIRNAME = @DIRNAME@
+DOMAIN_PREFIX = @DOMAIN_PREFIX@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FIND = @FIND@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MV = @MV@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PORTAGE_BASE = @PORTAGE_BASE@
+PYTHON = @PYTHON@
+RM = @RM@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+WGET = @WGET@
+XARGS = @XARGS@
+XCU_ID = @XCU_ID@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+portagegroup = @portagegroup@
+portageuser = @portageuser@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+rootuid = @rootuid@
+rootuser = @rootuser@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+wheelgid = @wheelgid@
+man_MANS = dispatch-conf.1  \
+		ebuild.1  \
+		ebuild.5  \
+		emerge.1  \
+		env-update.1  \
+		etc-update.1  \
+		make.conf.5  \
+		portage.5  \
+		quickpkg.1  \
+		repoman.1
+
+EXTRA_DIST = $(man_MANS)
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  man/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  man/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-man1: $(man1_MANS) $(man_MANS)
+	@$(NORMAL_INSTALL)
+	test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
+	@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+	for i in $$l2; do \
+	  case "$$i" in \
+	    *.1*) list="$$list $$i" ;; \
+	  esac; \
+	done; \
+	for i in $$list; do \
+	  if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+	  else file=$$i; fi; \
+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+	  case "$$ext" in \
+	    1*) ;; \
+	    *) ext='1' ;; \
+	  esac; \
+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+	  echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+	  $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+	done
+uninstall-man1:
+	@$(NORMAL_UNINSTALL)
+	@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+	for i in $$l2; do \
+	  case "$$i" in \
+	    *.1*) list="$$list $$i" ;; \
+	  esac; \
+	done; \
+	for i in $$list; do \
+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+	  case "$$ext" in \
+	    1*) ;; \
+	    *) ext='1' ;; \
+	  esac; \
+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+	  echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+	  rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+	done
+install-man5: $(man5_MANS) $(man_MANS)
+	@$(NORMAL_INSTALL)
+	test -z "$(man5dir)" || $(MKDIR_P) "$(DESTDIR)$(man5dir)"
+	@list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \
+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+	for i in $$l2; do \
+	  case "$$i" in \
+	    *.5*) list="$$list $$i" ;; \
+	  esac; \
+	done; \
+	for i in $$list; do \
+	  if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+	  else file=$$i; fi; \
+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+	  case "$$ext" in \
+	    5*) ;; \
+	    *) ext='5' ;; \
+	  esac; \
+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+	  echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \
+	  $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst"; \
+	done
+uninstall-man5:
+	@$(NORMAL_UNINSTALL)
+	@list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \
+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+	for i in $$l2; do \
+	  case "$$i" in \
+	    *.5*) list="$$list $$i" ;; \
+	  esac; \
+	done; \
+	for i in $$list; do \
+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+	  case "$$ext" in \
+	    5*) ;; \
+	    *) ext='5' ;; \
+	  esac; \
+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+	  echo " rm -f '$(DESTDIR)$(man5dir)/$$inst'"; \
+	  rm -f "$(DESTDIR)$(man5dir)/$$inst"; \
+	done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(MANS)
+installdirs:
+	for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man: install-man1 install-man5
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-man
+
+uninstall-man: uninstall-man1 uninstall-man5
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+	distclean-generic distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-man1 install-man5 install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
+	pdf-am ps ps-am uninstall uninstall-am uninstall-man \
+	uninstall-man1 uninstall-man5
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
Index: /vendor/prefix-portage/current/man/dispatch-conf.1
===================================================================
--- /vendor/prefix-portage/current/man/dispatch-conf.1	(revision 3489)
+++ /vendor/prefix-portage/current/man/dispatch-conf.1	(revision 3489)
@@ -0,0 +1,91 @@
+.TH "DISPATCH-CONF" "1" "Dec 2005" "Portage 2.1" "Portage"
+.SH NAME
+dispatch-conf \- Sanely update configuration files after emerging new packages
+.SH SYNOPSIS
+.B dispatch-conf
+.SH DESCRIPTION
+.I dispatch-conf
+is designed to be run after merging new packages in order to see if
+there are updates to the configuration files.  If a new
+configuration file will overwrite an old one, 
+.I dispatch-conf 
+will prompt the user for a decision about how to resolve the
+discrepancy.  
+Advantages of 
+.I dispatch-conf
+include easy rollback (changes to config files are stored either using
+patches or rcs) and the ability to automatically update config files
+that the user has never modified or 
+that differ from the current version only in CVS cruft or white space.
+
+.I dispatch-conf
+will check all directories in the \fICONFIG_PROTECT\fR variable.  All
+config files found in \fICONFIG_PROTECT_MASK\fR will automatically be
+updated for you by \fIdispatch-conf\fR.  See \fBmake.conf\fR(5) for more
+information.
+.SH OPTIONS
+.TP
+None.
+.SH USAGE
+.I dispatch-conf
+must be run as root, since the config files to be replaced are generally
+owned by root.  Before running
+.I dispatch-conf
+for the first time the settings in 
+.B /etc/dispatch-conf.conf
+should be edited and the archive directory specified in 
+\fI/etc/dispatch-conf.conf\fR will need to be created.  All changes to
+config files will be saved in the archive directory either as patches
+or using rcs, making restoration to an earlier version rather simple.
+
+When dispatch-conf finds a config file that has a new update the user 
+is provided
+with a menu of options for how to handle the update:
+.TP
+.B u
+Update (replace) the current config file with the new config file and continue.
+.TP
+.B z
+Zap (delete) the new config file and continue.
+.TP
+.B n
+Skip to the next config file, leaving both the original config file and any
+\fICONFIG_PROTECT\fRed files.
+.TP
+.B e
+Edit the new config file, using the editor defined in \fI$EDITOR\fR.
+.TP
+.B m
+Interactively merge the current and new config files.
+.TP
+.B l
+Look at the differences between the pre-merged and merged config files.
+.TP
+.B t
+Toggle between the merged and pre-merged config files (in terms of which
+should be installed using the 
+.Qt u
+command).
+.TP
+.B h
+Display a help screen.
+.TP
+.B q
+Quit
+.I dispatch-conf.
+.SH "REPORTING BUGS"
+Please report bugs via http://bugs.gentoo.org/
+.SH AUTHORS
+.nf
+Jeremy Wohl
+Karl Trygve Kalleberg <karltk@gentoo.org>
+Mike Frysinger <vapier@gentoo.org>
+Grant Goodyear <g2boojum@gentoo.org>
+.fi
+.SH "FILES"
+.TP
+.B /etc/dispatch-conf.conf
+Configuration settings for \fIdispatch-conf\fR are stored here.
+.SH "SEE ALSO"
+.BR make.conf (5),
+.BR etc-update (1)
Index: /vendor/prefix-portage/current/man/ebuild.1
===================================================================
--- /vendor/prefix-portage/current/man/ebuild.1	(revision 3489)
+++ /vendor/prefix-portage/current/man/ebuild.1	(revision 3489)
@@ -0,0 +1,191 @@
+.TH "EBUILD" "1" "Dec 2005" "Portage 2.1" "Portage"
+.SH "NAME"
+ebuild \- a low level interface to the Portage system
+.SH "SYNOPSIS"
+.B ebuild
+.I file command [command]\fR...
+.SH "DESCRIPTION"
+The ebuild program is a direct interface to the Portage system. It
+allows for direct action upon an ebuild with specific subcommands or
+groups of commands to perform in a specific ebuild's context and
+functions.  Accepting an ebuild script and one or more commands
+as arguments, the ebuild program parses the ebuild script and
+executes the specified commands.  Commands exist to fetch sources,
+unpack sources, compile sources, install object files into a temporary
+directory "image", merge the image to the local filesystem, create a
+bzipped tarball package out of the image, and more.
+.SH "FILE"
+This must be a valid ebuild script.  For further information read
+\fBebuild\fR(5).
+.SH "COMMANDS"
+By default, portage will execute all the functions in order up to the
+one actually specified.  For example, simply issuing the command \fBcompile\fR
+will trigger the functions before it to also be run (such as \fBsetup\fR
+and \fBunpack\fR).  If you wish to only have the specified command run, then
+you should use the \fInoauto\fR option in the \fBFEATURES\fR environment
+variable.  See the \fBmake.conf\fR(5) man page for more information.
+
+.TP
+.BR help
+Shows a condensed form of this man page along with a lot of package
+specific information.
+.TP
+.BR setup
+Runs all package-specific setup actions and exotic system checks.
+.TP
+.BR clean
+Cleans the temporary build directory that Portage has created for
+this particular ebuild file.  The temporary build directory normally
+contains the extracted source files as well as a possible
+"install image" (all the files that will be merged to the local
+filesystem or stored in a package).  The location of the build
+directory is set by the BUILD_PREFIX variable.  For information
+on what this variable is, run \fIemerge [\-v] info\fR, or to override
+this variable, see \fBmake.conf\fR(5).
+
+Note: Portage cleans up almost everything after a package has been
+successfully merged unless FEATURES contains 'noclean'.  Adding noclean
+to FEATURES will cause a lot of files to remain and will consume large
+amounts of space, very quickly.  It is not recommended to leave this on,
+unless you have use for the sources post\-merge.  Optionally, one may
+manually clean these files with \fIrm \-rf /var/tmp/portage\fR.
+.TP
+.BR fetch
+Checks to see if all the sources specified in SRC_URI are available in
+DISTDIR (see \fBmake.conf\fR(5) for more information) and have a valid
+md5 checksum.  If the sources aren't available, an attempt is made to
+download them from the locations specified in SRC_URI.  If multiple
+download locations are listed for a particular file, Portage pings
+each location to see which location is closer. (May not be true
+presently.)  The Gentoo Linux mirrors defined by GENTOO_MIRRORS is
+always considered first.  If for some reason the current or
+just\-downloaded sources' md5 digests don't match those recorded
+in files/digest\-[package]\-[version\-rev], a warning is printed
+and ebuild exits with an error code of 1.
+.TP
+.BR digest
+Creates a digest file for the package in
+/usr/portage/[category]/[package]/files/.  This digest file lists the
+md5sums of all the files found in the SRC_URI.  If the fetched source
+of the package is corrupt/bogus in some way, the md5sum will catch this.
+.TP
+.BR manifest
+Updates the manifest file for the package.  This performs the second half
+of the digest command, creating md5sums for the files in the files
+directory as well as the ebuild.
+.TP
+.BR unpack
+Extracts the sources to a subdirectory in the \fIbuild directory\fR
+(BUILD_PREFIX) by running the \fIsrc_unpack()\fR function in the ebuild
+file.  If no src_unpack() function has been specified, a default
+src_unpack() function is used that extracts all the files specified in
+SRC_URI.  The sources are normally extracted to
+${BUILD_PREFIX}/[package]\-[version\-rev]/work.  This particular directory
+can be referenced by using the ${WORKDIR} variable.
+
+If you're creating an ebuild, you'll want to make sure that the S
+(source directory) variable defined at the top of your ebuild script
+points to the directory that contains your extracted sources.  This
+directory is defined by default to be ${WORKDIR}/${P}, so it is not
+often required.  The src_unpack() function is also responsible for
+making the appropriate patches to the sources so that they're ready
+for compilation.
+.TP
+.BR compile
+Compiles the extracted sources by running the \fIsrc_compile()\fR
+function specified in the ebuild file.  When src_compile() starts, the
+current working directory will be set to ${S}.  When src_compile()
+completes, the sources should be fully compiled.
+.TP
+.BR test
+Runs package-specific test cases to verify that everything was built 
+properly.
+.TP
+.BR preinst
+Runs package-specific actions that need to be done before the package
+is installed into the live filesystem.
+.TP
+.BR install
+Installs the package to the temporary \fIinstall directory\fR by running
+the \fIsrc_install()\fR function.  When completed, the
+\fIinstall directory\fR (${BUILD_PREFIX}/[package]\-[version\-rev]/image)
+will contain all the files that should either be merged to the local
+filesystem or included in a binary package.
+.TP
+.BR postinst
+Runs package-specific actions that need to be done after the package
+is installed into the live filesystem.  Usually helpful messages are
+shown here.
+.TP
+.BR qmerge
+This function installs all the files in the \fIinstall directory\fR
+to the live filesystem.  The process works as follows: first, the
+\fIpkg_preinst()\fR function (if specified) is run.  Then, the files
+are merged into the live filesystem, and the installed files' md5
+digests are recorded in
+\fI/var/db/pkg/${CATEGORY}/${PN}\-${PVR}/CONTENTS\fR.  After
+all the files have been merged, the \fIpkg_postinst()\fR function
+(if specified) is executed.
+.TP
+.BR merge
+Normally, to merge an ebuild, you need to \fIfetch\fR, \fIunpack\fR,
+\fIcompile\fR, \fIinstall\fR and \fIqmerge\fR.  If you're simply
+interested in merging the ebuild, you can use this command, which
+will perform all these steps for you, stopping along the way if a
+particular step doesn't complete successfully.
+.TP
+.BR unmerge
+This function first executes the \fIpkg_prerm()\fR function (if specified).
+Then it removes all files from the live filesystem that have a valid md5
+checksum and mtime in the package contents file.  Any empty directories
+are recursively removed.  Finally, it runs \fIpkg_postrm()\fR function (if
+specified).  It is safe to merge a new version of a package first and
+then unmerge the old one.  In fact, this is the recommended package
+upgrade method.
+.TP
+.BR prerm
+Runs package-specific actions that need to be executed before the package is
+removed from the filesystem.  See also \fIunmerge\fR.
+.TP
+.BR postrm
+Runs package-specific actions that need to be executed after the package is
+removed from the filesystem.  See also \fIunmerge\fR.
+.TP
+.BR config
+Runs package-specific actions that need to be executed after the emerge
+process has completed.  This usually entails setup of configuration files
+or other similar setups that the user may wish to run.
+.TP
+.BR package
+This command is a lot like the \fImerge\fR command, except that after
+fetching, unpacking, compiling and installing, a .tbz2 binary package
+tarball is created and stored in  ${PKGDIR}/All (${PKGDIR} defaults to
+/usr/portage/packages).  A symbolic link is created in
+${PKGDIR}/${CATEGORY} that points to the package in ${PKGDIR}/All.
+.TP
+.BR rpm
+Builds a RedHat RPM package from the files in the temporary
+\fIinstall directory\fR.  At the moment, the ebuild's dependency
+information is not incorporated into the RPM.
+.SH "REPORTING BUGS"
+Please report bugs via http://bugs.gentoo.org/
+.SH "AUTHORS"
+.nf
+Achim Gottinger <achim@gentoo.org>
+Daniel Robbins <drobbins@gentoo.org>
+Nicholas Jones <carpaski@gentoo.org>
+Mike Frysinger <vapier@gentoo.org>
+.fi
+.SH "FILES"
+.TP
+\fB/etc/make.conf\fR 
+Contains variables for the build\-process and overwrites those
+in make.globals.
+.SH "SEE ALSO"
+.BR emerge (1),
+.BR ebuild (5),
+.BR make.conf (5)
+.TP
+The \fI/usr/sbin/ebuild.sh\fR script. 
+.TP
+The helper apps in \fI@PORTAGE_BASE@/bin\fR.
Index: /vendor/prefix-portage/current/man/ebuild.5
===================================================================
--- /vendor/prefix-portage/current/man/ebuild.5	(revision 3489)
+++ /vendor/prefix-portage/current/man/ebuild.5	(revision 3489)
@@ -0,0 +1,887 @@
+.TH "EBUILD" "5" "Jan 2007" "Portage 2.1.2" "Portage"
+.SH "NAME"
+ebuild \- the internal format, variables, and functions in an ebuild script
+.SH "DESCRIPTION"
+The
+.BR ebuild (1)
+program accepts a single ebuild script as an argument.  This script
+contains variables and commands that specify how to download, unpack,
+patch, compile, install and merge a particular software package from
+its original sources.  In addition to all of this, the ebuild script
+can also contain pre/post install/remove commands, as required.  All
+ebuild scripts are written in bash.
+.SH "EXAMPLES"
+Here's a simple example ebuild:
+
+.DS
+.nf
+# Copyright 1999\-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit some_eclass another_eclass
+
+DESCRIPTION="Super\-useful stream editor (sed)"
+HOMEPAGE="http://www.gnu.org/software/sed/sed.html"
+SRC_URI="ftp://alpha.gnu.org/pub/gnu/sed/${P}.tar.gz"
+
+LICENSE="GPL\-2"
+SLOT="0"
+KEYWORDS="~x86"
+IUSE=""
+
+RDEPEND=""
+DEPEND="nls? ( sys-devel/gettext )"
+
+src_compile() {
+	econf \\
+		\-\-bindir=/bin \\
+		|| die "could not configure"
+	emake || die "emake failed"
+}
+
+src_install() {
+	emake install DESTDIR="${D}" || die "Install failed"
+	dodoc NEWS README* THANKS AUTHORS BUGS ChangeLog
+}
+.fi
+.SH "VARIABLES"
+.TP
+.B MISC USAGE NOTES
+\- All variables defined in \fBmake.conf\fR(5) are available for use in
+ebuilds (such as the PORTAGE* and PORTDIR* variables)
+.br
+\- When assigning values to variables in ebuilds, you \fBcannot have a
+space\fR between the variable name and the equal sign.
+.TP
+.B P
+This variable contains the package name without the ebuild revision.
+This variable must NEVER be modified.
+.br
+\fBxfree\-4.2.1\-r2.ebuild\fR \-\-> \fB$P\fR=='\fIxfree\-4.2.1\fR'
+.TP
+.B PN
+Contains the name of the script without the version number.
+.br
+\fBxfree\-4.2.1\-r2.ebuild\fR \-\-> \fB$PN\fR=='\fIxfree\fR'
+.TP
+.B PV
+Contains the version number without the revision.
+.br
+\fBxfree\-4.2.1\-r2.ebuild\fR \-\-> \fB$PV\fR=='\fI4.2.1\fR'
+.TP
+.B PR
+Contains the revision number or 'r0' if no revision number exists.
+.br
+\fBxfree\-4.2.1\-r2.ebuild\fR \-\-> \fB$PR\fR=='\fIr2\fR'
+.TP
+.B PVR
+Contains the version number with the revision.
+.br
+\fBxfree\-4.2.1\-r2.ebuild\fR \-\-> \fB$PVR\fR=='\fI4.2.1\-r2\fR'
+.TP
+.B PF
+Contains the full package name \fI[PN]\-[PVR]\fR
+.br
+\fBxfree\-4.2.1\-r2.ebuild\fR \-\-> \fB$PF\fR=='\fIxfree\-4.2.1\-r2\fR'
+.TP
+.B CATEGORY
+Contains the package category name.
+.TP
+.B A
+Contains all source files required for the package.  This variable must
+not be defined. It is autogenerated from the \fISRC_URI\fR variable.
+.TP
+\fBWORKDIR\fR = \fI"${PORTAGE_TMPDIR}/portage/${CATEGORY}/${PF}/work"\fR
+Contains the path to the package build root.  Do not modify this variable.
+.TP
+\fBFILESDIR\fR = \fI"${PORTDIR}/${CATEGORY}/${PN}/files"\fR
+Contains the path to the 'files' sub folder in the package specific
+location in the portage tree.  Do not modify this variable.
+.TP
+\fBS\fR = \fI"${WORKDIR}/${P}"\fR
+Contains the path to the temporary \fIbuild directory\fR.  This variable
+is used by the functions \fIsrc_compile\fR and \fIsrc_install\fR.  Both
+are executed with \fIS\fR as the current directory.  This variable may
+be modified to match the extraction directory of a tarball for the package.
+.TP
+\fBT\fR = \fI"${PORTAGE_TMPDIR}/portage/${CATEGORY}/${PF}/temp"\fR
+Contains the path to a \fItemporary directory\fR.  You may use this for
+whatever you like.
+.TP
+\fBD\fR = \fI"${PORTAGE_TMPDIR}/portage/${CATEGORY}/${PF}/image"\fR
+Contains the path to the temporary \fIinstall directory\fR.  Every write
+operation that does not involve the helper tools and functions (found below)
+should be prefixed with ${D}.  Do not modify this variable.
+.TP
+.B PORTAGE_LOG_FILE
+Contains the path of the build log. If \fBPORT_LOGDIR\fR variable is unset then
+\fBPORTAGE_LOG_FILE\fR=\fB"${T}/build.log"\fR.
+.TP
+\fBROOT\fR = \fI"/"\fR
+Contains the path that portage should use as the root of the live filesystem.
+When packages wish to make changes to the live filesystem, they should do so in
+the tree prefixed by ${ROOT}.  Do not modify this variable.
+.TP
+\fBDESCRIPTION\fR = \fI"A happy little package"\fR
+Should contain a short description of the package.
+.TP
+\fBSRC_URI\fR = \fI"http://happy.com/little/${P}.tar.gz"\fR
+Contains a list of URI's for the required source files.  It can contain
+multiple URI's for a single source file.  The list is processed in order
+if the file was not found on any of the \fIGENTOO_MIRRORS\fR.
+.TP
+\fBHOMEPAGE\fR = \fI"http://happy.com/"\fR
+Should contain a list of URL's for the sources main sites and other further
+package dependent information.
+.TP
+\fBKEYWORDS\fR = \fI[\-~][x86,ppc,sparc,mips,alpha,arm,hppa]\fR
+Should contain appropriate list of arches that the ebuild is know to
+work/not work.  By default if you do not know if an ebuild runs under
+a particular arch simply omit that KEYWORD.  If the ebuild will not
+work on that arch include it as \-ppc for example.  If the ebuild is
+being submitted for inclusion, it must have ~arch set for architectures
+where it has been PROVEN TO WORK.  (Packages KEYWORDed this way may be
+unmasked for testing by setting ACCEPT_KEYWORDS="~arch" on the command
+line, or in \fBmake.conf\fR(5)) For an authoritative list please review
+/usr/portage/profiles/arch.list.  Please keep this list in alphabetical order.
+.TP
+\fBSLOT\fR
+This sets the SLOT for packages that may need to have multiple versions
+co\-exist.  By default you should set \fBSLOT\fR="0".  If you are unsure, then
+do not fiddle with this until you seek some guidance from some guru.  This
+value should \fINEVER\fR be left undefined.
+.TP
+\fBLICENSE\fR
+This should be a space delimited list of licenses that the package falls
+under.  This \fB_must_\fR be set to a matching license in
+/usr/portage/licenses/. If the license does not exist in portage yet, you
+must add it first.
+.TP
+\fBIUSE\fR
+This should be a list of any and all USE flags that are leveraged within
+your build script.  The only USE flags that should not be listed here are
+arch related flags (see \fBKEYWORDS\fR).
+.TP
+\fBDEPEND\fR
+This should contain a list of all packages that are required for the
+program to compile.
+.RS
+.TP
+.B DEPEND Atoms
+A depend atom is simply a dependency that is used by portage when calculating
+relationships between packages.  Please note that if the atom has not already
+been emerged, then the latest version available is matched.
+.RS
+.TP
+.B Atom Bases
+The base atom is just a full category/packagename.  Hence, these are base atoms:
+
+.nf
+.I sys\-apps/sed
+.I sys\-libs/zlib
+.I net\-misc/dhcp
+.fi
+.TP
+.B Atom Versions
+It is nice to be more specific and say that only certain versions of atoms are
+acceptable.  Note that versions must be combined with a prefix (see below).  
+Hence you may add a version number as a postfix to the base:
+
+.nf
+sys\-apps/sed\fI\-4.0.5\fR
+sys\-libs/zlib\fI\-1.1.4\-r1\fR
+net\-misc/dhcp\fI\-3.0_p2\fR
+.fi
+
+Versions are normally made up of two or three numbers separated by periods, such
+as 1.2 or 4.5.2.  This string may be followed by a character such as 1.2a or 
+4.5.2z.  Note that this letter is \fBnot\fR meant to indicate alpha, beta, 
+etc... status.  For that, use the optional suffix; either _alpha, _beta, _pre 
+(pre\-release), _rc (release candidate), or _p (patch).  This means for the 
+3rd pre\-release of a package, you would use something like 1.2_pre3.  The 
+suffixes here can be arbitrarily chained without limitation.
+.TP
+.B Atom Prefix Operators [> >= = <= <]
+Sometimes you want to be able to depend on general versions rather than specifying
+exact versions all the time.  Hence we provide standard boolean operators:
+
+.nf
+\fI>\fRmedia\-libs/libgd\-1.6
+\fI>=\fRmedia\-libs/libgd\-1.6
+\fI=\fRmedia\-libs/libgd\-1.6
+\fI<=\fRmedia\-libs/libgd\-1.6
+\fI<\fRmedia\-libs/libgd\-1.6
+.fi
+.TP
+.B Extended Atom Prefixes [!~] and Postfixes [*]
+Now to get even fancier, we provide the ability to define blocking packages and
+version range matching.  Also note that these extended prefixes/postfixes may
+be combined in any way with the atom classes defined above.  Here are some common
+examples you may find in the portage tree:
+
+.nf
+\fI!\fRapp\-text/dos2unix
+=dev\-libs/glib\-2\fI*\fR
+\fI!\fR=net\-fs/samba\-2\fI*\fR
+\fI~\fRnet\-libs/libnet\-1.0.2a
+.fi
+
+\fI!\fR means block packages from being installed at the same time.
+.br
+\fI*\fR means match any version of the package so long as the specified base
+is matched.  So with a version of '2*', we can match '2.1', '2.2', '2.2.1',
+etc... and not match version '1.0', '3.0', '4.1', etc...
+.br
+\fI~\fR means match any revision of the base version specified.  So in the
+above example, we would match versions '1.0.2a', '1.0.2a\-r1', '1.0.2a\-r2',
+etc...
+.RE
+.TP
+.B Dynamic DEPENDs
+Sometimes programs may depend on different things depending on the USE
+variable.  Portage offers a few options to handle this.  Note that when
+using the following syntaxes, each case is considered as 1 Atom in the
+scope it appears.  That means that each Atom both conditionally include
+multiple Atoms and be nested to an infinite depth.
+.RS
+.TP
+.B usevar? ( DEPEND Atom )
+To include the jpeg library when the user has jpeg in \fBUSE\fR, simply use the
+following syntax:
+.br
+.B jpeg? ( media\-libs/jpeg )
+.TP
+.B !usevar? ( Atom )
+If you want to include a package only if the user does not have a certain option
+in their \fBUSE\fR variable, then use the following syntax:
+.br
+.B !nophysfs? ( dev\-games/physfs )
+.br
+This is often useful for those times when you want to want to add optional support
+for a feature and have it enabled by default.
+.TP
+.B usevar? ( Atom if true ) !usevar? ( Atom if false )
+For functionality like the tertiary operator found in C you must use
+two statements, one normal and one inverted.  If a package uses
+GTK2 or GTK1, but not both, then you can handle that like this:
+.br
+.B gtk2? ( =x11\-libs/gtk+\-2* ) !gtk2? ( =x11\-libs/gtk+\-1* )
+.br
+That way the default is the superior GTK2 library.
+.TP
+.B || ( Atom Atom ... )
+When a package can work with a few different packages but a virtual is not
+appropriate, this syntax can easily be used.
+.nf
+.B || (
+.B 	app\-games/unreal\-tournament
+.B 	app\-games/unreal\-tournament\-goty
+.B )
+.fi
+Here we see that unreal\-tournament has a normal version and it has a goty
+version.  Since they provide the same base set of files, another package can
+use either.  Adding a virtual is inappropriate due to the small scope of it.
+.br
+Another good example is when a package can be built with multiple video 
+interfaces, but it can only ever have just one.
+.nf
+.B || (
+.B 	sdl? ( media\-libs/libsdl )
+.B 	svga? ( media\-libs/svgalib )
+.B 	opengl? ( virtual/opengl )
+.B 	ggi? ( media\-libs/libggi )
+.B 	virtual/x11
+.B )
+.fi
+Here only one of the packages will be chosen, and the order of preference is
+determined by the order in which they appear.  So sdl has the best chance of
+being chosen, followed by svga, then opengl, then ggi, with a default of X if
+the user does not specify any of the previous choices.
+.br
+Note that if any of the packages listed are already merged, the package manager
+will use that to consider the dependency satisfied.
+.RE
+
+.RE
+.TP
+\fBRDEPEND\fR
+This should contain a list of all packages that are required for this
+program to run (aka runtime depend).  If this is not set, then it
+defaults to the value of \fBDEPEND\fR.
+.br
+You may use the same syntax to vary dependencies as seen above in \fBDEPEND\fR.
+.TP
+\fBPDEPEND\fR
+This should contain a list of all packages that should be merged after this one,
+but may be merged before if need be.
+.br
+You may use the same syntax to vary dependencies as seen above in \fBDEPEND\fR.
+.TP
+\fBRESTRICT\fR = \fI[strip,mirror,fetch,userpriv]\fR
+This should be a space delimited list of portage features to restrict.
+.PD 0
+.RS
+.TP
+.I binchecks
+Disable all QA checks for binaries.  This should ONLY be used in packages
+for which binary checks make no sense (linux\-headers and kernel\-sources, for
+example, can safely be skipped since they have no binaries).  If the binary
+checks need to be skipped for other reasons (such as proprietary binaries),
+see the \fBQA CONTROL VARIABLES\fR section for more specific exemptions.
+.TP
+.I confcache
+Prevent econf from using confcache.
+.TP
+.I fetch
+like \fImirror\fR but the files will not be fetched via \fBSRC_URI\fR either.
+.TP
+.I mirror
+files in \fBSRC_URI\fR will not be downloaded from the \fBGENTOO_MIRRORS\fR.
+.TP
+.I primaryuri
+fetch from URL's in \fBSRC_URI\fR before \fBGENTOO_MIRRORS\fR.
+.TP
+.I strip
+final binaries/libraries will not be stripped of debug symbols.
+.TP
+.I test
+do not run src_test even if user has \fBFEATURES\fR=test.
+.TP
+.I userpriv
+Disables userpriv for specific packages.
+.RE
+.PD 1
+.TP
+\fBPROVIDE\fR = \fI"virtual/TARGET"\fR
+This variable should only be used when a package provides a virtual target.
+For example, blackdown\-jdk and sun\-jdk provide \fIvirtual/jdk\fR.  This
+allows for packages to depend on \fIvirtual/jdk\fR rather than on blackdown
+or sun specifically.
+.SH "QA CONTROL VARIABLES"
+.TP
+.B USAGE NOTES
+Several QA variables are provided which allow an ebuild to manipulate some
+of the QA checks performed by portage.  Use of these variables in ebuilds
+should be kept to an absolute minimum otherwise they defeat the purpose
+of the QA checks, and their use is subject to agreement of the QA team.
+They are primarily intended for use by ebuilds that install closed\-source
+binary objects that cannot be altered.
+.br
+Note that objects that violate these rules may fail on some architectures.
+.TP
+\fBQA_TEXTRELS\fR
+This variable can be set to a list of file paths, relative to the image
+directory, of files that contain text relocations that cannot be eliminated.
+The paths may contain regular expressions.
+.br
+This variable is intended to be used on closed\-source binary objects that
+cannot be altered.
+.TP
+\fBQA_EXECSTACK\fR
+This should contain a list of file paths, relative to the image directory, of
+objects that require executable stack in order to run.
+The paths may contain regular expressions.
+.br
+This variable is intended to be used on objects that truly need executable
+stack (i.e. not those marked to need it which in fact do not).
+.TP
+\fBQA_WX_LOAD\fR
+This should contain a list of file paths, relative to the image directory, of
+files that contain writable and executable segments.  These are rare.
+The paths may contain regular expressions.
+.SH "PORTAGE DECLARATIONS"
+.TP
+.B inherit
+Inherit is portage's maintenance of extra classes of functions that are
+external to ebuilds and provided as inheritable capabilities and data. They
+define functions and set data types as drop\-in replacements, expanded, and
+simplified routines for extremely common tasks to streamline the build
+process.  Inherit may only be called once in an ebuild and it may \fBnever be
+wrapped within any conditionals\fR of any kind.  Specification of the eclasses
+contains only their name and not the \fI.eclass\fR extension.  Also note that
+the inherit statement must come before other variable declarations.
+.SH "FUNCTIONS"
+.TP
+.B pkg_nofetch
+If you turn on \fIfetch\fR in \fBRESTRICT\fR, then this function will be
+run when the files in \fBSRC_URI\fR cannot be found.  Useful for
+displaying information to the user on *how* to obtain said files.  All
+you have to do is output a message and let the function return.  Do not
+end the function with a call to \fBdie\fR.
+.TP
+.B pkg_setup
+This function can be used if the package needs specific setup actions or
+checks to be preformed before anything else.
+.br
+Initial working directory of ${PORTAGE_TMPDIR}.
+.TP
+.B src_unpack
+This function is used to unpack all the sources in \fIA\fR to \fIWORKDIR\fR.
+If not defined in the \fIebuild script\fR it calls \fIunpack ${A}\fR. Any
+patches and other pre configure/compile modifications should be done here.
+.br
+Initial working directory of $WORKDIR.
+.TP
+.B src_compile
+All necessary steps for configuration and compilation should be done in here.
+.br
+Initial working directory of $S.
+.TP
+.B src_test
+Run all package specific test cases.  The default is to run 'make check'
+followed 'make test'.
+.br
+Initial working directory of $S.
+.TP
+.B src_install
+Should contain everything required to install the package in the temporary
+\fIinstall directory\fR.
+.br
+Initial working directory of $S.
+.TP
+.B pkg_preinst pkg_postinst
+All modifications required on the live\-filesystem before and after the
+package is merged should be placed here. Also commentary for the user
+should be listed here as it will be displayed last.
+.br
+Initial working directory of $PWD.
+.TP
+.B pkg_prerm pkg_postrm
+Like the pkg_*inst functions but for unmerge.
+.br
+Initial working directory of $PWD.
+.TP
+.B pkg_config
+This function should contain optional basic configuration steps.
+.br
+Initial working directory of $PWD.
+.SH "HELPER FUNCTIONS: GENERAL"
+.TP
+\fBdie\fR \fI[reason]\fR
+Causes the current emerge process to be aborted. The final display will
+include \fIreason\fR.
+.TP
+\fBuse\fR \fI<USE item>\fR
+If \fIUSE item\fR is in the \fBUSE\fR variable, the function will silently
+return 0 (aka shell true).  If \fIUSE item\fR is not in the \fBUSE\fR
+variable, the function will silently return 1 (aka shell false).  \fBusev\fR
+is a verbose version of \fBuse\fR.
+.RS
+.TP
+.I Example:
+.nf
+if use gnome ; then
+	guiconf="\-\-enable\-gui=gnome \-\-with\-x"
+elif use gtk ; then
+	guiconf="\-\-enable\-gui=gtk \-\-with\-x"
+elif use X ; then
+	guiconf="\-\-enable\-gui=athena \-\-with\-x"
+else
+	# No gui version will be built
+	guiconf=""
+fi
+.fi
+.RE
+.TP
+\fBuse_with\fR \fI<USE item>\fR \fI[configure name]\fR \fI[configure opt]\fR
+Useful for creating custom options to pass to a configure script. If \fIUSE
+item\fR is in the \fBUSE\fR variable and a \fIconfigure opt\fR is specified,
+then the string \fI\-\-with\-[configure name]=[configure opt]\fR will be echoed.
+If \fIconfigure opt\fR is not specified, then just \fI\-\-with\-[configure
+name]\fR will be echoed.  If \fIUSE item\fR is not in the \fBUSE\fR variable,
+then the string \fI\-\-without\-[configure name]\fR will be echoed. If
+\fIconfigure name\fR is not specified, then \fIUSE item\fR will be used in
+its place.
+.RS
+.TP
+.I Examples:
+.nf
+USE="opengl"
+myconf=$(use_with opengl)
+(myconf now has the value "\-\-with\-opengl")
+
+USE="jpeg"
+myconf=$(use_with jpeg libjpeg)
+(myconf now has the value "\-\-with\-libjpeg")
+
+USE=""
+myconf=$(use_with jpeg libjpeg)
+(myconf now has the value "\-\-without\-libjpeg")
+
+USE="sdl"
+myconf=$(use_with sdl SDL all\-plugins)
+(myconf now has the value "\-\-with\-SDL=all\-plugins")
+.fi
+.RE
+.TP
+\fBuse_enable\fR \fI<USE item>\fR \fI[configure name]\fR \fI[configure opt]\fR
+Same as \fBuse_with\fR above, except that the configure options are
+\fI\-\-enable\-\fR instead of \fI\-\-with\-\fR and \fI\-\-disable\-\fR instead of
+\fI\-\-without\-\fR.
+.TP
+\fBhas\fR \fI<item>\fR \fI<item list>\fR
+If \fIitem\fR is in \fIitem list\fR, then \fIitem\fR is echoed and \fBhas\fR
+returns 0.  Otherwise, nothing is echoed and 1 is returned. As indicated with
+use, there is a non\-echoing version \fBhasq\fR. Please use \fBhasq\fR in all
+places where output is to be disregarded. Never use the output for calculation.
+.br
+The \fIitem list\fR is delimited by the \fIIFS\fR variable.  This variable
+has a default value of ' ', or a space.  It is a \fBbash\fR(1) setting.
+.TP
+\fBhas_version\fR \fI<category/package\-version>\fR
+Check to see if \fIcategory/package\-version\fR is installed on the system.
+The parameter accepts all values that are acceptable in the \fBDEPEND\fR
+variable.  The function returns 0 if \fIcategory/package\-version\fR is
+installed, 1 otherwise.
+.TP
+\fBbest_version\fR \fI<package name>\fR
+This function will look up \fIpackage name\fR in the database of currently
+installed programs and echo the "best version" of the package that is
+currently installed. 
+.RS
+.TP
+.I Example:
+VERINS="$(best_version net\-ftp/glftpd)"
+.br
+(VERINS now has the value "net\-ftp/glftpd\-1.27" if glftpd\-1.27 is installed)
+.RE
+.SH "HELPER FUNCTIONS: OUTPUT"
+.TP
+\fBeinfo\fR \fI"disposable message"\fR
+Same as \fBelog\fR, but should be used when the message isn't important to the
+user (like progress or status messages during the build process).
+.TP
+\fBelog\fR \fI"informative message"\fR
+If you need to display a message that you wish the user to read and take
+notice of, then use \fBelog\fR.  It works just like \fBecho\fR(1), but
+adds a little more to the output so as to catch the user's eye. The message
+will also be logged by portage for later review.
+.TP
+\fBewarn\fR \fI"warning message"\fR
+Same as \fBeinfo\fR, but should be used when showing a warning to the user.
+.TP
+\fBeerror\fR \fI"error message"\fR
+Same as \fBeinfo\fR, but should be used when showing an error to the user.
+.TP
+\fBebegin\fR \fI"helpful message"\fR
+Like \fBeinfo\fR, we output a \fIhelpful message\fR and then hint that the
+following operation may take some time to complete.  Once the task is
+finished, you need to call \fBeend\fR.
+.TP
+\fBeend\fR \fI<status>\fR \fI["error message"]\fR
+Followup the \fBebegin\fR message with an appropriate "OK" or "!!" (for
+errors) marker.  If \fIstatus\fR is non\-zero, then the additional \fIerror
+message\fR is displayed.
+.SH "HELPER FUNCTIONS: UNPACK"
+.TP
+\fBunpack\fR \fI<source>\fR \fI[list of more sources]\fR
+This function uncompresses and/or untars a list of sources into the current
+directory. The function will append \fIsource\fR to the \fBDISTDIR\fR variable.
+.SH "HELPER FUNCTIONS: COMPILE"
+.TP
+\fBeconf\fR \fI[configure options]\fR
+This is used as a replacement for configure.  Performs:
+.nf
+${\fIECONF_SOURCE\fR:-.}/configure \\
+	\-\-prefix=/usr \\
+	\-\-host=${CHOST} \\
+	\-\-mandir=/usr/share/man \\
+	\-\-infodir=/usr/share/info \\
+	\-\-datadir=/usr/share \\
+	\-\-sysconfdir=/etc \\
+	\-\-localstatedir=/var/lib \\
+	\fI${EXTRA_ECONF}\fR \\
+	\fIconfigure options\fR
+.fi
+Note that the \fIEXTRA_ECONF\fR is for users only, not for ebuild
+writers.  If you wish to pass more options to configure, just pass the
+extra arguements to \fBeconf\fR.
+.TP
+\fBemake\fR \fI[make options]\fR
+This is used as a replacement for make.  Performs 'make ${MAKEOPTS}
+\fImake options\fR' (as set in /etc/make.globals), default is MAKEOPTS="\-j2".
+
+\fB***warning***\fR
+.br
+if you are going to use \fBemake\fR, make sure your build is happy with
+parallel makes (make \-j2).  It should be tested thoroughly as parallel
+makes are notorious for failing _sometimes_ but not always.  If you determine
+that your package fails to build in parallel, and you are unable to resolve
+the issue, then you should run '\fBemake\fR \-j1' instead of 'make'.
+.SH "HELPER FUNCTIONS: INSTALL"
+.TP
+\fBeinstall\fR \fI[make options]\fR
+This is used as a replacement for make install.  Performs:
+.nf
+make \\
+	prefix=${D}/usr \\
+	datadir=${D}/usr/share \\
+	infodir=${D}/usr/share/info \\
+	localstatedir=${D}/var/lib \\
+	mandir=${D}/usr/share/man \\
+	sysconfdir=${D}/etc \\
+	\fI${EXTRA_EINSTALL}\fR \\
+	\fImake options\fR \\
+	install
+.fi
+Please do \fBnot\fR use this in place of 'emake install DESTDIR=${D}'.
+That is the preferred way of installing make\-based packages.  Also, do
+not utilize the \fIEXTRA_EINSTALL\fR variable since it is for users.
+
+.PD 0
+.TP
+.B prepall
+.TP
+.B prepalldocs
+.TP
+.B prepallinfo
+.TP
+.B prepallman
+.TP
+.B prepallstrip
+.PD 1
+Useful for when a package installs into \fB${D}\fR via scripts
+(i.e. makefiles).  If you want to be sure that libraries are executable,
+aclocal files are installed into the right place, doc/info/man files are
+all compressed, and that executables are all stripped of debugging symbols,
+then use these suite of functions.
+.RS
+.PD 0
+.TP
+.B prepall:
+Runs \fBprepallman\fR, \fBprepallinfo\fR, \fBprepallstrip\fR, sets
+libraries +x, and then checks aclocal directories.  Please note this
+does \fI*not*\fR run \fBprepalldocs\fR.
+.TP
+.B prepalldocs:
+Compresses all doc files in ${D}/usr/share/doc.
+.TP
+.B prepallinfo:
+Compresses all info files in ${D}/usr/share/info.
+.TP
+.B prepallman:
+Compresses all man files in ${D}/usr/share/man.
+.TP
+.B prepallstrip:
+Strips all executable files of debugging symboles.  This includes libraries.
+.RE
+
+.TP
+\fBprepinfo\fR \fI[dir]\fR
+.TP
+\fBprepman\fR \fI[dir]\fR
+.TP
+\fBprepstrip\fR \fI[dir]\fR
+.PD 1
+Similiar to the \fBprepall\fR functions, these are subtle in their differences.
+.RS
+.PD 0
+.TP
+.B prepinfo:
+If a \fIdir\fR is not specified, then \fBprepinfo\fR will assume the dir
+\fIusr\fR. \fBprepinfo\fR will then compress all the files in
+${D}/\fIdir\fR/info.
+.TP
+.B prepman:
+If a \fIdir\fR is not specified, then \fBprepman\fR will assume the dir
+\fIusr\fR. \fBprepman\fR will then compress all the files in
+${D}/\fIdir\fR/man/*/.
+.TP
+.B prepstrip:
+All the files found in ${D}/\fIdir\fR will be stripped.  You may specify
+multiple directories.
+.RE
+.PD 1
+.TP
+\fBdosed\fR \fI"s:orig:change:g" <filename>\fR
+Performs sed (including cp/mv \fIfilename\fR) on \fIfilename\fR.
+.br
+.BR 'dosed\ "s:/usr/local:/usr:g"\ /usr/bin/some\-script'
+runs sed on ${D}/usr/bin/some\-script
+.TP
+\fBdodir\fR \fI<path>\fR
+Creates a directory inside of ${D}.
+.br
+.BR 'dodir\ /usr/lib/apache'
+creates ${D}/usr/lib/apache.  Note that the do* functions will run
+\fBdodir\fR for you.
+.TP
+\fBdiropts\fR \fI[options for install(1)]\fR
+Can be used to define options for the install function used in
+\fBdodir\fR.  The default is \fI\-m0755\fR.
+.TP
+\fBinto\fR \fI<path>\fR
+Sets the root (\fIDESTTREE\fR) for other functions like \fBdobin\fR,
+\fBdosbin\fR, \fBdoman\fR, \fBdoinfo\fR, \fBdolib\fR.
+.br
+The default root is /usr.
+.TP
+\fBkeepdir\fR \fI<path>\fR
+Tells portage to leave a directory behind even if it is empty.  Functions
+the same as \fBdodir\fR.
+.TP
+\fBdobin\fR \fI<binary> [list of more binaries]\fR
+Installs a \fIbinary\fR or a list of binaries into \fIDESTTREE\fR/bin.
+Creates all necessary dirs.
+.TP
+\fBdosbin\fR \fI<binary> [list of more binaries]\fR
+Installs a \fIbinary\fR or a list of binaries into \fIDESTTREE\fR/sbin.
+Creates all necessary dirs.
+.TP
+\fBdoinitd\fR \fI<init.d script> [list of more init.d scripts]\fR
+Install Gentoo \fIinit.d scripts\fR.  They will be installed into the
+correct location for Gentoo init.d scripts (/etc/init.d/).  Creates all
+necessary dirs.
+.TP
+\fBdoconfd\fR \fI<conf.d file> [list of more conf.d file]\fR
+Install Gentoo \fIconf.d files\fR.  They will be installed into the
+correct location for Gentoo conf.d files (/etc/conf.d/).  Creates all
+necessary dirs.
+.TP
+\fBdoenvd\fR \fI<env.d entry> [list of more env.d entries]\fR
+Install Gentoo \fIenv.d entries\fR.  They will be installed into the
+correct location for Gentoo env.d entries (/etc/env.d/).  Creates all
+necessary dirs.
+
+.PD 0
+.TP
+\fBdolib\fR \fI<library>\fR \fI[list of more libraries]\fR
+.TP
+\fBdolib.a\fR \fI<library>\fR \fI[list of more libraries]\fR
+.TP
+\fBdolib.so\fR \fI<library>\fR \fI[list of more libraries]\fR
+.PD 1
+Installs a library or a list of libraries into \fIDESTTREE\fR/lib.
+Creates all necessary dirs.
+.TP
+\fBlibopts\fR \fI[options for install(1)]\fR
+Can be used to define options for the install function used in
+the \fBdolib\fR functions.  The default is \fI\-m0644\fR.
+.TP
+\fBdoman\fR \fI[\-i18n=<locale>]\fR \fI<man\-page> [list of more man\-pages]\fR
+Installs manual\-pages into /usr/share/man/man[0\-9n] depending on the
+manual file ending.  The files are compressed if they are not already.  You
+can specify locale\-specific manpages with the \fI\-i18n\fR option.  Then the
+man\-page will be installed into /usr/share/man/\fI<locale>\fR/man[0\-9n].
+.PD 0
+.TP
+\fBdohard\fR \fI<filename> <linkname>\fR
+.TP
+\fBdosym\fR \fI<filename> <linkname>\fR
+.PD 1
+Performs the ln command as either a hard link or symlink.
+.TP
+\fBdohtml\fR \fI [\-a filetypes] [\-r] [\-x list\-of\-dirs\-to\-ignore] [list\-of\-files\-and\-dirs]\fR
+Installs the files in the list of files (space\-separated list) into
+/usr/share/doc/${PF}/html provided the file ends in .html, .png, .js, .jpg,
+or .css.  Setting \fI\-a\fR limits what types of files will be included,
+\fI\-A\fR appends to the default list, setting \fI\-x\fR sets which dirs to
+exclude (CVS excluded by default), \fI\-r\fR sets recursive.
+.TP
+\fBdoinfo\fR \fI<info\-file> [list of more info\-files]\fR
+Installs info\-pages into \fIDESTDIR\fR/info.  Files are automatically
+gzipped.  Creates all necessary dirs.
+.TP
+\fBdomo\fR \fI<locale\-file> [list of more locale\-files] \fR
+Installs locale\-files into \fIDESTDIR\fR/usr/share/locale/[LANG]
+depending on local\-file's ending.  Creates all necessary dirs.
+
+.PD 0
+.TP
+\fBfowners\fR \fI<permissions> <file> [files]\fR
+.TP
+\fBfperms\fR \fI<permissions> <file> [files]\fR
+.PD 1
+Performs chown (\fBfowners\fR) or chmod (\fBfperms\fR), applying
+\fIpermissions\fR to \fIfiles\fR.
+.TP
+\fBinsinto\fR \fI[path]\fR
+Sets the destination path for the \fBdoins\fR function.
+.br
+The default path is /.
+.TP
+\fBinsopts\fR \fI[options for install(1)]\fR
+Can be used to define options for the install function used in
+\fBdoins\fR.  The default is \fI\-m0644\fR.
+.TP
+\fBdoins\fR \fI<file> [list of more files]\fR
+Installs files into the path controlled by \fBinsinto\fR.  This function
+uses \fBinstall\fR(1).  Creates all necessary dirs.
+.TP
+\fBexeinto\fR \fI[path]\fR
+Sets the destination path for the \fBdoexe\fR function.
+.br
+The default path is /.
+.TP
+\fBexeopts\fR \fI[options for install(1)]\fR
+Can be used to define options for the install function used in \fBdoexe\fR.
+The default is \fI\-m0755\fR.
+.TP
+\fBdoexe\fR \fI<executable> [list of more executables]\fR
+Installs executables into the path controlled by \fBexecinto\fR.  This function
+uses \fBinstall\fR(1).  Creates all necessary dirs.
+.TP
+\fBdocinto\fR \fI[path]\fR
+Sets the subdir used by \fBdodoc\fR when installing into the document tree
+(based in /usr/share/doc/${PF}/).  Default is no subdir, or just "".
+.TP
+\fBdodoc\fR \fI<document> [list of more documents]\fR
+Installs a document or a list of documents into /usr/share/doc/${PF}/\fI<docinto path>\fR.
+Documents are marked for compression.  Creates all necessary dirs.
+
+.PD 0
+.TP
+\fBnewbin\fR \fI<old file> <new filename>\fR
+.TP
+\fBnewsbin\fR \fI<old file> <new filename>\fR
+.TP
+\fBnewinitd\fR \fI<old file> <new filename>\fR
+.TP
+\fBnewconfd\fR \fI<old file> <new filename>\fR
+.TP
+\fBnewenvd\fR \fI<old file> <new filename>\fR
+.TP
+\fBnewlib\fR \fI<old file> <new filename>\fR
+.TP
+\fBnewlib.so\fR \fI<old file> <new filename>\fR
+.TP
+\fBnewlib.a\fR \fI<old file> <new filename>\fR
+.TP
+\fBnewman\fR \fI<old file> <new filename>\fR
+.TP
+\fBnewinfo\fR \fI<old file> <new filename>\fR
+.TP
+\fBnewins\fR \fI<old file> <new filename>\fR
+.TP
+\fBnewexe\fR \fI<old file> <new filename>\fR
+.TP
+\fBnewdoc\fR \fI<old file> <new filename>\fR
+.PD 1
+All these functions act like the do* functions, but they only work with one
+file and the file is installed as \fI[new filename]\fR.
+.SH "REPORTING BUGS"
+Please report bugs via http://bugs.gentoo.org/
+.SH "AUTHORS"
+.nf
+Achim Gottinger <achim@gentoo.org>
+Mark Guertin <gerk@gentoo.org>
+Nicholas Jones <carpaski@gentoo.org>
+Mike Frysinger <vapier@gentoo.org>
+Arfrever Frehtes Taifersar Arahesis <FFTA@WP.PL>
+.fi
+.SH "FILES"
+.TP
+The \fI/usr/sbin/ebuild.sh\fR script.
+.TP
+The helper apps in \fI@PORTAGE_BASE@/bin\fR.
+.TP
+\fB/etc/make.conf\fR 
+Contains variables for the build\-process and overwrites those in make.defaults.
+.TP
+\fB/etc/make.globals\fR
+Contains the default variables for the build\-process, you should edit
+\fI/etc/make.conf\fR instead.
+.SH "SEE ALSO"
+.BR ebuild (1),
+.BR make.conf (5)
Index: /vendor/prefix-portage/current/man/emaint.1
===================================================================
--- /vendor/prefix-portage/current/man/emaint.1	(revision 3489)
+++ /vendor/prefix-portage/current/man/emaint.1	(revision 3489)
@@ -0,0 +1,30 @@
+.TH "EMAINT" "1" "Dec 2005" "Portage 2.1" "Portage"
+.SH NAME
+emaint \- updates environment settings automatically
+.SH SYNOPSIS
+.BR emaint
+[\fIoptions\fR]
+[\fBall\fR | \fBworld\fR]
+.SH DESCRIPTION
+.B emaint
+checks for and fixes problems in the portage \fIworld\fR file.
+.SH OPTIONS 
+.TP
+.B \-c, \-\-check
+Check for any problems that may exist.
+.TP
+.B \-f, \-\-fix
+Fix any problems that may exist.
+.SH "REPORTING BUGS"
+Please report bugs via http://bugs.gentoo.org/
+.SH AUTHORS
+.nf
+Mike Frysinger <vapier@gentoo.org>
+.fi
+.SH "FILES"
+.TP
+.B /var/lib/portage/world
+Contains a list of all user\-specified packages.
+.SH "SEE ALSO"
+.BR emerge (1),
+.BR portage (5)
Index: /vendor/prefix-portage/current/man/emerge.1
===================================================================
--- /vendor/prefix-portage/current/man/emerge.1	(revision 3489)
+++ /vendor/prefix-portage/current/man/emerge.1	(revision 3489)
@@ -0,0 +1,612 @@
+.TH "EMERGE" "1" "Dec 2006" "Portage 2.1" "Portage"
+.SH "NAME"
+emerge \- Command\-line interface to the Portage system
+.SH "SYNOPSIS"
+.TP
+.BR emerge
+[\fIoptions\fR] [\fIaction\fR] [\fIebuild\fR | \fItbz2file\fR | \fIset\fR | \fIatom\fR] ...
+.TP
+.BR emerge
+\fB\-\-sync\fR | \fB\-\-info\fR | \fB\-\-version\fR
+.TP
+.BR emerge
+\fB\-\-search\fR \fIsomestring\fR
+.TP
+.BR emerge
+\fB\-\-help\fR [\fB\-\-system\fR | \fB\-\-config\fR | \fB\-\-sync\fR]
+.SH "DESCRIPTION"
+\fBemerge\fR is the definitive command\-line interface to the Portage
+system.  It is primarily used for installing packages, and \fBemerge\fR
+can automatically handle any dependencies that the desired package has.
+\fBemerge\fR can also update the \fBportage tree\fR, making new and
+updated packages available.  \fBemerge\fR gracefully handles updating
+installed packages to newer releases as well.  It handles both source
+and binary packages, and it can be used to create binary packages for
+distribution.
+.SH "EBUILDS, TBZ2S, SETS AND ATOMS"
+\fBemerge\fR primarily installs packages.  You can specify
+packages to install in one of four main ways: an \fIebuild\fR,
+a \fItbz2file\fR, a \fIset\fR, or an \fIatom\fR.
+.LP
+.TP
+.BR ebuild
+An \fIebuild\fR must be, at a minimum, a valid Portage
+package directory name without a version or category, such as
+\fBportage\fR or \fBpython\fR.
+Both categories and version numbers may be used in addition, such
+as \fBsys\-apps/portage\fR or \fB=python\-2.2.1\-r2\fR.
+\fBemerge\fR
+ignores a trailing slash so that filename completion can be used.
+The \fIebuild\fR may also be an actual filename, such as
+\fB/usr/portage/app\-admin/python/python\-2.2.1\-r2.ebuild\fR.
+\fBWARNING:\fR The implementation of \fBemerge /path/to/ebuild\fR is broken and
+so this syntax shouldn't be used.
+.TP
+.BR tbz2file
+A \fItbz2file\fR must be a valid .tbz2 created with \fBebuild
+<package>\-<version>.ebuild package\fR or \fBemerge \-\-buildpkg 
+[category/]<package>\fR or \fBquickpkg /var/db/pkg/<category>/<package>\fR.
+.TP
+.BR set
+A \fIset\fR is a convenient shorthand for a large group of
+packages.  Two sets are currently supported: \fBsystem\fR
+and \fBworld\fR.  \fBsystem\fR refers to a set of packages
+deemed necessary for your system to run properly.  \fBworld\fR
+contains all the packages in \fBsystem\fR, plus any
+other packages listed in \fB/var/lib/portage/world\fR.  [See
+\fBFILES\fR below for more information.]  Note that a \fIset\fR
+is generally used in conjunction with \fB\-\-update\fR.
+.TP
+.BR atom
+An \fIatom\fR describes bounds on a package that you wish to install.  
+\fISee portage(5) for the details on atom syntax.\fR  For example, 
+\fB>=dev\-lang/python\-2.2.1\-r2\fR matches the latest available version of 
+Python greater than or equal to 2.2.1\-r2.  Similarly, 
+\fB<dev\-lang/python\-2.0\fR matches the latest available version of Python 
+before 2.0.  Note that in many shells you will need to escape characters such 
+as '<' and '='; use single\- or double\-quotes around the \fIatom\fR 
+to get around escaping problems.
+.SH "ACTIONS"
+.TP
+.BR "No action"
+If no action is specified, the action is to merge in the specified
+packages, satisfying any dependencies that they may have.  The
+arguments can be \fIebuilds\fR, \fItbz2s\fR, \fIsets\fR, or
+\fIatoms\fR.  \fBNote that you need to use the \-\-usepkg 
+option if you want to install a tbz2\fR.  The packages are added
+to the \fBworld\fR file at the end, so that they are considered for
+later updating.
+.TP
+.BR "\-\-clean " (\fB\-c\fR)
+Cleans up the system by examining the installed packages and removing older
+packages.  This is accomplished by looking at each installed package and separating
+the installed versions by \fBslot\fR.  Clean will \fBremove all but the most recently
+installed version in each \fbslot\fR.  Clean should not remove unslotted packages.
+Note: Most recently installed means most \fBrecent\fR, not highest version.
+.TP
+.BR "\-\-config "
+Run package specific actions needed to be executed after the emerge process 
+has completed.  This usually entails configuration file setup or other similar 
+setups that the user may wish to run.
+.TP
+.BR \-\-depclean
+Determines all packages installed on the system that have no 
+explicit reason for being there.  \fBemerge\fR generates a list 
+of packages which it expects to be installed by checking the 
+\fBsystem\fR package list and the \fBworld\fR file.  It then 
+compares that list to the list of packages which are actually 
+installed; the differences are listed as unnecessary packages 
+and then unmerged after a short timeout.  \fBWARNING: Removing some 
+packages may cause packages which link to the removed package 
+to stop working and complain about missing libraries.\fR 
+Re\-emerge the complaining package to fix this issue.  Also see
+\fB\-\-with\-bdeps\fR for behavior with respect to build time dependencies that
+are not strictly required.
+.TP
+.BR "\-\-help " (\fB\-h\fR)
+Displays help information for emerge.  Adding one of the additional
+arguments listed above will give you more specific help information
+on that subject.  The internal \fBemerge\fR help documentation is
+updated more frequently than this man page; check it out if you
+are having problems that this man page does not help resolve.
+.TP
+.BR \-\-info
+Produces a list of information to include in bug reports which aids the 
+developers when fixing the reported problem.  \fBPlease include this 
+information when submitting a bug report.\fR  Expanded output can be obtained 
+with the \fI\-\-verbose\fR option.
+.TP
+.BR \-\-metadata
+Transfers metadata cache from ${PORTDIR}/metadata/cache/ to
+/var/cache/edb/dep/ as is normally done on the
+tail end of an rsync update using \fBemerge \-\-sync\fR.  This process
+populates the cache database that portage uses for pre-parsed lookups of
+package data.  It does not populate cache for the overlays listed in
+PORTDIR_OVERLAY.  In order to generate cache for overlays, use \fB\-\-regen\fR.
+.TP
+.BR "\-\-prune " (\fB\-P\fR)
+\fBWARNING: This action can remove important packages!\fR  Prune looks at each
+installed package and attempts to \fBremove\fR all but the \fBmost recently 
+installed version.  \fRPrune ignores \fBslots\fR, if you require a slot\-aware
+Prune use \fB emerge \-\-clean\fR.  Prune may inadvertently remove important 
+packages from your system.  Use \fB\-\-clean\fR instead unless you really 
+know what you're doing.
+.TP
+.BR \-\-regen
+Causes portage to check and update the dependency cache of all ebuilds in the 
+portage tree.  The cache is used to speed up searches and the building of 
+dependency trees.  This command is not recommended for rsync users as rsync 
+updates the cache using server\-side caches.  If you do not know the 
+differences between a 'rsync user' and some other user, then you are a 'rsync 
+user' :).  Rsync users should simply run \fBemerge \-\-sync\fR to regenerate 
+the cache.  After a portage update, rsync users may find it convenient to run 
+\fBemerge \-\-metadata\fR to rebuild the cache as portage does at the end of 
+a sync operation.
+.TP
+.BR "\-\-resume"
+Resumes the most recent merge list that has been aborted due to an error.
+Please note that this operation will only return an error on failure.  If there
+is nothing for portage to do, then portage will exit with a message and a
+success condition. A resume list will persist until it has been completed in
+entirety or until another aborted merge list replaces it.  The resume history
+is capable of storing two merge lists.  After one resume list completes, it is
+possible to invoke \-\-resume once again in order to resume an older list.
+.TP
+.BR "\-\-search " (\fB\-s\fR)
+Searches for matches of the supplied string in the portage tree.
+By default emerge uses a case-insensitive simple search, but you can 
+enable a regular expression search by prefixing the search string with %.
+For example, \fBemerge \-\-search "%^kde"\fR searches for any package whose 
+name starts with "kde"; \fBemerge \-\-search "%gcc$"\fR searches for any 
+package that ends with "gcc"; \fBemerge \-\-search "office"\fR searches for 
+any package that contains the word "office".  If you want to include the 
+category into the search string, prepend an @: \fBemerge --search 
+"%@^dev-java.*jdk"\fR. If you want to search the package descriptions as well, 
+use the \fB\-\-searchdesc\fR action.
+.TP
+.BR "\-\-searchdesc " (\fB\-S\fR)
+Matches the search string against the description field as well as
+the package name.  \fBTake caution\fR as the descriptions are also
+matched as regular expressions.
+.TP
+.BR \-\-sync
+Initiates a portage tree update with one of the rsync.gentoo.org
+mirrors.  \fBNote that any changes you have made to the portage
+tree will be erased\fR.  Except for special circumstances, 
+this uses \fBrsync\fR to do the update.  See \fBmake.conf\fR(5)'s 
+description of PORTDIR_OVERLAY for a method to avoid deletions.
+.TP
+.BR "\-\-unmerge " (\fB\-C\fR)
+\fBWARNING: This action can remove important packages!\fR Removes
+all matching packages.  This does no checking of dependencies, so
+it may remove packages necessary for the proper operation of your
+system.  Its arguments can be \fIebuilds\fR, \fIsets\fR, or
+\fIatoms\fR.
+.TP
+.BR "\-\-update " (\fB\-u\fR)
+Updates packages to the best version available, which may not always be the 
+highest version number due to masking for testing and development.  This will 
+also update direct dependencies which may not be what you want.  Package atoms
+specified on the command line are greedy, meaning that unspecific atoms may
+match multiple installed versions of slotted packages.
+.TP
+.BR "\-\-version " (\fB\-V\fR)
+Displays the version number of \fBemerge\fR.
+.SH "OPTIONS"
+.TP
+.BR "\-\-alphabetical "
+When displaying USE and other flag output, combines the enabled and
+disabled lists into one list and sorts the whole list alphabetically.
+.TP
+.BR "\-\-ask " (\fB\-a\fR)
+Before performing the action, display what will take place (server info for
+\fB\-\-sync\fR, \fB\-\-pretend\fR output for merge, and so forth), then ask
+whether to proceed with the action or abort.  Using \fB\-\-ask\fR is more
+efficient than using \fB\-\-pretend\fR and then executing the same command
+without \fB\-\-pretend\fR, as dependencies will only need to be calculated once.
+\fBWARNING: If the "Enter" key is pressed at the prompt (with no other input),
+it is interpreted as acceptance of the first choice.  Note that the input
+buffer is not cleared prior to the prompt, so an accidental press of the
+"Enter" key at any time prior to the prompt will be interpreted as a choice!\fR
+.TP
+.BR "\-\-buildpkg " (\fB\-b\fR)
+Tells emerge to build binary packages for all ebuilds processed in
+addition to actually merging the packages.  Useful for maintainers
+or if you administrate multiple Gentoo Linux systems (build once,
+emerge tbz2s everywhere).  The package will be created in the
+\fI${PKGDIR}/All\fR directory.  An alternative for already\-merged
+packages is to use \fBquickpkg\fR which creates a tbz2 from the
+live filesystem.
+.TP
+.BR "\-\-buildpkgonly " (\fB\-B\fR)
+Creates binary packages for all ebuilds processed without actually
+merging the packages.  This comes with the caveat that all build-time 
+dependencies must already be emerged on the system.
+.TP
+.BR "\-\-changelog " (\fB\-l\fR)
+Use this in conjunction with the \fB\-\-pretend\fR option.  This will
+show the ChangeLog entries for all the packages that will be upgraded.
+.TP
+.BR "\-\-color < y | n >"
+Enable or disable color output.  This option will override \fINOCOLOR\fR
+(see \fBmake.conf\fR(5)) and may also be used to force color output when stdout
+is not a tty (by default, color is disabled unless stdout is a tty).
+.TP
+.BR "\-\-columns"
+Used alongside \fB\-\-pretend\fR to cause the package name, new version, 
+and old version to be displayed in an aligned format for easy cut\-n\-paste.
+.TP
+.BR \-\-config\-root=DIR
+Set the \fBPORTAGE_CONFIGROOT\fR environment variable.
+.TP
+.BR "\-\-debug " (\fB\-d\fR)
+Tells emerge to run the emerge command in \fB\-\-debug\fR mode.  In this
+mode the bash build environment will run with the \-x option, causing 
+it to output verbose debugging information to stdout.  This also enables
+a plethora of other output (mostly dependency resolution messages).
+.TP
+.BR "\-\-deep " (\fB\-D\fR)
+This flag forces
+\fBemerge\fR to consider the entire dependency tree of packages,
+instead of checking only the immediate dependencies of the packages.
+As an example, this catches updates in libraries that are not directly
+listed in the dependencies of a package.  Also see \fB\-\-with\-bdeps\fR for
+behavior with respect to build time dependencies that are not strictly
+required.
+.TP
+.BR "\-\-emptytree " (\fB\-e\fR)
+Reinstalls all world packages and their dependencies to the current USE 
+specifications while differing from the installed set of packages as 
+little as possible.  You should run with \fB\-\-pretend\fR first to make 
+sure the result is what you expect.
+.TP
+.BR "\-\-fetchonly " (\fB\-f\fR)
+Instead of doing any package building, just perform fetches for all
+packages (the main package as well as all dependencies).
+.TP
+.BR "\-\-fetch\-all\-uri " (\fB\-F\fR)
+Instead of doing any package building, just perform fetches for all
+packages (the main package as well as all dependencies), grabbing all potential
+files.
+.TP
+.BR "\-\-getbinpkg " (\fB\-g\fR)
+Using the server and location defined in \fIPORTAGE_BINHOST\fR (see 
+\fBmake.conf\fR(5)), portage will download the information from each binary 
+package found and it will use that information to help build the dependency 
+list.  This option implies \fB\-k\fR.  (Use \fB\-gK\fR for binary\-only 
+merging.)
+.TP
+.BR "\-\-getbinpkgonly " (\fB\-G\fR)
+This option is identical to \fB\-g\fR, as above, except it will not use ANY 
+information from the local machine.  All binaries will be downloaded from the 
+remote server without consulting packages existing in the local packages 
+directory.
+.TP
+.BR "\-\-ignore-default-opts"
+Causes \fIEMERGE_DEFAULT_OPTS\fR (see \fBmake.conf\fR(5)) to be ignored.
+.TP
+.BR "\-\-newuse " (\fB\-N\fR)
+Tells emerge to include installed packages where USE flags have changed since 
+compilation.  USE flag changes include:
+
+A USE flag was added to a package.
+A USE flag was removed from a package.
+A USE flag was turned on for a package.
+A USE flag was turned off for a package.
+
+USE flags may be toggled by your profile as well as your USE and package.use
+settings.
+.TP
+.BR "\-\-noconfmem"
+Causes portage to disregard merge records indicating that a config file
+inside of a \fBCONFIG_PROTECT\fR directory has been merged already.  Portage
+will normally merge those files only once to prevent the user from
+dealing with the same config multiple times.  This flag will cause the
+file to always be merged.
+.TP
+.BR "\-\-nodeps " (\fB\-O\fR)
+Merges specified packages without merging any dependencies.  Note that
+the build may fail if the dependencies aren't satisfied.
+.TP
+.BR "\-\-noreplace " (\fB\-n\fR)
+Skips the packages specified on the command\-line that have already
+been installed.  Without this option, any packages, ebuilds, or deps
+you specify on the command\-line \fBwill\fR cause Portage to remerge
+the package, even if it is already installed.  Note that Portage will
+not remerge dependencies by default.
+.TP
+.BR "\-\-nospinner"
+Disables the spinner for the session.  The spinner is active when the
+terminal device is determined to be a TTY.  This flag disables it regardless.
+.TP
+.BR "\-\-oneshot " (\fB\-1\fR)
+Emerge as normal, but do not add the packages to the world file
+for later updating.
+.TP
+.BR "\-\-onlydeps " (\fB\-o\fR)
+Only merge (or pretend to merge) the dependencies of the packages
+specified, not the packages themselves.
+.TP
+.BR "\-\-pretend " (\fB\-p\fR)
+Instead of actually performing the merge, simply display what *would*
+have been installed if \fB\-\-pretend\fR weren't used.  Using \fB\-\-pretend\fR
+is strongly recommended before installing an unfamiliar package.  In
+the printout:
+.br 
+ 
+.br 
+\fIN\fR = new (not yet installed)
+.br 
+\fIS\fR = new SLOT installation (side-by-side versions) 
+.br 
+\fIU\fR = updating (to another version)
+.br 
+\fID\fR = downgrading (best version seems lower)
+.br 
+\fIR\fR = replacing (remerging same version))
+.br 
+\fIF\fR = fetch restricted (must be manually downloaded)
+.br 
+\fIf\fR = fetch restricted (already downloaded)
+.br 
+\fIB\fR = blocked by an already installed package
+.TP
+.BR "\-\-quiet " (\fB\-q\fR)
+Results may vary, but the general outcome is a reduced or condensed
+output from portage's displays.
+.TP
+.BR "\-\-skipfirst"
+This option is only valid when used with \fB\-\-resume\fR.  It removes the 
+first package in the resume list so that a merge may continue in the presence 
+of an uncorrectable or inconsequential error.  This should only be used in 
+cases where skipping the package will not result in failed dependencies.
+.TP
+.BR "\-\-tree " (\fB\-t\fR)
+Shows the dependency tree for the given target by indenting dependencies.
+This is only really useful in combination with \fB\-\-emptytree\fR or 
+\fB\-\-update\fR and \fB\-\-deep\fR.
+.TP
+.BR "\-\-usepkg " (\fB\-k\fR) 
+Tells emerge to use binary packages (from $PKGDIR) if they are available, thus 
+possibly avoiding some time\-consuming compiles.  This option is useful for CD 
+installs; you can export PKGDIR=/mnt/cdrom/packages and then use this option to 
+have emerge "pull" binary packages from the CD in order to satisfy dependencies.
+.TP
+.BR "\-\-usepkgonly " (\fB\-K\fR)
+Tells emerge to only use binary packages (from $PKGDIR).  All the binary 
+packages must be available at the time of dependency calculation or emerge 
+will simply abort.  Portage does not use $PORTDIR when calculating dependency 
+information so all masking information is ignored.
+.TP
+.BR "\-\-verbose " (\fB\-v\fR)
+Tell emerge to run in verbose mode.  Currently this flag causes emerge to print 
+out GNU info errors, if any, and to show the USE flags that will be used for 
+each package when pretending. The following symbols are affixed to USE flags
+in order to indicate their status:
+.br
+
+.br
+\fI- prefix\fR     = not enabled (either disabled or removed)
+.br
+\fI* suffix\fR     = transition to or from the enabled state
+.br
+\fI% suffix\fR     = newly added or removed
+.br
+\fI() circumfix\fR = forced, masked, or removed
+.TP
+.BR "\-\-with\-bdeps < y | n >"
+In dependency calculations, pull in build time dependencies that are not
+strictly required.   This defaults to \'n\' for installation actions and
+\'y\' for the \fB\-\-depclean\fR action.  This setting can be added to
+\fBEMERGE_DEFAULT_OPTS\fR (see make.conf(5)) and later overridden via the
+command line.
+.SH "ENVIRONMENT OPTIONS"
+.TP
+\fBROOT\fR = \fI[path]\fR
+Use \fBROOT\fR to specify the target root filesystem to be used for
+merging packages or ebuilds.  This variable can be set in \fBmake.conf\fR(5)
+when \fBPORTAGE_CONFIGROOT\fR has a value other than /.
+.br
+Defaults to /.
+.TP
+\fBPORTAGE_CONFIGROOT\fR = \fI[path]\fR
+Use \fBPORTAGE_CONFIGROOT\fR to specify the location for various portage 
+configuration files
+(see \fBFILES\fR for a detailed list of configuration files).  This variable
+can be set via the \fB\-\-config\-root\fR option.
+.br
+Defaults to /.
+.SH "OUTPUT"
+When utilizing \fBemerge\fR with the \fB\-\-pretend\fR and \fB\-\-verbose\fR 
+flags, the output may be a little hard to understand at first.  This section
+explains the abbreviations.
+.TP
+.B [blocks B     ] app\-text/dos2unix (from pkg app\-text/hd2u\-0.8.0)
+Dos2unix is Blocking hd2u from being emerged.  Blockers are defined when
+two packages will clobber each others files, or otherwise cause some form
+of breakage in your system.  However, blockers usually do not need to be
+simultaneously emerged because they usually provide the same functionality.
+.TP
+.B [ebuild  N    ] app\-games/qstat\-25c
+Qstat is New to your system, and will be emerged for the first time.
+.TP
+.B [ebuild  NS   ] dev-libs/glib-2.4.7
+You already have a version of glib installed, but a 'new' version in 
+a different SLOT is available.
+.TP
+.B [ebuild   R   ] sys\-apps/sed\-4.0.5
+Sed 4.0.5 has already been emerged, but if you run the command, then 
+portage will Re\-emerge the specified package (sed in this case).
+.TP
+.B [ebuild    F  ] media\-video/realplayer\-8\-r6
+The realplayer package requires that you Fetch the sources manually.  
+When you attempt to emerge the package, if the sources are not found, 
+then portage will halt and you will be provided with instructions on how 
+to download the required files.
+.TP
+.B [ebuild    f  ] media\-video/realplayer\-8\-r6
+The realplayer package's files are already downloaded.
+.TP
+.B [ebuild     U ] net\-fs/samba\-2.2.8_pre1 [2.2.7a]
+Samba 2.2.7a has already been emerged and can be Updated to version 
+2.2.8_pre1.
+.TP
+.B [ebuild     UD] media\-libs/libgd\-1.8.4 [2.0.11]
+Libgd 2.0.11 is already emerged, but if you run the command, then 
+portage will Downgrade to version 1.8.4 for you.
+.br 
+This may occur if a newer version of a package has been masked because it is
+broken or it creates a security risk on your system and a fix has not been
+released yet.
+.br 
+Another reason this may occur is if a package you are trying to emerge requires
+an older version of a package in order to emerge successfully.  In this case,
+libgd 2.x is incompatible with libgd 1.x.  This means that packages that were
+created with libgd 1.x will not compile with 2.x and must downgrade libgd first
+before they can emerge.
+.TP
+.B [ebuild     U ] sys\-devel/distcc\-2.16 [2.13\-r1] USE="ipv6* \-gtk \-qt%"
+Here we see that the make.conf variable \fBUSE\fR affects how this package is
+built.  In this example, ipv6 optional support is enabled and both gtk and qt
+support are disabled.  The asterisk following ipv6 indicates that ipv6 support
+was disabled the last time this packages was installed.  The percent sign
+following qt indicates that the qt option has been added to the package since
+it was last installed.  For information about all \fBUSE\fR symbols, see the
+\fB\-\-verbose\fR option documentation above.
+.br
+\fB*Note:\fR Flags that haven't changed since the last install are only
+displayed when you use the \fB\-\-pretend\fR and \fB\-\-verbose\fR options.
+Using the \fB\-\-quiet\fR option will prevent all information from being
+displayed.
+.SH "NOTES"
+You should almost always precede any package install or update attempt with a 
+\fB\-\-pretend\fR install or update.  This lets you see how much will be 
+done, and shows you any blocking packages that you will have to rectify.  
+This goes doubly so for the \fBsystem\fR and \fBworld\fR sets, which can 
+update a large number of packages if the portage tree has been particularly 
+active.
+.LP
+You also want to typically use \fB\-\-update\fR, which ignores packages that 
+are already fully updated but updates those that are not.
+.LP
+When you install a package with uninstalled dependencies and do
+not explicitly state those dependencies in the list of parameters,
+they will not be added to the world file.  If you want them to be
+detected for world updates, make sure to explicitly list them as
+parameters to \fBemerge\fR.
+.LP
+\fBUSE variables\fR may be specified on the command line to
+override those specified in the default locations, letting you
+avoid using some dependencies you may not want to have.  \fBUSE
+flags specified on the command line are NOT remembered\fR.  For
+example, \fBenv USE="\-X \-gnome" emerge mc\fR will emerge mc with
+those USE settings (on Bourne-compatible shells you may omit the \fBenv\fR
+part).  If you want those USE settings to be more 
+permanent, you can put them in /etc/portage/package.use instead.
+.LP
+If \fBemerge \-\-update system\fR or \fBemerge \-\-update world\fR
+fails with an error message, it may be that an ebuild uses some
+newer feature not present in this version of \fBemerge\fR.  You
+can use \fBemerge \-\-update portage\fR to upgrade to the lastest
+version, which should support any necessary new features.
+.SH "MASKED PACKAGES"
+\fINOTE: Please use caution when using development packages.  Problems
+and bugs resulting from misusing masked packages drains Gentoo
+developer time.  Please be sure you are capable of handling any problems
+that may ensue.\fR
+.LP
+Masks in \fBportage\fR provide three primary functions: they allow a
+testing period where the packages can be used in live machines; they
+prevent the use of a package when it will fail; and they mask existing
+packages that are broken or could pose a security risk.  Masking can be
+done by two methods: \fBpackage.mask\fR and \fBKEYWORDS\fR.  Read below
+to find out how to unmask in either case.  Also note that if you give 
+\fBemerge\fR an ebuild, then all forms of masking will be ignored and
+\fBemerge\fR will attempt to emerge the package.
+.TP
+.BR package.mask
+The \fBpackage.mask\fR file primarily blocks the use of packages that cause
+problems or are known to have issues on different systems.  It resides in
+\fI/usr/portage/profiles\fR.
+.TP
+.BR KEYWORDS
+The \fBKEYWORDS\fR variable in an \fBebuild\fR file is also used for masking 
+a package still in testing.  There are architecture\-specific keywords for 
+each package that let \fBportage\fR know which systems are compatible with 
+the package.  Packages which compile on an architecture, but have not been 
+proven to be "stable", are masked with a tilde (\fB~\fR) in front of the 
+architecture name.  \fBemerge\fR examines the \fBACCEPT_KEYWORDS\fR environment 
+variable to allow or disallow the emerging of a package masked by 
+\fBKEYWORDS\fR.  To inform \fBemerge\fR that it should build these 'testing' 
+versions of packages, you should update your 
+\fI/etc/portage/package.keywords\fR file to list the packages you want the 
+\'testing\' version.  See \fBportage\fR(5) for more information.
+.SH "REPORTING BUGS"
+Please report any bugs you encounter through our website:
+.LP
+\fBhttp://bugs.gentoo.org/\fR
+.LP
+Please include the output of \fBemerge \-\-info\fR when you submit your
+bug report.
+.SH "AUTHORS"
+.nf
+Daniel Robbins <drobbins@gentoo.org>
+Geert Bevin <gbevin@gentoo.org>
+Achim Gottinger <achim@gentoo.org>
+Nicholas Jones <carpaski@gentoo.org>
+Phil Bordelon <phil@thenexusproject.org>
+Mike Frysinger <vapier@gentoo.org>
+Marius Mauch <genone@gentoo.org>
+.fi
+.SH "FILES"
+Here is a common list of files you will probably be interested in.  For a 
+complete listing, please refer to the \fBportage\fR(5) man page.
+.TP
+.B /var/lib/portage/world
+Contains a list of all user\-specified packages.  You can safely edit
+this file, adding packages that you want to be considered in \fBworld\fR
+set updates and removing those that you do not want to be considered.
+.TP
+.B /etc/make.conf
+Contains variables for the build process, overriding those in
+\fBmake.globals\fR.  \fBYou should edit this file instead of the ones
+listed below\fR.
+.TP
+.B /etc/dispatch\-conf.conf
+Contains settings to handle automatic updates/backups of configuration 
+files.
+.TP
+.B /etc/make.profile/make.defaults
+Contains profile\-specific variables for the build process.  \fBDo not
+edit this file\fR.
+.TP
+.B /etc/make.profile/use.defaults
+Contains a list of packages which, if installed, cause the respective USE 
+flag to be enabled by default.  \fBDo not edit this file\fR.
+.TP
+.B /usr/portage/profiles/use.desc
+Contains the master list of USE flags with descriptions of their
+functions.  \fBDo not edit this file\fR.
+.TP
+.B /etc/make.profile/virtuals
+Contains a list of default packages used to resolve virtual dependencies.
+\fBDo not edit this file\fR.
+.TP
+.B /etc/make.profile/packages
+Contains a list of packages used for the base system.  The \fBsystem\fR
+and \fBworld\fR sets consult this file.  \fBDo not edit this file\fR.
+.TP
+.B /etc/make.globals
+Contains the default variables for the build process.  \fBDo not edit
+this file\fR.
+.SH "SEE ALSO"
+.BR "emerge \-\-help",
+.BR ebuild (1),
+.BR ebuild (5),
+.BR make.conf (5),
+.BR portage (5)
+.LP
+A number of helper applications reside in \fI@PORTAGE_BASE@bin\fR.
+.LP
+The \fBapp\-portage/gentoolkit\fR package contains useful scripts such as 
+\fBequery\fR (a package query tool).
Index: /vendor/prefix-portage/current/man/env-update.1
===================================================================
--- /vendor/prefix-portage/current/man/env-update.1	(revision 3489)
+++ /vendor/prefix-portage/current/man/env-update.1	(revision 3489)
@@ -0,0 +1,28 @@
+.TH "ENV-UPDATE" "1" "Mar 2006" "Portage 2.1" "Portage"
+.SH NAME
+env\-update \- updates environment settings automatically
+.SH SYNOPSIS
+\fBenv\-update\fR \fI[options]\fR
+.SH DESCRIPTION
+.B env\-update
+reads the files in \fI/etc/env.d\fR and automatically generates
+\fI/etc/profile.env\fR and \fI/etc/ld.so.conf\fR.  Then \fBldconfig\fR(8)
+is run to update \fI/etc/ld.so.cache\fR.  \fBenv-update\fR is run by
+\fBemerge\fR(1) automatically after each package merge.  Also, if you
+make changes to \fI/etc/env.d\fR, you should run \fIenv-update\fR 
+yourself for changes to take effect immediately.  Note that this would 
+only affect new processes.  In order for the changes to affect your 
+active shell, you will probably have to run \fIsource /etc/profile\fR 
+first.
+.SH OPTIONS 
+.TP
+.B \-\-no\-ldconfig
+Do not run ldconfig (and thus skip rebuilding the ldso cache, updating the 
+links in library paths, etc...).
+.SH "REPORTING BUGS"
+Please report bugs via http://bugs.gentoo.org/
+.SH AUTHORS
+Daniel Robbins <drobbins@gentoo.org>
+.SH "SEE ALSO"
+.BR emerge (1),
+.BR ldconfig (8)
Index: /vendor/prefix-portage/current/man/etc-update.1
===================================================================
--- /vendor/prefix-portage/current/man/etc-update.1	(revision 3489)
+++ /vendor/prefix-portage/current/man/etc-update.1	(revision 3489)
@@ -0,0 +1,38 @@
+.TH "ETC-UPDATE" "1" "Dec 2005" "Portage 2.1" "Portage"
+.SH NAME
+etc-update \- handle configuration file updates
+.SH SYNOPSIS
+.B etc-update
+.SH DESCRIPTION
+.I etc-update
+is supposed to be run after merging a new package to see if
+there are updates to the configuration files.  If a new
+configuration file will override an old one, 
+.I etc-update 
+will prompt the user for a decision.
+.PP
+.I etc-update
+will check all directories in the \fICONFIG_PROTECT\fR variable.  All
+config files found in \fICONFIG_PROTECT_MASK\fR will automatically be
+updated for you by \fIetc-update\fR.  See \fBmake.conf\fR(5) for more
+information.
+.SH OPTIONS
+.TP
+None.
+.SH "REPORTING BUGS"
+Please report bugs via http://bugs.gentoo.org/
+.SH AUTHORS
+.nf
+Jochem Kossen and Leo Lipelis
+Karl Trygve Kalleberg <karltk@gentoo.org>
+Mike Frysinger <vapier@gentoo.org>
+.fi
+.SH "FILES"
+.TP
+.B /etc/etc-update.conf
+Configuration settings for \fIetc-update\fR are stored here.
+.TP
+.B /etc/dispatch-conf.conf
+Settings for dispatching configuration files right before they're merged.
+.SH "SEE ALSO"
+.BR make.conf (5)
Index: /vendor/prefix-portage/current/man/make.conf.5
===================================================================
--- /vendor/prefix-portage/current/man/make.conf.5	(revision 3489)
+++ /vendor/prefix-portage/current/man/make.conf.5	(revision 3489)
@@ -0,0 +1,538 @@
+.TH "MAKE.CONF" "5" "Jan 2007" "Portage 2.1.2" "Portage"
+.SH "NAME"
+make.conf \- custom settings for Portage
+.SH "SYNOPSIS"
+.B /etc/make.conf
+.SH "DESCRIPTION"
+This file contains various variables that are used by Portage.
+Portage will check the currently\-defined environment variables
+first for any settings.  If no environment settings are found,
+Portage then checks /etc/make.conf.  If no setting is found
+in /etc/make.conf, Portage checks /etc/make.globals. If no
+setting is found there, the profile's default setting is grabbed
+from /etc/make.profile/make.defaults. Please note that all user
+settings should be made in the environment or in /etc/make.conf,
+which is intended to be customized by the user.
+.br
+Exceptions are incremental variables such as USE, CONFIG_PROTECT*,
+and ACCEPT_KEYWORDS.  Incremental variables are propagated down from
+make.defaults to make.globals to make.conf to the environment
+settings.  Clearing these variables requires a clear\-all as in:
+export USE="\-*"
+.SH "VARIABLES"
+.TP
+\fBACCEPT_KEYWORDS\fR = \fI[space delimited list of KEYWORDS]\fR
+Enable testing of ebuilds that have not yet been deemed 'stable'.  Users
+of the 'x86' architecture would set this to '~x86' while ppc users would
+set this to '~ppc'.  This is an incremental variable.  Only define a 
+~arch.
+.br
+Defaults to the value of $ARCH.
+.TP
+\fBBUILD_PREFIX\fR = \fI[path]\fR
+Defines the location of the package working directory. 
+.br
+Defaults to ${PORTAGE_TMPDIR}/portage
+.TP
+.B CBUILD
+This variable is passed by the \fIebuild scripts\fR to the \fIconfigure\fR
+as \fI\-\-build=${CBUILD}\fR only if it is defined.  Do not set this yourself
+unless you know what you are doing.
+.TP
+\fBCCACHE_DIR\fR = \fI[path]\fR
+Defines the location of the ccache working directory.  See the \fBccache\fR(1)
+man page for more information.
+.br
+Defaults to /var/tmp/ccache
+.TP
+\fBCCACHE_SIZE\fR = \fI"size"\fR
+This controls the space use limitations for ccache.  The default is 2 gigabytes 
+('2G').  Sizes are specified with 'G', 'M', or 'K'.
+.TP
+.B CFLAGS CXXFLAGS
+Use these variables to set the desired optimization/CPU instruction settings
+for applications that you compile.  Nearly all ebuild files will take advantage
+of your custom settings, resulting in a Gentoo Linux that is fully customized
+to your specifications.  Please use sane settings as some packages will fail to
+compile/run if the optimizations are too extreme.
+
+For more information, see the \fIInvoking GCC\fR section of the gcc manual:
+.br
+http://gcc.gnu.org/onlinedocs/
+.TP
+.B CHOST
+This variable is passed by the \fIebuild scripts\fR to the \fIconfigure\fR
+step as \fI\-\-host=${CHOST}\fR.  This way you can force the build\-host.
+
+For more information:
+.br
+http://gcc.gnu.org/onlinedocs/gcc\-4.1.1/gcc/Submodel\-Options.html
+.br
+http://gcc.gnu.org/onlinedocs/gcc\-3.3/gcc/Submodel\-Options.html
+.br
+http://gcc.gnu.org/onlinedocs/gcc\-3.2/gcc/Submodel\-Options.html
+.br
+http://gcc.gnu.org/onlinedocs/gcc\-2.95.3/gcc_2.html
+.TP
+\fBCLEAN_DELAY\fR = \fIinteger\fR
+Determines how long the countdown delay will be after running `emerge clean`.
+.br
+Defaults to 5 seconds.
+.TP
+\fBCOLLISION_IGNORE\fR = \fI[space delimited list of files and/or directories]\fR
+This variable allows the user to disable \fIcollision\-protect\fR for specific
+files and/or directories.
+.TP
+\fBCONFIG_PROTECT\fR = \fI[space delimited list of files and/or directories]\fR
+All files and/or directories that are defined here will have "config file protection"
+enabled for them.  For more information, please see `emerge \-\-help config`.
+.TP
+\fBCONFIG_PROTECT_MASK\fR = \fI[space delimited list of files and/or directories]\fR
+All files and/or directories that are defined here will have "config file protection"
+disabled for them.  For more information, please see `emerge \-\-help config`.
+.TP
+.B CTARGET
+This variable is passed by the \fIebuild scripts\fR to the \fIconfigure\fR
+as \fI\-\-target=${CTARGET}\fR only if it is defined.
+.TP
+\fBDISTDIR\fR = \fI[path]\fR
+Defines the location of your local source file repository.
+.br
+Defaults to /usr/portage/distfiles.
+.TP
+.B DOC_SYMLINKS_DIR
+If this variable contains a directory then symlinks to html documentation will
+be installed into it.
+.TP
+.B EBEEP_IGNORE
+Defines whether or not to ignore audible beeps when displaying important
+informational messages.  This variable is unset by default.
+.TP
+.B EMERGE_DEFAULT_OPTS
+Options to append to the end of the \fBemerge\fR(1) command line on every invocation.
+These options will not be appended to the command line if \-\-ignore\-default\-opts
+is specified.
+.TP
+.B EPAUSE_IGNORE
+Defines whether or not to ignore short pauses that occur when displaying
+important informational messages.  This variable is unset by default.
+If it is set to any value pauses are ignored.
+.TP
+\fBEXTRA_ECONF\fR = \fI[configure options string]\fR
+Contains additional options that \fBeconf\fR will append to configure
+script arguments (see \fBebuild\fR(5)).
+.TP
+\fBFEATURES\fR = \fI"sandbox ccache"\fR
+Defines actions portage takes by default.  These options should
+not be changed by anyone but developers and/or maintainers.  'sandbox' is an important
+part of \fBFEATURES\fR and should not be disabled by default.  This is 
+an incremental variable.
+.RS
+.TP
+.B assume\-digests
+When commiting work to cvs with \fBrepoman\fR(1), assume that all existing 
+SRC_URI digests are correct.  This feature also affects digest generation via
+\fBebuild\fR(1) and \fBemerge\fR(1) (emerge generates digests only when the
+\fIdigest\fR feature is enabled).
+.TP
+.B buildpkg
+Binary packages will be created for all packages that are merged.
+.TP
+.B buildsyspkg
+Build binary packages for just packages in the system set.
+.TP
+.B ccache
+Enable portage support for the ccache package.  If the ccache dir is not 
+present in the user's environment, then portage will default to 
+${PORTAGE_TMPDIR}/ccache.
+.TP
+.B collision\-protect
+A QA\-feature to ensure that a package doesn't overwrite files it doesn't own.
+The \fICOLLISION_IGNORE\fR variable can be used to selectively disable this
+feature.
+.TP
+.B digest
+Autogenerate digests for packages when running the \fBemerge\fR(1) command.  If
+the \fIassume\-digests\fR feature is also enabled then existing SRC_URI digests
+will be reused whenever they are available.
+.TP
+.B distcc
+Enable portage support for the distcc package.
+.TP
+.B distlocks
+Portage uses lockfiles to ensure competing instances don't clobber
+each other's files. This feature is enabled by default but may cause
+heartache on less intelligent remote filesystems like NFSv2 and some
+strangely configured Samba server (oplocks off, NFS re\-export). A tool
+@PORTAGE_BASE@bin/clean_locks exists to help handle lock issues
+when a problem arises (normally due to a crash or disconnect).
+.TP
+.B fixpackages
+Runs the script that will fix the dependencies in all binary packages.  This is 
+run whenever packages are moved around in the portage tree.  Please note that this 
+can take a lot of time.
+.TP
+.B getbinpkg
+Force emerges to always try to fetch files from the \fIPORTAGE_BINHOST\fR.  See 
+\fBmake.conf\fR(5) for more information.
+.TP
+.B gpg
+Check the signatures of Manifests and make sure they are correct.
+.TP
+.B installsources
+Install source code into /usr/src/debug/${CATEGORY}/${PF} (also see
+\fBsplitdebug\fR). This feature works only if debugedit is installed and CFLAGS
+is set to include debug information (such as with the \-ggdb flag).
+.TP
+.B keeptemp
+Do not delete the ${T} directory after the merge process.
+.TP
+.B keepwork
+Do not delete the ${WORKDIR} directory after the merge process. ${WORKDIR} can
+then be reused since this feature disables most of the clean phase that runs
+prior to each build. Due to lack of proper cleanup, this feature can
+interfere with normal emerge operation and therefore it should not be left
+enabled for more than a short period of time.
+.TP
+.B metadata\-transfer
+Automatically perform a metadata transfer when `emerge \-\-sync` is run.
+.TP
+.B mirror
+This will cause \fBFETCHCOMMAND\fR to always be run even if 
+the file already exists in \fBDISTDIR\fR.
+.TP
+.B noauto
+When utilizing \fBebuild\fR(1), only run the function requested.
+.TP
+.B noclean
+Do not delete the the source and temporary files after the merge process.
+.TP
+.B nodoc
+Do not install doc files (/usr/share/doc).
+.TP
+.B noinfo
+Do not install info pages.
+.TP
+.B noman
+Do not install manpages.
+.TP
+.B nostrip
+Prevents the stripping of binaries that are merged to the live filesystem.
+.TP
+.B notitles
+Disables xterm titlebar updates (which contains status info).
+.TP
+.B parallel\-fetch
+Fetch in the background while compiling.
+.TP
+.B sandbox
+Enable sandbox\-ing when running \fBemerge\fR(1) and \fBebuild\fR(1).
+.TP
+.B sesandbox
+Enable SELinux sandbox\-ing.  Do not toggle this \fBFEATURE\fR yourself.
+.TP
+.B severe
+When checking Manifests, only accept ones that have been signed by a
+key which you trust.
+.TP
+.B sfperms
+Stands for Smart Filesystem Permissions.  Before merging packages to the 
+live filesystem, automatically search for and set permissions on setuid 
+and setgid files.  Files that are setuid have the group and other read 
+bits removed while files that are setgid have the other read bit removed.  
+See also \fIsuidctl\fR below.
+.TP
+.B sign
+When commiting work to cvs with \fBrepoman\fR(1), sign the Manifest with 
+a GPG key.  Read about the \fIPORTAGE_GPG_KEY\fR variable in \fBmake.conf\fR(5).
+.TP
+.B splitdebug
+Prior to stripping ELF etdyn and etexec files, the debugging info is 
+stored for later use by various debuggers.  This feature is disabled by
+\fBnostrip\fR.  For installation of source code, see \fBinstallsources\fR.
+.TP
+.B strict
+Have portage react strongly to conditions that have the potential to be 
+dangerous (like missing or incorrect digests for ebuilds or distfiles).
+.TP
+.B stricter
+Have portage react strongly to conditions that may conflict with system
+security provisions (for example textrels, executable stack).  Read about
+the \fIQA_STRICT_*\fR variables in \fBmake.conf\fR(5).
+.TP
+.B suidctl
+Before merging packages to the live filesystem, automatically strip setuid 
+bits from any file that is not listed in \fI/etc/portage/suidctl.conf\fR.
+.TP
+.B test
+Run package\-specific tests during each merge to help make sure 
+the package compiled properly.  See \fItest\fR in \fBebuild\fR(1) 
+and \fIsrc_test()\fR in \fBebuild\fR(5). This feature implies the "test"
+\fBUSE\fR flag.
+.TP
+.B userfetch
+When portage is run as root, drop privileges to portage:portage during the
+fetching of package sources.
+.TP
+.B userpriv
+Allow portage to drop root privileges and compile packages as 
+portage:portage without a sandbox (unless \fIusersandbox\fR is also used).
+.TP
+.B usersandbox
+Enable the sandbox in the compile phase, when running without root privs (\fIuserpriv\fR).
+.RE
+.TP
+.B FETCHCOMMAND
+This variable contains the command used for fetching package sources from
+the internet.  It must contain the full path to the executable as well as the
+place\-holders \\${DISTDIR} and \\${URI}.
+.TP
+\fBGENTOO_MIRRORS\fR = \fI[URLs]\fR
+Insert your space\-seperated list of local mirrors here.  These
+locations are used to download files before the ones listed in
+the \fIebuild scripts\fR. Merging 'mirrorselect' can help.  Entries in this
+variable that have no protocol and simply start with a '/' path separator may
+be used to specify mounted filesystem mirrors.
+.TP
+\fBhttp_proxy ftp_proxy\fR = \fI[host:port]\fR
+These vars are used if the sources must be downloaded from the
+internet by \fBwget\fR(1).  They are only required if you use a
+proxy server for internet access.
+.TP
+\fBINSTALL_MASK\fR = \fI[space delimited list of file names]\fR
+Use this variable if you want to selectively prevent certain files from being
+copied into your file system tree.  This does not work on symlinks, but only on
+actual files.  Useful if you wish to filter out files like HACKING.gz and
+TODO.gz.
+.TP
+.B MAKEOPTS
+Use this variable if you want to use parallel make.  For example, if you
+have a dual\-processor system, set this variable to "\-j2" or "\-j3" for 
+enhanced build performance with many packages. Suggested settings are
+between \fICPUs+1\fR and \fI2*CPUs+1\fR.
+For more information, see \fBmake\fR(1).
+.TP
+\fBNOCOLOR\fR = \fI["true" | "false"]\fR
+Defines if color should be disabled by default.
+.br
+Defaults to false.
+.TP
+\fBPKGDIR\fR = \fI[path]\fR
+Defines the location where created .tbz2 binary packages will be stored.
+.br
+Defaults to /usr/portage/packages.
+.TP
+.B PORT_LOGDIR
+This variable defines the directory in which per\-ebuild logs are kept.
+Logs are created only when this is set and writable.
+.TP
+\fBPORTAGE_BINHOST\fR = \fI"ftp://login:pass@grp.mirror.site/pub/grp/i686/athlon\-xp/"\fR
+This is the host from which portage will grab prebuilt\-binary packages.  
+The list is a single entry specifying the full address of the directory 
+serving the tbz2's for your system.  This is only used when running with 
+the get binary pkg options are given to \fBemerge\fR.  Review \fBemerge\fR(1) 
+for more information.  For versions of portage less that 2.2, this variable
+should point to the 'All' directory on the host that creates the binary
+packages and not to the root of the \fBPKGDIR\fR.  Starting with portage 2.2,
+it should point to a directory containing a 'Packages' index file.  If
+${PORTAGE_BINHOST}/Packages does not exist then portage will attempt to use
+the older protocol.
+.TP
+\fBPORTAGE_BINHOST_HEADER_URI\fR = \fI"ftp://login:pass@grp.mirror.site/pub/grp/i686/athlon\-xp/"\fR
+This variable only makes sense on a system that will serve as a binhost and
+build packages for clients.  It defines the URI header field for the package
+index file which is located at ${PKGDIR}/Packages. Clients that have
+\fBPORTAGE_BINHOST\fR properly configured will be able to fetch the index and
+use the URI header field as a base URI for fetching binary packages. If the URI
+header field is not defined then the client will use it's ${PORTAGE_BINHOST}
+setting as the base URI.
+.TP
+\fBPORTAGE_COMPRESS\fR = \fI"bzip2"\fR
+This variable contains the command used to compress documentation during the
+install phase.
+.TP
+\fBPORTAGE_COMPRESS_FLAGS\fR = \fI"\-9"\fR
+This variable contains flags for the \fBPORTAGE_COMPRESS\fR command.
+.TP
+.B PORTAGE_ELOG_CLASSES
+.TP
+.B PORTAGE_ELOG_SYSTEM
+.TP
+.B PORTAGE_ELOG_COMMAND
+.TP
+.B PORTAGE_ELOG_MAILURI
+.TP
+.B PORTAGE_ELOG_MAILFROM
+.TP
+.B PORTAGE_ELOG_MAILSUBJECT
+Please see /etc/make.conf.example for elog documentation.
+.TP
+\fBPORTAGE_NICENESS\fR = \fI[number]\fR
+The value of this variable will be added to the current nice level that
+emerge is running at.  In other words, this will not set the nice level,
+it will increment it.  For more information about nice levels and what
+are acceptable ranges, see \fBnice\fR(1).
+.TP
+\fBPORTAGE_RSYNC_INITIAL_TIMEOUT\fR = \fIinteger\fR
+Used by \fBemerge \-\-sync\fR as a timeout for the initial connection to an
+rsync server.
+.br
+Defaults to 15 seconds.
+.TP
+\fBPORTAGE_RSYNC_EXTRA_OPTS\fR = \fI[rsync options string]\fR
+Additional rsync options to be used by \fBemerge \-\-sync\fR.
+.br
+Defaults to no value.
+.TP
+\fBPORTAGE_RSYNC_OPTS\fR = \fI[rsync options string]\fR
+Default rsync options to be used by \fBemerge \-\-sync\fR. 
+.br
+\fBDon't change this unless you know exactly what you're doing!\fR
+.br
+Defaults to "\-\-recursive \-\-links \-\-safe\-links \-\-perms \-\-times
+\-\-compress \-\-force \-\-whole\-file \-\-delete \-\-delete\-after \-\-stats
+\-\-timeout=180 \-\-exclude='/distfiles' \-\-exclude='/local'
+\-\-exclude='/packages'"
+.TP
+\fBPORTAGE_RSYNC_RETRIES\fR = \fI[NUMBER]\fR
+The number of times rsync should retry on failed connections before
+giving up.
+.br
+Defaults to 3.
+.TP
+\fBPORTAGE_TMPDIR\fR = \fI[path]\fR
+Defines the location of the temporary build directories.
+.br
+Defaults to /var/tmp.
+.TP
+\fBPORTAGE_WORKDIR_MODE\fR = \fI"0700"\fR
+This variable controls permissions for \fIWORKDIR\fR (see \fBebuild\fR(5)).
+.TP
+\fBPORTDIR\fR = \fI[path]\fR
+Defines the location of your Portage tree.
+.br
+Defaults to /usr/portage. 
+.br
+\fB***Warning***\fR
+.br
+Storing data such as distfiles and binary packages in PORTDIR can
+be potentially dangerous. The default emerge configuration defaults to this 
+behavior (which will work fine), however if you deviate from the default
+configuration by changing PKGDIR or DISTDIR, emerge \-\-sync may inadvertedly
+delete all your distfiles/binary packages. Please make sure to set
+\fBPORTAGE_EXTRA_RSYNC_OPTS\fR properly to insure the safety of files in PORTDIR.
+.TP
+\fBPORTDIR_OVERLAY\fR = \fI"[path] [different\-path] [etc...]"\fR
+Defines the directories in which user made ebuilds may be stored and not 
+overwriten when `emerge \-\-sync` is run.  This is a space delimited list of 
+directories.
+.br
+Defaults to no value.
+.TP
+\fBQA_STRICT_EXECSTACK = \fI"set"\fR
+Set this to cause portage to ignore any \fIQA_EXECSTACK\fR override
+settings from ebuilds.  See also \fBebuild\fR(5).
+.TP
+\fBQA_STRICT_WX_LOAD = \fI"set"\fR
+Set this to cause portage to ignore any \fIQA_WX_LOAD\fR override
+settings from ebuilds.  See also \fBebuild\fR(5).
+.TP
+\fBQA_STRICT_TEXTRELS = \fI"set"\fR
+Set this to cause portage to ignore any \fIQA_TEXTREL\fR override
+settings from ebuilds.  See also \fBebuild\fR(5).
+.TP
+.B RESUMECOMMAND
+This variable contains the command used for resuming package sources that
+have been partially downloaded.  It should be defined using the same format
+as \fBFETCHCOMMAND\fR.
+.TP
+\fBROOT\fR = \fI[path]\fR
+Use \fBROOT\fR to specify the target root filesystem to be used for merging 
+packages or ebuilds.  All \fBRDEPEND\fR and \fBPDEPEND\fR will be installed 
+into \fBROOT\fR while all \fBDEPEND\fR will be still be installed into /.  
+Typically, you should set this setting in the environment rather than in 
+\fI/etc/make.conf\fR itself.  It's commonly used for creating new build 
+images.  Make sure you use an absolute path.
+.br
+Defaults to /.
+.TP
+\fBRPMDIR\fR = \fI[path]\fR
+Defines the location where created RPM packages will be stored.
+.br
+Defaults to ${PORTDIR}/rpm.
+.TP
+\fBSYNC\fR = \fI[RSYNC]\fR
+Insert your preferred rsync mirror here.  This rsync server
+is used to sync the local portage tree when `emerge \-\-sync` is run.
+.br
+Defaults to rsync://rsync.gentoo.org/gentoo\-portage
+.TP
+\fBUSE\fR = \fI[space delimited list of USE items]\fR
+This variable contains options that control the build behavior of several
+packages.  More information in \fBebuild\fR(5).  Possible USE values
+can be found in \fI/usr/portage/profiles/use.desc\fR.
+.TP
+\fBUSE_EXPAND_HIDDEN\fR = \fI[space delimited list of variable names]\fR
+Names of \fBUSE_EXPAND\fR variables that should not be shown in the verbose merge
+list output of the \fBemerge\fR(1) command.
+.TP
+\fBUSE_ORDER\fR = \fI"env:pkg:conf:defaults:pkginternal"\fR
+Determines the precedence of layers in the incremental stacking of the USE
+variable. Precedence decreases from left to right such that env overrides
+pkg, pkg overrides conf, and so forth.
+
+.B ***warning***
+.br
+Do not modify this value unless you're a developer and you know what
+you're doing. If you change this and something breaks, we will not help
+you fix it.
+.br
+.RS
+.TP
+.B env
+USE from the current USE environment variable if it exists
+.TP
+.B pkg
+Per\-package USE from \fB/etc/portage/package.use\fR (see \fBportage\fR(5))
+.TP
+.B conf
+USE from make.conf
+.TP
+.B defaults
+USE from make.defaults and package.use in the profile (see \fBportage\fR(5))
+.TP
+.B pkginternal
+USE from ebuild IUSE defaults (flags enabled via a + prefix; see \fBebuild\fR(5))
+.RE
+
+.SH "REPORTING BUGS"
+Please report bugs via http://bugs.gentoo.org/
+.SH "AUTHORS"
+.nf
+Daniel Robbins <drobbins@gentoo.org>
+Nicholas Jones <carpaski@gentoo.org>
+Mike Frysinger <vapier@gentoo.org>
+Saleem Abdulrasool <compnerd@gentoo.org>
+.fi
+.SH "FILES"
+.TP
+\fB/etc/make.conf\fR 
+Contains variables for the build\-process and overwrites those in make.defaults.
+.TP
+\fB/etc/make.globals\fR 
+Contains the default variables for the build\-process, you should edit \fI/etc/make.conf\fR instead.
+.TP
+\fB/usr/portage/profiles/use.desc\fR
+Contains a list of all global USE flags.
+.TP
+\fB/usr/portage/profiles/use.local.desc\fR
+Contains a list of all local USE variables.
+.SH "SEE ALSO"
+.BR emerge (1),
+.BR portage (5),
+.BR ebuild (1),
+.BR ebuild (5)
+.TP
+The \fI/usr/sbin/ebuild.sh\fR script. 
+.TP
+The helper apps in \fI@PORTAGE_BASE@/bin\fR.
Index: /vendor/prefix-portage/current/man/portage.5
===================================================================
--- /vendor/prefix-portage/current/man/portage.5	(revision 3489)
+++ /vendor/prefix-portage/current/man/portage.5	(revision 3489)
@@ -0,0 +1,731 @@
+.TH "PORTAGE" "5" "Dec 2005" "Portage 2.1" "Portage"
+.SH NAME
+portage \- the heart of Gentoo
+.SH "DESCRIPTION"
+The current portage code uses many different configuration files, most of which 
+are unknown to users and normal developers.  Here we will try to collect all 
+the odds and ends so as to help users more effectively utilize portage.  This 
+is a reference only for files which do not already have a man page.
+
+All files in the make.profile directory may be tweaked via parent profiles 
+when using cascading profiles.  For more info, please see 
+http://www.gentoo.org/proj/en/releng/docs/cascading-profiles.xml
+.IP Note:
+If you are looking for information on how to emerge something, please see 
+.BR emerge (1).
+.SH "SYNOPSIS"
+.TP
+.BR /etc/
+.nf
+make.globals
+.BR make.conf (5)
+.fi
+.TP
+.BR /etc/make.profile/
+.nf
+deprecated
+make.defaults
+packages
+packages.build
+package.provided
+package.use
+package.use.force
+package.use.mask
+parent
+profile.bashrc
+use.force
+use.mask
+virtuals
+.fi
+.TP
+.BR /etc/portage/
+.nf
+bashrc
+modules
+package.keywords
+package.mask
+package.unmask
+package.use
+mirrors
+categories
+.fi
+.TP
+.BR /etc/portage/profile/
+site-specific overrides of \fB/etc/make.profile/\fR
+.TP
+.BR /usr/portage/profiles/
+.nf
+arch.list
+categories
+info_pkgs
+info_vars
+package.mask
+profiles.desc
+thirdpartymirrors
+use.desc
+use.local.desc
+.fi
+.TP
+.BR /var/cache/edb/
+misc internal cache files
+.TP
+.BR /var/db/pkg/
+database to track installed packages
+.TP
+.BR /var/lib/portage/
+.nf
+config
+world
+.fi
+.SH "GLOSSARY"
+In the following sections, some terminology may be foreign to you or used 
+with meaning specific to Portage.  Please see the referenced manpages for 
+more detailed explanations.
+.RS
+.TP
+.B DEPEND atom
+A string which matches a package.  It is of the form category/package.  
+It may also contain optional logical operators and versions.
+.br
+More reading: 
+.BR ebuild (5)
+.TP
+.B KEYWORD
+Each architecture has a unique KEYWORD.
+.br
+More reading: 
+.BR ebuild (5)
+.TP
+.B virtual
+A DEPEND atom that is part of the "virtual" category.  They are used 
+when different packages can satisfy a dependency and only one of them is 
+needed.
+.br
+More reading: 
+.BR ebuild (5)
+.RE
+.SH "SPECIFIC FILE DESCRIPTIONS"
+.TP
+.BR /etc/
+.RS
+.TP
+.BR make.globals
+The global default settings for Portage.  This comes from the portage package 
+itself.  Settings in \fBmake.conf\fR override values here.  The format 
+is described extensivly in \fBmake.conf\fR(5).
+.TP
+.BR make.conf
+The global custom settings for Portage.  See \fBmake.conf\fR(5).
+.RE
+.TP
+.BR /etc/make.profile/
+This is usually just a symlink to the correct profile in 
+\fB/usr/portage/profiles/\fR.  Since it is part of the portage tree, it 
+may easily be updated/regenerated by running `emerge \-\-sync`.  It defines 
+what a profile is (usually arch specific stuff).  If you need a custom 
+profile, then you should make your own \fB/etc/make.profile/\fR 
+directory and populate it.  However, if you just wish to override some 
+settings, do NOT edit these files because they WILL be lost with the 
+next `emerge \-\-sync`.  See the section below on \fB/etc/portage/\fR for 
+overriding.
+.RS
+.TP
+.BR deprecated
+The existence of this file marks a profile as deprecated, meaning it is 
+not supported by Gentoo anymore.  The first line must be the profile to which 
+users are encouraged to upgrade, optionally followed by some instructions 
+explaining how they can upgrade.
+
+.I Example:
+.nf
+default-linux/x86/2005.0
+# emerge -n '>=sys-apps/portage-2.0.51'
+# rm -f /etc/make.profile
+# ln -s /usr/portage/profiles/default-linux/alpha/2005.0 /etc/make.profile
+.fi
+.TP
+.BR make.defaults
+The profile default settings for Portage.  The general format is described 
+in \fBmake.conf\fR(5).  The \fImake.defaults\fR for your profile defines a 
+few specific variables too:
+
+.PD 0
+.RS
+.TP
+.BR ARCH
+Architecture type (x86/ppc/hppa/etc...).
+.TP
+.B USERLAND = \fI"GNU"\fR
+Support BSD/cygwin/etc...
+.TP
+.B PORTAGE_LIBC = \fI"glibc"\fR
+Support uClibc/BSD libc/etc...
+.TP
+.BR PROFILE_ARCH
+Distinguish machines classes that have the same \fBARCH\fR.  All sparc 
+machines have ARCH=sparc but set this to either 'sparc32' or 'sparc64'.
+.TP
+.BR STAGE1_USE
+Special USE flags which may be needed when bootstrapping from stage1 to stage2.
+.TP
+.BR GRP_STAGE23_USE
+Special USE flags used by catalyst for building a stage3 and GRP sets.
+.RE
+.PD 1
+.TP
+.BR packages
+Provides the list of packages that compose the special \fIsystem\fR set.
+
+.I Format:
+.nf
+\- comments begin with #
+\- one DEPEND atom per line
+\- packages to be added to the system set begin with a *
+.fi
+.I Note:
+In a cascading profile setup, you can remove packages in children 
+profiles which were added by parent profiles by prefixing the atom with 
+a '\-'.
+
+.I Example:
+.nf
+# i am a comment !
+# pull in a version of glibc less than 2.3
+*<sys\-libs/glibc\-2.3
+# pull in any version of bash
+*app\-shells/bash
+# pull in a version of readline earlier than 4.2
+*<sys\-libs/readline\-4.2
+.fi
+.TP
+.BR packages.build
+A list of packages (one per line) that make up a stage1 tarball.  Really only 
+useful for stage builders.
+.TP
+.BR package.provided
+A list of packages (one per line) that portage should assume have been 
+provided.  Useful for porting to non-Linux systems.  Portage will not 
+attempt to update a package that is listed here unless another package 
+explicitly requires a version that is newer than what has been listed.  
+Basically, it's a list that replaces the \fBemerge \-\-inject\fR syntax.
+
+For example, if you manage your own copy of a 2.6 kernel, then you can 
+tell portage that 'sys-kernel/development-sources-2.6.7' is already taken 
+care of and it should get off your back about it.
+
+Virtual packages (virtual/*) should not be specified in package.provided.
+Depending on the type of virtual, it may be necessary to add an entry to the
+virtuals file and/or add a package that satisfies a virtual to
+package.provided.
+
+.I Format:
+.nf
+\- comments begin with #
+\- one DEPEND atom per line
+\- relational operators are not allowed
+\- must include a version
+.fi
+
+.I Example:
+.nf
+# you take care of the kernel
+sys-kernel/development-sources-2.6.7
+
+# you installed your own special copy of QT
+x11-libs/qt-3.3.0
+
+# you have modular X but packages want monolithic
+x11-base/xorg-x11-6.8
+.fi
+.TP
+.BR package.use.force
+Per\-package USE flag forcing.
+
+.I Note:
+In a cascading profile setup, you can remove USE flags in children 
+profiles which were added by parent profiles by prefixing the flag with 
+a '\-'.
+
+.I Format:
+.nf
+\- comments begin with #
+\- one DEPEND atom per line with space-delimited USE flags
+.fi
+
+.I Example:
+.nf
+# force docs for GTK 2.x
+=x11\-libs/gtk+\-2* doc
+# unforce mysql support for QT
+x11\-libs/qt \-mysql
+.fi
+.TP
+.BR package.use.mask
+Per\-package USE flag masks.
+
+.I Note:
+In a cascading profile setup, you can remove USE flags in children 
+profiles which were added by parent profiles by prefixing the flag with 
+a '\-'.
+
+.I Format:
+.nf
+\- comments begin with #
+\- one DEPEND atom per line with space-delimited USE flags
+.fi
+
+.I Example:
+.nf
+# mask docs for GTK 2.x
+=x11\-libs/gtk+\-2* doc
+# unmask mysql support for QT
+x11\-libs/qt \-mysql
+.fi
+.TP
+.BR parent
+This contains a path to the parent profile.  It may be either relative or 
+absolute.  The paths will be relative to the location of the profile.  Most 
+commonly this file contains '..' to indicate the directory above.  Utilized 
+only in cascading profiles.
+.TP
+.BR profile.bashrc
+If needed, this file can be used to set up a special environment for ebuilds,
+different from the standard root environment.  The syntax is the same as for
+any other bash script.
+.TP
+.BR use.force
+Some USE flags don't make sense to disable under certain conditions.  Here we
+list forced flags.
+
+.I Note:
+In a cascading profile setup, you can remove USE flags in children 
+profiles which were added by parent profiles by prefixing the flag with 
+a '\-'.
+
+.I Format:
+.nf
+\- comments begin with #
+\- one USE flag per line
+.fi
+.TP
+.BR use.mask
+Some USE flags don't make sense on some archs (for example altivec on 
+non\-ppc or mmx on non\-x86), or haven't yet been tested.  Here we list 
+the masked ones.
+
+.I Note:
+In a cascading profile setup, you can remove USE flags in children 
+profiles which were added by parent profiles by prefixing the flag with 
+a '\-'.
+
+.I Format:
+.nf
+\- comments begin with #
+\- one USE flag per line
+.fi
+.TP
+.BR virtuals
+This controls what packages will provide a virtual by default.  For example, 
+if a package needs to send e\-mail, it will need virtual/mta.  In the absence 
+of a package that provides virtual/mta (like qmail, sendmail, postfix, etc...), 
+portage will look here to see what package to use.  In this case, Gentoo uses 
+net\-mail/ssmtp as the default (as defined in the virtuals file) because it's 
+the package that does the very bare minimum to send e\-mail.
+
+.I Format:
+.nf
+\- comments begin with #
+\- one virtual and DEPEND atom base pair per line
+.fi
+
+.I Example:
+.nf
+# use net\-mail/ssmtp as the default mta
+virtual/mta           net\-mail/ssmtp
+# use app\-dicts/aspell\-en as the default dictionary
+virtual/aspell\-dict   app\-dicts/aspell\-en
+.fi
+.RE
+.TP
+.BR /etc/portage/
+Any file in this directory that begins with "package." can be more than just a 
+flat file.  If it is a directory, then all the files in that directory will be 
+summed together as if it were a single file.
+
+.I Example:
+.nf
+/etc/portage/package.keywords/kde
+/etc/portage/package.keywords/common
+/etc/portage/package.keywords/e17
+.fi
+.RS
+.TP
+.BR bashrc
+If needed, this file can be used to set up a special environment for ebuilds,
+different from the standard root environment.  The syntax is the same as for
+any other bash script.
+.TP
+.BR modules
+This file can be used to override the metadata cache implementation.  In
+practice, portdbapi.auxdbmodule is the only variable that the user will want to
+override.
+
+.I Example:
+.nf
+portdbapi.auxdbmodule = portage.cache.metadata_overlay.database
+.fi
+
+The metadata_overlay cache module makes it possible to disable
+FEATURES="metadata-transfer" in \fBmake.conf\fR(5).  When the user initially
+enables metadata_overlay in /etc/portage/modules, all of the cache files
+contained in /var/cache/edb/dep/${PORTDIR} must be manually removed in order
+to avoid unecessary cache regeneration.  In addition, users of the
+metadata_overlay module must never modify eclasses in ${PORTDIR} because
+portage will not be able to detect that cache regeneration is necessary.  If
+the user would like to modify eclasses, it is safe to use metadata_overlay
+together with PORTDIR_OVERLAY in \fBmake.conf\fR.
+.TP
+.BR package.keywords
+Per\-package KEYWORDS.  Useful for mixing unstable packages in with a normally 
+stable system or vice versa.  This will allow ACCEPT_KEYWORDS to be augmented
+for a single package.
+
+.I Format:
+.nf
+\- comment lines begin with # (no inline comments)
+\- one DEPEND atom per line followed by additional KEYWORDS
+\- lines without any KEYWORDS imply unstable host arch
+
+.I Example:
+# always use unstable libgd
+media\-libs/libgd ~x86
+# only use stable mplayer
+media\-video/mplayer \-~x86
+# always use unstable netcat
+net-analyzer/netcat
+.fi
+
+.I Note:
+.fi
+In addition to the normal values from ACCEPT_KEYWORDS package.keywords supports
+three special tokens:
+
+.nf
+\fB*\fR  package is visible if it is stable on any architecture
+\fB~*\fR package is visible if it is in testing on any architecture
+\fB**\fR package is always visible (KEYWORDS are ignored completely)
+.fi
+
+.I Additional Note:
+If you encounter the \fB-*\fR KEYWORD, this indicates that the package is known 
+to be broken on all systems which are not otherwise listed in KEYWORDS.  For 
+example, a binary only package which is built for x86 will look like:
+
+games-fps/quake3-demo-1.11.ebuild:KEYWORDS="-* x86"
+
+If you wish to accept this package anyways, then use one of the other keywords in your 
+package.keywords like this:
+
+games-fps/quake3-demo x86
+
+.TP
+.BR package.mask
+A list of package atoms to mask.  Useful if specific versions of packages do
+not work well for you.  For example, you swear by the Nvidia drivers, but only
+versions earlier than 1.0.4496.  No problem!
+
+.I Format:
+.nf
+\- comment lines begin with # (no inline comments)
+\- one DEPEND atom per line
+.fi
+
+.I Example:
+.nf
+# mask out versions 1.0.4496 of the nvidia
+# drivers and later
+>=media\-video/nvidia\-kernel\-1.0.4496
+>=media\-video/nvidia\-glx\-1.0.4496
+.fi
+.TP
+.BR package.unmask
+Just like package.mask above, except here you list packages you want to 
+unmask.  Useful for overriding the global package.mask file (see 
+below).  Note that this does not override packages that are masked via 
+KEYWORDS.
+.TP
+.BR package.use
+Per\-package USE flags.  Useful for tracking local USE flags or for 
+enabling USE flags for certain packages only.  Perhaps you develop GTK 
+and thus you want documentation for it, but you don't want 
+documentation for QT.  Easy as pie my friend!
+
+.I Format:
+.nf
+\- comments begin with #
+\- one DEPEND atom per line with space-delimited USE flags
+.fi
+
+.I Example:
+.nf
+# turn on docs for GTK 2.x
+=x11\-libs/gtk+\-2* doc
+# disable mysql support for QT
+x11\-libs/qt \-mysql
+.fi
+.TP
+.BR mirrors
+Whenever portage encounters a mirror:// style URL it will look up the actual 
+hosts here.  If the mirror set is not found here, it will check the global 
+mirrors file at /usr/portage/profiles/thirdpartymirrors.  You may also set a 
+special mirror type called "local".  This list of mirrors will be checked 
+before GENTOO_MIRRORS and will be used even if the package has 
+RESTRICT="mirror" or RESTRICT="fetch".
+
+.I Format:
+.nf
+\- comments begin with #
+\- mirror type followed by a list of hosts
+.fi
+
+.I Example:
+.nf
+# local private mirrors used only by my company
+local ftp://192.168.0.3/mirrors/gentoo http://192.168.0.4/distfiles
+
+# people in japan would want to use the japanese mirror first
+sourceforge http://keihanna.dl.sourceforge.net/sourceforge
+
+# people in tawain would want to use the local gnu mirror first
+gnu ftp://ftp.nctu.edu.tw/UNIX/gnu/
+.fi
+.TP
+.BR categories
+A simple list of valid categories that may be used in /usr/portage, 
+PORTDIR_OVERLAY, and PKGDIR (see \fBmake.conf\fR(5)).  This allows for custom 
+categories to be created.
+
+.I Format:
+.nf
+\- one category per line
+.fi
+
+.I Example:
+.nf
+app\-hackers
+media\-other
+.fi
+.RE
+.TP
+.BR /usr/portage/profiles/
+Global Gentoo settings that are controlled by the developers.  To override 
+these settings, you can use the files in \fB/etc/portage/\fR.
+.RS
+.TP
+.BR arch.list
+A list of all valid KEYWORDS.  This does not include modifiers.
+
+.I Format:
+.nf
+\- one KEYWORD per line
+.fi
+
+.I Example:
+.nf
+x86
+ppc
+sparc
+.fi
+.TP
+.BR categories
+A simple list of valid categories that may be used in /usr/portage, 
+PORTDIR_OVERLAY, and PKGDIR (see \fBmake.conf\fR(5)).
+
+.I Format:
+.nf
+\- one category per line
+.fi
+
+.I Example:
+.nf
+app\-admin
+dev\-lang
+games\-strategy
+sys\-kernel
+.fi
+.TP
+.BR info_pkgs
+A list of all the packages which will be displayed when you run `emerge info`.
+.TP
+.BR info_vars
+A list of all the variables which will be displayed when you run `emerge info`.
+.TP
+.BR package.mask
+This contains a list of DEPEND atoms for packages that should not be installed 
+in any profile.  Useful for adding the latest KDE betas and making sure no 
+one accidentally upgrades to them.  Also useful for quickly masking specific 
+versions due to security issues.  ALWAYS include a comment explaining WHY the 
+package has been masked and WHO is doing the masking.
+
+.I Format:
+.nf
+\- comments begin with #
+\- one DEPEND atom per line
+.fi
+
+.I Example:
+.nf
+# masked for security reasons
+<sys\-libs/zlib\-1.1.4
+# <caleb@gentoo.org> (10 Sep 2003)
+# new kde betas
+=kde\-base/kde\-3.2.0_beta1
+=kde\-base/kdeaccessibility\-3.2.0_beta1
+.fi
+.TP
+.BR profiles.desc
+List all the current stable and development profiles.  If a profile is listed 
+here, then it will be checked by repoman.  At the moment, only 1 profile is 
+allowed per stable/dev/KEYWORD; the last one found is the last one used.
+
+.I Format:
+.nf
+\- comments begin with #
+\- one profile list per line in format: arch dir status
+\- arch must be listed in arch.list
+\- dir is relative to profiles.desc
+\- status must be 'stable' or 'dev'
+.fi
+
+.I Example:
+.nf
+alpha default-linux/alpha/2004.3 stable
+m68k  default-linux/m68k         dev
+x86   default-linux/x86/2004.3   stable
+.fi
+.TP
+.BR thirdpartymirrors
+Controls the mapping of mirror:// style URLs to actual lists of 
+mirrors.  Keeps us from overloading a single server.
+
+.I Format:
+.nf
+\- comments begin with #
+\- mirror type followed by a list of hosts
+.fi
+
+.I Example:
+.nf
+sourceforge http://aleron.dl.sourceforge.net/sourceforge http://unc.dl.sourceforge.net/sourceforge
+
+gentoo http://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/ ftp://ftp.gtlib.cc.gatech.edu/pub/gentoo/distfiles
+
+kernel http://www.kernel.org/pub http://www.us.kernel.org/pub
+.fi
+.TP
+.BR use.desc
+All global USE flags must be listed here with a description of what they do.  
+
+.I Format:
+.nf
+\- comments begin with #
+\- use flag \- some description
+.fi
+
+.I Example:
+.nf
+3dfx \- Adds support for 3dfx video cards
+acl \- Adds support for Access Control Lists
+doc \- Adds extra documentation
+.fi
+.TP
+.BR use.local.desc
+All local USE flags must be listed here along with the package and a 
+description.
+
+.nf
+.I Format:
+\- comments begin with #
+\- package:use flag \- description
+
+.I Example:
+app\-editors/nano:justify \- Toggles the justify option
+dev\-libs/DirectFB:fusion \- Adds Multi Application support
+games\-emulation/xmess:net \- Adds network support
+.fi
+.RE
+.TP
+.BR /var/cache/edb/
+.RS
+This directory is used to store internal portage cache files.  The names and
+purpose of these files are not documented on purpose so as to keep down bitrot
+as internals change.  If you aren't working on portage internally, then the
+details most likely do not matter to you.
+
+This entire directory can be safely deleted.  It is highly recommended you do
+not do this however as it can be a time consuming process to generate them all
+again.
+.RE
+.TP
+.BR /var/db/pkg/
+.RS
+All installed package information is recorded here.  If portage thinks you have
+a package installed, it is usually because it is listed here.
+
+The format follows somewhat closely that of the portage tree.  There is a
+directory for each category and a package-version subdirectory for each package
+you have installed.
+
+Inside each package directory are misc files that describe the installed
+contents of the package as well as build time information (so that the package
+can be unmerged without needing the portage tree).
+
+The exact file contents and format are not described here again so that things
+can be changed quickly.  Generally though there is one file per environment
+variable that "matters" (like CFLAGS) with the contents stored inside of it.
+Another common file is the CONTENTS file which lists the path and hashes of
+all objects that the package installed onto your system.
+.RE
+.TP
+.BR /var/lib/portage/
+.RS
+.TP
+.BR config
+Hashes which are used to determine whether files in config protected
+directories have been modified since being installed.  Files which have not
+been modified will automatically be unmerged.
+.TP
+.BR world
+Every time you emerge a package, the package that you requested is 
+recorded here.  Then when you run `emerge world \-up`, the list of 
+packages is read from this file.  Note that this does not mean that the 
+packages that were installed as dependencies are listed here.  For 
+example, if you run `emerge mod_php` and you do not have apache 
+already, then "dev\-php/mod_php" is recorded in the world file but 
+"net\-www/apache" is not.  For more information, review \fBemerge\fR(1).
+
+.I Format:
+.nf
+\- one DEPEND atom base per line
+.fi
+
+.I Example:
+.nf
+games\-misc/fortune\-mod\-gentoo\-dev
+dev\-libs/uclibc
+app\-cdr/cdemu
+.fi
+.RE
+.SH "REPORTING BUGS"
+Please report bugs via http://bugs.gentoo.org/
+.SH "AUTHORS"
+.nf
+Marius Mauch <genone@gentoo.org>
+Mike Frysinger <vapier@gentoo.org>
+Drake Wyrm <wyrm@haell.com>
+.fi
+.SH "SEE ALSO"
+.BR emerge (1),
+.BR ebuild (1),
+.BR ebuild (5),
+.BR make.conf (5)
Index: /vendor/prefix-portage/current/man/quickpkg.1
===================================================================
--- /vendor/prefix-portage/current/man/quickpkg.1	(revision 3489)
+++ /vendor/prefix-portage/current/man/quickpkg.1	(revision 3489)
@@ -0,0 +1,55 @@
+.TH "QUICKPKG" "1" "Dec 2005" "Portage 2.1" "Portage"
+.SH NAME
+quickpkg \- creates portage packages
+.SH SYNOPSIS
+.B quickpkg <list of pkgs>
+.SH DESCRIPTION
+.I quickpkg
+can be utilized to quickly create a package for portage by
+utilizing the files already on your filesystem.  This package
+then can be emerged on any system.  To review syntax for 
+emerging binary packages, review \fBemerge\fR(1).  The upside
+of this process is that you don't have to wait for the package 
+to unpack, configure, compile, and install before you can have 
+the package ready to go.  The downside is that the package will 
+contain the files that exist on your filesystem even if they have 
+modified since they were first installed.
+.br
+The packages, after being created, will be placed in \fBPKGDIR\fR.  
+This variable is defined in \fBmake.conf\fR(5) and defaults to 
+/usr/portage/packages.
+.SH OPTIONS
+.TP
+.B <list of packages>
+Each package in the list can be of two forms.  First you can
+give it the full path to the installed entry in the virtual
+database.  That is, /var/db/pkg/<CATEGORY>/<PKG-VERSION>/.  
+The second form is a portage depend atom.  This atom is of
+the same form that you would give \fBemerge\fR if you wanted 
+to emerge something.  See \fBebuild\fR(5) for full definition.
+.SH "EXAMPLES"
+.B quickpkg
+/var/db/pkg/dev-python/pyogg-1.1
+.br
+.B quickpkg
+planeshift
+.br
+.B quickpkg
+=apache-1.3.27-r1
+.br
+.B quickpkg
+=net-www/apache-2*
+.SH "REPORTING BUGS"
+Please report bugs via http://bugs.gentoo.org/
+.SH AUTHORS
+.nf
+Terry Chan (original author)
+Mike Frysinger <vapier@gentoo.org> (revamped version)
+.fi
+.SH "FILES"
+.TP
+.B /etc/make.conf
+The \fBPKGDIR\fR variable is defined here.
+.SH "SEE ALSO"
+.BR ebuild (5),
+.BR make.conf (5)
Index: /vendor/prefix-portage/current/man/repoman.1
===================================================================
--- /vendor/prefix-portage/current/man/repoman.1	(revision 3489)
+++ /vendor/prefix-portage/current/man/repoman.1	(revision 3489)
@@ -0,0 +1,265 @@
+.TH "REPOMAN" "1" "Dec 2005" "Portage 2.1" "Portage"
+.SH NAME
+repoman \- Gentoo's program to enforce a minimal level of quality assurance in packages added to the portage tree
+.SH SYNOPSIS
+\fBrepoman\fR [\fIoption\fR] [\fImode\fR]
+.SH DESCRIPTION
+.BR "Quality is job zero."
+
+.BR repoman
+is meant for Gentoo developers only due to the fact it does not work on a per-ebuild basis.
+It checks the quality of CVS repositories.
+
+Note: \fBrepoman commit\fR only works \fIinside local\fR CVS repositories.
+.SH OPTIONS
+.TP
+\fB-q\fR, \fB--quiet\fR
+Be less verbose about extraneous info
+.TP
+\fB-p\fR, \fB--pretend\fR
+Don't commit or fix anything; just show what would be done
+.TP
+\fB-i\fR, \fB--include-masked\fR
+Include masked packages in scans at category or tree level
+.TP
+\fB-x\fR, \fB--xmlparse\fR
+Forces the metadata.xml parse check to be carried out
+.TP
+\fB-v\fR, \fB--verbose\fR
+Displays every package name while checking
+.TP
+\fB-I\fR, \fB--ignore-arches\fR
+Ignore arch-specific failures (where arch != host)
+.TP
+\fB-m\fR, \fB--commitmsg\fR
+Adds a commit message via the command line
+.TP
+\fB-M\fR, \fB--commitmsgfile\fR
+Adds a commit message from the specified file
+.TP
+\fB-V\fR, \fB--version\fR
+Show version info
+.TP
+\fB-h\fR, \fB--help\fR
+Show this screen
+.SH MODES
+.TP
+.B full
+Scan directory tree for QA issues (full listing)
+.TP
+.B last
+Remember report from last run
+.TP
+.B help
+Show this screen
+.TP
+.B scan
+Scan directory tree for QA issues (default)
+.TP
+.B fix
+Fix simple QA issues (stray digests, missing digests)
+.TP
+.B lfull
+Remember report from last run (full listing)
+.TP
+.B commit
+Scan directory tree for QA issues; if OK, commit via cvs
+.SH QA KEYWORDS
+.TP
+.B CVS/Entries.IO_error
+Attempting to commit, and an IO error was encountered access the Entries file
+.TP
+.B DEPEND.bad
+User-visible ebuilds with bad DEPEND settings (matched against *visible* ebuilds)
+.TP
+.B DEPEND.badindev
+User-visible ebuilds with bad DEPEND settings (matched against *visible* ebuilds) in developing arch
+.TP
+.B DEPEND.badmasked
+Masked ebuilds with bad DEPEND settings (matched against *all* ebuilds)
+.TP
+.B DEPEND.badmaskedindev
+Masked ebuilds with bad DEPEND settings (matched against *all* ebuilds) in developing arch
+.TP
+.B DEPEND.syntax
+Syntax error in DEPEND (usually an extra/missing space/parenthesis)
+.TP
+.B DESCRIPTION.missing
+Ebuilds that have a missing or empty DESCRIPTION variable
+.TP
+.B HOMEPAGE.missing
+Ebuilds that have a missing or empty HOMEPAGE variable
+.TP
+.B IUSE.invalid
+This build has a variable in IUSE that is not in the use.desc or use.local.desc file
+.TP
+.B KEYWORDS.invalid
+This ebuild contains KEYWORDS that are not listed in profiles/arch.list or for which no valid profile was found
+.TP
+.B KEYWORDS.missing
+Ebuilds that have a missing or empty KEYWORDS variable
+.TP
+.B KEYWORDS.stupid
+Ebuilds that use KEYWORDS=-* instead of package.mask
+.TP
+.B LICENSE.invalid
+This ebuild is listing a license that doesnt exist in portages license/ dir.
+.TP
+.B LICENSE.missing
+Ebuilds that have a missing or empty LICENSE variable
+.TP
+.B LICENSE.syntax
+Syntax error in LICENSE (usually an extra/missing space/parenthesis)
+.TP
+.B LIVEVCS.stable
+Ebuild is a live ebuild (cvs, git, darcs, svn, etc) checkout with stable keywords.
+.TP
+.B PDEPEND.bad
+User-visible ebuilds with bad PDEPEND settings (matched against *visible* ebuilds)
+.TP
+.B PDEPEND.badindev
+User-visible ebuilds with bad PDEPEND settings (matched against *visible* ebuilds) in developing arch
+.TP
+.B PDEPEND.badmasked
+Masked ebuilds with PDEPEND settings (matched against *all* ebuilds)
+.TP
+.B PDEPEND.badmaskedindev
+Masked ebuilds with PDEPEND settings (matched against *all* ebuilds) in developing arch
+.TP
+.B PDEPEND.syntax
+Syntax error in PDEPEND (usually an extra/missing space/parenthesis)
+.TP
+.B PROVIDE.syntax
+Syntax error in PROVIDE (usually an extra/missing space/parenthesis)
+.TP
+.B RDEPEND.bad
+User-visible ebuilds with bad RDEPEND settings (matched against *visible* ebuilds)
+.TP
+.B RDEPEND.badindev
+User-visible ebuilds with bad RDEPEND settings (matched against *visible* ebuilds) in developing arch
+.TP
+.B RDEPEND.badmasked
+Masked ebuilds with RDEPEND settings (matched against *all* ebuilds)
+.TP
+.B RDEPEND.badmaskedindev
+Masked ebuilds with RDEPEND settings (matched against *all* ebuilds) in developing arch
+.TP
+.B RDEPEND.syntax
+Syntax error in RDEPEND (usually an extra/missing space/parenthesis)
+.TP
+.B SLOT.missing
+Ebuilds that have a missing or empty SLOT variable
+.TP
+.B changelog.missing
+Missing ChangeLog files
+.TP
+.B changelog.notadded
+ChangeLogs that exist but have not been added to cvs
+.TP
+.B digest.assumed
+Existing digest must be assumed correct (Package level only)
+.TP
+.B digest.disjointed
+Digests not added to cvs when the matching ebuild has been added
+.TP
+.B digest.fail
+Digest does not match the specified local file
+.TP
+.B digest.missing
+Digest files that are missing (ebuild exists, digest doesn't)
+.TP
+.B digest.notadded
+Digests that exist but have not been added to cvs
+.TP
+.B digest.partial
+Digest files do not contain all corresponding URI elements
+.TP
+.B digest.stray
+Digest files that do not have a corresponding ebuild
+.TP
+.B digest.unmatch
+Digests which are incomplete (please check if your USE/ARCH includes all files)
+.TP
+.B digest.unused
+Digest/Manifest entry has no matching SRC_URI entry
+.TP
+.B ebuild.allmasked
+All ebuilds are masked for this package (Package level only)
+.TP
+.B ebuild.badheader
+This ebuild has a malformed header
+.TP
+.B ebuild.disjointed
+Ebuilds not added to cvs when the matching digest has been added
+.TP
+.B ebuild.invalidname
+Ebuild files with a non-parseable or syntactically incorrect name (or using 2.1 versioning extensions)
+.TP
+.B ebuild.majorsyn
+This ebuild has a major syntax error that may cause the ebuild to fail partially or fully
+.TP
+.B ebuild.minorsyn
+This ebuild has a minor syntax error that contravenes gentoo coding style
+.TP
+.B ebuild.namenomatch
+Ebuild files that do not have the same name as their parent directory
+.TP
+.B ebuild.nesteddie
+Placing 'die' inside ( ) prints an error, but doesn't stop the ebuild.
+.TP
+.B ebuild.nostable
+There are no ebuilds that are marked as stable for your ARCH
+.TP
+.B ebuild.notadded
+Ebuilds that exist but have not been added to cvs
+.TP
+.B ebuild.output
+A simple sourcing of the ebuild produces output; this breaks ebuild policy.
+.TP
+.B ebuild.syntax
+Error generating cache entry for ebuild; typically caused by ebuild syntax error
+.TP
+.B file.UTF8
+File is not UTF8 compliant
+.TP
+.B file.executable
+Ebuilds, digests, metadata.xml, Manifest, and ChangeLog do note need the executable bit
+.TP
+.B file.name
+File/dir name must be composed of only the following chars: a-zA-Z0-9._-+:
+.TP
+.B file.size
+Files in the files directory must be under 20k
+.TP
+.B filedir.missing
+Package lacks a files directory
+.TP
+.B metadata.bad
+Bad metadata.xml files
+.TP
+.B metadata.missing
+Missing metadata.xml files
+.TP
+.B usage.obsolete
+The ebuild makes use of an obsolete construct
+.TP
+.B variable.readonly
+Assigning a readonly variable
+.TP
+.B virtual.exists
+PROVIDE contains existing package names
+.TP
+.B virtual.unavailable
+PROVIDE contains a virtual which contains no profile default
+.TP
+.B virtual.versioned
+PROVIDE contains virtuals with versions
+.SH "REPORTING BUGS"
+Please report bugs via http://bugs.gentoo.org/
+.SH AUTHORS
+.nf
+Daniel Robbins <drobbins@gentoo.org>
+Saleem Abdulrasool <compnerd@gentoo.org>
+.fi
+.SH "SEE ALSO"
+.BR emerge (1)
Index: /vendor/prefix-portage/current/missing
===================================================================
--- /vendor/prefix-portage/current/missing	(revision 3489)
+++ /vendor/prefix-portage/current/missing	(revision 3489)
@@ -0,0 +1,367 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2006-05-10.23
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
+#   Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+  echo 1>&2 "Try \`$0 --help' for more information"
+  exit 1
+fi
+
+run=:
+sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
+sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+  configure_ac=configure.ac
+else
+  configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case $1 in
+--run)
+  # Try to run requested program, and just exit if it succeeds.
+  run=
+  shift
+  "$@" && exit 0
+  # Exit code 63 means version mismatch.  This often happens
+  # when the user try to use an ancient version of a tool on
+  # a file that requires a minimum version.  In this case we
+  # we should proceed has if the program had been absent, or
+  # if --run hadn't been passed.
+  if test $? = 63; then
+    run=:
+    msg="probably too old"
+  fi
+  ;;
+
+  -h|--h|--he|--hel|--help)
+    echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+  -h, --help      display this help and exit
+  -v, --version   output version information and exit
+  --run           try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+  aclocal      touch file \`aclocal.m4'
+  autoconf     touch file \`configure'
+  autoheader   touch file \`config.h.in'
+  autom4te     touch the output file, or create a stub one
+  automake     touch all \`Makefile.in' files
+  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
+  flex         create \`lex.yy.c', if possible, from existing .c
+  help2man     touch the output file
+  lex          create \`lex.yy.c', if possible, from existing .c
+  makeinfo     touch the output file
+  tar          try tar, gnutar, gtar, then tar without non-portable flags
+  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Send bug reports to <bug-automake@gnu.org>."
+    exit $?
+    ;;
+
+  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+    echo "missing $scriptversion (GNU Automake)"
+    exit $?
+    ;;
+
+  -*)
+    echo 1>&2 "$0: Unknown \`$1' option"
+    echo 1>&2 "Try \`$0 --help' for more information"
+    exit 1
+    ;;
+
+esac
+
+# Now exit if we have it, but it failed.  Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).
+case $1 in
+  lex|yacc)
+    # Not GNU programs, they don't have --version.
+    ;;
+
+  tar)
+    if test -n "$run"; then
+       echo 1>&2 "ERROR: \`tar' requires --run"
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       exit 1
+    fi
+    ;;
+
+  *)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       # Could not run --version or --help.  This is probably someone
+       # running `$TOOL --version' or `$TOOL --help' to check whether
+       # $TOOL exists and not knowing $TOOL uses missing.
+       exit 1
+    fi
+    ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case $1 in
+  aclocal*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
+         to install the \`Automake' and \`Perl' packages.  Grab them from
+         any GNU archive site."
+    touch aclocal.m4
+    ;;
+
+  autoconf)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`${configure_ac}'.  You might want to install the
+         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
+         archive site."
+    touch configure
+    ;;
+
+  autoheader)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
+         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
+         from any GNU archive site."
+    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+    test -z "$files" && files="config.h"
+    touch_files=
+    for f in $files; do
+      case $f in
+      *:*) touch_files="$touch_files "`echo "$f" |
+				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+      *) touch_files="$touch_files $f.in";;
+      esac
+    done
+    touch $touch_files
+    ;;
+
+  automake*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+         You might want to install the \`Automake' and \`Perl' packages.
+         Grab them from any GNU archive site."
+    find . -type f -name Makefile.am -print |
+	   sed 's/\.am$/.in/' |
+	   while read f; do touch "$f"; done
+    ;;
+
+  autom4te)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+         You might have modified some files without having the
+         proper tools for further handling them.
+         You can get \`$1' as part of \`Autoconf' from any GNU
+         archive site."
+
+    file=`echo "$*" | sed -n "$sed_output"`
+    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+    if test -f "$file"; then
+	touch $file
+    else
+	test -z "$file" || exec >$file
+	echo "#! /bin/sh"
+	echo "# Created by GNU Automake missing as a replacement of"
+	echo "#  $ $@"
+	echo "exit 0"
+	chmod +x $file
+	exit 1
+    fi
+    ;;
+
+  bison|yacc)
+    echo 1>&2 "\
+WARNING: \`$1' $msg.  You should only need it if
+         you modified a \`.y' file.  You may need the \`Bison' package
+         in order for those modifications to take effect.  You can get
+         \`Bison' from any GNU archive site."
+    rm -f y.tab.c y.tab.h
+    if test $# -ne 1; then
+        eval LASTARG="\${$#}"
+	case $LASTARG in
+	*.y)
+	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+	    if test -f "$SRCFILE"; then
+	         cp "$SRCFILE" y.tab.c
+	    fi
+	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+	    if test -f "$SRCFILE"; then
+	         cp "$SRCFILE" y.tab.h
+	    fi
+	  ;;
+	esac
+    fi
+    if test ! -f y.tab.h; then
+	echo >y.tab.h
+    fi
+    if test ! -f y.tab.c; then
+	echo 'main() { return 0; }' >y.tab.c
+    fi
+    ;;
+
+  lex|flex)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified a \`.l' file.  You may need the \`Flex' package
+         in order for those modifications to take effect.  You can get
+         \`Flex' from any GNU archive site."
+    rm -f lex.yy.c
+    if test $# -ne 1; then
+        eval LASTARG="\${$#}"
+	case $LASTARG in
+	*.l)
+	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+	    if test -f "$SRCFILE"; then
+	         cp "$SRCFILE" lex.yy.c
+	    fi
+	  ;;
+	esac
+    fi
+    if test ! -f lex.yy.c; then
+	echo 'main() { return 0; }' >lex.yy.c
+    fi
+    ;;
+
+  help2man)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+	 you modified a dependency of a manual page.  You may need the
+	 \`Help2man' package in order for those modifications to take
+	 effect.  You can get \`Help2man' from any GNU archive site."
+
+    file=`echo "$*" | sed -n "$sed_output"`
+    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+    if test -f "$file"; then
+	touch $file
+    else
+	test -z "$file" || exec >$file
+	echo ".ab help2man is required to generate this page"
+	exit 1
+    fi
+    ;;
+
+  makeinfo)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified a \`.texi' or \`.texinfo' file, or any other file
+         indirectly affecting the aspect of the manual.  The spurious
+         call might also be the consequence of using a buggy \`make' (AIX,
+         DU, IRIX).  You might want to install the \`Texinfo' package or
+         the \`GNU make' package.  Grab either from any GNU archive site."
+    # The file to touch is that specified with -o ...
+    file=`echo "$*" | sed -n "$sed_output"`
+    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+    if test -z "$file"; then
+      # ... or it is the one specified with @setfilename ...
+      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+      file=`sed -n '
+	/^@setfilename/{
+	  s/.* \([^ ]*\) *$/\1/
+	  p
+	  q
+	}' $infile`
+      # ... or it is derived from the source name (dir/f.texi becomes f.info)
+      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+    fi
+    # If the file does not exist, the user really needs makeinfo;
+    # let's fail without touching anything.
+    test -f $file || exit 1
+    touch $file
+    ;;
+
+  tar)
+    shift
+
+    # We have already tried tar in the generic part.
+    # Look for gnutar/gtar before invocation to avoid ugly error
+    # messages.
+    if (gnutar --version > /dev/null 2>&1); then
+       gnutar "$@" && exit 0
+    fi
+    if (gtar --version > /dev/null 2>&1); then
+       gtar "$@" && exit 0
+    fi
+    firstarg="$1"
+    if shift; then
+	case $firstarg in
+	*o*)
+	    firstarg=`echo "$firstarg" | sed s/o//`
+	    tar "$firstarg" "$@" && exit 0
+	    ;;
+	esac
+	case $firstarg in
+	*h*)
+	    firstarg=`echo "$firstarg" | sed s/h//`
+	    tar "$firstarg" "$@" && exit 0
+	    ;;
+	esac
+    fi
+
+    echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+         You may want to install GNU tar or Free paxutils, or check the
+         command line arguments."
+    exit 1
+    ;;
+
+  *)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+         You might have modified some files without having the
+         proper tools for further handling them.  Check the \`README' file,
+         it often tells you about the needed prerequisites for installing
+         this package.  You may also peek at any GNU archive site, in case
+         some other package would contain this missing \`$1' program."
+    exit 1
+    ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
Index: /vendor/prefix-portage/current/pym/Makefile.in
===================================================================
--- /vendor/prefix-portage/current/pym/Makefile.in	(revision 3489)
+++ /vendor/prefix-portage/current/pym/Makefile.in	(revision 3489)
@@ -0,0 +1,75 @@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+sysconfdir = @sysconfdir@
+libdir = @libdir@
+PYTHON = @PYTHON@
+
+srcdir=@srcdir@
+top_builddir=@top_builddir@
+
+portageuser = @portageuser@
+portagegroup = @portagegroup@
+
+PORTAGE_PYM = @PORTAGE_BASE@/pym
+INSTALL = @INSTALL@
+INSTALL_PY = @INSTALL_DATA@ -o $(portageuser) -g $(portagegroup)
+INSTALL_PYsubst = $(SHELL) ${top_builddir}/subst-install --installcmd='${INSTALL_PY}'
+
+list_sourcedir_dirs = \
+	( cd ${srcdir} && find . \
+	-name 'CVS' -prune \
+	-o -name '.svn' -prune \
+	-o -type d -print )
+
+list_sourcedir = \
+	( cd ${srcdir} && find . \
+	-name 'CVS' -prune \
+	-o -name '.\#*' -prune \
+	-o -name '.svn' -prune \
+	-o -type f -name '*.py' \
+	-print )
+
+all:
+
+install:
+	$(INSTALL) -d -m 755 -o $(portageuser) -g $(portagegroup) $(DESTDIR)$(PORTAGE_PYM)
+	$(list_sourcedir_dirs) | while read f \
+	; do echo $(INSTALL) -d -m 755 -o $(portageuser) -g $(portagegroup) $(DESTDIR)$(PORTAGE_PYM)/$${f} \
+	   ; $(INSTALL) -d -m 755 -o $(portageuser) -g $(portagegroup) $(DESTDIR)$(PORTAGE_PYM)/$${f} \
+	; done
+	$(list_sourcedir) | while read f \
+	; do echo $(INSTALL_PYsubst) ${srcdir}/$${f} $(DESTDIR)$(PORTAGE_PYM)/$${f} \
+	   ; $(INSTALL_PYsubst) ${srcdir}/$${f} $(DESTDIR)$(PORTAGE_PYM)/$${f} \
+	; done
+#	$(PYTHON) -c 'import compileall; compileall.compile_dir("$(DESTDIR)$(PORTAGE_PYM)")'
+#	$(PYTHON) -O -c 'import compileall; compileall.compile_dir("$(DESTDIR)$(PORTAGE_PYM)")'
+#@INSTALL_PYTHON_SOURCES_FALSE@	$(list_sourcedir) | while read f \
+#@INSTALL_PYTHON_SOURCES_FALSE@	; do rm -f $(DESTDIR)$(PORTAGE_PYM)/$${f} \
+#@INSTALL_PYTHON_SOURCES_FALSE@	; done
+
+distdir:
+	$(list_sourcedir_dirs) | while read f \
+	; do echo $(INSTALL) -d $(distdir)/$${f} \
+	   ; $(INSTALL) -d $(distdir)/$${f} \
+	; done
+	$(list_sourcedir) | while read f \
+	; do echo $(INSTALL) ${srcdir}/$${f} $(distdir)/$${f} \
+	   ; $(INSTALL) ${srcdir}/$${f} $(distdir)/$${f} \
+	; done
+
+uninstall:
+	$(list_sourcedir) | while read f \
+	; do echo rm -f $(DESTDIR)$(PORTAGE_PYM)/$${f} \
+	   ; rm -f $(DESTDIR)$(PORTAGE_PYM)/$${f} \
+	   ; echo rm -f $(DESTDIR)$(PORTAGE_PYM)/$${f}c \
+	   ; rm -f $(DESTDIR)$(PORTAGE_PYM)/$${f}c \
+	   ; echo rm -f $(DESTDIR)$(PORTAGE_PYM)/$${f}o \
+	   ; rm -f $(DESTDIR)$(PORTAGE_PYM)/$${f}o \
+	; done 
+	
+all dvi check installcheck:
+clean distclean maintainer-clean:
+
+.PHONY:	all install distdir
+.PHONY: dvi check installcheck
+.PHONY: clean distclean maintainer-clean
Index: /vendor/prefix-portage/current/pym/cvstree.py
===================================================================
--- /vendor/prefix-portage/current/pym/cvstree.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/cvstree.py	(revision 3489)
@@ -0,0 +1,35 @@
+# portage_compat_namespace.py -- provide compability layer with new namespace
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_compat_namespace.py 5981 2007-02-17 13:11:28Z genone $
+
+""" 
+This module checks the name under which it is imported and attempts to load
+the corresponding module of the new portage namespace, inserting it into the
+loaded modules list.
+It also issues a warning to the caller to migrate to the new namespace.
+Note that this module should never be used with it's true name, but only by 
+links pointing to it. Also it is limited to portage_foo -> portage.foo 
+translations, however existing subpackages shouldn't use it anyway to maintain 
+compability with 3rd party modules (like elog or cache plugins), and they 
+shouldn't be directly imported by external consumers.
+
+This module is based on an idea by Brian Harring.
+"""
+
+import sys, warnings
+
+__oldname = __name__
+if __name__.startswith("portage_"):
+	__newname = __name__.replace("_", ".")
+else:
+	__newname = "portage."+__name__
+
+try:
+	__package = __import__(__newname, globals(), locals())
+	__realmodule = getattr(__package, __newname[8:])
+except ImportError, AttributeError:
+	raise ImportError("No module named %s" % __oldname)
+
+warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname))
+sys.modules[__oldname] = __realmodule
Index: /vendor/prefix-portage/current/pym/eclass_cache.py
===================================================================
--- /vendor/prefix-portage/current/pym/eclass_cache.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/eclass_cache.py	(revision 3489)
@@ -0,0 +1,35 @@
+# portage_compat_namespace.py -- provide compability layer with new namespace
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_compat_namespace.py 5981 2007-02-17 13:11:28Z genone $
+
+""" 
+This module checks the name under which it is imported and attempts to load
+the corresponding module of the new portage namespace, inserting it into the
+loaded modules list.
+It also issues a warning to the caller to migrate to the new namespace.
+Note that this module should never be used with it's true name, but only by 
+links pointing to it. Also it is limited to portage_foo -> portage.foo 
+translations, however existing subpackages shouldn't use it anyway to maintain 
+compability with 3rd party modules (like elog or cache plugins), and they 
+shouldn't be directly imported by external consumers.
+
+This module is based on an idea by Brian Harring.
+"""
+
+import sys, warnings
+
+__oldname = __name__
+if __name__.startswith("portage_"):
+	__newname = __name__.replace("_", ".")
+else:
+	__newname = "portage."+__name__
+
+try:
+	__package = __import__(__newname, globals(), locals())
+	__realmodule = getattr(__package, __newname[8:])
+except ImportError, AttributeError:
+	raise ImportError("No module named %s" % __oldname)
+
+warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname))
+sys.modules[__oldname] = __realmodule
Index: /vendor/prefix-portage/current/pym/emerge/__init__.py
===================================================================
--- /vendor/prefix-portage/current/pym/emerge/__init__.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/emerge/__init__.py	(revision 3489)
@@ -0,0 +1,5759 @@
+#!@PYTHON@ -O
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: $
+
+import sys
+# This block ensures that ^C interrupts are handled quietly.
+try:
+	import signal
+
+	def exithandler(signum,frame):
+		signal.signal(signal.SIGINT, signal.SIG_IGN)
+		signal.signal(signal.SIGTERM, signal.SIG_IGN)
+		sys.exit(1)
+	
+	signal.signal(signal.SIGINT, exithandler)
+	signal.signal(signal.SIGTERM, exithandler)
+	signal.signal(signal.SIGPIPE, signal.SIG_DFL)
+
+except KeyboardInterrupt:
+	sys.exit(1)
+
+import os, stat
+
+os.environ["PORTAGE_LEGACY_GLOBALS"] = "false"
+try:
+	import portage
+except ImportError:
+	from os import path as osp
+	sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
+	import portage
+del os.environ["PORTAGE_LEGACY_GLOBALS"]
+from portage import digraph, portdbapi
+from portage.const import NEWS_LIB_PATH, CACHE_PATH
+
+import emerge.help
+import portage.xpak, commands, errno, re, socket, time, types
+from portage.output import blue, bold, colorize, darkblue, darkgreen, darkred, green, \
+	havecolor, nc_len, nocolor, red, teal, turquoise, white, xtermTitle, \
+	xtermTitleReset, yellow
+from portage.output import create_color_func
+good = create_color_func("GOOD")
+bad = create_color_func("BAD")
+
+import portage.dep
+portage.dep._dep_check_strict = True
+import portage.util
+import portage.locks
+import portage.exception
+from portage.const import EPREFIX
+from portage.data import secpass
+from portage.util import normalize_path as normpath
+from portage.util import writemsg
+
+if not hasattr(__builtins__, "set"):
+	from sets import Set as set
+from itertools import chain, izip
+from UserDict import DictMixin
+
+try:
+	import cPickle
+except ImportError:
+	import pickle as cPickle
+
+class stdout_spinner(object):
+	scroll_msgs = [
+		"Gentoo Rocks ("+os.uname()[0]+")",
+		"Thank you for using Gentoo. :)",
+		"Are you actually trying to read this?",
+		"How many times have you stared at this?",
+		"We are generating the cache right now",
+		"You are paying too much attention.",
+		"A theory is better than its explanation.",
+		"Phasers locked on target, Captain.",
+		"Thrashing is just virtual crashing.",
+		"To be is to program.",
+		"Real Users hate Real Programmers.",
+		"When all else fails, read the instructions.",
+		"Functionality breeds Contempt.",
+		"The future lies ahead.",
+		"3.1415926535897932384626433832795028841971694",
+		"Sometimes insanity is the only alternative.",
+		"Inaccuracy saves a world of explanation.",
+	]
+
+	twirl_sequence = "/-\\|/-\\|/-\\|/-\\|\\-/|\\-/|\\-/|\\-/|"
+
+	def __init__(self):
+		self.spinpos = 0
+		self.update = self.update_twirl
+		self.scroll_sequence = self.scroll_msgs[
+			int(time.time() * 100) % len(self.scroll_msgs)]
+
+	def update_basic(self):
+		self.spinpos = (self.spinpos + 1) % 500
+		if (self.spinpos % 100) == 0:
+			if self.spinpos == 0:
+				sys.stdout.write(". ")
+			else:
+				sys.stdout.write(".")
+		sys.stdout.flush()
+
+	def update_scroll(self):
+		if(self.spinpos >= len(self.scroll_sequence)):
+			sys.stdout.write(darkgreen(" \b\b\b" + self.scroll_sequence[
+				len(self.scroll_sequence) - 1 - (self.spinpos % len(self.scroll_sequence))]))
+		else:
+			sys.stdout.write(green("\b " + self.scroll_sequence[self.spinpos]))
+		sys.stdout.flush()
+		self.spinpos = (self.spinpos + 1) % (2 * len(self.scroll_sequence))
+
+	def update_twirl(self):
+		self.spinpos = (self.spinpos + 1) % len(self.twirl_sequence)
+		sys.stdout.write("\b\b " + self.twirl_sequence[self.spinpos])
+		sys.stdout.flush()
+
+	def update_quiet(self):
+		return
+
+def userquery(prompt, responses=None, colours=None):
+	"""Displays a prompt and a set of responses, then waits for a response
+	which is checked against the responses and the first to match is
+	returned.  An empty response will match the first value in responses.  The
+	input buffer is *not* cleared prior to the prompt!
+
+	prompt: a String.
+	responses: a List of Strings.
+	colours: a List of Functions taking and returning a String, used to
+	process the responses for display. Typically these will be functions
+	like red() but could be e.g. lambda x: "DisplayString".
+	If responses is omitted, defaults to ["Yes", "No"], [green, red].
+	If only colours is omitted, defaults to [bold, ...].
+
+	Returns a member of the List responses. (If called without optional
+	arguments, returns "Yes" or "No".)
+	KeyboardInterrupt is converted to SystemExit to avoid tracebacks being
+	printed."""
+	if responses is None:
+		responses, colours = ["Yes", "No"], [green, red]
+	elif colours is None:
+		colours=[bold]
+	colours=(colours*len(responses))[:len(responses)]
+	print bold(prompt),
+	try:
+		while True:
+			response=raw_input("["+"/".join([colours[i](responses[i]) for i in range(len(responses))])+"] ")
+			for key in responses:
+				# An empty response will match the first value in responses.
+				if response.upper()==key[:len(response)].upper():
+					return key
+			print "Sorry, response '%s' not understood." % response,
+	except (EOFError, KeyboardInterrupt):
+		print "Interrupted."
+		sys.exit(1)
+
+actions=[
+"clean", "config", "depclean",
+"info", "metadata",
+"prune", "regen",  "search",
+"sync",  "system", "unmerge",  "world",
+]
+options=[
+"--ask",          "--alphabetical",
+"--buildpkg",     "--buildpkgonly",
+"--changelog",    "--columns",
+"--debug",        "--deep",
+"--digest",
+"--emptytree",
+"--fetchonly",    "--fetch-all-uri",
+"--getbinpkg",    "--getbinpkgonly",
+"--help",         "--ignore-default-opts",
+"--noconfmem",
+"--newuse",       "--nocolor",
+"--nodeps",       "--noreplace",
+"--nospinner",    "--oneshot",
+"--onlydeps",     "--pretend",
+"--quiet",        "--resume",
+"--searchdesc",   "--selective",
+"--skipfirst",
+"--tree",
+"--update",
+"--usepkg",       "--usepkgonly",
+"--verbose",      "--version"
+]
+
+shortmapping={
+"1":"--oneshot",
+"a":"--ask",
+"b":"--buildpkg",  "B":"--buildpkgonly",
+"c":"--clean",     "C":"--unmerge",
+"d":"--debug",     "D":"--deep",
+"e":"--emptytree",
+"f":"--fetchonly", "F":"--fetch-all-uri",
+"g":"--getbinpkg", "G":"--getbinpkgonly",
+"h":"--help",
+"k":"--usepkg",    "K":"--usepkgonly",
+"l":"--changelog",
+"n":"--noreplace", "N":"--newuse",
+"o":"--onlydeps",  "O":"--nodeps",
+"p":"--pretend",   "P":"--prune",
+"q":"--quiet",
+"s":"--search",    "S":"--searchdesc",
+'t':"--tree",
+"u":"--update",
+"v":"--verbose",   "V":"--version"
+}
+
+def emergelog(xterm_titles, mystr, short_msg=None):
+	if xterm_titles:
+		if short_msg == None:
+			short_msg = mystr
+		if "HOSTNAME" in os.environ.keys():
+			short_msg = os.environ["HOSTNAME"]+": "+short_msg
+		xtermTitle(short_msg)
+	try:
+		file_path = EPREFIX+"/var/log/emerge.log"
+		mylogfile = open(file_path, "a")
+		portage.util.apply_secpass_permissions(file_path,
+			uid=portage.portage_uid, gid=portage.portage_gid,
+			mode=0660)
+		mylock = None
+		try:
+			mylock = portage.locks.lockfile(mylogfile)
+			# seek because we may have gotten held up by the lock.
+			# if so, we may not be positioned at the end of the file.
+			mylogfile.seek(0, 2)
+			mylogfile.write(str(time.time())[:10]+": "+mystr+"\n")
+			mylogfile.flush()
+		finally:
+			if mylock:
+				portage.locks.unlockfile(mylock)
+			mylogfile.close()
+	except (IOError,OSError,portage.exception.PortageException), e:
+		if secpass >= 1:
+			print >> sys.stderr, "emergelog():",e
+
+def countdown(secs=5, doing="Starting"):
+	if secs:
+		print ">>> Waiting",secs,"seconds before starting..."
+		print ">>> (Control-C to abort)...\n"+doing+" in: ",
+		ticks=range(secs)
+		ticks.reverse()
+		for sec in ticks:
+			sys.stdout.write(colorize("UNMERGE_WARN", str(sec+1)+" "))
+			sys.stdout.flush()
+			time.sleep(1)
+		print
+
+# formats a size given in bytes nicely
+def format_size(mysize):
+	if type(mysize) not in [types.IntType,types.LongType]:
+		return str(mysize)
+	if 0 != mysize % 1024:
+		# Always round up to the next kB so that it doesn't show 0 kB when
+		# some small file still needs to be fetched.
+		mysize += 1024 - mysize % 1024
+	mystr=str(mysize/1024)
+	mycount=len(mystr)
+	while (mycount > 3):
+		mycount-=3
+		mystr=mystr[:mycount]+","+mystr[mycount:]
+	return mystr+" kB"
+
+
+def getgccversion(chost):
+	"""
+	rtype: C{str}
+	return:  the current in-use gcc version
+	"""
+
+	gcc_ver_command = 'gcc -dumpversion'
+	gcc_ver_prefix = 'gcc-'
+
+	gcc_not_found_error = red(
+	"!!! No gcc found. You probably need to 'source /etc/profile'\n" +
+	"!!! to update the environment of this terminal and possibly\n" +
+	"!!! other terminals also.\n"
+	)
+
+	mystatus, myoutput = commands.getstatusoutput("eselect compiler show")
+	if mystatus == os.EX_OK and len(myoutput.split("/")) == 2:
+		part1, part2 = myoutput.split("/")
+		if part1.startswith(chost + "-"):
+			return myoutput.replace(chost + "-", gcc_ver_prefix, 1)
+
+	mystatus, myoutput = commands.getstatusoutput("gcc-config -c")
+	if mystatus == os.EX_OK and myoutput.startswith(chost + "-"):
+		return myoutput.replace(chost + "-", gcc_ver_prefix, 1)
+
+	mystatus, myoutput = commands.getstatusoutput(
+		chost + "-" + gcc_ver_command)
+	if mystatus == os.EX_OK:
+		return gcc_ver_prefix + myoutput
+
+	mystatus, myoutput = commands.getstatusoutput(gcc_ver_command)
+	if mystatus == os.EX_OK:
+		return gcc_ver_prefix + myoutput
+
+	portage.writemsg(gcc_not_found_error, noiselevel=-1)
+	return "[unavailable]"
+
+def getportageversion(portdir, target_root, profile, chost, vardb):
+	profilever = "unavailable"
+	if profile:
+		realpath = os.path.realpath(profile)
+		basepath   = os.path.realpath(os.path.join(portdir, "profiles"))
+		if realpath.startswith(basepath):
+			profilever = realpath[1 + len(basepath):]
+		else:
+			try:
+				profilever = "!" + os.readlink(profile)
+			except (OSError):
+				pass
+		del realpath, basepath
+
+	libcver=[]
+	libclist  = vardb.match("virtual/libc")
+	libclist += vardb.match("virtual/glibc")
+	libclist  = portage.util.unique_array(libclist)
+	for x in libclist:
+		xs=portage.catpkgsplit(x)
+		if libcver:
+			libcver+=","+"-".join(xs[1:])
+		else:
+			libcver="-".join(xs[1:])
+	if libcver==[]:
+		libcver="unavailable"
+
+	gccver = getgccversion(chost)
+	unameout=os.uname()[2]+" "+os.uname()[4]
+
+	return "Portage " + portage.VERSION +" ("+profilever+", "+gccver+", "+libcver+", "+unameout+")"
+
+def create_depgraph_params(myopts, myaction):
+	#configure emerge engine parameters
+	#
+	# self:      include _this_ package regardless of if it is merged.
+	# selective: exclude the package if it is merged
+	# recurse:   go into the dependencies
+	# deep:      go into the dependencies of already merged packages
+	# empty:     pretend nothing is merged
+	myparams = ["recurse"]
+	add=[]
+	sub=[]
+	if "--update" in myopts or \
+		"--newuse" in myopts or \
+		"--noreplace" in myopts or \
+		myaction in ("system", "world"):
+		add.extend(["selective"])
+	if "--emptytree" in myopts:
+		add.extend(["empty"])
+		sub.extend(["selective"])
+	if "--nodeps" in myopts:
+		sub.extend(["recurse"])
+	if "--deep" in myopts:
+		add.extend(["deep"])
+	for x in add:
+		if (x not in myparams) and (x not in sub):
+			myparams.append(x)
+	for x in sub:
+		if x in myparams:
+			myparams.remove(x)
+	return myparams
+
+# search functionality
+class search:
+
+	#
+	# class constants
+	#
+	VERSION_SHORT=1
+	VERSION_RELEASE=2
+
+	#
+	# public interface
+	#
+	def __init__(self, settings, portdb, vartree, spinner, searchdesc,
+		verbose):
+		"""Searches the available and installed packages for the supplied search key.
+		The list of available and installed packages is created at object instantiation.
+		This makes successive searches faster."""
+		self.settings = settings
+		self.portdb = portdb
+		self.vartree = vartree
+		self.spinner = spinner
+		self.verbose = verbose
+		self.searchdesc = searchdesc
+
+	def execute(self,searchkey):
+		"""Performs the search for the supplied search key"""
+		match_category = 0
+		self.searchkey=searchkey
+		self.packagematches = []
+		if self.searchdesc:
+			self.searchdesc=1
+			self.matches = {"pkg":[], "desc":[]}
+		else:
+			self.searchdesc=0
+			self.matches = {"pkg":[]}
+		print "Searching...   ",
+
+		regexsearch = False
+		if self.searchkey.startswith('%'):
+			regexsearch = True
+			self.searchkey = self.searchkey[1:]
+		if self.searchkey.startswith('@'):
+			match_category = 1
+			self.searchkey = self.searchkey[1:]
+		if regexsearch:
+			self.searchre=re.compile(self.searchkey,re.I)
+		else:
+			self.searchre=re.compile(re.escape(self.searchkey), re.I)
+		for package in self.portdb.cp_all():
+			self.spinner.update()
+
+			if match_category:
+				match_string  = package[:]
+			else:
+				match_string  = package.split("/")[-1]
+
+			masked=0
+			if self.searchre.search(match_string):
+				if not self.portdb.xmatch("match-visible", package):
+					masked=1
+				self.matches["pkg"].append([package,masked])
+			elif self.searchdesc: # DESCRIPTION searching
+				full_package = self.portdb.xmatch("bestmatch-visible", package)
+				if not full_package:
+					#no match found; we don't want to query description
+					full_package = portage.best(
+						self.portdb.xmatch("match-all", package))
+					if not full_package:
+						continue
+					else:
+						masked=1
+				try:
+					full_desc = self.portdb.aux_get(
+						full_package, ["DESCRIPTION"])[0]
+				except KeyError:
+					print "emerge: search: aux_get() failed, skipping"
+					continue
+				if self.searchre.search(full_desc):
+					self.matches["desc"].append([full_package,masked])
+		self.mlen=0
+		for mtype in self.matches.keys():
+			self.matches[mtype].sort()
+			self.mlen += len(self.matches[mtype])
+
+	def output(self):
+		"""Outputs the results of the search."""
+		print "\b\b  \n[ Results for search key : "+white(self.searchkey)+" ]"
+		print "[ Applications found : "+white(str(self.mlen))+" ]"
+		print " "
+		for mtype in self.matches.keys():
+			for match,masked in self.matches[mtype]:
+				if mtype=="pkg":
+					catpack=match
+					full_package = self.portdb.xmatch(
+						"bestmatch-visible", match)
+					if not full_package:
+						#no match found; we don't want to query description
+						masked=1
+						full_package = portage.best(
+							self.portdb.xmatch("match-all",match))
+				else:
+					full_package = match
+					match        = portage.pkgsplit(match)[0]
+
+				if full_package:
+					try:
+						desc, homepage, license = self.portdb.aux_get(
+							full_package, ["DESCRIPTION","HOMEPAGE","LICENSE"])
+					except KeyError:
+						print "emerge: search: aux_get() failed, skipping"
+						continue
+					if masked:
+						print green("*")+"  "+white(match)+" "+red("[ Masked ]")
+					else:
+						print green("*")+"  "+white(match)
+					myversion = self.getVersion(full_package, search.VERSION_RELEASE)
+
+					mysum = [0,0]
+					mycat = match.split("/")[0]
+					mypkg = match.split("/")[1]
+					mycpv = match + "-" + myversion
+					myebuild = self.portdb.findname(mycpv)
+					pkgdir = os.path.dirname(myebuild)
+					from portage import manifest
+					mf = manifest.Manifest(
+						pkgdir, self.settings["DISTDIR"])
+					fetchlist = self.portdb.getfetchlist(mycpv,
+						mysettings=self.settings, all=True)[1]
+					try:
+						mysum[0] = mf.getDistfilesSize(fetchlist)
+						mystr = str(mysum[0]/1024)
+						mycount=len(mystr)
+						while (mycount > 3):
+							mycount-=3
+							mystr=mystr[:mycount]+","+mystr[mycount:]
+						mysum[0]=mystr+" kB"
+					except KeyError, e:
+						mysum[0] = "Unknown (missing digest for %s)" % str(e)
+
+					if self.verbose:
+						print "     ", darkgreen("Latest version available:"),myversion
+						print "     ", self.getInstallationStatus(mycat+'/'+mypkg)
+						print "     ", darkgreen("Size of files:"),mysum[0]
+						print "     ", darkgreen("Homepage:")+"     ",homepage
+						print "     ", darkgreen("Description:")+"  ",desc
+						print "     ", darkgreen("License:")+"      ",license
+						print
+		print
+	#
+	# private interface
+	#
+	def getInstallationStatus(self,package):
+		installed_package = self.vartree.dep_bestmatch(package)
+		result = ""
+		version = self.getVersion(installed_package,search.VERSION_RELEASE)
+		if len(version) > 0:
+			result = darkgreen("Latest version installed:")+" "+version
+		else:
+			result = darkgreen("Latest version installed:")+" [ Not Installed ]"
+		return result
+
+	def getVersion(self,full_package,detail):
+		if len(full_package) > 1:
+			package_parts = portage.catpkgsplit(full_package)
+			if detail == search.VERSION_RELEASE and package_parts[3] != 'r0':
+				result = package_parts[2]+ "-" + package_parts[3]
+			else:
+				result = package_parts[2]
+		else:
+			result = ""
+		return result
+
+
+#build our package digraph
+def getlist(settings, mode):
+	if mode=="system":
+		mylines = settings.packages
+	elif mode=="world":
+		try:
+			file_path = os.path.join(settings["ROOT"], portage.WORLD_FILE)
+			myfile = open(file_path, "r")
+			mylines = myfile.readlines()
+			myfile.close()
+		except (OSError, IOError), e:
+			if e.errno == errno.ENOENT:
+				portage.writemsg("\n!!! World file does not exist: '%s'\n" % file_path)
+				mylines=[]
+			else:
+				raise
+	mynewlines=[]
+	for x in mylines:
+		myline=" ".join(x.split())
+		if not len(myline):
+			continue
+		elif myline[0]=="#":
+			continue
+		elif mode=="system":
+			if myline[0]!="*":
+				continue
+			myline=myline[1:]
+		mynewlines.append(myline.strip())
+
+	return mynewlines
+
+def clean_world(vardb, cpv):
+	"""Remove a package from the world file when unmerged."""
+	world_filename = os.path.join(vardb.root, portage.WORLD_FILE)
+	worldlist = portage.util.grabfile(world_filename)
+	mykey = portage.cpv_getkey(cpv)
+	newworldlist = []
+	for x in worldlist:
+		if portage.dep_getkey(x) == mykey:
+			matches = vardb.match(x, use_cache=0)
+			if not matches:
+				#zap our world entry
+				pass
+			elif len(matches) == 1 and matches[0] == cpv:
+				#zap our world entry
+				pass
+			else:
+				#others are around; keep it.
+				newworldlist.append(x)
+		else:
+			#this doesn't match the package we're unmerging; keep it.
+			newworldlist.append(x)
+
+	portage.util.ensure_dirs(os.path.join(vardb.root, portage.PRIVATE_PATH),
+		gid=portage.portage_gid, mode=02770)
+	portage.util.write_atomic(world_filename, "\n".join(newworldlist))
+
+def genericdict(mylist):
+	mynewdict={}
+	for x in mylist:
+		mynewdict[portage.dep_getkey(x)]=x
+	return mynewdict
+
+def filter_iuse_defaults(iuse):
+	for flag in iuse:
+		if flag.startswith("+") or flag.startswith("-"):
+			yield flag[1:]
+		else:
+			yield flag
+
+class DepPriority(object):
+	"""
+		This class generates an integer priority level based of various
+		attributes of the dependency relationship.  Attributes can be assigned
+		at any time and the new integer value will be generated on calls to the
+		__int__() method.  Rich comparison operators are supported.
+
+		The boolean attributes that affect the integer value are "satisfied",
+		"buildtime", "runtime", and "system".  Various combinations of
+		attributes lead to the following priority levels:
+
+		Combination of properties    Priority level
+
+		not satisfied and buildtime     0
+		not satisfied and runtime      -1
+		satisfied and buildtime        -2
+		satisfied and runtime          -3
+		(none of the above)            -4
+
+		Several integer constants are defined for categorization of priority
+		levels:
+
+		MEDIUM   The upper boundary for medium dependencies.
+		SOFT     The upper boundary for soft dependencies.
+		MIN      The lower boundary for soft dependencies.
+	"""
+	__slots__ = ("__weakref__", "satisfied", "buildtime", "runtime")
+	MEDIUM = -1
+	SOFT   = -2
+	MIN    = -4
+	def __init__(self, **kwargs):
+		for myattr in self.__slots__:
+			if myattr == "__weakref__":
+				continue
+			myvalue = kwargs.get(myattr, False)
+			setattr(self, myattr, myvalue)
+	def __int__(self):
+		if not self.satisfied:
+			if self.buildtime:
+				return 0
+			if self.runtime:
+				return -1
+		if self.buildtime:
+			return -2
+		if self.runtime:
+			return -3
+		return -4
+	def __lt__(self, other):
+		return self.__int__() < other
+	def __le__(self, other):
+		return self.__int__() <= other
+	def __eq__(self, other):
+		return self.__int__() == other
+	def __ne__(self, other):
+		return self.__int__() != other
+	def __gt__(self, other):
+		return self.__int__() > other
+	def __ge__(self, other):
+		return self.__int__() >= other
+	def copy(self):
+		import copy
+		return copy.copy(self)
+	def __str__(self):
+		myvalue = self.__int__()
+		if myvalue > self.MEDIUM:
+			return "hard"
+		if myvalue > self.SOFT:
+			return "medium"
+		return "soft"
+
+class FakeVartree(portage.vartree):
+	"""This is implements an in-memory copy of a vartree instance that provides
+	all the interfaces required for use by the depgraph.  The vardb is locked
+	during the constructor call just long enough to read a copy of the
+	installed package information.  This allows the depgraph to do it's
+	dependency calculations without holding a lock on the vardb.  It also
+	allows things like vardb global updates to be done in memory so that the
+	user doesn't necessarily need write access to the vardb in cases where
+	global updates are necessary (updates are performed when necessary if there
+	is not a matching ebuild in the tree)."""
+	def __init__(self, real_vartree, portdb):
+		self.root = real_vartree.root
+		self.settings = real_vartree.settings
+		self.dbapi = portage.fakedbapi(settings=real_vartree.settings)
+		vdb_path = os.path.join(self.root, portage.VDB_PATH)
+		try:
+			# At least the parent needs to exist for the lock file.
+			portage.util.ensure_dirs(vdb_path)
+		except portage.exception.PortageException:
+			pass
+		vdb_lock = None
+		try:
+			if os.access(vdb_path, os.W_OK):
+				vdb_lock = portage.locks.lockdir(vdb_path)
+			mykeys = ["SLOT", "COUNTER", "PROVIDE", "USE", "IUSE",
+				"DEPEND", "RDEPEND", "PDEPEND"]
+			real_dbapi = real_vartree.dbapi
+			slot_counters = {}
+			for cpv in real_dbapi.cpv_all():
+				metadata = dict(izip(mykeys, real_dbapi.aux_get(cpv, mykeys)))
+				myslot = metadata["SLOT"]
+				mycp = portage.dep_getkey(cpv)
+				myslot_atom = "%s:%s" % (mycp, myslot)
+				try:
+					mycounter = long(metadata["COUNTER"])
+				except ValueError:
+					mycounter = 0
+					metadata["COUNTER"] = str(mycounter)
+				other_counter = slot_counters.get(myslot_atom, None)
+				if other_counter is not None:
+					if other_counter > mycounter:
+						continue
+				slot_counters[myslot_atom] = mycounter
+				self.dbapi.cpv_inject(cpv, metadata=metadata)
+			real_dbapi.flush_cache()
+		finally:
+			if vdb_lock:
+				portage.locks.unlockdir(vdb_lock)
+		# Populate the old-style virtuals using the cached values.
+		if not self.settings.treeVirtuals:
+			self.settings.treeVirtuals = portage.util.map_dictlist_vals(
+				portage.getCPFromCPV, self.get_all_provides())
+
+		# Intialize variables needed for lazy cache pulls of the live ebuild
+		# metadata.  This ensures that the vardb lock is released ASAP, without
+		# being delayed in case cache generation is triggered.
+		self._aux_get = self.dbapi.aux_get
+		self.dbapi.aux_get = self._aux_get_wrapper
+		self._aux_get_history = set()
+		self._portdb_keys = ["DEPEND", "RDEPEND", "PDEPEND"]
+		self._portdb = portdb
+		self._global_updates = None
+
+	def _aux_get_wrapper(self, pkg, wants):
+		if pkg in self._aux_get_history:
+			return self._aux_get(pkg, wants)
+		self._aux_get_history.add(pkg)
+		try:
+			# Use the live ebuild metadata if possible.
+			live_metadata = dict(izip(self._portdb_keys,
+				self._portdb.aux_get(pkg, self._portdb_keys)))
+			self.dbapi.aux_update(pkg, live_metadata)
+		except (KeyError, portage.exception.PortageException):
+			if self._global_updates is None:
+				self._global_updates = \
+					grab_global_updates(self._portdb.porttree_root)
+			perform_global_updates(
+				pkg, self.dbapi, self._global_updates)
+		return self._aux_get(pkg, wants)
+
+def grab_global_updates(portdir):
+	from portage.update import grab_updates, parse_updates
+	updpath = os.path.join(portdir, "profiles", "updates")
+	try:
+		rawupdates = grab_updates(updpath)
+	except portage.exception.DirectoryNotFound:
+		rawupdates = []
+	upd_commands = []
+	for mykey, mystat, mycontent in rawupdates:
+		commands, errors = parse_updates(mycontent)
+		upd_commands.extend(commands)
+	return upd_commands
+
+def perform_global_updates(mycpv, mydb, mycommands):
+	from portage.update import update_dbentries
+	aux_keys = ["DEPEND", "RDEPEND", "PDEPEND"]
+	aux_dict = dict(izip(aux_keys, mydb.aux_get(mycpv, aux_keys)))
+	updates = update_dbentries(mycommands, aux_dict)
+	if updates:
+		mydb.aux_update(mycpv, updates)
+
+class BlockerCache(DictMixin):
+	"""This caches blockers of installed packages so that dep_check does not
+	have to be done for every single installed package on every invocation of
+	emerge.  The cache is invalidated whenever it is detected that something
+	has changed that might alter the results of dep_check() calls:
+		1) the set of installed packages (including COUNTER) has changed
+		2) the old-style virtuals have changed
+	"""
+	class BlockerData(object):
+		def __init__(self, counter, atoms):
+			self.counter = counter
+			self.atoms = atoms
+
+	def __init__(self, myroot, vardb):
+		self._vardb = vardb
+		self._installed_pkgs = set(vardb.cpv_all())
+		self._virtuals = vardb.settings.getvirtuals()
+		self._cache_filename = os.path.join(myroot,
+			portage.CACHE_PATH.lstrip(os.path.sep), "vdb_blockers.pickle")
+		self._cache_version = "1"
+		self._cache_data = None
+		self._modified = False
+		self._load()
+
+	def _load(self):
+		try:
+			f = open(self._cache_filename)
+			mypickle = cPickle.Unpickler(f)
+			mypickle.find_global = None
+			self._cache_data = mypickle.load()
+			f.close()
+			del f
+		except (IOError, OSError, EOFError, cPickle.UnpicklingError):
+			pass
+		cache_valid = self._cache_data and \
+			isinstance(self._cache_data, dict) and \
+			self._cache_data.get("version") == self._cache_version and \
+			self._cache_data.get("virtuals") == self._virtuals and \
+			set(self._cache_data.get("blockers", [])) == self._installed_pkgs
+		if cache_valid:
+			for pkg in self._installed_pkgs:
+				if long(self._vardb.aux_get(pkg, ["COUNTER"])[0]) != \
+					self[pkg].counter:
+					cache_valid = False
+					break
+		if not cache_valid:
+			self._cache_data = {"version":self._cache_version}
+			self._cache_data["blockers"] = {}
+			self._cache_data["virtuals"] = self._virtuals
+		self._modified = False
+
+	def flush(self):
+		"""If the current user has permission and the internal blocker cache
+		been updated, save it to disk and mark it unmodified.  This is called
+		by emerge after it has proccessed blockers for all installed packages.
+		Currently, the cache is only written if the user has superuser
+		privileges (since that's required to obtain a lock), but all users
+		have read access and benefit from faster blocker lookups (as long as
+		the entire cache is still valid).  The cache is stored as a pickled
+		dict object with the following format:
+
+		{
+			version : "1",
+			"blockers" : {cpv1:(counter,(atom1, atom2...)), cpv2...},
+			"virtuals" : vardb.settings.getvirtuals()
+		}
+		"""
+		if self._modified and \
+			secpass >= 2:
+			try:
+				f = portage.util.atomic_ofstream(self._cache_filename)
+				cPickle.dump(self._cache_data, f, -1)
+				f.close()
+				portage.util.apply_secpass_permissions(
+					self._cache_filename, gid=portage.portage_gid, mode=0644)
+			except (IOError, OSError), e:
+				pass
+			self._modified = False
+
+	def __setitem__(self, cpv, blocker_data):
+		"""
+		Update the cache and mark it as modified for a future call to
+		self.flush().
+
+		@param cpv: Package for which to cache blockers.
+		@type cpv: String
+		@param blocker_data: An object with counter and atoms attributes.
+		@type blocker_data: BlockerData
+		"""
+		self._cache_data["blockers"][cpv] = \
+			(blocker_data.counter, blocker_data.atoms)
+		self._modified = True
+
+	def __getitem__(self, cpv):
+		"""
+		@rtype: BlockerData
+		@returns: An object with counter and atoms attributes.
+		"""
+		return self.BlockerData(*self._cache_data["blockers"][cpv])
+
+def show_invalid_depstring_notice(parent_node, depstring, error_msg):
+
+	from formatter import AbstractFormatter, DumbWriter
+	f = AbstractFormatter(DumbWriter(maxcol=72))
+
+	print "\n\n!!! Invalid or corrupt dependency specification: "
+	print
+	print error_msg
+	print
+	print parent_node
+	print
+	print depstring
+	print
+	p_type, p_root, p_key, p_status = parent_node
+	msg = []
+	if p_status == "nomerge":
+		category, pf = portage.catsplit(p_key)
+		pkg_location = os.path.join(p_root, portage.VDB_PATH, category, pf)
+		msg.append("Portage is unable to process the dependencies of the ")
+		msg.append("'%s' package. " % p_key)
+		msg.append("In order to correct this problem, the package ")
+		msg.append("should be uninstalled, reinstalled, or upgraded. ")
+		msg.append("As a temporary workaround, the --nodeps option can ")
+		msg.append("be used to ignore all dependencies.  For reference, ")
+		msg.append("the problematic dependencies can be found in the ")
+		msg.append("*DEPEND files located in '%s/'." % pkg_location)
+	else:
+		msg.append("This package can not be installed.  ")
+		msg.append("Please notify the '%s' package maintainer " % p_key)
+		msg.append("about this problem.")
+
+	for x in msg:
+		f.add_flowing_data(x)
+	f.end_paragraph(1)
+
+class depgraph:
+
+	pkg_tree_map = {
+		"ebuild":"porttree",
+		"binary":"bintree",
+		"installed":"vartree"}
+
+	def __init__(self, settings, trees, myopts, myparams, spinner):
+		self.settings = settings
+		self.target_root = settings["ROOT"]
+		self.myopts = myopts
+		self.myparams = myparams
+		self.edebug = 0
+		if settings.get("PORTAGE_DEBUG", "") == "1":
+			self.edebug = 1
+		self.spinner = spinner
+		self.pkgsettings = {}
+		# Maps cpv to digraph node for all nodes added to the graph.
+		self.pkg_node_map = {}
+		# Maps slot atom to digraph node for all nodes added to the graph.
+		self._slot_node_map = {}
+		self.mydbapi = {}
+		self._mydbapi_keys = ["SLOT", "DEPEND", "RDEPEND", "PDEPEND"]
+		self.useFlags = {}
+		self.trees = {}
+		for myroot in trees:
+			self.trees[myroot] = {}
+			for tree in ("porttree", "bintree"):
+				self.trees[myroot][tree] = trees[myroot][tree]
+			self.trees[myroot]["vartree"] = \
+				FakeVartree(trees[myroot]["vartree"],
+					trees[myroot]["porttree"].dbapi)
+			self.pkgsettings[myroot] = portage.config(
+				clone=self.trees[myroot]["vartree"].settings)
+			self.pkg_node_map[myroot] = {}
+			self._slot_node_map[myroot] = {}
+			vardb = self.trees[myroot]["vartree"].dbapi
+			# This fakedbapi instance will model the state that the vdb will
+			# have after new packages have been installed.
+			fakedb = portage.fakedbapi(settings=self.pkgsettings[myroot])
+			self.mydbapi[myroot] = fakedb
+			if "--nodeps" not in self.myopts and \
+				"--buildpkgonly" not in self.myopts:
+				# --nodeps bypasses this, since it isn't needed in this case
+				# and the cache pulls might trigger (slow) cache generation.
+				for pkg in vardb.cpv_all():
+					self.spinner.update()
+					fakedb.cpv_inject(pkg,
+						metadata=dict(izip(self._mydbapi_keys,
+						vardb.aux_get(pkg, self._mydbapi_keys))))
+			del vardb, fakedb
+			self.useFlags[myroot] = {}
+			if "--usepkg" in self.myopts:
+				self.trees[myroot]["bintree"].populate(
+					"--getbinpkg" in self.myopts,
+					"--getbinpkgonly" in self.myopts)
+		del trees
+
+		self.missingbins=[]
+		self.digraph=portage.digraph()
+		# Tracks simple parent/child relationships (PDEPEND relationships are
+		# not reversed).
+		self._parent_child_digraph = digraph()
+		self.orderedkeys=[]
+		self.outdatedpackages=[]
+		self.args_keys = []
+		self.blocker_digraph = digraph()
+		self.blocker_parents = {}
+		self._unresolved_blocker_parents = {}
+		self._slot_collision_info = []
+		# Slot collision nodes are not allowed to block other packages since
+		# blocker validation is only able to account for one package per slot.
+		self._slot_collision_nodes = set()
+		self._altlist_cache = {}
+		self._pprovided_args = []
+
+	def _show_slot_collision_notice(self, packages):
+		"""Show an informational message advising the user to mask one of the
+		the packages. In some cases it may be possible to resolve this
+		automatically, but support for backtracking (removal nodes that have
+		already been selected) will be required in order to handle all possible
+		cases."""
+
+		msg = []
+		msg.append("\n!!! Multiple versions within a single " + \
+			"package slot have been \n")
+		msg.append("!!! pulled into the dependency graph:\n\n")
+		for node, parents in packages:
+			msg.append(str(node))
+			if parents:
+				msg.append(" pulled in by\n")
+				for parent in parents:
+					msg.append("  ")
+					msg.append(str(parent))
+					msg.append("\n")
+			else:
+				msg.append(" (no parents)\n")
+			msg.append("\n")
+		sys.stderr.write("".join(msg))
+		sys.stderr.flush()
+
+		if "--quiet" in self.myopts:
+			return
+
+		msg = []
+		msg.append("It may be possible to solve this problem ")
+		msg.append("by using package.mask to prevent one of ")
+		msg.append("those packages from being selected. ")
+		msg.append("However, it is also possible that conflicting ")
+		msg.append("dependencies exist such that they are impossible to ")
+		msg.append("satisfy simultaneously.  If such a conflict exists in ")
+		msg.append("the dependencies of two different packages, then those ")
+		msg.append("packages can not be installed simultaneously.")
+
+		from formatter import AbstractFormatter, DumbWriter
+		f = AbstractFormatter(DumbWriter(sys.stderr, maxcol=72))
+		for x in msg:
+			f.add_flowing_data(x)
+		f.end_paragraph(1)
+
+		msg = []
+		msg.append("For more information, see MASKED PACKAGES ")
+		msg.append("section in the emerge man page or refer ")
+		msg.append("to the Gentoo Handbook.")
+		for x in msg:
+			f.add_flowing_data(x)
+		f.end_paragraph(1)
+		f.writer.flush()
+
+	def create(self, mybigkey, myparent=None, addme=1, myuse=None,
+		priority=DepPriority(), rev_dep=False, arg=None):
+		"""
+		Fills the digraph with nodes comprised of packages to merge.
+		mybigkey is the package spec of the package to merge.
+		myparent is the package depending on mybigkey ( or None )
+		addme = Should we add this package to the digraph or are we just looking at it's deps?
+			Think --onlydeps, we need to ignore packages in that case.
+		#stuff to add:
+		#SLOT-aware emerge
+		#IUSE-aware emerge -> USE DEP aware depgraph
+		#"no downgrade" emerge
+		"""
+		mytype, myroot, mykey = mybigkey
+		existing_node = None
+		if addme:
+			existing_node = self.pkg_node_map[myroot].get(mykey)
+		if existing_node:
+			self._parent_child_digraph.add(existing_node, myparent)
+			if existing_node != myparent:
+				# Refuse to make a node depend on itself so that the we don't
+				# don't create a bogus circular dependency in self.altlist().
+				if rev_dep and myparent:
+					self.digraph.addnode(myparent, existing_node,
+						priority=priority)
+				else:
+					self.digraph.addnode(existing_node, myparent,
+						priority=priority)
+			return 1
+		
+		if "--nodeps" not in self.myopts:
+			self.spinner.update()
+		if mytype == "blocks":
+			if myparent and \
+				"--buildpkgonly" not in self.myopts and \
+				"--nodeps" not in self.myopts and \
+				myparent not in self._slot_collision_nodes:
+				mybigkey[1] = myparent[1]
+				self.blocker_parents.setdefault(
+					tuple(mybigkey), set()).add(myparent)
+			return 1
+
+		# select the correct /var database that we'll be checking against
+		vardbapi = self.trees[myroot]["vartree"].dbapi
+		portdb = self.trees[myroot]["porttree"].dbapi
+		bindb = self.trees[myroot]["bintree"].dbapi
+		pkgsettings = self.pkgsettings[myroot]
+
+		# if the package is already on the system, we add a "nomerge"
+		# directive, otherwise we add a "merge" directive.
+
+		mydbapi = self.trees[myroot][self.pkg_tree_map[mytype]].dbapi
+
+		if not arg and myroot == self.target_root:
+			cpv_slot = "%s:%s" % (mykey, mydbapi.aux_get(mykey, ["SLOT"])[0])
+			arg = portage.best_match_to_list(cpv_slot, self.args_keys)
+
+		if myuse is None:
+			self.pkgsettings[myroot].setcpv(mykey, mydb=portdb)
+			myuse = self.pkgsettings[myroot]["USE"].split()
+
+		merging=1
+		if mytype == "installed":
+			merging = 0
+		if addme and mytype != "installed":
+		# this is where we add the node to the list of packages to merge
+			if "selective" in self.myparams or not arg:
+				if "empty" not in self.myparams and vardbapi.cpv_exists(mykey):
+					merging=0
+
+			""" If we aren't merging, perform the --newuse check.
+			    If the package has new iuse flags or different use flags then if
+			    --newuse is specified, we need to merge the package. """
+			if merging==0 and "--newuse" in self.myopts and \
+				vardbapi.cpv_exists(mykey):
+				pkgsettings.setcpv(mykey, mydb=mydbapi)
+				forced_flags = set()
+				forced_flags.update(pkgsettings.useforce)
+				forced_flags.update(pkgsettings.usemask)
+				old_use = vardbapi.aux_get(mykey, ["USE"])[0].split()
+				iuses = set(filter_iuse_defaults(
+					mydbapi.aux_get(mykey, ["IUSE"])[0].split()))
+				old_iuse = set(filter_iuse_defaults(
+					vardbapi.aux_get(mykey, ["IUSE"])[0].split()))
+				if iuses.symmetric_difference(
+					old_iuse).difference(forced_flags):
+					merging = 1
+				elif old_iuse.intersection(old_use) != \
+					iuses.intersection(myuse):
+					merging=1
+
+		if addme and merging == 1:
+			mybigkey.append("merge")
+		else:
+			mybigkey.append("nomerge")
+		jbigkey = tuple(mybigkey)
+
+		if addme:
+			metadata = dict(izip(self._mydbapi_keys,
+				mydbapi.aux_get(mykey, self._mydbapi_keys)))
+			if merging == 0 and vardbapi.cpv_exists(mykey) and \
+				mytype != "installed":
+				mybigkey[0] = "installed"
+				mydbapi = vardbapi
+				jbigkey = tuple(mybigkey)
+				metadata = dict(izip(self._mydbapi_keys,
+					mydbapi.aux_get(mykey, self._mydbapi_keys)))
+				myuse = mydbapi.aux_get(mykey, ["USE"])[0].split()
+			slot_atom = "%s:%s" % (portage.dep_getkey(mykey), metadata["SLOT"])
+			existing_node = self._slot_node_map[myroot].get(
+				slot_atom, None)
+			slot_collision = False
+			if existing_node:
+				e_type, myroot, e_cpv, e_status = existing_node
+				if mykey == e_cpv:
+					# The existing node can be reused.
+					self._parent_child_digraph.add(existing_node, myparent)
+					if rev_dep and myparent:
+						ptype, proot, pkey, pstatus = myparent
+						self.digraph.addnode(myparent, existing_node,
+							priority=priority)
+					else:
+						self.digraph.addnode(existing_node, myparent,
+							priority=priority)
+					return 1
+				else:
+					# A slot collision has occurred.  Sometimes this coincides
+					# with unresolvable blockers, so the slot collision will be
+					# shown later if there are no unresolvable blockers.
+					e_parents = self._parent_child_digraph.parent_nodes(
+						existing_node)
+					myparents = []
+					if myparent:
+						myparents.append(myparent)
+					self._slot_collision_info.append(
+						((jbigkey, myparents), (existing_node, e_parents)))
+					self._slot_collision_nodes.add(jbigkey)
+					slot_collision = True
+
+			if slot_collision:
+				# Now add this node to the graph so that self.display()
+				# can show use flags and --tree portage.output.  This node is
+				# only being partially added to the graph.  It must not be
+				# allowed to interfere with the other nodes that have been
+				# added.  Do not overwrite data for existing nodes in
+				# self.pkg_node_map and self.mydbapi since that data will
+				# be used for blocker validation.
+				self.pkg_node_map[myroot].setdefault(mykey, jbigkey)
+				self.useFlags[myroot].setdefault(mykey, myuse)
+				# Even though the graph is now invalid, continue to process
+				# dependencies so that things like --fetchonly can still
+				# function despite collisions.
+			else:
+				self.mydbapi[myroot].cpv_inject(mykey, metadata=metadata)
+				self._slot_node_map[myroot][slot_atom] = jbigkey
+				self.pkg_node_map[myroot][mykey] = jbigkey
+				self.useFlags[myroot][mykey] = myuse
+
+			if rev_dep and myparent:
+				self.digraph.addnode(myparent, jbigkey,
+					priority=priority)
+			else:
+				self.digraph.addnode(jbigkey, myparent,
+					priority=priority)
+
+		# Do this even when addme is False (--onlydeps) so that the
+		# parent/child relationship is always known in case
+		# self._show_slot_collision_notice() needs to be called later.
+		self._parent_child_digraph.add(jbigkey, myparent)
+
+		""" This section determines whether we go deeper into dependencies or not.
+		    We want to go deeper on a few occasions:
+		    Installing package A, we need to make sure package A's deps are met.
+		    emerge --deep <pkgspec>; we need to recursively check dependencies of pkgspec
+		    If we are in --nodeps (no recursion) mode, we obviously only check 1 level of dependencies.
+		"""
+		if "deep" not in self.myparams and not merging and \
+			not ("--update" in self.myopts and arg and merging):
+			return 1
+		elif "recurse" not in self.myparams:
+			return 1
+
+		""" Check DEPEND/RDEPEND/PDEPEND/SLOT
+		Pull from bintree if it's binary package, porttree if it's ebuild.
+		Binpkg's can be either remote or local. """
+
+		edepend={}
+		depkeys = ["DEPEND","RDEPEND","PDEPEND"]
+		depvalues = mydbapi.aux_get(mykey, depkeys)
+		for i in xrange(len(depkeys)):
+			edepend[depkeys[i]] = depvalues[i]
+
+		if mytype == "ebuild":
+			if "--buildpkgonly" in self.myopts:
+				edepend["RDEPEND"] = ""
+				edepend["PDEPEND"] = ""
+		if not (arg and "--onlydeps" in self.myopts and \
+			mytype == "ebuild") and \
+			self.myopts.get("--with-bdeps", "n") == "n" and \
+			(mytype == "binary" or mybigkey[3] == "nomerge"):
+			edepend["DEPEND"] = ""
+
+		""" We have retrieve the dependency information, now we need to recursively
+		    process them.  DEPEND gets processed for root = "/", {R,P}DEPEND in myroot. """
+		
+		mp = tuple(mybigkey)
+
+		try:
+			if not self.select_dep("/", edepend["DEPEND"], myparent=mp,
+				myuse=myuse, priority=DepPriority(buildtime=True),
+				parent_arg=arg):
+				return 0
+			"""RDEPEND is soft by definition.  However, in order to ensure
+			correct merge order, we make it a hard dependency.  Otherwise, a
+			build time dependency might not be usable due to it's run time
+			dependencies not being installed yet.
+			"""
+			if not self.select_dep(myroot,edepend["RDEPEND"], myparent=mp,
+				myuse=myuse, priority=DepPriority(runtime=True),
+				parent_arg=arg):
+				return 0
+			if edepend.has_key("PDEPEND") and edepend["PDEPEND"]:
+				# Post Depend -- Add to the list without a parent, as it depends
+				# on a package being present AND must be built after that package.
+				if not self.select_dep(myroot, edepend["PDEPEND"], myparent=mp,
+					myuse=myuse, priority=DepPriority(), rev_deps=True,
+					parent_arg=arg):
+					return 0
+		except ValueError, e:
+			pkgs = e.args[0]
+			portage.writemsg("\n\n!!! An atom in the dependencies " + \
+				"is not fully-qualified. Multiple matches:\n\n", noiselevel=-1)
+			for cpv in pkgs:
+				portage.writemsg("    %s\n" % cpv, noiselevel=-1)
+			portage.writemsg("\n", noiselevel=-1)
+			if mytype == "binary":
+				portage.writemsg(
+					"!!! This binary package cannot be installed: '%s'\n" % \
+					mykey, noiselevel=-1)
+			elif mytype == "ebuild":
+				myebuild, mylocation = portdb.findname2(mykey)
+				portage.writemsg("!!! This ebuild cannot be installed: " + \
+					"'%s'\n" % myebuild, noiselevel=-1)
+			portage.writemsg("!!! Please notify the package maintainer " + \
+				"that atoms must be fully-qualified.\n", noiselevel=-1)
+			return 0
+		return 1
+
+	def select_files(self,myfiles):
+		"given a list of .tbz2s, .ebuilds and deps, create the appropriate depgraph and return a favorite list"
+		myfavorites=[]
+		myroot = self.target_root
+		portdb = self.trees[myroot]["porttree"].dbapi
+		bindb = self.trees[myroot]["bintree"].dbapi
+		pkgsettings = self.pkgsettings[myroot]
+		arg_atoms = []
+		def visible(mylist):
+			matches = portdb.gvisible(portdb.visible(mylist))
+			return [x for x in mylist \
+				if x in matches or not portdb.cpv_exists(x)]
+		for x in myfiles:
+			ext = os.path.splitext(x)[1]
+			if ext==".tbz2":
+				if not os.path.exists(x):
+					if os.path.exists(
+						os.path.join(pkgsettings["PKGDIR"], "All", x)):
+						x = os.path.join(pkgsettings["PKGDIR"], "All", x)
+					elif os.path.exists(
+						os.path.join(pkgsettings["PKGDIR"], x)):
+						x = os.path.join(pkgsettings["PKGDIR"], x)
+					else:
+						print "\n\n!!! Binary package '"+str(x)+"' does not exist."
+						print "!!! Please ensure the tbz2 exists as specified.\n"
+						sys.exit(1)
+				mytbz2=portage.xpak.tbz2(x)
+				mykey=mytbz2.getelements("CATEGORY")[0]+"/"+os.path.splitext(os.path.basename(x))[0]
+				if os.path.realpath(x) != \
+					os.path.realpath(self.trees[myroot]["bintree"].getname(mykey)):
+					print colorize("BAD", "\n*** You need to adjust PKGDIR to emerge this package.\n")
+					sys.exit(1)
+				if not self.create(["binary", myroot, mykey],
+					None, "--onlydeps" not in self.myopts):
+					return (0,myfavorites)
+				elif not "--oneshot" in self.myopts:
+					myfavorites.append(mykey)
+			elif ext==".ebuild":
+				x = os.path.realpath(x)
+				mykey=os.path.basename(os.path.normpath(x+"/../.."))+"/"+os.path.splitext(os.path.basename(x))[0]
+				ebuild_path = portdb.findname(mykey)
+				if ebuild_path:
+					if os.path.realpath(ebuild_path) != x:
+						print colorize("BAD", "\n*** You need to adjust PORTDIR or PORTDIR_OVERLAY to emerge this package.\n")
+						sys.exit(1)
+					if mykey not in portdb.xmatch(
+						"match-visible", portage.dep_getkey(mykey)):
+						print colorize("BAD", "\n*** You are emerging a masked package. It is MUCH better to use")
+						print colorize("BAD", "*** /etc/portage/package.* to accomplish this. See portage(5) man")
+						print colorize("BAD", "*** page for details.")
+						countdown(int(self.settings["EMERGE_WARNING_DELAY"]),
+							"Continuing...")
+				else:
+					raise portage.exception.PackageNotFound(
+						"%s is not in a valid portage tree hierarchy or does not exist" % x)
+				if not self.create(["ebuild", myroot, mykey],
+					None, "--onlydeps" not in self.myopts):
+					return (0,myfavorites)
+				elif not "--oneshot" in self.myopts:
+					myfavorites.append(mykey)
+			else:
+				if not is_valid_package_atom(x):
+					portage.writemsg("\n\n!!! '%s' is not a valid package atom.\n" % x,
+						noiselevel=-1)
+					portage.writemsg("!!! Please check ebuild(5) for full details.\n")
+					portage.writemsg("!!! (Did you specify a version but forget to prefix with '='?)\n")
+					return (0,[])
+				try:
+					mykey = None
+					if "--usepkg" in self.myopts:
+						mykey = portage.dep_expand(x, mydb=bindb,
+							settings=pkgsettings)
+					if (mykey and not mykey.startswith("null/")) or \
+						"--usepkgonly" in self.myopts:
+						arg_atoms.append((x, mykey))
+						continue
+
+					mykey = portage.dep_expand(x,
+						mydb=portdb, settings=pkgsettings)
+					arg_atoms.append((x, mykey))
+				except ValueError, errpkgs:
+					print "\n\n!!! The short ebuild name \"" + x + "\" is ambiguous.  Please specify"
+					print "!!! one of the following fully-qualified ebuild names instead:\n"
+					for i in errpkgs[0]:
+						print "    " + green(i)
+					print
+					sys.exit(1)
+
+		if "--update" in self.myopts:
+			"""Make sure all installed slots are updated when possible. Do this
+			with --emptytree also, to ensure that all slots are remerged."""
+			vardb = self.trees[self.target_root]["vartree"].dbapi
+			greedy_atoms = []
+			for myarg, myatom in arg_atoms:
+				greedy_atoms.append((myarg, myatom))
+				myslots = set()
+				for cpv in vardb.match(myatom):
+					myslots.add(vardb.aux_get(cpv, ["SLOT"])[0])
+				if myslots:
+					best_pkgs = []
+					if "--usepkg" in self.myopts:
+						mymatches = bindb.match(myatom)
+						if "--usepkgonly" not in self.myopts:
+							mymatches = visible(mymatches)
+						best_pkg = portage.best(mymatches)
+						if best_pkg:
+							best_slot = bindb.aux_get(best_pkg, ["SLOT"])[0]
+							best_pkgs.append(("binary", best_pkg, best_slot))
+					if "--usepkgonly" not in self.myopts:
+						best_pkg = portage.best(portdb.match(myatom))
+						if best_pkg:
+							best_slot = portdb.aux_get(best_pkg, ["SLOT"])[0]
+							best_pkgs.append(("ebuild", best_pkg, best_slot))
+					if best_pkgs:
+						best_pkg = portage.best([x[1] for x in best_pkgs])
+						best_pkgs = [x for x in best_pkgs if x[1] == best_pkg]
+						best_slot = best_pkgs[0][2]
+						myslots.add(best_slot)
+				if len(myslots) > 1:
+					for myslot in myslots:
+						myslot_atom = "%s:%s" % \
+							(portage.dep_getkey(myatom), myslot)
+						available = False
+						if "--usepkgonly" not in self.myopts and \
+							self.trees[self.target_root][
+							"porttree"].dbapi.match(myslot_atom):
+							available = True
+						elif "--usepkg" in self.myopts:
+							mymatches = bindb.match(myslot_atom)
+							if "--usepkgonly" not in self.myopts:
+								mymatches = visible(mymatches)
+							if mymatches:
+								available = True
+						if available:
+							greedy_atoms.append((myarg, myslot_atom))
+			arg_atoms = greedy_atoms
+
+		""" These are used inside self.create() in order to ensure packages
+		that happen to match arguments are not incorrectly marked as nomerge."""
+		self.args_keys = [x[1] for x in arg_atoms]
+		for myarg, myatom in arg_atoms:
+				try:
+					self.mysd = self.select_dep(myroot, myatom, arg=myarg)
+				except portage.exception.MissingSignature, e:
+					portage.writemsg("\n\n!!! A missing gpg signature is preventing portage from calculating the\n")
+					portage.writemsg("!!! required dependencies. This is a security feature enabled by the admin\n")
+					portage.writemsg("!!! to aid in the detection of malicious intent.\n\n")
+					portage.writemsg("!!! THIS IS A POSSIBLE INDICATION OF TAMPERED FILES -- CHECK CAREFULLY.\n")
+					portage.writemsg("!!! Affected file: %s\n" % (e), noiselevel=-1)
+					sys.exit(1)
+				except portage.exception.InvalidSignature, e:
+					portage.writemsg("\n\n!!! An invalid gpg signature is preventing portage from calculating the\n")
+					portage.writemsg("!!! required dependencies. This is a security feature enabled by the admin\n")
+					portage.writemsg("!!! to aid in the detection of malicious intent.\n\n")
+					portage.writemsg("!!! THIS IS A POSSIBLE INDICATION OF TAMPERED FILES -- CHECK CAREFULLY.\n")
+					portage.writemsg("!!! Affected file: %s\n" % (e), noiselevel=-1)
+					sys.exit(1)
+				except SystemExit, e:
+					raise # Needed else can't exit
+				except Exception, e:
+					print >> sys.stderr, "\n\n!!! Problem in '%s' dependencies." % mykey
+					print >> sys.stderr, "!!!", str(e), getattr(e, "__module__", None)
+					raise
+
+				if not self.mysd:
+					return (0,myfavorites)
+				elif not "--oneshot" in self.myopts:
+					mykey = portage.dep_getkey(myatom)
+					if mykey not in myfavorites:
+						myfavorites.append(mykey)
+
+		missing=0
+		if "--usepkgonly" in self.myopts:
+			for xs in self.digraph.all_nodes():
+				if len(xs) >= 4 and xs[0] != "binary" and xs[3] == "merge":
+					if missing == 0:
+						print
+					missing += 1
+					print "Missing binary for:",xs[2]
+
+		if not self.validate_blockers():
+			return False, myfavorites
+		
+		# We're true here unless we are missing binaries.
+		return (not missing,myfavorites)
+
+	def select_dep(self, myroot, depstring, myparent=None, arg=None,
+		myuse=None, raise_on_missing=False, priority=DepPriority(),
+		rev_deps=False, parent_arg=None):
+		""" Given a depstring, create the depgraph such that all dependencies are satisfied.
+		    myroot = $ROOT from environment, where {R,P}DEPENDs are merged to.
+		    myparent = the node whose depstring is being passed in
+		    arg = package was specified on the command line, merge even if it's already installed
+		    myuse = USE flags at present
+		    raise_on_missing = Given that the depgraph is not proper, raise an exception if true
+		    else continue trying.
+		    return 1 on success, 0 for failure
+		"""
+
+		portdb = self.trees[myroot]["porttree"].dbapi
+		bindb  = self.trees[myroot]["bintree"].dbapi
+		vardb  = self.trees[myroot]["vartree"].dbapi
+		pkgsettings = self.pkgsettings[myroot]
+		if myparent:
+			p_type, p_root, p_key, p_status = myparent
+
+		if "--debug" in self.myopts:
+			print
+			print "Parent:   ",myparent
+			print "Depstring:",depstring
+			if rev_deps:
+				print "Reverse:", rev_deps
+			print "Priority:", priority
+
+		#processing dependencies
+		""" Call portage.dep_check to evaluate the use? conditionals and make sure all
+		dependencies are satisfiable. """
+		if arg:
+			mymerge = [depstring]
+			pprovided = pkgsettings.pprovideddict.get(
+				portage.dep_getkey(depstring))
+			if pprovided and portage.match_from_list(depstring, pprovided):
+				mymerge = []
+		else:
+			try:
+				if myparent and p_status == "nomerge":
+					portage.dep._dep_check_strict = False
+				mycheck = portage.dep_check(depstring, None,
+					pkgsettings, myuse=myuse,
+					use_binaries=("--usepkgonly" in self.myopts),
+					myroot=myroot, trees=self.trees)
+			finally:
+				portage.dep._dep_check_strict = True
+	
+			if not mycheck[0]:
+				if myparent:
+					show_invalid_depstring_notice(
+						myparent, depstring, mycheck[1])
+				else:
+					sys.stderr.write("\n%s\n%s\n" % (depstring, mycheck[1]))
+				return 0
+			mymerge = mycheck[1]
+
+		if not mymerge and arg and \
+			portage.best_match_to_list(depstring, self.args_keys):
+			# A provided package has been specified on the command line.  The
+			# package will not be merged and a warning will be displayed.
+			self._pprovided_args.append(arg)
+
+		if myparent:
+			# The parent is added after it's own dep_check call so that it
+			# isn't allowed to satisfy a direct bootstrap dependency on itself
+			# via an old-style virtual.  This isn't a problem with new-style
+			# virtuals, which are preferenced in dep_zapdeps by looking only at
+			# the depstring, vdb, and available packages.
+
+			p_type, p_root, p_key, p_status = myparent
+			if p_status == "merge":
+				# Update old-style virtuals if this package provides any.
+				# These are needed for dep_virtual calls inside dep_check.
+				p_db = self.trees[p_root][self.pkg_tree_map[p_type]].dbapi
+				try:
+					self.pkgsettings[p_root].setinst(p_key, p_db)
+				except portage.exception.InvalidDependString, e:
+					provide = p_db.aux_get(p_key, ["PROVIDE"])[0]
+					show_invalid_depstring_notice(myparent, provide, str(e))
+					del e
+					return 0
+
+		if "--debug" in self.myopts:
+			print "Candidates:",mymerge
+		for x in mymerge:
+			selected_pkg = None
+			if x[0]=="!":
+				selected_pkg = ["blocks", myroot, x[1:], None]
+			else:
+				#We are not processing a blocker but a normal dependency
+				if myparent:
+					"""In some cases, dep_check will return deps that shouldn't
+					be proccessed any further, so they are identified and
+					discarded here."""
+					if "empty" not in self.myparams and \
+						"deep" not in self.myparams and \
+						not ("--update" in self.myopts and parent_arg) and \
+						vardb.match(x):
+						continue
+
+				# List of acceptable packages, ordered by type preference.
+				matched_packages = []
+				myeb_matches = portdb.xmatch("match-visible", x)
+				myeb = None
+				if "--usepkgonly" not in self.myopts:
+					myeb = portage.best(myeb_matches)
+
+				myeb_pkg=None
+				if "--usepkg" in self.myopts:
+					# The next line assumes the binarytree has been populated.
+					# XXX: Need to work out how we use the binary tree with roots.
+					myeb_pkg_matches = bindb.match(x)
+					if "--usepkgonly" not in self.myopts:
+						# Remove any binary package entries that are masked in the portage tree (#55871)
+						myeb_pkg_matches = [pkg for pkg in myeb_pkg_matches \
+							if pkg in myeb_matches or  \
+							not portdb.cpv_exists(pkg)]
+					if myeb_pkg_matches:
+						myeb_pkg = portage.best(myeb_pkg_matches)
+
+				if myeb_pkg and "--newuse" in self.myopts:
+					iuses = set(filter_iuse_defaults(
+						bindb.aux_get(myeb_pkg, ["IUSE"])[0].split()))
+					old_use = bindb.aux_get(myeb_pkg, ["USE"])[0].split()
+					mydb = None
+					if "--usepkgonly" not in self.myopts and myeb:
+						mydb = portdb
+					if myeb:
+						pkgsettings.setcpv(myeb, mydb=mydb)
+					else:
+						pkgsettings.setcpv(myeb_pkg, mydb=mydb)
+					now_use = pkgsettings["USE"].split()
+					forced_flags = set()
+					forced_flags.update(pkgsettings.useforce)
+					forced_flags.update(pkgsettings.usemask)
+					cur_iuse = iuses
+					if "--usepkgonly" not in self.myopts and myeb:
+						cur_iuse = set(filter_iuse_defaults(
+							portdb.aux_get(myeb, ["IUSE"])[0].split()))
+					if iuses.symmetric_difference(
+						cur_iuse).difference(forced_flags):
+						myeb_pkg = None
+					elif iuses.intersection(old_use) != \
+						cur_iuse.intersection(now_use):
+						myeb_pkg = None
+				if myeb_pkg:
+					binpkguseflags = \
+						self.trees[myroot]["bintree"].dbapi.aux_get(
+							myeb_pkg, ["USE"])[0].split()
+					matched_packages.append(
+						["binary", myroot, myeb_pkg, binpkguseflags])
+
+				if "--usepkgonly" not in self.myopts and myeb_matches:
+					matched_packages.append(
+						["ebuild", myroot, myeb, None])
+
+				if not matched_packages and \
+					not (arg and "selective" not in self.myparams):
+					"""Fall back to the installed package database.  This is a
+					last resort because the metadata tends to diverge from that
+					of the ebuild in the tree."""
+					myeb_inst_matches = vardb.match(x)
+					if "--usepkgonly" not in self.myopts:
+						""" TODO: Improve masking check for installed and
+						binary packages. bug #149816"""
+						myeb_inst_matches = [pkg for pkg in myeb_inst_matches \
+							if not portdb.cpv_exists(pkg)]
+					myeb_inst = None
+					if myeb_inst_matches:
+						myeb_inst = portage.best(myeb_inst_matches)
+					if myeb_inst:
+						binpkguseflags = vardb.aux_get(
+							myeb_inst, ["USE"])[0].split()
+						matched_packages.append(
+							["installed", myroot, myeb_inst, binpkguseflags])
+
+				if not matched_packages:
+					if raise_on_missing:
+						raise ValueError
+					if not arg:
+						xinfo='"'+x+'"'
+					else:
+						xinfo='"'+arg+'"'
+					if myparent:
+						xfrom = '(dependency required by '+ \
+							green('"%s"' % myparent[2]) + \
+							red(' [%s]' % myparent[0]) + ')'
+					alleb = portdb.xmatch("match-all", x)
+					if alleb:
+						if "--usepkgonly" not in self.myopts:
+							print "\n!!! "+red("All ebuilds that could satisfy ")+green(xinfo)+red(" have been masked.")
+							print "!!! One of the following masked packages is required to complete your request:"
+							oldcomment = ""
+							shown_licenses = []
+							for p in alleb:
+								mreasons = portage.getmaskingstatus(p,
+									settings=pkgsettings, portdb=portdb)
+								print "- "+p+" (masked by: "+", ".join(mreasons)+")"
+								if "package.mask" in mreasons:
+									comment, filename = \
+										portage.getmaskingreason(p,
+										settings=pkgsettings, portdb=portdb,
+										return_location=True)
+									if comment and comment != oldcomment:
+										print filename+":"
+										print comment
+										oldcomment = comment
+								try:
+									licenses = portdb.aux_get(p, ["LICENSE"])[0]
+								except KeyError:
+									# Corruption will have been reported above.
+									continue
+								uselist = []
+								if "?" in licenses:
+									pkgsettings.setcpv(p, mydb=portdb)
+									uselist = pkgsettings.get("USE", "").split()
+								missing_licenses = []
+								try:
+									missing_licenses = \
+										pkgsettings.getMissingLicenses(
+											licenses, p, uselist)
+								except portage.exception.InvalidDependString:
+									# This will have already been reported
+									# above via mreasons.
+									pass
+								for l in missing_licenses:
+									l_path = portdb.findLicensePath(l)
+									if l in shown_licenses:
+										continue
+									msg = ("A copy of the '%s' license" + \
+									" is located at '%s'.") % (l, l_path)
+									print msg
+									print
+									shown_licenses.append(l)
+							print
+							print "For more information, see MASKED PACKAGES section in the emerge man page or "
+							print "refer to the Gentoo Handbook."
+						else:
+							print "\n!!! "+red("There are no packages available to satisfy: ")+green(xinfo)
+							print "!!! Either add a suitable binary package or compile from an ebuild."
+					else:
+						print "\nemerge: there are no ebuilds to satisfy "+green(xinfo)+"."
+					if myparent:
+						print xfrom
+					print
+					return 0
+
+				if "--debug" in self.myopts:
+					for pkg in matched_packages:
+						print (pkg[0] + ":").rjust(10), pkg[2]
+
+				if len(matched_packages) > 1:
+					bestmatch = portage.best(
+						[pkg[2] for pkg in matched_packages])
+					matched_packages = [pkg for pkg in matched_packages \
+						if pkg[2] == bestmatch]
+
+				# ordered by type preference ("ebuild" type is the last resort)
+				selected_pkg =  matched_packages[0]
+				pkgtype, myroot, mycpv, myuse = selected_pkg
+				mydbapi = self.trees[myroot][self.pkg_tree_map[pkgtype]].dbapi
+				slot_atom = "%s:%s" % (portage.dep_getkey(mycpv),
+					mydbapi.aux_get(mycpv, ["SLOT"])[0])
+				existing_node = self._slot_node_map[myroot].get(
+					slot_atom, None)
+				if existing_node:
+					e_type, myroot, e_cpv, e_status = existing_node
+					if portage.match_from_list(x, [e_cpv]):
+						# The existing node can be reused.
+						selected_pkg = [e_type, myroot, e_cpv,
+							self.useFlags[myroot][e_cpv]]
+
+			if myparent:
+				#we are a dependency, so we want to be unconditionally added
+				mypriority = priority.copy()
+				if vardb.match(x):
+					mypriority.satisfied = True
+				if not self.create(selected_pkg[0:3], myparent,
+					myuse=selected_pkg[-1], priority=mypriority,
+					rev_dep=rev_deps, arg=arg):
+					return 0
+			else:
+				#if mysource is not set, then we are a command-line dependency and should not be added
+				#if --onlydeps is specified.
+				if not self.create(selected_pkg[0:3], myparent,
+					addme=("--onlydeps" not in self.myopts),
+					myuse=selected_pkg[-1], rev_dep=rev_deps, arg=arg):
+					return 0
+
+		if "--debug" in self.myopts:
+			print "Exiting...",myparent
+		return 1
+
+	def validate_blockers(self):
+		"""Remove any blockers from the digraph that do not match any of the
+		packages within the graph.  If necessary, create hard deps to ensure
+		correct merge order such that mutually blocking packages are never
+		installed simultaneously."""
+
+		if "--buildpkgonly" in self.myopts or \
+			"--nodeps" in self.myopts:
+			return True
+
+		modified_slots = {}
+		for myroot in self.trees:
+			myslots = {}
+			modified_slots[myroot] = myslots
+			final_db = self.mydbapi[myroot]
+			slot_node_map = self._slot_node_map[myroot]
+			for slot_atom, mynode in slot_node_map.iteritems():
+				mytype, myroot, mycpv, mystatus = mynode
+				if mystatus == "merge":
+					myslots[slot_atom] = mycpv
+
+		#if "deep" in self.myparams:
+		if True:
+			# Pull in blockers from all installed packages that haven't already
+			# been pulled into the depgraph.  This is not enabled by default
+			# due to the performance penalty that is incurred by all the
+			# additional dep_check calls that are required.
+
+			# Optimization hack for dep_check calls that minimizes the
+			# available matches by replacing the portdb with a fakedbapi
+			# instance.
+			class FakePortageTree(object):
+				def __init__(self, mydb):
+					self.dbapi = mydb
+			dep_check_trees = {}
+			for myroot in self.trees:
+				dep_check_trees[myroot] = self.trees[myroot].copy()
+				dep_check_trees[myroot]["porttree"] = \
+					FakePortageTree(self.mydbapi[myroot])
+
+			dep_keys = ["DEPEND","RDEPEND","PDEPEND"]
+			for myroot in self.trees:
+				pkg_node_map = self.pkg_node_map[myroot]
+				vardb = self.trees[myroot]["vartree"].dbapi
+				portdb = self.trees[myroot]["porttree"].dbapi
+				pkgsettings = self.pkgsettings[myroot]
+				final_db = self.mydbapi[myroot]
+				cpv_all_installed = self.trees[myroot]["vartree"].dbapi.cpv_all()
+				blocker_cache = BlockerCache(myroot, vardb)
+				for pkg in cpv_all_installed:
+					blocker_atoms = None
+					matching_node = pkg_node_map.get(pkg, None)
+					if matching_node and \
+						matching_node[3] == "nomerge":
+						continue
+					# If this node has any blockers, create a "nomerge"
+					# node for it so that they can be enforced.
+					self.spinner.update()
+					blocker_data = blocker_cache.get(pkg)
+					if blocker_data:
+						blocker_atoms = blocker_data.atoms
+					else:
+						dep_vals = vardb.aux_get(pkg, dep_keys)
+						myuse = vardb.aux_get(pkg, ["USE"])[0].split()
+						depstr = " ".join(dep_vals)
+						# It is crucial to pass in final_db here in order to
+						# optimize dep_check calls by eliminating atoms via
+						# dep_wordreduce and dep_eval calls.
+						try:
+							portage.dep._dep_check_strict = False
+							try:
+								success, atoms = portage.dep_check(depstr,
+									final_db, pkgsettings, myuse=myuse,
+									trees=dep_check_trees, myroot=myroot)
+							except Exception, e:
+								if isinstance(e, SystemExit):
+									raise
+								# This is helpful, for example, if a ValueError
+								# is thrown from cpv_expand due to multiple
+								# matches (this can happen if an atom lacks a
+								# category).
+								show_invalid_depstring_notice(
+									("installed", myroot, pkg, "nomerge"),
+									depstr, str(e))
+								del e
+								raise
+						finally:
+							portage.dep._dep_check_strict = True
+						if not success:
+							slot_atom = "%s:%s" % (portage.dep_getkey(pkg),
+								vardb.aux_get(pkg, ["SLOT"])[0])
+							if slot_atom in modified_slots[myroot]:
+								# This package is being replaced anyway, so
+								# ignore invalid dependencies so as not to
+								# annoy the user too much (otherwise they'd be
+								# forced to manually unmerge it first).
+								continue
+							show_invalid_depstring_notice(
+								("installed", myroot, pkg, "nomerge"),
+								depstr, atoms)
+							return False
+						blocker_atoms = [myatom for myatom in atoms \
+							if myatom.startswith("!")]
+						counter = long(vardb.aux_get(pkg, ["COUNTER"])[0])
+						blocker_cache[pkg] = \
+							blocker_cache.BlockerData(counter, blocker_atoms)
+					if blocker_atoms:
+						# Don't store this parent in pkg_node_map, because it's
+						# not needed there and it might overwrite a "merge"
+						# node with the same cpv.
+						myparent = ("installed", myroot, pkg, "nomerge")
+						for myatom in blocker_atoms:
+							blocker = ("blocks", myroot, myatom[1:])
+							myparents = \
+								self.blocker_parents.get(blocker, None)
+							if not myparents:
+								myparents = set()
+								self.blocker_parents[blocker] = myparents
+							myparents.add(myparent)
+				blocker_cache.flush()
+				del blocker_cache
+
+		for blocker in self.blocker_parents.keys():
+			mytype, myroot, mydep = blocker
+			initial_db = self.trees[myroot]["vartree"].dbapi
+			final_db = self.mydbapi[myroot]
+			blocked_initial = initial_db.match(mydep)
+			blocked_final = final_db.match(mydep)
+			if not blocked_initial and not blocked_final:
+				del self.blocker_parents[blocker]
+				continue
+			blocked_slots_initial = {}
+			blocked_slots_final = {}
+			for cpv in blocked_initial:
+				blocked_slots_initial[cpv] = \
+					"%s:%s" % (portage.dep_getkey(cpv),
+						initial_db.aux_get(cpv, ["SLOT"])[0])
+			for cpv in blocked_final:
+				blocked_slots_final[cpv] = \
+					"%s:%s" % (portage.dep_getkey(cpv),
+						final_db.aux_get(cpv, ["SLOT"])[0])
+			for parent in list(self.blocker_parents[blocker]):
+				ptype, proot, pcpv, pstatus = parent
+				pdbapi = self.trees[proot][self.pkg_tree_map[ptype]].dbapi
+				pslot = pdbapi.aux_get(pcpv, ["SLOT"])[0]
+				pslot_atom = "%s:%s" % (portage.dep_getkey(pcpv), pslot)
+				parent_static = pslot_atom not in modified_slots[proot]
+				unresolved_blocks = False
+				depends_on_order = set()
+				for cpv in blocked_initial:
+					slot_atom = blocked_slots_initial[cpv]
+					if slot_atom == pslot_atom:
+						# TODO: Support blocks within slots in cases where it
+						# might make sense.  For example, a new version might
+						# require that the old version be uninstalled at build
+						# time.
+						continue
+					if parent_static and \
+						slot_atom not in modified_slots[myroot]:
+						# This blocker will be handled the next time that a
+						# merge of either package is triggered.
+						continue
+					if pstatus == "merge" and \
+						slot_atom in modified_slots[myroot]:
+						replacement = final_db.match(slot_atom)
+						if replacement:
+							if not portage.match_from_list(mydep, replacement):
+								# Apparently a replacement may be able to
+								# invalidate this block.
+								replacement_node = \
+									self.pkg_node_map[proot][replacement[0]]
+								depends_on_order.add((replacement_node, parent))
+								continue
+					# None of the above blocker resolutions techniques apply,
+					# so apparently this one is unresolvable.
+					unresolved_blocks = True
+				for cpv in blocked_final:
+					slot_atom = blocked_slots_final[cpv]
+					if slot_atom == pslot_atom:
+						# TODO: Support blocks within slots.
+						continue
+					if parent_static and \
+						slot_atom not in modified_slots[myroot]:
+						# This blocker will be handled the next time that a
+						# merge of either package is triggered.
+						continue
+					if not parent_static and pstatus == "nomerge" and \
+						slot_atom in modified_slots[myroot]:
+						replacement = final_db.match(pslot_atom)
+						if replacement:
+							replacement_node = \
+								self.pkg_node_map[proot][replacement[0]]
+							if replacement_node not in \
+								self.blocker_parents[blocker]:
+								# Apparently a replacement may be able to
+								# invalidate this block.
+								blocked_node = self.pkg_node_map[proot][cpv]
+								depends_on_order.add(
+									(replacement_node, blocked_node))
+								continue
+					# None of the above blocker resolutions techniques apply,
+					# so apparently this one is unresolvable.
+					unresolved_blocks = True
+				if not unresolved_blocks and depends_on_order:
+					for node, pnode in depends_on_order:
+						# Enforce correct merge order with a hard dep.
+						self.digraph.addnode(node, pnode,
+							priority=DepPriority(buildtime=True))
+						# Count references to this blocker so that it can be
+						# invalidated after nodes referencing it have been
+						# merged.
+						self.blocker_digraph.addnode(node, blocker)
+				if not unresolved_blocks and not depends_on_order:
+					self.blocker_parents[blocker].remove(parent)
+				if unresolved_blocks:
+					self._unresolved_blocker_parents.setdefault(
+						blocker, set()).add(parent)
+			if not self.blocker_parents[blocker]:
+				del self.blocker_parents[blocker]
+		# Validate blockers that depend on merge order.
+		if not self.blocker_digraph.empty():
+			self.altlist()
+		if self._slot_collision_info:
+			# The user is only notified of a slot collision if there are no
+			# unresolvable blocks.
+			for x in self.altlist():
+				if x[0] == "blocks":
+					return True
+			self._show_slot_collision_notice(self._slot_collision_info[0])
+			if not self._accept_collisions():
+				return False
+		return True
+
+	def _accept_collisions(self):
+		acceptable = False
+		for x in ("--nodeps", "--pretend", "--fetchonly", "--fetch-all-uri"):
+			if x in self.myopts:
+				acceptable = True
+				break
+		return acceptable
+
+	def _merge_order_bias(self, mygraph):
+		"""Order nodes from highest to lowest overall reference count for
+		optimal leaf node selection."""
+		node_info = {}
+		for node in mygraph.order:
+			node_info[node] = len(mygraph.parent_nodes(node))
+		def cmp_merge_preference(node1, node2):
+			return node_info[node2] - node_info[node1]
+		mygraph.order.sort(cmp_merge_preference)
+
+	def altlist(self, reversed=False):
+		if reversed in self._altlist_cache:
+			return self._altlist_cache[reversed][:]
+		if reversed:
+			retlist = self.altlist()
+			retlist.reverse()
+			self._altlist_cache[reversed] = retlist[:]
+			return retlist
+		mygraph=self.digraph.copy()
+		self._merge_order_bias(mygraph)
+		myblockers = self.blocker_digraph.copy()
+		retlist=[]
+		circular_blocks = False
+		blocker_deps = None
+		asap_nodes = []
+		if reversed:
+			get_nodes = mygraph.root_nodes
+		else:
+			get_nodes = mygraph.leaf_nodes
+			for cpv, node in self.pkg_node_map["/"].iteritems():
+				if "portage" == portage.catsplit(portage.dep_getkey(cpv))[-1]:
+					asap_nodes.append(node)
+					break
+		ignore_priority_range = [None]
+		ignore_priority_range.extend(
+			xrange(DepPriority.MIN, DepPriority.MEDIUM + 1))
+		tree_mode = "--tree" in self.myopts
+		while not mygraph.empty():
+			ignore_priority = None
+			nodes = None
+			if asap_nodes:
+				"""ASAP nodes are merged before their soft deps."""
+				for node in asap_nodes:
+					if not mygraph.contains(node):
+						asap_nodes.remove(node)
+						continue
+					if not mygraph.child_nodes(node,
+						ignore_priority=DepPriority.SOFT):
+						nodes = [node]
+						asap_nodes.remove(node)
+						break
+			if not nodes:
+				for ignore_priority in ignore_priority_range:
+					nodes = get_nodes(ignore_priority=ignore_priority)
+					if nodes:
+						break
+			selected_nodes = None
+			if nodes:
+				if ignore_priority <= DepPriority.SOFT:
+					if ignore_priority is None and not tree_mode:
+						# Greedily pop all of these nodes since no relationship
+						# has been ignored.  This optimization destroys --tree
+						# output, so it's disabled in reversed mode.
+						selected_nodes = nodes
+					else:
+						# For optimal merge order:
+						#  * Only pop one node.
+						#  * Removing a root node (node without a parent)
+						#    will not produce a leaf node, so avoid it.
+						for node in nodes:
+							if mygraph.parent_nodes(node):
+								# found a non-root node
+								selected_nodes = [node]
+								break
+						if not selected_nodes:
+							# settle for a root node
+							selected_nodes = [nodes[0]]
+				else:
+					"""Recursively gather a group of nodes that RDEPEND on
+					eachother.  This ensures that they are merged as a group
+					and get their RDEPENDs satisfied as soon as possible."""
+					def gather_deps(mergeable_nodes, selected_nodes, node):
+						if node in selected_nodes:
+							return True
+						if node not in mergeable_nodes:
+							return False
+						selected_nodes.add(node)
+						for child in mygraph.child_nodes(node,
+							ignore_priority=DepPriority.SOFT):
+							if not gather_deps(
+								mergeable_nodes, selected_nodes, child):
+								return False
+						return True
+					mergeable_nodes = set(nodes)
+					for node in nodes:
+						selected_nodes = set()
+						if gather_deps(
+							mergeable_nodes, selected_nodes, node):
+							break
+						else:
+							selected_nodes = None
+
+			if not selected_nodes:
+				if not myblockers.is_empty():
+					"""A blocker couldn't be circumnavigated while keeping all
+					dependencies satisfied.  The user will have to resolve this
+					manually.  This is a panic condition and thus the order
+					doesn't really matter, so just pop a random node in order
+					to avoid a circular dependency panic if possible."""
+					if not circular_blocks:
+						circular_blocks = True
+						blocker_deps = myblockers.leaf_nodes()
+					if blocker_deps:
+						selected_nodes = [blocker_deps.pop()]
+
+			if not selected_nodes:
+				# No leaf nodes are available, so we have a circular
+				# dependency panic situation.  Reduce the noise level to a
+				# minimum via repeated elimination of root nodes since they
+				# have no parents and thus can not be part of a cycle.
+				while True:
+					root_nodes = mygraph.root_nodes(
+						ignore_priority=DepPriority.SOFT)
+					if not root_nodes:
+						break
+					for node in root_nodes:
+						mygraph.remove(node)
+				# Display the USE flags that are enabled on nodes that are part
+				# of dependency cycles in case that helps the user decide to
+				# disable some of them.
+				display_order = []
+				tempgraph = mygraph.copy()
+				while not tempgraph.empty():
+					nodes = tempgraph.leaf_nodes()
+					if not nodes:
+						node = tempgraph.order[0]
+					else:
+						node = nodes[0]
+					display_order.append(list(node))
+					tempgraph.remove(node)
+				display_order.reverse()
+				self.myopts.pop("--quiet", None)
+				self.myopts.pop("--verbose", None)
+				self.myopts["--tree"] = True
+				self.display(display_order)
+				print "!!! Error: circular dependencies:"
+				print
+				mygraph.debug_print()
+				print
+				print "!!! Note that circular dependencies can often be avoided by temporarily"
+				print "!!! disabling USE flags that trigger optional dependencies."
+				sys.exit(1)
+
+			for node in selected_nodes:
+				retlist.append(list(node))
+				mygraph.remove(node)
+				if not reversed and not circular_blocks and myblockers.contains(node):
+					"""This node may have invalidated one or more blockers."""
+					myblockers.remove(node)
+					for blocker in myblockers.root_nodes():
+						if not myblockers.child_nodes(blocker):
+							myblockers.remove(blocker)
+							unresolved = \
+								self._unresolved_blocker_parents.get(blocker)
+							if unresolved:
+								self.blocker_parents[blocker] = unresolved
+							else:
+								del self.blocker_parents[blocker]
+
+		if not reversed:
+			"""Blocker validation does not work with reverse mode,
+			so self.altlist() should first be called with reverse disabled
+			so that blockers are properly validated."""
+			self.blocker_digraph = myblockers
+
+		""" Add any unresolved blocks so that they can be displayed."""
+		for blocker in self.blocker_parents:
+			retlist.append(list(blocker))
+		self._altlist_cache[reversed] = retlist[:]
+		return retlist
+
+	def xcreate(self,mode="system"):
+		vardb = self.trees[self.target_root]["vartree"].dbapi
+		portdb = self.trees[self.target_root]["porttree"].dbapi
+		bindb = self.trees[self.target_root]["bintree"].dbapi
+		def visible(mylist):
+			matches = portdb.gvisible(portdb.visible(mylist))
+			return [x for x in mylist \
+				if x in matches or not portdb.cpv_exists(x)]
+		world_problems = False
+		if mode=="system":
+			mylist = getlist(self.settings, "system")
+		else:
+			#world mode
+			worldlist = getlist(self.settings, "world")
+			mylist = getlist(self.settings, "system")
+			worlddict=genericdict(worldlist)
+
+			for x in worlddict.keys():
+				if not portage.isvalidatom(x):
+					world_problems = True
+				elif not self.trees[self.target_root]["vartree"].dbapi.match(x):
+					world_problems = True
+				else:
+					mylist.append(x)
+
+		newlist = []
+		for atom in mylist:
+			mykey = portage.dep_getkey(atom)
+			if True:
+				newlist.append(atom)
+				"""Make sure all installed slots are updated when possible.
+				Do this with --emptytree also, to ensure that all slots are
+				remerged."""
+				myslots = set()
+				for cpv in vardb.match(mykey):
+					myslots.add(vardb.aux_get(cpv, ["SLOT"])[0])
+				if myslots:
+					best_pkgs = []
+					if "--usepkg" in self.myopts:
+						mymatches = bindb.match(atom)
+						if "--usepkgonly" not in self.myopts:
+							mymatches = visible(mymatches)
+						best_pkg = portage.best(mymatches)
+						if best_pkg:
+							best_slot = bindb.aux_get(best_pkg, ["SLOT"])[0]
+							best_pkgs.append(("binary", best_pkg, best_slot))
+					if "--usepkgonly" not in self.myopts:
+						best_pkg = portage.best(portdb.match(atom))
+						if best_pkg:
+							best_slot = portdb.aux_get(best_pkg, ["SLOT"])[0]
+							best_pkgs.append(("ebuild", best_pkg, best_slot))
+					if best_pkgs:
+						best_pkg = portage.best([x[1] for x in best_pkgs])
+						best_pkgs = [x for x in best_pkgs if x[1] == best_pkg]
+						best_slot = best_pkgs[0][2]
+						myslots.add(best_slot)
+				if len(myslots) > 1:
+					for myslot in myslots:
+						myslot_atom = "%s:%s" % (mykey, myslot)
+						available = False
+						if "--usepkgonly" not in self.myopts and \
+							self.trees[self.target_root][
+							"porttree"].dbapi.match(myslot_atom):
+							available = True
+						elif "--usepkg" in self.myopts:
+							mymatches = bindb.match(myslot_atom)
+							if "--usepkgonly" not in self.myopts:
+								mymatches = visible(mymatches)
+							if mymatches:
+								available = True
+						if available:
+							newlist.append(myslot_atom)
+		mylist = newlist
+		
+		missing_atoms = []
+		for mydep in mylist:
+			try:
+				if not self.select_dep(
+					self.target_root, mydep, raise_on_missing=True, arg=mydep):
+					print >> sys.stderr, "\n\n!!! Problem resolving dependencies for", mydep
+					return 0
+			except ValueError:
+				missing_atoms.append(mydep)
+
+		if not self.validate_blockers():
+			return False
+
+		if world_problems:
+			print >> sys.stderr, "\n!!! Problems have been detected with your world file"
+			print >> sys.stderr, "!!! Please run "+green("emaint --check world")+"\n"
+
+		if missing_atoms:
+			print >> sys.stderr, "\n" + colorize("BAD", "!!!") + \
+				" Ebuilds for the following packages are either all"
+			print >> sys.stderr, colorize("BAD", "!!!") + " masked or don't exist:"
+			print >> sys.stderr, " ".join(missing_atoms) + "\n"
+
+		return 1
+
+	def display(self,mylist,verbosity=None):
+		if verbosity is None:
+			verbosity = ("--quiet" in self.myopts and 1 or \
+				"--verbose" in self.myopts and 3 or 2)
+		changelogs=[]
+		p=[]
+		blockers = []
+
+		counters = PackageCounters()
+
+		if verbosity == 1 and "--verbose" not in self.myopts:
+			def create_use_string(*args):
+				return ""
+		else:
+			def create_use_string(name, cur_iuse, iuse_forced, cur_use,
+				old_iuse, old_use,
+				is_new, all_flags=(verbosity == 3 or "--quiet" in self.myopts),
+				alphabetical=("--alphabetical" in self.myopts)):
+				enabled = []
+				if alphabetical:
+					disabled = enabled
+					removed = enabled
+				else:
+					disabled = []
+					removed = []
+				cur_iuse = set(cur_iuse)
+				enabled_flags = cur_iuse.intersection(cur_use)
+				removed_iuse = set(old_iuse).difference(cur_iuse)
+				any_iuse = cur_iuse.union(old_iuse)
+				any_iuse = list(any_iuse)
+				any_iuse.sort()
+				for flag in any_iuse:
+					flag_str = None
+					isEnabled = False
+					if flag in enabled_flags:
+						isEnabled = True
+						if is_new or flag in old_use and all_flags:
+							flag_str = red(flag)
+						elif flag not in old_iuse:
+							flag_str = yellow(flag) + "%*"
+						elif flag not in old_use:
+							flag_str = green(flag) + "*"
+					elif flag in removed_iuse:
+						if all_flags:
+							flag_str = yellow("-" + flag) + "%"
+							if flag in old_use:
+								flag_str += "*"
+							flag_str = "(" + flag_str + ")"
+							removed.append(flag_str)
+						continue
+					else:
+						if is_new or flag in old_iuse and flag not in old_use and all_flags:
+							flag_str = blue("-" + flag)
+						elif flag not in old_iuse:
+							flag_str = yellow("-" + flag)
+							if flag not in iuse_forced:
+								flag_str += "%"
+						elif flag in old_use:
+							flag_str = green("-" + flag) + "*"
+					if flag_str:
+						if flag in iuse_forced:
+							flag_str = "(" + flag_str + ")"
+						if isEnabled:
+							enabled.append(flag_str)
+						else:
+							disabled.append(flag_str)
+
+				if alphabetical:
+					ret = " ".join(enabled)
+				else:
+					ret = " ".join(enabled + disabled + removed)
+				if ret:
+					ret = '%s="%s" ' % (name, ret)
+				return ret
+
+		if verbosity == 3:
+			# FIXME: account for the possibility of different overlays in
+			# /etc/make.conf vs. ${PORTAGE_CONFIGROOT}/etc/make.conf
+			overlays = self.settings["PORTDIR_OVERLAY"].split()
+			overlays_real = [os.path.realpath(t) \
+				for t in self.settings["PORTDIR_OVERLAY"].split()]
+
+		tree_nodes = []
+		display_list = []
+		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))
+				continue
+			graph_key = tuple(x)
+			if "--tree" in self.myopts:
+				depth = len(tree_nodes)
+				while depth and graph_key not in \
+					mygraph.child_nodes(tree_nodes[depth-1]):
+						depth -= 1
+				if depth:
+					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)
+					def add_parents(current_node, ordered):
+						parent_nodes = mygraph.parent_nodes(current_node)
+						if parent_nodes:
+							child_nodes = set(mygraph.child_nodes(current_node))
+							selected_parent = None
+							# First, try to avoid a direct cycle.
+							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),
+							len(tree_nodes), ordered))
+						tree_nodes.append(current_node)
+					tree_nodes = []
+					add_parents(graph_key, True)
+			else:
+				display_list.append((x, depth, True))
+		mylist = display_list
+
+		last_merge_depth = 0
+		for i in xrange(len(mylist)-1,-1,-1):
+			graph_key, depth, ordered = mylist[i]
+			if not ordered and depth == 0 and i > 0 \
+				and graph_key == mylist[i-1][0] and \
+				mylist[i-1][1] == 0:
+				# An ordered node got a consecutive duplicate when the tree was
+				# being filled in.
+				del mylist[i]
+				continue
+			if "blocks" == graph_key[0]:
+				continue
+			if ordered and graph_key[-1] != "nomerge":
+				last_merge_depth = depth
+				continue
+			if depth >= last_merge_depth or \
+				i < len(mylist) - 1 and \
+				depth >= mylist[i+1][1]:
+					del mylist[i]
+
+		from portage import flatten
+		from portage.dep import use_reduce, paren_reduce
+		display_overlays=False
+		# files to fetch list - avoids counting a same file twice
+		# in size display (verbose mode)
+		myfetchlist=[]
+		for mylist_index in xrange(len(mylist)):
+			x, depth, ordered = mylist[mylist_index]
+			pkg_type = x[0]
+			myroot = x[1]
+			pkg_key = x[2]
+			portdb = self.trees[myroot]["porttree"].dbapi
+			bindb  = self.trees[myroot]["bintree"].dbapi
+			vardb = self.trees[myroot]["vartree"].dbapi
+			vartree = self.trees[myroot]["vartree"]
+			pkgsettings = self.pkgsettings[myroot]
+
+			fetch=" "
+
+			if x[0]=="blocks":
+				addl=""+red("B")+"  "+fetch+"  "
+				if ordered:
+					counters.blocks += 1
+				resolved = portage.key_expand(
+					pkg_key, mydb=vardb, settings=pkgsettings)
+				if "--columns" in self.myopts and "--quiet" in self.myopts:
+					addl = addl + " " + red(resolved)
+				else:
+					addl = "[blocks " + addl + "] " + red(resolved)
+				block_parents = self.blocker_parents[tuple(x)]
+				block_parents = set([pnode[2] for pnode in block_parents])
+				block_parents = ", ".join(block_parents)
+				if resolved!=x[2]:
+					addl += bad(" (\"%s\" is blocking %s)") % \
+						(pkg_key, block_parents)
+				else:
+					addl += bad(" (is blocking %s)") % block_parents
+				blockers.append(addl)
+			else:
+				mydbapi = self.trees[myroot][self.pkg_tree_map[pkg_type]].dbapi
+				pkg_status = x[3]
+				binary_package = True
+				if "ebuild" == pkg_type:
+					if "merge" == x[3] or \
+						not vartree.dbapi.cpv_exists(pkg_key):
+						"""An ebuild "merge" node or a --onlydeps "nomerge"
+						node."""
+						binary_package = False
+						pkgsettings.setcpv(pkg_key, mydb=portdb)
+						if pkg_key not in self.useFlags[myroot]:
+							self.useFlags[myroot][pkg_key] = \
+								pkgsettings["USE"].split()
+					else:
+						# An ebuild "nomerge" node, so USE come from the vardb.
+						mydbapi = vartree.dbapi
+				if pkg_key not in self.useFlags[myroot]:
+					"""If this is a --resume then the USE flags need to be
+					fetched from the appropriate locations here."""
+					self.useFlags[myroot][pkg_key] = mydbapi.aux_get(
+						pkg_key, ["USE"])[0].split()
+
+				try:
+					restrict = flatten(use_reduce(paren_reduce(
+						mydbapi.aux_get(pkg_key, ["RESTRICT"])[0]),
+						uselist=self.useFlags[myroot][pkg_key]))
+				except portage.exception.InvalidDependString, e:
+					if pkg_status != "nomerge":
+						restrict = mydbapi.aux_get(pkg_key, ["RESTRICT"])[0]
+						show_invalid_depstring_notice(x, restrict, str(e))
+						del e
+						sys.exit(1)
+					restrict = []
+				if "ebuild" == pkg_type and x[3] != "nomerge" and \
+					"fetch" in restrict:
+					fetch = red("F")
+					if ordered:
+						counters.restrict_fetch += 1
+					if portdb.fetch_check(
+						pkg_key, self.useFlags[myroot][pkg_key]):
+						fetch = green("f")
+						if ordered:
+							counters.restrict_fetch_satisfied += 1
+
+				#we need to use "--emptrytree" testing here rather than "empty" param testing because "empty"
+				#param is used for -u, where you still *do* want to see when something is being upgraded.
+				myoldbest=""
+				if vardb.cpv_exists(pkg_key):
+					addl="  "+yellow("R")+fetch+"  "
+					if x[3] != "nomerge":
+						if ordered:
+							counters.reinst += 1
+				elif vardb.match(portage.dep_getkey(pkg_key)):
+					mynewslot = mydbapi.aux_get(pkg_key, ["SLOT"])[0]
+					myoldlist = self.trees[x[1]]["vartree"].dbapi.match(
+						portage.pkgsplit(x[2])[0])
+					myinslotlist = [inst_pkg for inst_pkg in myoldlist
+						if mynewslot == vardb.aux_get(inst_pkg, ["SLOT"])[0]]
+					if myinslotlist:
+						myoldbest=portage.best(myinslotlist)
+						addl="   "+fetch
+						if portage.pkgcmp(portage.pkgsplit(x[2]), portage.pkgsplit(myoldbest)) < 0:
+							# Downgrade in slot
+							addl+=turquoise("U")+blue("D")
+							if ordered:
+								counters.downgrades += 1
+						else:
+							# Update in slot
+							addl+=turquoise("U")+" "
+							if ordered:
+								counters.upgrades += 1
+					else:
+						# New slot, mark it new.
+						addl=" "+green("NS")+fetch+"  "
+						if ordered:
+							counters.newslot += 1
+
+					if "--changelog" in self.myopts:
+						slot_atom = "%s:%s" % (portage.dep_getkey(pkg_key),
+							mydbapi.aux_get(pkg_key, ["SLOT"])[0])
+						inst_matches = vardb.match(slot_atom)
+						if inst_matches:
+							changelogs.extend(self.calc_changelog(
+								portdb.findname(pkg_key),
+								inst_matches[0], pkg_key))
+				else:
+					addl=" "+green("N")+" "+fetch+"  "
+					if ordered:
+						counters.new += 1
+
+				verboseadd=""
+				
+				if pkg_key in self.useFlags[myroot]:
+					# USE flag display
+					cur_iuse = list(filter_iuse_defaults(
+						mydbapi.aux_get(pkg_key, ["IUSE"])[0].split()))
+
+					forced_flags = set()
+					if not binary_package:
+						forced_flags.update(pkgsettings.useforce)
+						forced_flags.update(pkgsettings.usemask)
+
+					cur_iuse = portage.unique_array(cur_iuse)
+					cur_iuse.sort()
+					cur_use = self.useFlags[myroot][pkg_key]
+					cur_use = [flag for flag in cur_use if flag in cur_iuse]
+
+					if myoldbest:
+						pkg = myoldbest
+					else:
+						pkg = x[2]
+					if self.trees[x[1]]["vartree"].dbapi.cpv_exists(pkg):
+						old_iuse, old_use = \
+							self.trees[x[1]]["vartree"].dbapi.aux_get(
+								pkg, ["IUSE", "USE"])
+						old_iuse = list(set(
+							filter_iuse_defaults(old_iuse.split())))
+						old_iuse.sort()
+						old_use = old_use.split()
+						is_new = False
+					else:
+						old_iuse = []
+						old_use = []
+						is_new = True
+
+					old_use = [flag for flag in old_use if flag in old_iuse]
+
+					use_expand = pkgsettings["USE_EXPAND"].lower().split()
+					use_expand.sort()
+					use_expand.reverse()
+					use_expand_hidden = \
+						pkgsettings["USE_EXPAND_HIDDEN"].lower().split()
+
+					def map_to_use_expand(myvals, forcedFlags=False):
+						ret = {}
+						forced = {}
+						for exp in use_expand:
+							ret[exp] = []
+							forced[exp] = set()
+							for val in myvals[:]:
+								if val.startswith(exp.lower()+"_"):
+									if val in forced_flags:
+										forced[exp].add(val[len(exp)+1:])
+									ret[exp].append(val[len(exp)+1:])
+									myvals.remove(val)
+						ret["USE"] = myvals
+						forced["USE"] = [val for val in myvals \
+							if val in forced_flags]
+						for exp in use_expand_hidden:
+							if exp in ret:
+								del ret[exp]
+						if forcedFlags:
+							return ret, forced
+						return ret
+
+					cur_iuse_map, iuse_forced = \
+						map_to_use_expand(cur_iuse, forcedFlags=True)
+					cur_use_map = map_to_use_expand(cur_use)
+					old_iuse_map = map_to_use_expand(old_iuse)
+					old_use_map = map_to_use_expand(old_use)
+
+					use_expand.sort()
+					use_expand.insert(0, "USE")
+					
+					for key in use_expand:
+						if key in use_expand_hidden:
+							continue
+						verboseadd += create_use_string(key.upper(),
+							cur_iuse_map[key], iuse_forced[key],
+							cur_use_map[key], old_iuse_map[key],
+							old_use_map[key], is_new)
+
+				if verbosity == 3:
+					# size verbose
+					mysize=0
+					if x[0] == "ebuild" and ordered and x[-1] != "nomerge":
+						try:
+							myfilesdict = portdb.getfetchsizes(pkg_key,
+								useflags=self.useFlags[myroot][pkg_key],
+								debug=self.edebug)
+						except portage.exception.InvalidDependString, e:
+							src_uri = portdb.aux_get(pkg_key, ["SRC_URI"])[0]
+							show_invalid_depstring_notice(x, src_uri, str(e))
+							del e
+							sys.exit(1)
+						if myfilesdict is None:
+							myfilesdict="[empty/missing/bad digest]"
+						else:
+							for myfetchfile in myfilesdict.keys():
+								if myfetchfile not in myfetchlist:
+									mysize+=myfilesdict[myfetchfile]
+									myfetchlist.append(myfetchfile)
+							counters.totalsize += mysize
+						verboseadd+=format_size(mysize)+" "
+
+					# overlay verbose
+					# XXX: Invalid binaries have caused tracebacks here. 'if file_name'
+					# x = ['binary', '/', 'sys-apps/pcmcia-cs-3.2.7.2.6', 'merge']
+					file_name = portdb.findname(pkg_key)
+					if file_name: # It might not exist in the tree
+						dir_name=os.path.abspath(os.path.dirname(file_name)+"/../..")
+						if (overlays_real.count(dir_name)>0):
+							verboseadd+=teal("["+str(overlays_real.index(
+								os.path.normpath(dir_name))+1)+"]")+" "
+							display_overlays=True
+					else:
+						verboseadd += "[No ebuild?]"
+
+				xs = list(portage.pkgsplit(x[2]))
+				if xs[2]=="r0":
+					xs[2]=""
+				else:
+					xs[2]="-"+xs[2]
+
+				mywidth = 130
+				if "COLUMNWIDTH" in self.settings:
+					try:
+						mywidth = int(self.settings["COLUMNWIDTH"])
+					except ValueError, e:
+						portage.writemsg("!!! %s\n" % str(e), noiselevel=-1)
+						portage.writemsg(
+							"!!! Unable to parse COLUMNWIDTH='%s'\n" % \
+							self.settings["COLUMNWIDTH"], noiselevel=-1)
+						del e
+				oldlp=mywidth-30
+				newlp=oldlp-30
+
+				indent = " " * depth
+
+				if myoldbest:
+					myoldbest=portage.pkgsplit(myoldbest)[1]+"-"+portage.pkgsplit(myoldbest)[2]
+					if myoldbest[-3:]=="-r0":
+						myoldbest=myoldbest[:-3]
+					myoldbest=blue("["+myoldbest+"]")
+
+				if x[1]!="/":
+					if myoldbest:
+						myoldbest +=" "
+					if "--columns" in self.myopts:
+						if "--quiet" in self.myopts:
+							myprint=addl+" "+indent+darkgreen(xs[0])
+							myprint=myprint+darkblue(" "+xs[1]+xs[2])+" "
+							myprint=myprint+myoldbest
+							myprint=myprint+darkgreen("to "+x[1])
+						else:
+							myprint="["+x[0]+" "+addl+"] "+indent+darkgreen(xs[0])
+							if (newlp-nc_len(myprint)) > 0:
+								myprint=myprint+(" "*(newlp-nc_len(myprint)))
+							myprint=myprint+"["+darkblue(xs[1]+xs[2])+"] "
+							if (oldlp-nc_len(myprint)) > 0:
+								myprint=myprint+" "*(oldlp-nc_len(myprint))
+							myprint=myprint+myoldbest
+							myprint=myprint+darkgreen("to "+x[1])+" "+verboseadd
+					else:
+						if x[-1] == "nomerge" or not ordered:
+							myprint = darkblue("[nomerge      ] ")
+						else:
+							myprint = "[" + pkg_type + " " + addl + "] "
+						myprint += indent + darkgreen(pkg_key) + " " + \
+							myoldbest + darkgreen("to " + myroot) + " " + \
+							verboseadd
+				else:
+					if "--columns" in self.myopts:
+						if "--quiet" in self.myopts:
+							myprint=addl+" "+indent+darkgreen(xs[0])
+							myprint=myprint+" "+green(xs[1]+xs[2])+" "
+							myprint=myprint+myoldbest
+						else:
+							myprint="["+x[0]+" "+addl+"] "+indent+darkgreen(xs[0])
+							if (newlp-nc_len(myprint)) > 0:
+								myprint=myprint+(" "*(newlp-nc_len(myprint)))
+							myprint=myprint+green(" ["+xs[1]+xs[2]+"] ")
+							if (oldlp-nc_len(myprint)) > 0:
+								myprint=myprint+(" "*(oldlp-nc_len(myprint)))
+							myprint=myprint+myoldbest+"  "+verboseadd
+					else:
+						if x[-1] == "nomerge" or not ordered:
+							myprint=darkblue("[nomerge      ] "+indent+x[2]+" "+myoldbest+" ")+verboseadd
+						else:
+							myprint="["+x[0]+" "+addl+"] "+indent+darkgreen(x[2])+" "+myoldbest+" "+verboseadd
+				p.append(myprint)
+
+			mysplit = portage.pkgsplit(x[2])
+			if "--tree" not in self.myopts and mysplit and \
+				len(mysplit) == 3 and mysplit[0] == "sys-apps/portage" and \
+				x[1] == "/":
+
+				if mysplit[2] == "r0":
+					myversion = mysplit[1]
+				else:
+					myversion = "%s-%s" % (mysplit[1], mysplit[2])
+
+				if myversion != portage.VERSION and "--quiet" not in self.myopts:
+					if mylist_index < len(mylist) - 1 and \
+						"livecvsportage" not in self.settings.features:
+						p.append(colorize("WARN", "*** Portage will stop merging at this point and reload itself,"))
+						p.append(colorize("WARN", "    then resume the merge."))
+						print
+			del mysplit
+
+		for x in p:
+			print x
+		for x in blockers:
+			print x
+
+		if verbosity == 3:
+			print
+			print counters
+			if overlays and display_overlays:
+				print "Portage overlays:"
+				y=0
+				for x in overlays:
+					y=y+1
+					print " "+teal("["+str(y)+"]"),x
+
+		if "--changelog" in self.myopts:
+			print
+			for revision,text in changelogs:
+				print bold('*'+revision)
+				sys.stdout.write(text)
+
+		if self._pprovided_args:
+			msg = []
+			msg.append(bad("\nWARNING: "))
+			if len(self._pprovided_args) > 1:
+				msg.append("Requested packages will not be " + \
+					"merged because they are listed in\n")
+			else:
+				msg.append("A requested package will not be " + \
+					"merged because it is listed in\n")
+			msg.append("         package.provided:\n\n")
+			for arg in self._pprovided_args:
+				msg.append("             " + arg + "\n")
+			msg.append("\n")
+			sys.stderr.write("".join(msg))
+
+	def calc_changelog(self,ebuildpath,current,next):
+		if ebuildpath == None or not os.path.exists(ebuildpath):
+			return []
+		current = '-'.join(portage.catpkgsplit(current)[1:])
+		if current.endswith('-r0'):
+			current = current[:-3]
+		next = '-'.join(portage.catpkgsplit(next)[1:])
+		if next.endswith('-r0'):
+			next = next[:-3]
+		changelogpath = os.path.join(os.path.split(ebuildpath)[0],'ChangeLog')
+		try:
+			changelog = open(changelogpath).read()
+		except SystemExit, e:
+			raise # Needed else can't exit
+		except:
+			return []
+		divisions = self.find_changelog_tags(changelog)
+		#print 'XX from',current,'to',next
+		#for div,text in divisions: print 'XX',div
+		# skip entries for all revisions above the one we are about to emerge
+		for i in range(len(divisions)):
+			if divisions[i][0]==next:
+				divisions = divisions[i:]
+				break
+		# find out how many entries we are going to display
+		for i in range(len(divisions)):
+			if divisions[i][0]==current:
+				divisions = divisions[:i]
+				break
+		else:
+		    # couldnt find the current revision in the list. display nothing
+			return []
+		return divisions
+
+	def find_changelog_tags(self,changelog):
+		divs = []
+		release = None
+		while 1:
+			match = re.search(r'^\*\ ?([-a-zA-Z0-9_.+]*)(?:\ .*)?\n',changelog,re.M)
+			if match is None:
+				if release is not None:
+					divs.append((release,changelog))
+				return divs
+			if release is not None:
+				divs.append((release,changelog[:match.start()]))
+			changelog = changelog[match.end():]
+			release = match.group(1)
+			if release.endswith('.ebuild'):
+				release = release[:-7]
+			if release.endswith('-r0'):
+				release = release[:-3]
+
+	def outdated(self):
+		return self.outdatedpackages
+
+class PackageCounters(object):
+
+	def __init__(self):
+		self.upgrades   = 0
+		self.downgrades = 0
+		self.new        = 0
+		self.newslot    = 0
+		self.reinst     = 0
+		self.blocks     = 0
+		self.totalsize  = 0
+		self.restrict_fetch           = 0
+		self.restrict_fetch_satisfied = 0
+
+	def __str__(self):
+		total_installs = self.upgrades + self.downgrades + self.newslot + self.new + self.reinst
+		myoutput = []
+		details = []
+		myoutput.append("Total: %s package" % total_installs)
+		if total_installs != 1:
+			myoutput.append("s")
+		if total_installs != 0:
+			myoutput.append(" (")
+		if self.upgrades > 0:
+			details.append("%s upgrade" % self.upgrades)
+			if self.upgrades > 1:
+				details[-1] += "s"
+		if self.downgrades > 0:
+			details.append("%s downgrade" % self.downgrades)
+			if self.downgrades > 1:
+				details[-1] += "s"
+		if self.new > 0:
+			details.append("%s new" % self.new)
+		if self.newslot > 0:
+			details.append("%s in new slot" % self.newslot)
+			if self.newslot > 1:
+				details[-1] += "s"
+		if self.reinst > 0:
+			details.append("%s reinstall" % self.reinst)
+			if self.reinst > 1:
+				details[-1] += "s"
+		if self.blocks > 0:
+			details.append("%s block" % self.blocks)
+			if self.blocks > 1:
+				details[-1] += "s"
+		myoutput.append(", ".join(details))
+		if total_installs != 0:
+			myoutput.append(")")
+		myoutput.append(", Size of downloads: %s" % format_size(self.totalsize))
+		if self.restrict_fetch:
+			myoutput.append("\nFetch Restriction: %s package" % \
+				self.restrict_fetch)
+			if self.restrict_fetch > 1:
+				myoutput.append("s")
+		if self.restrict_fetch_satisfied < self.restrict_fetch:
+			myoutput.append(bad(" (%s unsatisfied)") % \
+				(self.restrict_fetch - self.restrict_fetch_satisfied))
+		return "".join(myoutput)
+
+class MergeTask(object):
+
+	def __init__(self, settings, trees, myopts):
+		self.settings = settings
+		self.target_root = settings["ROOT"]
+		self.trees = trees
+		self.myopts = myopts
+		self.edebug = 0
+		if settings.get("PORTAGE_DEBUG", "") == "1":
+			self.edebug = 1
+		self.pkgsettings = {}
+		self.pkgsettings[self.target_root] = portage.config(clone=settings)
+		if self.target_root != "/":
+			self.pkgsettings["/"] = \
+				portage.config(clone=trees["/"]["vartree"].settings)
+
+	def merge(self, mylist, favorites, mtimedb):
+		failed_fetches = []
+		fetchonly = "--fetchonly" in self.myopts or \
+			"--fetch-all-uri" in self.myopts
+		mymergelist=[]
+		ldpath_mtimes = mtimedb["ldpath"]
+		xterm_titles = "notitles" not in self.settings.features
+
+		#check for blocking dependencies
+		if "--fetchonly" not in self.myopts and \
+			"--fetch-all-uri" not in self.myopts and \
+			"--buildpkgonly" not in self.myopts:
+			for x in mylist:
+				if x[0]=="blocks":
+					print "\n!!! Error: the "+x[2]+" package conflicts with another package;"
+					print   "!!!        the two packages cannot be installed on the same system together."
+					print   "!!!        Please use 'emerge --pretend' to determine blockers."
+					if "--quiet" not in self.myopts:
+						show_blocker_docs_link()
+					return 1
+
+		if "--resume" in self.myopts:
+			# We're resuming.
+			print colorize("GOOD", "*** Resuming merge...")
+			emergelog(xterm_titles, " *** Resuming merge...")
+			mylist = mtimedb["resume"]["mergelist"][:]
+			if "--skipfirst" in self.myopts and mylist:
+				del mtimedb["resume"]["mergelist"][0]
+				del mylist[0]
+				mtimedb.commit()
+			validate_merge_list(self.trees, mylist)
+			mymergelist = mylist
+
+		# Verify all the manifests now so that the user is notified of failure
+		# as soon as possible.
+		if "--fetchonly" not in self.myopts and \
+			"--fetch-all-uri" not in self.myopts and \
+			"strict" in self.settings.features:
+			shown_verifying_msg = False
+			quiet_settings = {}
+			for myroot, pkgsettings in self.pkgsettings.iteritems():
+				quiet_config = portage.config(clone=pkgsettings)
+				quiet_config["PORTAGE_QUIET"] = "1"
+				quiet_config.backup_changes("PORTAGE_QUIET")
+				quiet_settings[myroot] = quiet_config
+				del quiet_config
+			for x in mylist:
+				if x[0] != "ebuild" or x[-1] == "nomerge":
+					continue
+				if not shown_verifying_msg:
+					shown_verifying_msg = True
+					print ">>> Verifying ebuild Manifests..."
+				mytype, myroot, mycpv, mystatus = x
+				portdb = self.trees[myroot]["porttree"].dbapi
+				quiet_config = quiet_settings[myroot]
+				quiet_config["O"] = os.path.dirname(portdb.findname(mycpv))
+				if not portage.digestcheck([], quiet_config, strict=True):
+					return 1
+				del x, mytype, myroot, mycpv, mystatus, quiet_config
+			del shown_verifying_msg, quiet_settings
+
+		#buildsyspkg: I need mysysdict also on resume (moved from the else block)
+		mysysdict = genericdict(getlist(self.settings, "system"))
+		if "--resume" not in self.myopts:
+			myfavs = portage.grabfile(
+				os.path.join(self.target_root, portage.WORLD_FILE))
+			myfavdict=genericdict(myfavs)
+			for x in range(len(mylist)):
+				if mylist[x][3]!="nomerge":
+					# Add to the mergelist
+					mymergelist.append(mylist[x])
+				else:
+					myfavkey=portage.cpv_getkey(mylist[x][2])
+					if "--onlydeps" in self.myopts:
+						continue
+					# Add to the world file. Since we won't be able to later.
+					if "--fetchonly" not in self.myopts and \
+						myfavkey in favorites:
+						#don't record if already in system profile or already recorded
+						if (not mysysdict.has_key(myfavkey)) and (not myfavdict.has_key(myfavkey)):
+							#we don't have a favorites entry for this package yet; add one
+							myfavdict[myfavkey]=myfavkey
+							print ">>> Recording",myfavkey,"in \"world\" favorites file..."
+			if not ("--fetchonly" in self.myopts or \
+				"--fetch-all-uri" in self.myopts or \
+				"--pretend" in self.myopts):
+				portage.write_atomic(
+					os.path.join(self.target_root, portage.WORLD_FILE),
+					"\n".join(myfavdict.values()))
+
+			mtimedb["resume"]["mergelist"]=mymergelist[:]
+			mtimedb.commit()
+
+		myfeat = self.settings.features[:]
+		bad_resume_opts = set(["--ask", "--tree", "--changelog", "--skipfirst",
+			"--resume"])
+		if "parallel-fetch" in myfeat and \
+			not ("--pretend" in self.myopts or \
+			"--fetch-all-uri" in self.myopts or \
+			"--fetchonly" in self.myopts):
+			if "distlocks" not in myfeat:
+				print red("!!!")
+				print red("!!!")+" parallel-fetching requires the distlocks feature enabled"
+				print red("!!!")+" you have it disabled, thus parallel-fetching is being disabled"
+				print red("!!!")
+			elif len(mymergelist) > 1:
+				print ">>> starting parallel fetching"
+				fetch_log = EPREFIX+"/var/log/emerge-fetch.log"
+				logfile = open(fetch_log, "w")
+				fd_pipes = {1:logfile.fileno(), 2:logfile.fileno()}
+				portage.util.apply_secpass_permissions(fetch_log,
+					uid=portage.portage_uid, gid=portage.portage_gid,
+					mode=0660)
+				fetch_env = os.environ.copy()
+				fetch_env["FEATURES"] = fetch_env.get("FEATURES", "") + " -cvs"
+				fetch_env["PORTAGE_NICENESS"] = "0"
+				fetch_args = [sys.argv[0], "--resume", "--fetchonly"]
+				resume_opts = self.myopts.copy()
+				# For automatic resume, we need to prevent
+				# any of bad_resume_opts from leaking in
+				# via EMERGE_DEFAULT_OPTS.
+				resume_opts["--ignore-default-opts"] = True
+				for myopt, myarg in resume_opts.iteritems():
+					if myopt not in bad_resume_opts:
+						if myarg is True:
+							fetch_args.append(myopt)
+						else:
+							fetch_args.append(myopt +"="+ myarg)
+				portage.process.spawn(fetch_args, env=fetch_env,
+					fd_pipes=fd_pipes, returnpid=True)
+				logfile.close() # belongs to the spawned process
+				del fetch_log, logfile, fd_pipes, fetch_env, fetch_args, \
+					resume_opts
+
+		mergecount=0
+		for x in mymergelist:
+			mergecount+=1
+			myroot=x[1]
+			pkg_key = x[2]
+			pkgindex=2
+			portdb = self.trees[myroot]["porttree"].dbapi
+			bindb  = self.trees[myroot]["bintree"].dbapi
+			vartree = self.trees[myroot]["vartree"]
+			pkgsettings = self.pkgsettings[myroot]
+			if x[0]=="blocks":
+				pkgindex=3
+			y = portdb.findname(pkg_key)
+			if "--pretend" not in self.myopts:
+				print "\n>>> Emerging (" + \
+					colorize("MERGE_LIST_PROGRESS", str(mergecount)) + " of " + \
+					colorize("MERGE_LIST_PROGRESS", str(len(mymergelist))) + ") " + \
+					colorize("GOOD", x[pkgindex]) + " to " + x[1]
+				emergelog(xterm_titles, " >>> emerge ("+\
+					str(mergecount)+" of "+str(len(mymergelist))+\
+					") "+x[pkgindex]+" to "+x[1])
+
+			pkgsettings["EMERGE_FROM"] = x[0]
+			pkgsettings.backup_changes("EMERGE_FROM")
+			pkgsettings.reset()
+
+			#buildsyspkg: Check if we need to _force_ binary package creation
+			issyspkg = ("buildsyspkg" in myfeat) \
+					and x[0] != "blocks" \
+					and mysysdict.has_key(portage.cpv_getkey(x[2])) \
+					and "--buildpkg" not in self.myopts
+			if x[0] in ["ebuild","blocks"]:
+				if x[0] == "blocks" and "--fetchonly" not in self.myopts:
+					raise Exception, "Merging a blocker"
+				elif "--fetchonly" in self.myopts or \
+					"--fetch-all-uri" in self.myopts:
+					if "--fetch-all-uri" in self.myopts:
+						retval = portage.doebuild(y, "fetch", myroot,
+							pkgsettings, self.edebug,
+							"--pretend" in self.myopts, fetchonly=1,
+							fetchall=1, mydbapi=portdb, tree="porttree")
+					else:
+						retval = portage.doebuild(y, "fetch", myroot,
+							pkgsettings, self.edebug,
+							"--pretend" in self.myopts, fetchonly=1,
+							mydbapi=portdb, tree="porttree")
+					if (retval is None) or retval:
+						print
+						print "!!! Fetch for",y,"failed, continuing..."
+						print
+						failed_fetches.append(pkg_key)
+					continue
+
+				portage.doebuild_environment(y, "setup", myroot,
+					pkgsettings, self.edebug, 1, portdb)
+				catdir = os.path.dirname(pkgsettings["PORTAGE_BUILDDIR"])
+				portage.util.ensure_dirs(os.path.dirname(catdir),
+					uid=portage.portage_uid, gid=portage.portage_gid,
+					mode=070, mask=0)
+				builddir_lock = None
+				catdir_lock = None
+				try:
+					catdir_lock = portage.locks.lockdir(catdir)
+					portage.util.ensure_dirs(catdir,
+						uid=portage.portage_uid, gid=portage.portage_gid,
+						mode=070, mask=0)
+					builddir_lock = portage.locks.lockdir(
+						pkgsettings["PORTAGE_BUILDDIR"])
+					try:
+						portage.locks.unlockdir(catdir_lock)
+					finally:
+						catdir_lock = None
+					msg = " === (%s of %s) Cleaning (%s::%s)" % \
+						(mergecount, len(mymergelist), pkg_key, y)
+					short_msg = "emerge: (%s of %s) %s Clean" % \
+						(mergecount, len(mymergelist), pkg_key)
+					emergelog(xterm_titles, msg, short_msg=short_msg)
+					retval = portage.doebuild(y, "clean", myroot,
+						pkgsettings, self.edebug, cleanup=1,
+						mydbapi=portdb, tree="porttree")
+					if retval != os.EX_OK:
+						return retval
+					if "--buildpkg" in self.myopts or issyspkg:
+						if issyspkg:
+							print ">>> This is a system package, " + \
+								"let's pack a rescue tarball."
+						msg = " === (%s of %s) Compiling/Packaging (%s::%s)" % \
+							(mergecount, len(mymergelist), pkg_key, y)
+						short_msg = "emerge: (%s of %s) %s Compile" % \
+							(mergecount, len(mymergelist), pkg_key)
+						emergelog(xterm_titles, msg, short_msg=short_msg)
+						self.trees[myroot]["bintree"].prevent_collision(pkg_key)
+						binpkg_tmpfile = os.path.join(pkgsettings["PKGDIR"],
+							pkg_key + ".tbz2." + str(os.getpid()))
+						pkgsettings["PORTAGE_BINPKG_TMPFILE"] = binpkg_tmpfile
+						pkgsettings.backup_changes("PORTAGE_BINPKG_TMPFILE")
+						retval = portage.doebuild(y, "package", myroot,
+							pkgsettings, self.edebug, mydbapi=portdb,
+							tree="porttree")
+						del pkgsettings["PORTAGE_BINPKG_TMPFILE"]
+						if retval != os.EX_OK:
+							return retval
+						bintree = self.trees[myroot]["bintree"]
+						bintree.inject(pkg_key, filename=binpkg_tmpfile)
+						if "--buildpkgonly" not in self.myopts:
+							msg = " === (%s of %s) Merging (%s::%s)" % \
+								(mergecount, len(mymergelist), pkg_key, y)
+							short_msg = "emerge: (%s of %s) %s Merge" % \
+								(mergecount, len(mymergelist), pkg_key)
+							emergelog(xterm_titles, msg, short_msg=short_msg)
+							retval = portage.merge(pkgsettings["CATEGORY"],
+								pkgsettings["PF"], pkgsettings["D"],
+								os.path.join(pkgsettings["PORTAGE_BUILDDIR"],
+								"build-info"), myroot, pkgsettings,
+								myebuild=pkgsettings["EBUILD"],
+								mytree="porttree", mydbapi=portdb,
+								vartree=vartree, prev_mtimes=ldpath_mtimes)
+							if retval != os.EX_OK:
+								return retval
+						elif "noclean" not in pkgsettings.features:
+							portage.doebuild(y, "clean", myroot,
+								pkgsettings, self.edebug, mydbapi=portdb,
+								tree="porttree")
+					else:
+						msg = " === (%s of %s) Compiling/Merging (%s::%s)" % \
+							(mergecount, len(mymergelist), pkg_key, y)
+						short_msg = "emerge: (%s of %s) %s Compile" % \
+							(mergecount, len(mymergelist), pkg_key)
+						emergelog(xterm_titles, msg, short_msg=short_msg)
+						retval = portage.doebuild(y, "merge", myroot,
+							pkgsettings, self.edebug, vartree=vartree,
+							mydbapi=portdb, tree="porttree",
+							prev_mtimes=ldpath_mtimes)
+						if retval != os.EX_OK:
+							return retval
+				finally:
+					if builddir_lock:
+						portage.locks.unlockdir(builddir_lock)
+					try:
+						if not catdir_lock:
+							# Lock catdir for removal if empty.
+							catdir_lock = portage.locks.lockdir(catdir)
+					finally:
+						if catdir_lock:
+							try:
+								os.rmdir(catdir)
+							except OSError, e:
+								if e.errno not in (errno.ENOENT,
+									errno.ENOTEMPTY, errno.EEXIST):
+									raise
+								del e
+							portage.locks.unlockdir(catdir_lock)
+
+			elif x[0]=="binary":
+				#merge the tbz2
+				mytbz2 = self.trees[myroot]["bintree"].getname(pkg_key)
+				if "--getbinpkg" in self.myopts:
+					tbz2_lock = None
+					try:
+						if "distlocks" in pkgsettings.features and \
+							os.access(pkgsettings["PKGDIR"], os.W_OK):
+							portage.util.ensure_dirs(os.path.dirname(mytbz2))
+							tbz2_lock = portage.locks.lockfile(mytbz2,
+								wantnewlockfile=1)
+						if self.trees[myroot]["bintree"].isremote(pkg_key):
+							msg = " --- (%s of %s) Fetching Binary (%s::%s)" %\
+								(mergecount, len(mymergelist), pkg_key, mytbz2)
+							short_msg = "emerge: (%s of %s) %s Fetch" % \
+								(mergecount, len(mymergelist), pkg_key)
+							emergelog(xterm_titles, msg, short_msg=short_msg)
+							try:
+								self.trees[myroot]["bintree"].gettbz2(pkg_key)
+							except portage.exception.FileNotFound:
+								writemsg("!!! Fetching Binary failed " + \
+									"for '%s'\n" % pkg_key, noiselevel=-1)
+								if not fetchonly:
+									return 1
+								failed_fetches.append(pkg_key)
+							except portage.exception.DigestException, e:
+								writemsg("\n!!! Digest verification failed:\n",
+									noiselevel=-1)
+								writemsg("!!! %s\n" % e.value[0],
+									noiselevel=-1)
+								writemsg("!!! Reason: %s\n" % e.value[1],
+									noiselevel=-1)
+								writemsg("!!! Got: %s\n" % e.value[2],
+									noiselevel=-1)
+								writemsg("!!! Expected: %s\n" % e.value[3],
+									noiselevel=-1)
+								os.unlink(mytbz2)
+								if not fetchonly:
+									return 1
+								failed_fetches.append(pkg_key)
+					finally:
+						if tbz2_lock:
+							portage.locks.unlockfile(tbz2_lock)
+
+				if "--fetchonly" in self.myopts or \
+					"--fetch-all-uri" in self.myopts:
+					continue
+
+				short_msg = "emerge: ("+str(mergecount)+" of "+str(len(mymergelist))+") "+x[pkgindex]+" Merge Binary"
+				emergelog(xterm_titles, " === ("+str(mergecount)+\
+					" of "+str(len(mymergelist))+") Merging Binary ("+\
+					x[pkgindex]+"::"+mytbz2+")", short_msg=short_msg)
+				retval = portage.pkgmerge(mytbz2, x[1], pkgsettings,
+					mydbapi=bindb,
+					vartree=self.trees[myroot]["vartree"],
+					prev_mtimes=ldpath_mtimes)
+				if retval != os.EX_OK:
+					return retval
+				#need to check for errors
+			if "--buildpkgonly" not in self.myopts:
+				self.trees[x[1]]["vartree"].inject(x[2])
+				myfavkey=portage.cpv_getkey(x[2])
+				if "--fetchonly" not in self.myopts and \
+					"--fetch-all-uri" not in self.myopts and \
+					myfavkey in favorites:
+					myfavs = portage.grabfile(os.path.join(myroot, portage.WORLD_FILE))
+					myfavdict=genericdict(myfavs)
+					#don't record if already in system profile or already recorded
+					if (not mysysdict.has_key(myfavkey)) and (not myfavdict.has_key(myfavkey)):
+						#we don't have a favorites entry for this package yet; add one
+						myfavdict[myfavkey]=myfavkey
+						print ">>> Recording",myfavkey,"in \"world\" favorites file..."
+						emergelog(xterm_titles, " === ("+\
+							str(mergecount)+" of "+\
+							str(len(mymergelist))+\
+							") Updating world file ("+x[pkgindex]+")")
+						portage.write_atomic(
+						os.path.join(myroot, portage.WORLD_FILE),
+						"\n".join(myfavdict.values()))
+
+				if "--pretend" not in self.myopts and \
+					"--fetchonly" not in self.myopts and \
+					"--fetch-all-uri" not in self.myopts:
+					# Clean the old package that we have merged over top of it.
+					if pkgsettings.get("AUTOCLEAN", "yes") == "yes":
+						xsplit=portage.pkgsplit(x[2])
+						emergelog(xterm_titles, " >>> AUTOCLEAN: " + xsplit[0])
+						retval = unmerge(pkgsettings, self.myopts, vartree,
+							"clean", [xsplit[0]], ldpath_mtimes, autoclean=1)
+						if not retval:
+							emergelog(xterm_titles,
+								" --- AUTOCLEAN: Nothing unmerged.")
+					else:
+						portage.writemsg_stdout(colorize("WARN", "WARNING:")
+							+ " AUTOCLEAN is disabled.  This can cause serious"
+							+ " problems due to overlapping packages.\n")
+
+					# Figure out if we need a restart.
+					mysplit=portage.pkgsplit(x[2])
+					if mysplit[0] == "sys-apps/portage" and x[1] == "/":
+						myver=mysplit[1]+"-"+mysplit[2]
+						if myver[-3:]=='-r0':
+							myver=myver[:-3]
+						if (myver != portage.VERSION) and \
+						   "livecvsportage" not in self.settings.features:
+							if len(mymergelist) > mergecount:
+								emergelog(xterm_titles,
+									" ::: completed emerge ("+ \
+									str(mergecount)+" of "+ \
+									str(len(mymergelist))+") "+ \
+									x[2]+" to "+x[1])
+								emergelog(xterm_titles, " *** RESTARTING " + \
+									"emerge via exec() after change of " + \
+									"portage version.")
+								del mtimedb["resume"]["mergelist"][0]
+								mtimedb.commit()
+								portage.run_exitfuncs()
+								mynewargv=[sys.argv[0],"--resume"]
+								resume_opts = self.myopts.copy()
+								# For automatic resume, we need to prevent
+								# any of bad_resume_opts from leaking in
+								# via EMERGE_DEFAULT_OPTS.
+								resume_opts["--ignore-default-opts"] = True
+								for myopt, myarg in resume_opts.iteritems():
+									if myopt not in bad_resume_opts:
+										if myarg is True:
+											mynewargv.append(myopt)
+										else:
+											mynewargv.append(myopt +"="+ myarg)
+								# priority only needs to be adjusted on the first run
+								os.environ["PORTAGE_NICENESS"] = "0"
+								os.execv(mynewargv[0], mynewargv)
+
+			if "--pretend" not in self.myopts and \
+				"--fetchonly" not in self.myopts and \
+				"--fetch-all-uri" not in self.myopts:
+				if "noclean" not in self.settings.features:
+					short_msg = "emerge: (%s of %s) %s Clean Post" % \
+						(mergecount, len(mymergelist), x[pkgindex])
+					emergelog(xterm_titles, (" === (%s of %s) " + \
+						"Post-Build Cleaning (%s::%s)") % \
+						(mergecount, len(mymergelist), x[pkgindex], y),
+						short_msg=short_msg)
+				emergelog(xterm_titles, " ::: completed emerge ("+\
+					str(mergecount)+" of "+str(len(mymergelist))+") "+\
+					x[2]+" to "+x[1])
+
+			# Unsafe for parallel merges
+			del mtimedb["resume"]["mergelist"][0]
+			# Commit after each merge so that --resume may still work in
+			# in the event that portage is not allowed to exit normally
+			# due to power failure, SIGKILL, etc...
+			mtimedb.commit()
+
+		if "--pretend" not in self.myopts:
+			emergelog(xterm_titles, " *** Finished. Cleaning up...")
+
+		# We're out of the loop... We're done. Delete the resume data.
+		if mtimedb.has_key("resume"):
+			del mtimedb["resume"]
+		mtimedb.commit()
+
+		#by doing an exit this way, --fetchonly can continue to try to
+		#fetch everything even if a particular download fails.
+		if "--fetchonly" in self.myopts or "--fetch-all-uri" in self.myopts:
+			if failed_fetches:
+				sys.stderr.write("\n\n!!! Some fetch errors were " + \
+					"encountered.  Please see above for details.\n\n")
+				for cpv in failed_fetches:
+					sys.stderr.write("   ")
+					sys.stderr.write(cpv)
+					sys.stderr.write("\n")
+				sys.stderr.write("\n")
+				sys.exit(1)
+			else:
+				sys.exit(0)
+		return os.EX_OK
+
+def unmerge(settings, myopts, vartree, unmerge_action, unmerge_files,
+	ldpath_mtimes, autoclean=0):
+	candidate_catpkgs=[]
+	global_unmerge=0
+	xterm_titles = "notitles" not in settings.features
+
+	vdb_path = os.path.join(settings["ROOT"], portage.VDB_PATH)
+	try:
+		# At least the parent needs to exist for the lock file.
+		portage.util.ensure_dirs(vdb_path)
+	except portage.exception.PortageException:
+		pass
+	vdb_lock = None
+	try:
+		if os.access(vdb_path, os.W_OK):
+			vdb_lock = portage.locks.lockdir(vdb_path)
+		realsyslist = getlist(settings, "system")
+		syslist = []
+		for x in realsyslist:
+			mycp = portage.dep_getkey(x)
+			if mycp in settings.getvirtuals():
+				providers = []
+				for provider in settings.getvirtuals()[mycp]:
+					if vartree.dbapi.match(provider):
+						providers.append(provider)
+				if len(providers) == 1:
+					syslist.extend(providers)
+			else:
+				syslist.append(mycp)
+	
+		mysettings = portage.config(clone=settings)
+	
+		if not unmerge_files or "world" in unmerge_files or \
+			"system" in unmerge_files:
+			if "unmerge"==unmerge_action:
+				print
+				print bold("emerge unmerge") + " can only be used with " + \
+					"specific package names, not with "+bold("world")+" or"
+				print bold("system")+" targets."
+				print
+				return 0
+			else:
+				global_unmerge = 1
+	
+		localtree = vartree
+		# process all arguments and add all
+		# valid db entries to candidate_catpkgs
+		if global_unmerge:
+			if not unmerge_files or "world" in unmerge_files:
+				candidate_catpkgs.extend(vartree.dbapi.cp_all())
+			elif "system" in unmerge_files:
+				candidate_catpkgs.extend(getlist(settings, "system"))
+		else:
+			#we've got command-line arguments
+			if not unmerge_files:
+				print "\nNo packages to unmerge have been provided.\n"
+				return 0
+			for x in unmerge_files:
+				arg_parts = x.split('/')
+				if x[0] not in [".","/"] and \
+					arg_parts[-1][-7:] != ".ebuild":
+					#possible cat/pkg or dep; treat as such
+					candidate_catpkgs.append(x)
+				elif unmerge_action in ["prune","clean"]:
+					print "\n!!! Prune and clean do not accept individual" + \
+						" ebuilds as arguments;\n    skipping.\n"
+					continue
+				else:
+					# it appears that the user is specifying an installed
+					# ebuild and we're in "unmerge" mode, so it's ok.
+					if not os.path.exists(x):
+						print "\n!!! The path '"+x+"' doesn't exist.\n"
+						return 0
+	
+					absx   = os.path.abspath(x)
+					sp_absx = absx.split("/")
+					if sp_absx[-1][-7:] == ".ebuild":
+						del sp_absx[-1]
+						absx = "/".join(sp_absx)
+	
+					sp_absx_len = len(sp_absx)
+	
+					vdb_path = os.path.join(settings["ROOT"], portage.VDB_PATH)
+					vdb_len  = len(vdb_path)
+	
+					sp_vdb     = vdb_path.split("/")
+					sp_vdb_len = len(sp_vdb)
+	
+					if not os.path.exists(absx+"/CONTENTS"):
+						print "!!! Not a valid db dir: "+str(absx)
+						return 0
+	
+					if sp_absx_len <= sp_vdb_len:
+						# The Path is shorter... so it can't be inside the vdb.
+						print sp_absx
+						print absx
+						print "\n!!!",x,"cannot be inside "+ \
+							vdb_path+"; aborting.\n"
+						return 0
+	
+					for idx in range(0,sp_vdb_len):
+						if idx >= sp_absx_len or sp_vdb[idx] != sp_absx[idx]:
+							print sp_absx
+							print absx
+							print "\n!!!", x, "is not inside "+\
+								vdb_path+"; aborting.\n"
+							return 0
+	
+					print "="+"/".join(sp_absx[sp_vdb_len:])
+					candidate_catpkgs.append(
+						"="+"/".join(sp_absx[sp_vdb_len:]))
+	
+		newline=""
+		if (not "--quiet" in myopts):
+			newline="\n"
+		if settings["ROOT"] != "/":
+			print darkgreen(newline+ \
+				">>> Using system located in ROOT tree "+settings["ROOT"])
+		if (("--pretend" in myopts) or ("--ask" in myopts)) and \
+			not ("--quiet" in myopts):
+			print darkgreen(newline+\
+				">>> These are the packages that would be unmerged:")
+	
+		pkgmap={}
+		numselected=0
+		for x in candidate_catpkgs:
+			# cycle through all our candidate deps and determine
+			# what will and will not get unmerged
+			try:
+				mymatch=localtree.dep_match(x)
+			except KeyError:
+				mymatch=None
+			except ValueError, errpkgs:
+				print "\n\n!!! The short ebuild name \"" + \
+					x + "\" is ambiguous.  Please specify"
+				print "!!! one of the following fully-qualified " + \
+					"ebuild names instead:\n"
+				for i in errpkgs[0]:
+					print "    " + green(i)
+				print
+				sys.exit(1)
+	
+			if not mymatch and x[0] not in "<>=~":
+				#add a "=" if missing
+				mymatch=localtree.dep_match("="+x)
+			if not mymatch:
+				portage.writemsg("\n--- Couldn't find '%s' to %s.\n" % \
+					(x, unmerge_action), noiselevel=-1)
+				continue
+			mykey = portage.key_expand(
+				portage.dep_getkey(
+					mymatch[0]), mydb=vartree.dbapi, settings=settings)
+			if not pkgmap.has_key(mykey):
+				pkgmap[mykey]={"protected":[], "selected":[], "omitted":[] }
+			if unmerge_action=="unmerge":
+					for y in mymatch:
+						if y not in pkgmap[mykey]["selected"]:
+							pkgmap[mykey]["selected"].append(y)
+							numselected=numselected+len(mymatch)
+	
+			else:
+				#unmerge_action in ["prune", clean"]
+				slotmap={}
+				for mypkg in mymatch:
+					if unmerge_action=="clean":
+						myslot=localtree.getslot(mypkg)
+					else:
+						# since we're pruning, we don't care about slots
+						# and put all the pkgs in together
+						myslot=0
+					if not slotmap.has_key(myslot):
+						slotmap[myslot]={}
+					slotmap[myslot][localtree.dbapi.cpv_counter(mypkg)]=mypkg
+				for myslot in slotmap.keys():
+					counterkeys=slotmap[myslot].keys()
+					counterkeys.sort()
+					if not counterkeys:
+						continue
+					counterkeys.sort()
+					pkgmap[mykey]["protected"].append(
+						slotmap[myslot][counterkeys[-1]])
+					del counterkeys[-1]
+					#be pretty and get them in order of merge:
+					for ckey in counterkeys:
+						pkgmap[mykey]["selected"].append(slotmap[myslot][ckey])
+						numselected=numselected+1
+					# ok, now the last-merged package
+					# is protected, and the rest are selected
+		if global_unmerge and not numselected:
+			portage.writemsg_stdout("\n>>> No outdated packages were found on your system.\n")
+			return 0
+	
+		if not numselected:
+			portage.writemsg_stdout(
+				"\n>>> No packages selected for removal by " + \
+				unmerge_action + "\n")
+			return 0
+	finally:
+		if vdb_lock:
+			portage.locks.unlockdir(vdb_lock)
+	for x in pkgmap.keys():
+		for y in localtree.dep_match(x):
+			if y not in pkgmap[x]["omitted"] and \
+			   y not in pkgmap[x]["selected"] and \
+			   y not in pkgmap[x]["protected"]:
+				pkgmap[x]["omitted"].append(y)
+		if global_unmerge and not pkgmap[x]["selected"]:
+			#avoid cluttering the preview printout with stuff that isn't getting unmerged
+			continue
+		if not (pkgmap[x]["protected"] or pkgmap[x]["omitted"]) and (x in syslist):
+			print colorize("BAD","\a\n\n!!! '%s' is part of your system profile." % x)
+			print colorize("WARN","\a!!! Unmerging it may be damaging to your system.\n")
+			if "--pretend" not in myopts and "--ask" not in myopts:
+				countdown(int(settings["EMERGE_WARNING_DELAY"]),
+					colorize("UNMERGE_WARN", "Press Ctrl-C to Stop"))
+		print "\n "+white(x)
+		for mytype in ["selected","protected","omitted"]:
+			portage.writemsg_stdout((mytype + ": ").rjust(14), noiselevel=-1)
+			if pkgmap[x][mytype]:
+				for mypkg in pkgmap[x][mytype]:
+					mysplit=portage.catpkgsplit(mypkg)
+					if mysplit[3]=="r0":
+						myversion=mysplit[2]
+					else:
+						myversion=mysplit[2]+"-"+mysplit[3]
+					if mytype=="selected":
+						portage.writemsg_stdout(
+							colorize("UNMERGE_WARN", myversion + " "), noiselevel=-1)
+					else:
+						portage.writemsg_stdout(
+							colorize("GOOD", myversion + " "), noiselevel=-1)
+			else:
+				portage.writemsg_stdout("none", noiselevel=-1)
+			portage.writemsg_stdout("\n", noiselevel=-1)
+
+	portage.writemsg_stdout("\n>>> " + colorize("UNMERGE_WARN", "'Selected'") + \
+		" packages are slated for removal.\n")
+	portage.writemsg_stdout(">>> " + colorize("GOOD", "'Protected'") + \
+			" and " + colorize("GOOD", "'omitted'") + \
+			" packages will not be removed.\n\n")
+
+	if "--pretend" in myopts:
+		#we're done... return
+		return 0
+	if "--ask" in myopts:
+		if userquery("Would you like to unmerge these packages?")=="No":
+			# enter pretend mode for correct formatting of results
+			myopts["--pretend"] = True
+			print
+			print "Quitting."
+			print
+			return 0
+	#the real unmerging begins, after a short delay....
+	if not autoclean:
+		countdown(int(settings["CLEAN_DELAY"]), ">>> Unmerging")
+
+	for x in pkgmap.keys():
+		for y in pkgmap[x]["selected"]:
+			print ">>> Unmerging "+y+"..."
+			emergelog(xterm_titles, "=== Unmerging... ("+y+")")
+			mysplit=y.split("/")
+			#unmerge...
+			retval = portage.unmerge(mysplit[0], mysplit[1], settings["ROOT"],
+				mysettings, unmerge_action not in ["clean","prune"],
+				vartree=vartree, ldpath_mtimes=ldpath_mtimes)
+			if retval != os.EX_OK:
+				emergelog(xterm_titles, " !!! unmerge FAILURE: "+y)
+				ebuild = vartree.dbapi.findname(y)
+				show_unmerge_failure_message(y, ebuild, retval)
+				sys.exit(retval)
+			else:
+				clean_world(vartree.dbapi, y)
+				emergelog(xterm_titles, " >>> unmerge success: "+y)
+	return 1
+
+def show_unmerge_failure_message(pkg, ebuild, retval):
+
+	from formatter import AbstractFormatter, DumbWriter
+	f = AbstractFormatter(DumbWriter(sys.stderr, maxcol=72))
+
+	msg = []
+	msg.append("A removal phase of the '%s' package " % pkg)
+	msg.append("has failed with exit value %s.  " % retval)
+	msg.append("The problem occurred while executing ")
+	msg.append("the ebuild located at '%s'.  " % ebuild)
+	msg.append("If necessary, manually remove the ebuild " )
+	msg.append("in order to skip the execution of removal phases.")
+
+	f.end_paragraph(1)
+	for x in msg:
+		f.add_flowing_data(x)
+	f.end_paragraph(1)
+	f.writer.flush()
+
+def chk_updated_info_files(root, infodirs, prev_mtimes, retval):
+
+	if os.path.exists(EPREFIX+"/usr/bin/install-info"):
+		regen_infodirs=[]
+		for z in infodirs:
+			if z=='':
+				continue
+			inforoot=normpath(root+z)
+			if os.path.isdir(inforoot):
+				infomtime = long(os.stat(inforoot).st_mtime)
+				if inforoot not in prev_mtimes or \
+					prev_mtimes[inforoot] != infomtime:
+						regen_infodirs.append(inforoot)
+
+		if not regen_infodirs:
+			portage.writemsg_stdout(" "+green("*")+" GNU info directory index is up-to-date.\n")
+		else:
+			portage.writemsg_stdout(" "+green("*")+" Regenerating GNU info directory index...\n")
+
+			icount=0
+			badcount=0
+			for inforoot in regen_infodirs:
+				if inforoot=='':
+					continue
+				for filename in ("dir", "dir.gz", "dir.bz2"):
+					file_path = os.path.join(inforoot, filename)
+					try:
+						os.rename(file_path, file_path + ".old")
+					except OSError, e:
+						if e.errno != errno.ENOENT:
+							raise
+						del e
+
+				if not os.path.isdir(inforoot):
+					continue
+				errmsg = ""
+				file_list = os.listdir(inforoot)
+				file_list.sort()
+				for x in file_list:
+					if (x[0] == ".") or (x in ["dir","dir.old"]) or (os.path.isdir(inforoot+"/"+x)):
+						continue
+					myso=commands.getstatusoutput("LANG=C LANGUAGE=C "+EPREFIX+"/usr/bin/install-info --dir-file="+inforoot+"/dir "+inforoot+"/"+x)[1]
+					existsstr="already exists, for file `"
+					if myso!="":
+						if re.search(existsstr,myso):
+							# Already exists... Don't increment the count for this.
+							pass
+						elif myso[:44]=="install-info: warning: no info dir entry in ":
+							# This info file doesn't contain a DIR-header: install-info produces this
+							# (harmless) warning (the --quiet switch doesn't seem to work).
+							# Don't increment the count for this.
+							pass
+						else:
+							badcount=badcount+1
+							errmsg += myso + "\n"
+					icount=icount+1
+
+				#update mtime so we can potentially avoid regenerating.
+				prev_mtimes[inforoot] = long(os.stat(inforoot).st_mtime)
+
+			if badcount:
+				print " "+yellow("*")+" Processed",icount,"info files;",badcount,"errors."
+				print errmsg
+			else:
+				print " "+green("*")+" Processed",icount,"info files."
+
+
+def display_news_notification(settings):
+	target_root = settings["ROOT"]
+	NEWS_PATH = os.path.join("metadata", "news")
+	UNREAD_PATH = os.path.join(target_root, NEWS_LIB_PATH, "news")
+	porttree = portdbapi(porttree_root=settings["PORTDIR"], mysettings=settings)
+	newsReaderDisplay = False
+
+	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)
+			
+	
+	if newsReaderDisplay:
+		print colorize("WARN", " *"),
+		print "Use " + colorize("GOOD", "eselect news") + " to read news items."
+		print
+
+def post_emerge(settings, mtimedb, retval):
+	"""
+	Misc. things to run at the end of a merge session.
+	
+	Update Info Files
+	Update Config Files
+	Update News Items
+	Commit mtimeDB
+	Display preserved libs warnings
+	Exit Emerge
+	
+	@param settings: Configuration settings (typically portage.settings)
+	@type settings: portage.config()
+	@param mtimedb: The mtimeDB to store data needed across merge invocations
+	@type mtimedb: MtimeDB class instance
+	@param retval: Emerge's return value
+	@type retval: Int
+	@rype: None
+	@returns:
+	1.  Calls sys.exit(retval)
+	"""
+	target_root = settings["ROOT"]
+	info_mtimes = mtimedb["info"]
+
+	# Load the most current variables from ${ROOT}/etc/profile.env
+	settings.unlock()
+	settings.regenerate()
+	settings.lock()
+
+	config_protect = settings.get("CONFIG_PROTECT","").split()
+	infodirs = settings.get("INFOPATH","").split(":") + \
+		settings.get("INFODIR","").split(":")
+
+	os.chdir("/")
+
+	emergelog("notitles" not in settings.features,
+		" *** exiting successfully.")
+
+	from portage.util import normalize_path
+	if "noinfo" not in settings.features:
+		chk_updated_info_files(normalize_path(target_root + EPREFIX), infodirs, info_mtimes, retval)
+	chk_updated_cfg_files(normalize_path(target_root + EPREFIX), config_protect)
+	
+	display_news_notification(settings)
+	
+	from portage.dbapi.vartree import PreservedLibsRegistry
+	plib_registry = PreservedLibsRegistry(os.path.join(target_root, CACHE_PATH, "preserved_libs_registry"))
+	if plib_registry.hasEntries():
+		print colorize("WARN", "!!!") + " existing preserved libs:"
+		plibdata = plib_registry.getPreservedLibs()
+		for cpv in plibdata.keys():
+			print colorize("WARN", ">>>") + " package: %s" % cpv
+			for f in plibdata[cpv]:
+				print colorize("WARN", " * ") + " - %s" % f
+		print "Use " + colorize("GOOD", "revdep-rebuild") + " to rebuild packages using these libraries"
+		print "and then remerge the packages listed above."
+	
+	mtimedb.commit()
+	sys.exit(retval)
+
+
+def chk_updated_cfg_files(target_root, config_protect):
+	if config_protect:
+		#number of directories with some protect files in them
+		procount=0
+		for x in config_protect:
+			x = os.path.join(target_root, x.lstrip(os.path.sep))
+			try:
+				mymode = os.lstat(x).st_mode
+			except OSError:
+				continue
+			if stat.S_ISDIR(mymode):
+				mycommand = "cd '%s'; find . -iname '._cfg????_*'" % x
+			else:
+				mycommand = "cd '%s'; find . -maxdepth 1 -iname '._cfg????_%s'" % \
+					os.path.split(x.rstrip(os.path.sep))
+			a = commands.getstatusoutput(mycommand + \
+				" ! -iname '.*~' ! -iname '.*.bak'")
+			if a[0] != 0:
+				print >> sys.stderr, " " + bad("*")+ " error scanning '%s'" % x
+			else:
+				files = a[1].split()
+				if files:
+					procount += 1
+					print colorize("WARN", " * IMPORTANT:"),
+					if stat.S_ISDIR(mymode):
+						 print "%d config files in '%s' need updating." % \
+							(len(files), x)
+					else:
+						 print "config file '%s' needs updating." % x
+
+		if procount:
+			#print " "+yellow("*")+" Type "+green("emerge --help config")+" to learn how to update config files."
+			print " "+yellow("*")+" Type "+green("emerge --help config")+" to learn how to update config files."
+
+def checkUpdatedNewsItems( root, NEWS_PATH, UNREAD_PATH, repo_id ):
+	"""
+	Examines news items in repodir + '/' + NEWS_PATH and attempts to find unread items
+	Returns the number of unread (yet relevent) items.
+	
+	@param root:
+	@type root:
+	@param NEWS_PATH:
+	@type NEWS_PATH:
+	@param UNREAD_PATH:
+	@type UNREAD_PATH:
+	@param repo_id:
+	@type repo_id:
+	@rtype: Integer
+	@returns:
+	1.  The number of unread but relevant news items.
+	
+	"""
+	from portage.news import NewsManager
+	manager = NewsManager( root, NEWS_PATH, UNREAD_PATH )
+	return manager.getUnreadItems( repo_id, update=True )
+
+def is_valid_package_atom(x):
+	try:
+		testkey = portage.dep_getkey(x)
+	except portage.exception.InvalidData:
+		return False
+	if testkey.startswith("null/"):
+		testatom = x.replace(testkey[5:], "cat/"+testkey[5:])
+	elif "/" not in x:
+		testatom = "cat/"+x
+	else:
+		testatom = x
+	return portage.isvalidatom(testatom)
+
+def validate_merge_list(trees, mergelist):
+	"""Validate the list to make sure all the packages are still available.
+	This is needed for --resume."""
+	for (pkg_type, myroot, pkg_key, action) in mergelist:
+		if pkg_type == "binary" and \
+			not trees[myroot]["bintree"].dbapi.match("="+pkg_key) or \
+			pkg_type == "ebuild" and \
+			not trees[myroot]["porttree"].dbapi.xmatch(
+			"match-all", "="+pkg_key):
+			print red("!!! Error: The resume list contains packages that are no longer")
+			print red("!!!        available to be emerged. Please restart/continue")
+			print red("!!!        the merge operation manually.")
+			sys.exit(1)
+
+def show_blocker_docs_link():
+	print
+	print "For more information about " + bad("Blocked Packages") + ", please refer to the following"
+	print "section of the Gentoo Linux x86 Handbook (architecture is irrelevant):"
+	print
+	print "http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?full=1#blocked"
+	print
+
+def action_sync(settings, trees, mtimedb, myopts, myaction):
+	xterm_titles = "notitles" not in settings.features
+	emergelog(xterm_titles, " === sync")
+	myportdir = settings.get("PORTDIR", None)
+	if not myportdir:
+		sys.stderr.write("!!! PORTDIR is undefined.  Is /etc/make.globals missing?\n")
+		sys.exit(1)
+	if myportdir[-1]=="/":
+		myportdir=myportdir[:-1]
+	if not os.path.exists(myportdir):
+		print ">>>",myportdir,"not found, creating it."
+		os.makedirs(myportdir,0755)
+	syncuri=settings["SYNC"].rstrip()
+	os.umask(0022)
+	updatecache_flg = False
+	if myaction == "metadata":
+		print "skipping sync"
+		updatecache_flg = True
+		tmpservertimestampfile = None
+	elif syncuri[:8]=="rsync://":
+		if not os.path.exists(EPREFIX+"/usr/bin/rsync"):
+			print "!!! rsync does not exist, so rsync support is disabled."
+			print "!!! Type \"emerge net-misc/rsync\" to enable rsync support."
+			sys.exit(1)
+		mytimeout=180
+
+		rsync_opts = []
+		import shlex, StringIO
+		if settings["PORTAGE_RSYNC_OPTS"] == "":
+			portage.writemsg("PORTAGE_RSYNC_OPTS empty or unset, using hardcoded defaults\n")
+			rsync_opts.extend([
+				"--recursive",    # Recurse directories
+				"--links",        # Consider symlinks
+				"--safe-links",   # Ignore links outside of tree
+				"--perms",        # Preserve permissions
+				"--times",        # Preserive mod times
+				"--compress",     # Compress the data transmitted
+				"--force",        # Force deletion on non-empty dirs
+				"--whole-file",   # Don't do block transfers, only entire files
+				"--delete",       # Delete files that aren't in the master tree
+				"--delete-after", # Delete only after everything else is done
+				"--stats",        # Show final statistics about what was transfered
+				"--timeout="+str(mytimeout), # IO timeout if not done in X seconds
+				"--exclude=/distfiles",   # Exclude distfiles from consideration
+				"--exclude=/local",       # Exclude local     from consideration
+				"--exclude=/packages",    # Exclude packages  from consideration
+				"--filter=H_**/files/digest-*", # Exclude manifest1 digests and delete on the receiving side
+			])
+
+		else:
+			# The below validation is not needed when using the above hardcoded
+			# defaults.
+
+			portage.writemsg("Using PORTAGE_RSYNC_OPTS instead of hardcoded defaults\n", 1)
+			lexer = shlex.shlex(StringIO.StringIO(
+				settings.get("PORTAGE_RSYNC_OPTS","")), posix=True)
+			lexer.whitespace_split = True
+			rsync_opts.extend(lexer)
+			del lexer
+
+			for opt in ("--recursive", "--times"):
+				if opt not in rsync_opts:
+					portage.writemsg(yellow("WARNING:") + " adding required option " + \
+					"%s not included in PORTAGE_RSYNC_OPTS\n" % opt)
+					rsync_opts.append(opt)
+	
+			for exclude in ("distfiles", "local", "packages"):
+				opt = "--exclude=/%s" % exclude
+				if opt not in rsync_opts:
+					portage.writemsg(yellow("WARNING:") + \
+					" adding required option %s not included in "  % opt + \
+					"PORTAGE_RSYNC_OPTS (can be overridden with --exclude='!')\n")
+					rsync_opts.append(opt)
+	
+			if settings["RSYNC_TIMEOUT"] != "":
+				portage.writemsg("WARNING: usage of RSYNC_TIMEOUT is deprecated, " + \
+				"use PORTAGE_RSYNC_EXTRA_OPTS instead\n")
+				try:
+					mytimeout = int(settings["RSYNC_TIMEOUT"])
+					rsync_opts.append("--timeout=%d" % mytimeout)
+				except ValueError, e:
+					portage.writemsg("!!! %s\n" % str(e))
+	
+			# TODO: determine options required for official servers
+			if syncuri.rstrip("/").endswith(".gentoo.org/gentoo-portage"):
+
+				def rsync_opt_startswith(opt_prefix):
+					for x in rsync_opts:
+						if x.startswith(opt_prefix):
+							return True
+					return False
+
+				if not rsync_opt_startswith("--timeout="):
+					rsync_opts.append("--timeout=%d" % mytimeout)
+
+				for opt in ("--compress", "--whole-file"):
+					if opt not in rsync_opts:
+						portage.writemsg(yellow("WARNING:") + " adding required option " + \
+						"%s not included in PORTAGE_RSYNC_OPTS\n" % opt)
+						rsync_opts.append(opt)
+
+		if "--quiet" in myopts:
+			rsync_opts.append("--quiet")    # Shut up a lot
+		else:
+			rsync_opts.append("--verbose")	# Print filelist
+
+		if "--verbose" in myopts:
+			rsync_opts.append("--progress")  # Progress meter for each file
+
+		if "--debug" in myopts:
+			rsync_opts.append("--checksum") # Force checksum on all files
+
+		if settings["RSYNC_EXCLUDEFROM"] != "":
+			portage.writemsg(yellow("WARNING:") + \
+			" usage of RSYNC_EXCLUDEFROM is deprecated, use " + \
+			"PORTAGE_RSYNC_EXTRA_OPTS instead\n")
+			if os.path.exists(settings["RSYNC_EXCLUDEFROM"]):
+				rsync_opts.append("--exclude-from=%s" % \
+				settings["RSYNC_EXCLUDEFROM"])
+			else:
+				portage.writemsg("!!! RSYNC_EXCLUDEFROM specified," + \
+				" but file does not exist.\n")
+
+		if settings["RSYNC_RATELIMIT"] != "":
+			portage.writemsg(yellow("WARNING:") + \
+			" usage of RSYNC_RATELIMIT is deprecated, use " + \
+			"PORTAGE_RSYNC_EXTRA_OPTS instead")
+			rsync_opts.append("--bwlimit=%s" % \
+			settings["RSYNC_RATELIMIT"])
+
+		# Real local timestamp file.
+		servertimestampfile = os.path.join(
+			myportdir, "metadata", "timestamp.chk")
+		# Temporary file for remote server timestamp comparison.
+		tmpservertimestampfile = os.path.join(
+			settings["PORTAGE_TMPDIR"], "timestamp.chk")
+
+		content = portage.util.grabfile(servertimestampfile)
+		mytimestamp = 0
+		if content:
+			try:
+				mytimestamp = time.mktime(time.strptime(content[0],
+					"%a, %d %b %Y %H:%M:%S +0000"))
+			except (OverflowError, ValueError):
+				pass
+		del content
+
+		try:
+			rsync_initial_timeout = \
+				int(settings.get("PORTAGE_RSYNC_INITIAL_TIMEOUT", "15"))
+		except ValueError:
+			rsync_initial_timeout = 15
+
+		try:
+			if settings.has_key("RSYNC_RETRIES"):
+				print yellow("WARNING:")+" usage of RSYNC_RETRIES is deprecated, use PORTAGE_RSYNC_RETRIES instead"
+				maxretries=int(settings["RSYNC_RETRIES"])				
+			else:
+				maxretries=int(settings["PORTAGE_RSYNC_RETRIES"])
+		except SystemExit, e:
+			raise # Needed else can't exit
+		except:
+			maxretries=3 #default number of retries
+
+		retries=0
+		user_name, hostname, port = re.split(
+			"rsync://([^:/]+@)?([^:/]*)(:[0-9]+)?", syncuri, maxsplit=3)[1:4]
+		if port is None:
+			port=""
+		if user_name is None:
+			user_name=""
+		updatecache_flg=True
+		all_rsync_opts = set(rsync_opts)
+		lexer = shlex.shlex(StringIO.StringIO(
+			settings.get("PORTAGE_RSYNC_EXTRA_OPTS","")), posix=True)
+		lexer.whitespace_split = True
+		extra_rsync_opts = list(lexer)
+		del lexer
+		all_rsync_opts.update(extra_rsync_opts)
+		family = socket.AF_INET
+		if "-4" in all_rsync_opts or "--ipv4" in all_rsync_opts:
+			family = socket.AF_INET
+		elif socket.has_ipv6 and \
+			("-6" in all_rsync_opts or "--ipv6" in all_rsync_opts):
+			family = socket.AF_INET6
+		ips=[]
+		while (1):
+			if ips:
+				del ips[0]
+			if ips==[]:
+				try:
+					for addrinfo in socket.getaddrinfo(
+						hostname, None, family, socket.SOCK_STREAM):
+						if addrinfo[0] == socket.AF_INET6:
+							# IPv6 addresses need to be enclosed in square brackets
+							ips.append("[%s]" % addrinfo[4][0])
+						else:
+							ips.append(addrinfo[4][0])
+					from random import shuffle
+					shuffle(ips)
+				except SystemExit, e:
+					raise # Needed else can't exit
+				except Exception, e:
+					print "Notice:",str(e)
+					dosyncuri=syncuri
+
+			if ips:
+				try:
+					dosyncuri = syncuri.replace(
+						"//" + user_name + hostname + port + "/",
+						"//" + user_name + ips[0] + port + "/", 1)
+				except SystemExit, e:
+					raise # Needed else can't exit
+				except Exception, e:
+					print "Notice:",str(e)
+					dosyncuri=syncuri
+
+			if (retries==0):
+				if "--ask" in myopts:
+					if userquery("Do you want to sync your Portage tree with the mirror at\n" + blue(dosyncuri) + bold("?"))=="No":
+						print
+						print "Quitting."
+						print
+						sys.exit(0)
+				emergelog(xterm_titles, ">>> Starting rsync with " + dosyncuri)
+				if "--quiet" not in myopts:
+					print ">>> Starting rsync with "+dosyncuri+"..."
+			else:
+				emergelog(xterm_titles,
+					">>> Starting retry %d of %d with %s" % \
+						(retries,maxretries,dosyncuri))
+				print "\n\n>>> Starting retry %d of %d with %s" % (retries,maxretries,dosyncuri)
+
+			if mytimestamp != 0 and "--quiet" not in myopts:
+				print ">>> Checking server timestamp ..."
+
+			rsynccommand = [EPREFIX+"/usr/bin/rsync"] + rsync_opts + extra_rsync_opts
+
+			if "--debug" in myopts:
+				print rsynccommand
+
+			exitcode = os.EX_OK
+			servertimestamp = 0
+			# Even if there's no timestamp available locally, fetch the
+			# timestamp anyway as an initial probe to verify that the server is
+			# responsive.  This protects us from hanging indefinitely on a
+			# connection attempt to an unresponsive server which rsync's
+			# --timeout option does not prevent.
+			if True:
+				mycommand = rsynccommand[:]
+				mycommand.append(dosyncuri.rstrip("/") + \
+					"/metadata/timestamp.chk")
+				mycommand.append(tmpservertimestampfile)
+				content = None
+				mypids = []
+				try:
+					def timeout_handler(signum, frame):
+						raise portage.exception.PortageException("timed out")
+					signal.signal(signal.SIGALRM, timeout_handler)
+					# Timeout here in case the server is unresponsive.  The
+					# --timeout rsync option doesn't apply to the initial
+					# connection attempt.
+					if rsync_initial_timeout:
+						signal.alarm(rsync_initial_timeout)
+					try:
+						mypids.extend(portage.process.spawn(
+							mycommand, env=settings.environ(), returnpid=True))
+						exitcode = os.waitpid(mypids[0], 0)[1]
+						content = portage.grabfile(tmpservertimestampfile)
+					finally:
+						if rsync_initial_timeout:
+							signal.alarm(0)
+						try:
+							os.unlink(tmpservertimestampfile)
+						except OSError:
+							pass
+				except portage.exception.PortageException, e:
+					# timed out
+					print e
+					del e
+					if mypids and os.waitpid(mypids[0], os.WNOHANG) == (0,0):
+						os.kill(mypids[0], signal.SIGTERM)
+						os.waitpid(mypids[0], 0)
+					# This is the same code rsync uses for timeout.
+					exitcode = 30
+				else:
+					if exitcode != os.EX_OK:
+						if exitcode & 0xff:
+							exitcode = (exitcode & 0xff) << 8
+						else:
+							exitcode = exitcode >> 8
+				if mypids:
+					portage.process.spawned_pids.remove(mypids[0])
+				if content:
+					try:
+						servertimestamp = time.mktime(time.strptime(
+							content[0], "%a, %d %b %Y %H:%M:%S +0000"))
+					except (OverflowError, ValueError):
+						pass
+				del mycommand, mypids, content
+			if exitcode == os.EX_OK:
+				if (servertimestamp != 0) and (servertimestamp == mytimestamp):
+					emergelog(xterm_titles,
+						">>> Cancelling sync -- Already current.")
+					print
+					print ">>>"
+					print ">>> Timestamps on the server and in the local repository are the same."
+					print ">>> Cancelling all further sync action. You are already up to date."
+					print ">>>"
+					print ">>> In order to force sync, remove '%s'." % servertimestampfile
+					print ">>>"
+					print
+					sys.exit(0)
+				elif (servertimestamp != 0) and (servertimestamp < mytimestamp):
+					emergelog(xterm_titles,
+						">>> Server out of date: %s" % dosyncuri)
+					print
+					print ">>>"
+					print ">>> SERVER OUT OF DATE: %s" % dosyncuri
+					print ">>>"
+					print ">>> In order to force sync, remove '%s'." % servertimestampfile
+					print ">>>"
+					print
+				elif (servertimestamp == 0) or (servertimestamp > mytimestamp):
+					# actual sync
+					mycommand = rsynccommand + [dosyncuri+"/", myportdir]
+					exitcode = portage.process.spawn(mycommand,
+						env=settings.environ())
+					if exitcode in [0,1,3,4,11,14,20,21]:
+						break
+			elif exitcode in [1,3,4,11,14,20,21]:
+				break
+			else:
+				# Code 2 indicates protocol incompatibility, which is expected
+				# for servers with protocol < 29 that don't support
+				# --prune-empty-directories.  Retry for a server that supports
+				# at least rsync protocol version 29 (>=rsync-2.6.4).
+				pass
+
+			retries=retries+1
+
+			if retries<=maxretries:
+				print ">>> Retrying..."
+				time.sleep(11)
+			else:
+				# over retries
+				# exit loop
+				updatecache_flg=False
+				break
+
+		if (exitcode==0):
+			emergelog(xterm_titles, "=== Sync completed with %s" % dosyncuri)
+		elif (exitcode>0):
+			print
+			if exitcode==1:
+				print darkred("!!!")+green(" Rsync has reported that there is a syntax error. Please ensure")
+				print darkred("!!!")+green(" that your SYNC statement is proper.")
+				print darkred("!!!")+green(" SYNC="+settings["SYNC"])
+			elif exitcode==11:
+				print darkred("!!!")+green(" Rsync has reported that there is a File IO error. Normally")
+				print darkred("!!!")+green(" this means your disk is full, but can be caused by corruption")
+				print darkred("!!!")+green(" on the filesystem that contains PORTDIR. Please investigate")
+				print darkred("!!!")+green(" and try again after the problem has been fixed.")
+				print darkred("!!!")+green(" PORTDIR="+settings["PORTDIR"])
+			elif exitcode==20:
+				print darkred("!!!")+green(" Rsync was killed before it finished.")
+			else:
+				print darkred("!!!")+green(" Rsync has not successfully finished. It is recommended that you keep")
+				print darkred("!!!")+green(" trying or that you use the 'emerge-webrsync' option if you are unable")
+				print darkred("!!!")+green(" to use rsync due to firewall or other restrictions. This should be a")
+				print darkred("!!!")+green(" temporary problem unless complications exist with your network")
+				print darkred("!!!")+green(" (and possibly your system's filesystem) configuration.")
+			print
+			sys.exit(exitcode)
+	elif syncuri[:6]=="cvs://":
+		if not os.path.exists(EPREFIX+"/usr/bin/cvs"):
+			print "!!! cvs does not exist, so CVS support is disabled."
+			print "!!! Type \"emerge dev-util/cvs\" to enable CVS support."
+			sys.exit(1)
+		cvsroot=syncuri[6:]
+		cvsdir=os.path.dirname(myportdir)
+		if not os.path.exists(myportdir+"/CVS"):
+			#initial checkout
+			print ">>> Starting initial cvs checkout with "+syncuri+"..."
+			if os.path.exists(cvsdir+"/gentoo-x86"):
+				print "!!! existing",cvsdir+"/gentoo-x86 directory; exiting."
+				sys.exit(1)
+			try:
+				os.rmdir(myportdir)
+			except OSError, e:
+				if e.errno != errno.ENOENT:
+					sys.stderr.write(
+						"!!! existing '%s' directory; exiting.\n" % myportdir)
+					sys.exit(1)
+				del e
+			if portage.spawn("cd "+cvsdir+"; cvs -z0 -d "+cvsroot+" co -P gentoo-x86",settings,free=1):
+				print "!!! cvs checkout error; exiting."
+				sys.exit(1)
+			os.rename(os.path.join(cvsdir, "gentoo-x86"), myportdir)
+		else:
+			#cvs update
+			print ">>> Starting cvs update with "+syncuri+"..."
+			retval = portage.spawn("cd '%s'; cvs -z0 -q update -dP" % \
+				myportdir, settings, free=1)
+			if retval != os.EX_OK:
+				sys.exit(retval)
+		dosyncuri = syncuri
+	elif syncuri[:11]=="svn+http://":
+		# this should be way more generic!
+		if not os.path.exists(EPREFIX+"/usr/bin/svn"):
+			print "!!! svn does not exist, so SVN support is disabled."
+			print "!!! Type \"emerge dev-util/subversion\" to enable SVN support."
+			sys.exit(1)
+		svndir=os.path.dirname(myportdir)
+		if not os.path.exists(myportdir+"/.svn"):
+			#initial checkout
+			print ">>> Starting initial svn checkout with "+syncuri+"..."
+			if os.path.exists(svndir+"/prefix-overlay"):
+				print "!!! existing",svndir+"/prefix-overlay directory; exiting."
+				sys.exit(1)
+			try:
+				os.rmdir(myportdir)
+			except OSError, e:
+				if e.errno != errno.ENOENT:
+					sys.stderr.write(
+						"!!! existing '%s' directory; exiting.\n" % myportdir)
+					sys.exit(1)
+				del e
+			if portage.spawn("cd "+svndir+"; svn checkout "+syncuri[4:],settings,free=1):
+				print "!!! svn checkout error; exiting."
+				sys.exit(1)
+			os.rename(os.path.join(svndir, "prefix-overlay"), myportdir)
+		else:
+			#svn update
+			print ">>> Starting svn update..."
+			retval = portage.spawn("cd '%s'; svn update" % myportdir, \
+				settings, free=1)
+			if retval != os.EX_OK:
+				sys.exit(retval)
+
+		# write timestamp.chk
+		try:
+			if not os.path.exists(os.path.join(myportdir, "metadata")):
+				os.mkdir(os.path.join(myportdir, "metadata"))
+			f = open(os.path.join(myportdir, "metadata", "timestamp.chk"), 'w')
+			f.write(time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()))
+			f.write('\n')
+			f.close()
+		except IOError, e:
+			# too bad, next time better luck!
+			pass
+
+		dosyncuri = syncuri
+		updatecache_flg = True
+	else:
+		print "!!! rsync setting: ",syncuri,"not recognized; exiting."
+		sys.exit(1)
+
+	if updatecache_flg and  \
+		myaction != "metadata" and \
+		"metadata-transfer" not in settings.features:
+		updatecache_flg = False
+
+	# Reload the whole config from scratch.
+	settings, trees, mtimedb = load_emerge_config(trees=trees)
+	portdb = trees[settings["ROOT"]]["porttree"].dbapi
+
+	if os.path.exists(myportdir+"/metadata/cache") and updatecache_flg:
+		action_metadata(settings, portdb, myopts)
+
+	if portage._global_updates(trees, mtimedb["updates"]):
+		mtimedb.commit()
+		# Reload the whole config from scratch.
+		settings, trees, mtimedb = load_emerge_config(trees=trees)
+		portdb = trees[settings["ROOT"]]["porttree"].dbapi
+
+	mybestpv = portdb.xmatch("bestmatch-visible", "sys-apps/portage")
+	mypvs = portage.best(
+		trees[settings["ROOT"]]["vartree"].dbapi.match("sys-apps/portage"))
+
+	chk_updated_cfg_files(EPREFIX, settings.get("CONFIG_PROTECT","").split())
+
+	if myaction != "metadata":
+		if os.access(portage.USER_CONFIG_PATH + "/bin/post_sync", os.X_OK):
+			retval = portage.process.spawn(
+				[os.path.join(portage.USER_CONFIG_PATH, "bin", "post_sync"),
+				dosyncuri], env=settings.environ())
+			if retval != os.EX_OK:
+				print red(" * ")+bold("spawn failed of "+ portage.USER_CONFIG_PATH + "/bin/post_sync")
+
+	if(mybestpv != mypvs) and not "--quiet" in myopts:
+		print
+		print red(" * ")+bold("An update to portage is available.")+" It is _highly_ recommended"
+		print red(" * ")+"that you update portage now, before any other packages are updated."
+		print red(" * ")+"Please run 'emerge portage' and then update "+bold("ALL")+" of your"
+		print red(" * ")+"configuration files."
+		print red(" * ")+"To update portage, run 'emerge portage'."
+		print
+	
+	display_news_notification(settings)
+
+def action_metadata(settings, portdb, myopts):
+	portage.writemsg_stdout("\n>>> Updating Portage cache:      ")
+	old_umask = os.umask(0002)
+	cachedir = os.path.normpath(settings.depcachedir)
+	if cachedir in ["/",    "/bin", "/dev",  "/etc",  "/home",
+					"/lib", "/opt", "/proc", "/root", "/sbin",
+					"/sys", "/tmp", "/usr",  "/var"]:
+		print >> sys.stderr, "!!! PORTAGE_DEPCACHEDIR IS SET TO A PRIMARY " + \
+			"ROOT DIRECTORY ON YOUR SYSTEM."
+		print >> sys.stderr, \
+			"!!! This is ALMOST CERTAINLY NOT what you want: '%s'" % cachedir
+		sys.exit(73)
+	if not os.path.exists(cachedir):
+		os.mkdir(cachedir)
+
+	ec = portage.eclass_cache.cache(portdb.porttree_root)
+	myportdir = os.path.realpath(settings["PORTDIR"])
+	cm = settings.load_best_module("portdbapi.metadbmodule")(
+		myportdir, "metadata/cache", portage.auxdbkeys[:])
+
+	from portage.cache import util
+
+	class percentage_noise_maker(util.quiet_mirroring):
+		def __init__(self, dbapi):
+			self.dbapi = dbapi
+			self.cp_all = dbapi.cp_all()
+			l = len(self.cp_all)
+			self.call_update_min = 100000000
+			self.min_cp_all = l/100.0
+			self.count = 1
+			self.pstr = ''
+
+		def __iter__(self):
+			for x in self.cp_all:
+				self.count += 1
+				if self.count > self.min_cp_all:
+					self.call_update_min = 0
+					self.count = 0
+				for y in self.dbapi.cp_list(x):
+					yield y
+			self.call_update_mine = 0
+
+		def update(self, *arg):
+			try:				self.pstr = int(self.pstr) + 1
+			except ValueError:	self.pstr = 1
+			sys.stdout.write("%s%i%%" % \
+				("\b" * (len(str(self.pstr))+1), self.pstr))
+			sys.stdout.flush()
+			self.call_update_min = 10000000
+
+		def finish(self, *arg):
+			sys.stdout.write("\b\b\b\b100%\n")
+			sys.stdout.flush()
+
+	if "--quiet" in myopts:
+		def quicky_cpv_generator(cp_all_list):
+			for x in cp_all_list:
+				for y in portdb.cp_list(x):
+					yield y
+		source = quicky_cpv_generator(portdb.cp_all())
+		noise_maker = portage.cache.util.quiet_mirroring()
+	else:
+		noise_maker = source = percentage_noise_maker(portdb)
+	portage.cache.util.mirror_cache(source, cm, portdb.auxdb[myportdir],
+		eclass_cache=ec, verbose_instance=noise_maker)
+
+	sys.stdout.flush()
+	os.umask(old_umask)
+
+def action_regen(settings, portdb):
+	xterm_titles = "notitles" not in settings.features
+	emergelog(xterm_titles, " === regen")
+	#regenerate cache entries
+	print "Regenerating cache entries... "
+	try:
+		os.close(sys.stdin.fileno())
+	except SystemExit, e:
+		raise # Needed else can't exit
+	except:
+		pass
+	sys.stdout.flush()
+	mynodes = portdb.cp_all()
+	from portage.cache.cache_errors import CacheError
+	dead_nodes = {}
+	for mytree in portdb.porttrees:
+		try:
+			dead_nodes[mytree] = set(portdb.auxdb[mytree].iterkeys())
+		except CacheError, e:
+			print "\n  error listing cache entries for " + \
+				"'%s': %s, continuing..." % (mytree, e)
+			del e
+			dead_nodes = None
+			break
+	for x in mynodes:
+		mymatches = portdb.cp_list(x)
+		portage.writemsg_stdout("processing %s\n" % x)
+		for y in mymatches:
+			try:
+				foo = portdb.aux_get(y,["DEPEND"])
+			except SystemExit, e:
+				# sys.exit is an exception... And consequently, we can't catch it.
+				raise
+			except Exception, e:
+				print "\n  error processing %(cpv)s, continuing... (%(e)s)" % {"cpv":y,"e":str(e)}
+			if dead_nodes:
+				for mytree in portdb.porttrees:
+					if portdb.findname2(y, mytree=mytree)[0]:
+						dead_nodes[mytree].discard(y)
+	if dead_nodes:
+		for mytree, nodes in dead_nodes.iteritems():
+			auxdb = portdb.auxdb[mytree]
+			for y in nodes:
+				try:
+					del auxdb[y]
+				except (KeyError, CacheError):
+					pass
+	print "done!"
+
+def action_config(settings, trees, myopts, myfiles):
+	if len(myfiles) != 1 or "system" in myfiles or "world" in myfiles:
+		print red("!!! config can only take a single package atom at this time\n")
+		sys.exit(1)
+	if not is_valid_package_atom(myfiles[0]):
+		portage.writemsg("!!! '%s' is not a valid package atom.\n" % myfiles[0],
+			noiselevel=-1)
+		portage.writemsg("!!! Please check ebuild(5) for full details.\n")
+		portage.writemsg("!!! (Did you specify a version but forget to prefix with '='?)\n")
+		sys.exit(1)
+	print
+	try:
+		pkgs = trees[settings["ROOT"]]["vartree"].dbapi.match(myfiles[0])
+	except ValueError, e:
+		# Multiple matches thrown from cpv_expand
+		pkgs = e.args[0]
+	if len(pkgs) == 0:
+		print "No packages found.\n"
+		sys.exit(0)
+	elif len(pkgs) > 1:
+		if "--ask" in myopts:
+			options = []
+			print "Please select a package to configure:"
+			idx = 0
+			for pkg in pkgs:
+				idx += 1
+				options.append(str(idx))
+				print options[-1]+") "+pkg
+			print "X) Cancel"
+			options.append("X")
+			idx = userquery("Selection?", options)
+			if idx == "X":
+				sys.exit(0)
+			pkg = pkgs[int(idx)-1]
+		else:
+			print "The following packages available:"
+			for pkg in pkgs:
+				print "* "+pkg
+			print "\nPlease use a specific atom or the --ask option."
+			sys.exit(1)
+	else:
+		pkg = pkgs[0]
+
+	print
+	if "--ask" in myopts:
+		if userquery("Ready to configure "+pkg+"?") == "No":
+			sys.exit(0)
+	else:
+		print "Configuring pkg..."
+	print
+	ebuildpath = trees[settings["ROOT"]]["vartree"].dbapi.findname(pkg)
+	mysettings = portage.config(clone=settings)
+	portage.doebuild(ebuildpath, "config", settings["ROOT"], mysettings,
+		debug=(settings.get("PORTAGE_DEBUG", "") == 1), cleanup=True,
+		mydbapi=trees[settings["ROOT"]]["vartree"].dbapi, tree="vartree")
+	print
+
+def action_info(settings, trees, myopts, myfiles):
+	unameout=commands.getstatusoutput("uname -mrp")[1]
+	print getportageversion(settings["PORTDIR"], settings["ROOT"],
+		settings.profile_path, settings["CHOST"],
+		trees[settings["ROOT"]]["vartree"].dbapi)
+	header_width = 65
+	header_title = "System Settings"
+	if myfiles:
+		print header_width * "="
+		print header_title.rjust(int(header_width/2 + len(header_title)/2))
+	print header_width * "="
+	print "System uname: "+unameout
+	gentoo_release = portage.grabfile(os.path.join(
+		settings["PORTAGE_CONFIGROOT"] + EPREFIX, "etc", "gentoo-release"))
+	if gentoo_release:
+		print gentoo_release[0]
+	else:
+		print "Unknown Host Operating System"
+	lastSync = portage.grabfile(os.path.join(
+		settings["PORTDIR"], "metadata", "timestamp.chk"))
+	print "Timestamp of tree:",
+	if lastSync:
+		print lastSync[0]
+	else:
+		print "Unknown"
+
+	output=commands.getstatusoutput("distcc --version")
+	if not output[0]:
+		print str(output[1].split("\n",1)[0]),
+		if "distcc" in settings.features:
+			print "[enabled]"
+		else:
+			print "[disabled]"
+
+	output=commands.getstatusoutput("ccache -V")
+	if not output[0]:
+		print str(output[1].split("\n",1)[0]),
+		if "ccache" in settings.features:
+			print "[enabled]"
+		else:
+			print "[disabled]"
+
+	myvars  = ["sys-devel/autoconf", "sys-devel/automake", "virtual/os-headers",
+	           "sys-devel/binutils", "sys-devel/libtool",  "dev-lang/python"]
+	myvars += portage.util.grabfile(settings["PORTDIR"]+"/profiles/info_pkgs")
+	myvars  = portage.util.unique_array(myvars)
+	myvars.sort()
+
+	for x in myvars:
+		if portage.isvalidatom(x):
+			pkg_matches = trees["/"]["vartree"].dbapi.match(x)
+			pkg_matches = [portage.catpkgsplit(cpv)[1:] for cpv in pkg_matches]
+			pkg_matches.sort(portage.pkgcmp)
+			pkgs = []
+			for pn, ver, rev in pkg_matches:
+				if rev != "r0":
+					pkgs.append(ver + "-" + rev)
+				else:
+					pkgs.append(ver)
+			if pkgs:
+				pkgs = ", ".join(pkgs)
+				print "%-20s %s" % (x+":", pkgs)
+		else:
+			print "%-20s %s" % (x+":", "[NOT VALID]")
+
+	libtool_vers = ",".join(trees["/"]["vartree"].dbapi.match("sys-devel/libtool"))
+
+	if "--verbose" in myopts:
+		myvars=settings.keys()
+	else:
+		myvars = ['GENTOO_MIRRORS', 'CONFIG_PROTECT', 'CONFIG_PROTECT_MASK',
+		          'PORTDIR', 'DISTDIR', 'PKGDIR', 'PORTAGE_TMPDIR',
+		          'PORTDIR_OVERLAY', 'USE', 'CHOST', 'CFLAGS', 'CXXFLAGS',
+		          'ACCEPT_KEYWORDS', 'SYNC', 'FEATURES', 'EMERGE_DEFAULT_OPTS',
+		          'EPREFIX']
+
+		myvars.extend(portage.util.grabfile(settings["PORTDIR"]+"/profiles/info_vars"))
+
+	myvars = portage.util.unique_array(myvars)
+	unset_vars = []
+	myvars.sort()
+	for x in myvars:
+		if x in settings:
+			if x != "USE":
+				print '%s="%s"' % (x, settings[x])
+			else:
+				use = set(settings["USE"].split())
+				use_expand = settings["USE_EXPAND"].split()
+				use_expand.sort()
+				for varname in use_expand:
+					flag_prefix = varname.lower() + "_"
+					for f in list(use):
+						if f.startswith(flag_prefix):
+							use.remove(f)
+				use = list(use)
+				use.sort()
+				print 'USE="%s"' % " ".join(use),
+				for varname in use_expand:
+					myval = settings.get(varname)
+					if myval:
+						print '%s="%s"' % (varname, myval),
+				print
+		else:
+			unset_vars.append(x)
+	if unset_vars:
+		print "Unset:  "+", ".join(unset_vars)
+	print
+
+	if "--debug" in myopts:
+		for x in dir(portage):
+			module = getattr(portage, x)
+			if "cvs_id_string" in dir(module):
+				print "%s: %s" % (str(x), str(module.cvs_id_string))
+
+	# See if we can find any packages installed matching the strings
+	# passed on the command line
+	mypkgs = []
+	vardb = trees[settings["ROOT"]]["vartree"].dbapi
+	portdb = trees[settings["ROOT"]]["porttree"].dbapi
+	for x in myfiles:
+		mypkgs.extend(vardb.match(x))
+
+	# If some packages were found...
+	if mypkgs:
+		# Get our global settings (we only print stuff if it varies from
+		# the current config)
+		mydesiredvars = [ 'CHOST', 'CFLAGS', 'CXXFLAGS' ]
+		auxkeys = mydesiredvars + [ "USE", "IUSE"]
+		global_vals = {}
+		pkgsettings = portage.config(clone=settings)
+
+		for myvar in mydesiredvars:
+			global_vals[myvar] = set(settings.get(myvar, "").split())
+
+		# Loop through each package
+		# Only print settings if they differ from global settings
+		header_printed = False
+		for pkg in mypkgs:
+			# Get all package specific variables
+			auxvalues = vardb.aux_get(pkg, auxkeys)
+			valuesmap = {}
+			for i in xrange(len(auxkeys)):
+				valuesmap[auxkeys[i]] = set(auxvalues[i].split())
+			diff_values = {}
+			for myvar in mydesiredvars:
+				# If the package variable doesn't match the
+				# current global variable, something has changed
+				# so set diff_found so we know to print
+				if valuesmap[myvar] != global_vals[myvar]:
+					diff_values[myvar] = valuesmap[myvar]
+			valuesmap["IUSE"] = set(filter_iuse_defaults(valuesmap["IUSE"]))
+			valuesmap["USE"] = valuesmap["USE"].intersection(valuesmap["IUSE"])
+			pkgsettings.reset()
+			# If a matching ebuild is no longer available in the tree, maybe it
+			# would make sense to compare against the flags for the best
+			# available version with the same slot?
+			mydb = None
+			if portdb.cpv_exists(pkg):
+				mydb = portdb
+			pkgsettings.setcpv(pkg, mydb=mydb)
+			if valuesmap["IUSE"].intersection(pkgsettings["USE"].split()) != \
+				valuesmap["USE"]:
+				diff_values["USE"] = valuesmap["USE"]
+			# If a difference was found, print the info for
+			# this package.
+			if diff_values:
+
+				# If we have not yet printed the header, 
+				# print it now
+				if not header_printed:
+					header_title = "Package Settings"
+					print header_width * "="
+					print header_title.rjust(int(header_width/2 + len(header_title)/2))
+					print header_width * "="
+					header_printed = True
+
+				# Print package info
+				print "%s was built with the following:" % pkg
+				for myvar in mydesiredvars + ["USE"]:
+					if myvar in diff_values:
+						mylist = list(diff_values[myvar])
+						mylist.sort()
+						print "%s=\"%s\"" % (myvar, " ".join(mylist))
+				print
+
+def action_search(settings, portdb, vartree, myopts, myfiles, spinner):
+	if not myfiles:
+		print "emerge: no search terms provided."
+	else:
+		searchinstance = search(settings, portdb,
+			vartree, spinner, "--searchdesc" in myopts,
+			"--quiet" not in myopts)
+		for mysearch in myfiles:
+			try:
+				searchinstance.execute(mysearch)
+			except re.error, comment:
+				print "\n!!! Regular expression error in \"%s\": %s" % ( mysearch, comment )
+				sys.exit(1)
+			searchinstance.output()
+
+def action_depclean(settings, trees, ldpath_mtimes,
+	myopts, spinner):
+	# Kill packages that aren't explicitly merged or are required as a
+	# dependency of another package. World file is explicit.
+
+	warn_prefix = colorize("BAD", "*** WARNING ***  ")
+	print
+	print warn_prefix + "Depclean may break link level dependencies.  Thus, it is"
+	print warn_prefix + "recommended to use a tool such as " + good("`revdep-rebuild`") + " (from"
+	print warn_prefix + "app-portage/gentoolkit) in order to detect such breakage."
+	print warn_prefix
+	print warn_prefix + "Also study the list of packages to be cleaned for any obvious"
+	print warn_prefix + "mistakes. Packages that are part of the world set will always"
+	print warn_prefix + "be kept.  They can be manually added to this set with"
+	print warn_prefix + good("`emerge --noreplace <atom>`") + ".  Packages that are listed in"
+	print warn_prefix + "package.provided (see portage(5)) will be removed by"
+	print warn_prefix + "depclean, even if they are part of the world set."
+	print warn_prefix
+	print warn_prefix + "As a safety measure, depclean will not remove any packages"
+	print warn_prefix + "unless *all* required dependencies have been resolved.  As a"
+	print warn_prefix + "consequence, it is often necessary to run "
+	print warn_prefix + good("`emerge --update --newuse --deep world`") + " prior to depclean."
+
+	xterm_titles = "notitles" not in settings.features
+	myroot = settings["ROOT"]
+	dep_check_trees = {}
+	dep_check_trees[myroot] = {}
+	dep_check_trees[myroot]["vartree"] = \
+		FakeVartree(trees[myroot]["vartree"], trees[myroot]["porttree"].dbapi)
+	vardb = dep_check_trees[myroot]["vartree"].dbapi
+	# Constrain dependency selection to the installed packages.
+	dep_check_trees[myroot]["porttree"] = dep_check_trees[myroot]["vartree"]
+	syslist = getlist(settings, "system")
+	worldlist = getlist(settings, "world")
+	system_world_dict = genericdict(worldlist)
+	system_world_dict.update(genericdict(syslist))
+	fakedb = portage.fakedbapi(settings=settings)
+	myvarlist = vardb.cpv_all()
+
+	if not syslist:
+		print "\n!!! You have no system list.",
+	if not worldlist:
+		print "\n!!! You have no world file.",
+	if not myvarlist:
+		print "\n!!! You have no installed package database (%s)." % portage.VDB_PATH,
+
+	if not (syslist and worldlist and myvarlist):
+		print "\n!!! Proceeding "+(syslist and myvarlist and "may" or "will")
+		print " break your installation.\n"
+		if "--pretend" not in myopts:
+			countdown(int(settings["EMERGE_WARNING_DELAY"]), ">>> Depclean")
+
+	if not "--pretend" in myopts: #just check pretend, since --ask implies pretend
+		emergelog(xterm_titles, " >>> depclean")
+
+	if "--quiet" not in myopts:
+		print "\nCalculating dependencies  ",
+
+	soft = 0
+	hard = 1
+	remaining_atoms = [(atom, 'world', hard) for atom in worldlist if vardb.match(atom)]
+	remaining_atoms += [(atom, 'system', hard) for atom in syslist if vardb.match(atom)]
+	unresolveable = {}
+	aux_keys = ["DEPEND", "RDEPEND", "PDEPEND"]
+
+	while remaining_atoms:
+		atom, parent, priority = remaining_atoms.pop()
+		pkgs = vardb.match(atom)
+		if not pkgs:
+			if not atom.startswith("!") and priority == hard:
+				unresolveable.setdefault(atom, []).append(parent)
+			continue
+		if portage.dep_getkey(atom) not in system_world_dict:
+			# Prune all but the best matching slot, since that's all that a
+			# deep world update would pull in.  Don't prune if the cpv is in
+			# system or world though, since those sets trigger greedy update
+			# of all slots.
+			pkgs = [portage.best(pkgs)]
+		for pkg in pkgs:
+			if fakedb.cpv_exists(pkg):
+				continue
+			spinner.update()
+			fakedb.cpv_inject(pkg)
+			myaux = dict(izip(aux_keys, vardb.aux_get(pkg, aux_keys)))
+			mydeps = []
+			if myopts.get("--with-bdeps", "y") == "y":
+				mydeps.append((myaux["DEPEND"], soft))
+			del myaux["DEPEND"]
+			mydeps.append((" ".join(myaux.values()), hard))
+			usedef = vardb.aux_get(pkg, ["USE"])[0].split()
+			for depstr, priority in mydeps:
+
+				if not depstr:
+					continue
+
+				if "--debug" in myopts:
+					print
+					print "Parent:   ", pkg
+					print "Depstring:", depstr
+					print "Priority:",
+					if priority == soft:
+						print "soft"
+					else:
+						print "hard"
+
+				try:
+					portage.dep._dep_check_strict = False
+					success, atoms = portage.dep_check(depstr, None, settings,
+						myuse=usedef, trees=dep_check_trees, myroot=myroot)
+				finally:
+					portage.dep._dep_check_strict = True
+				if not success:
+					show_invalid_depstring_notice(
+						("installed", myroot, pkg, "nomerge"),
+						depstr, atoms)
+					return
+
+				if "--debug" in myopts:
+					print "Candidates:", atoms
+
+				for atom in atoms:
+					remaining_atoms.append((atom, pkg, priority))
+
+	if "--quiet" not in myopts:
+		print "\b\b... done!\n"
+
+	if unresolveable:
+		print "Dependencies could not be completely resolved due to"
+		print "the following required packages not being installed:"
+		print
+		for atom in unresolveable:
+			print atom, "required by", " ".join(unresolveable[atom])
+		print
+		print "Have you forgotten to run " + good("`emerge --update --newuse --deep world`") + " prior to"
+		print "depclean?  It may be necessary to manually uninstall packages that no longer"
+		print "exist in the portage tree since it may not be possible to satisfy their"
+		print "dependencies.  Also, be aware of the --with-bdeps option that is documented"
+		print "in " + good("`man emerge`") + "."
+		print
+		return
+
+	cleanlist = [pkg for pkg in vardb.cpv_all() if not fakedb.cpv_exists(pkg)]
+
+	if len(cleanlist):
+		unmerge(settings, myopts, trees[settings["ROOT"]]["vartree"],
+			"unmerge", cleanlist, ldpath_mtimes)
+
+	print "Packages installed:   "+str(len(myvarlist))
+	print "Packages in world:    "+str(len(worldlist))
+	print "Packages in system:   "+str(len(syslist))
+	print "Unique package names: "+str(len(myvarlist))
+	print "Required packages:    "+str(len(fakedb.cpv_all()))
+	if "--pretend" in myopts:
+		print "Number to remove:     "+str(len(cleanlist))
+	else:
+		print "Number removed:       "+str(len(cleanlist))
+
+def action_build(settings, trees, mtimedb,
+	myopts, myaction, myfiles, spinner):
+	ldpath_mtimes = mtimedb["ldpath"]
+	favorites=[]
+	if "--quiet" not in myopts and \
+		("--pretend" in myopts or "--ask" in myopts or \
+		"--tree" in myopts or "--verbose" in myopts):
+		action = ""
+		if "--fetchonly" in myopts or "--fetch-all-uri" in myopts:
+			action = "fetched"
+		else:
+			action = "merged"
+		if "--tree" in myopts and action != "fetched": # Tree doesn't work with fetching
+			print
+			print darkgreen("These are the packages that would be %s, in reverse order:") % action
+			print
+		else:
+			print
+			print darkgreen("These are the packages that would be %s, in order:") % action
+			print
+
+	# validate the state of the resume data
+	# so that we can make assumptions later.
+	for k in ("resume", "resume_backup"):
+		if k in mtimedb:
+			if "mergelist" in mtimedb[k]:
+				if not mtimedb[k]["mergelist"]:
+					del mtimedb[k]
+			else:
+				del mtimedb[k]
+
+	if "--resume" in myopts and \
+		("resume" in mtimedb or
+		"resume_backup" in mtimedb):
+		if "resume" not in mtimedb:
+			mtimedb["resume"] = mtimedb["resume_backup"]
+			del mtimedb["resume_backup"]
+			mtimedb.commit()
+		# XXX: "myopts" is a list for backward compatibility.
+		myresumeopts = dict([(k,True) for k in mtimedb["resume"]["myopts"]])
+
+		for opt in ("--skipfirst", "--ask", "--tree"):
+			myresumeopts.pop(opt, None)
+
+		for myopt, myarg in myopts.iteritems():
+			if myopt not in myresumeopts:
+				myresumeopts[myopt] = myarg
+		myopts=myresumeopts
+
+		# Adjust config according to options of the command being resumed.
+		for myroot in trees:
+			mysettings =  trees[myroot]["vartree"].settings
+			mysettings.unlock()
+			adjust_config(myopts, mysettings)
+			mysettings.lock()
+			del myroot, mysettings
+
+		myparams = create_depgraph_params(myopts, myaction)
+		if "--quiet" not in myopts and "--nodeps" not in myopts:
+			print "Calculating dependencies  ",
+		mydepgraph = depgraph(settings, trees,
+			myopts, myparams, spinner)
+		if "--quiet" not in myopts and "--nodeps" not in myopts:
+			print "\b\b... done!"
+	else:
+		if ("--resume" in myopts):
+			print darkgreen("emerge: It seems we have nothing to resume...")
+			sys.exit(0)
+
+		myparams = create_depgraph_params(myopts, myaction)
+		if myaction in ["system","world"]:
+			if "--quiet" not in myopts and "--nodeps" not in myopts:
+				print "Calculating",myaction,"dependencies  ",
+				sys.stdout.flush()
+			mydepgraph = depgraph(settings, trees, myopts, myparams, spinner)
+			if not mydepgraph.xcreate(myaction):
+				print "!!! Depgraph creation failed."
+				sys.exit(1)
+			if "--quiet" not in myopts and "--nodeps" not in myopts:
+				print "\b\b... done!"
+		else:
+			if "--quiet" not in myopts and "--nodeps" not in myopts:
+				print "Calculating dependencies  ",
+				sys.stdout.flush()
+			mydepgraph = depgraph(settings, trees, myopts, myparams, spinner)
+			try:
+				retval, favorites = mydepgraph.select_files(myfiles)
+			except portage.exception.PackageNotFound, e:
+				portage.writemsg("\n!!! %s\n" % str(e), noiselevel=-1)
+				sys.exit(1)
+			if not retval:
+				sys.exit(1)
+			if "--quiet" not in myopts and "--nodeps" not in myopts:
+				print "\b\b... done!"
+
+			if ("--usepkgonly" in myopts) and mydepgraph.missingbins:
+				sys.stderr.write(red("The following binaries are not available for merging...\n"))
+
+		if mydepgraph.missingbins:
+			for x in mydepgraph.missingbins:
+				sys.stderr.write("   "+str(x)+"\n")
+			sys.stderr.write("\nThese are required by '--usepkgonly' -- Terminating.\n\n")
+			sys.exit(1)
+
+	if "--pretend" not in myopts and \
+		("--ask" in myopts or "--tree" in myopts or \
+		"--verbose" in myopts) and \
+		not ("--quiet" in myopts and "--ask" not in myopts):
+		if "--resume" in myopts:
+			validate_merge_list(trees, mtimedb["resume"]["mergelist"])
+			mymergelist = mtimedb["resume"]["mergelist"]
+			if "--skipfirst" in myopts:
+				mymergelist = mymergelist[1:]
+			if len(mymergelist) == 0:
+				print colorize("INFORM", "emerge: It seems we have nothing to resume...")
+				sys.exit(0)
+			mydepgraph.display(mymergelist)
+			prompt="Would you like to resume merging these packages?"
+		else:
+			mydepgraph.display(
+				mydepgraph.altlist(reversed=("--tree" in myopts)))
+			mergecount=0
+			for x in mydepgraph.altlist():
+				if x[0] != "blocks" and x[3] != "nomerge":
+					mergecount+=1
+				#check for blocking dependencies
+				if x[0]=="blocks" and "--fetchonly" not in myopts and "--fetch-all-uri" not in myopts:
+					print "\n!!! Error: The above package list contains packages which cannot be installed"
+					print   "!!!        at the same time on the same system."
+					if "--quiet" not in myopts:
+						show_blocker_docs_link()
+					sys.exit(1)
+			if mergecount==0:
+				if "--noreplace" in myopts and favorites:
+					print
+					for x in favorites:
+						print " %s %s" % (good("*"), x)
+					prompt="Would you like to add these packages to your world favorites?"
+				elif settings["AUTOCLEAN"] and "yes"==settings["AUTOCLEAN"]:
+					prompt="Nothing to merge; would you like to auto-clean packages?"
+				else:
+					print
+					print "Nothing to merge; quitting."
+					print
+					sys.exit(0)
+			elif "--fetchonly" in myopts or "--fetch-all-uri" in myopts:
+				prompt="Would you like to fetch the source files for these packages?"
+			else:
+				prompt="Would you like to merge these packages?"
+		print
+		if "--ask" in myopts and userquery(prompt) == "No":
+			print
+			print "Quitting."
+			print
+			sys.exit(0)
+		# Don't ask again (e.g. when auto-cleaning packages after merge)
+		myopts.pop("--ask", None)
+
+	if ("--pretend" in myopts) and not ("--fetchonly" in myopts or "--fetch-all-uri" in myopts):
+		if ("--resume" in myopts):
+			validate_merge_list(trees, mtimedb["resume"]["mergelist"])
+			mymergelist = mtimedb["resume"]["mergelist"]
+			if "--skipfirst" in myopts:
+				mymergelist = mymergelist[1:]
+			if len(mymergelist) == 0:
+				print colorize("INFORM", "emerge: It seems we have nothing to resume...")
+				sys.exit(0)
+			mydepgraph.display(mymergelist)
+		else:
+			mydepgraph.display(
+				mydepgraph.altlist(reversed=("--tree" in myopts)))
+		if ("--buildpkgonly" in myopts):
+			if not mydepgraph.digraph.hasallzeros(ignore_priority=DepPriority.MEDIUM):
+				print "\n!!! --buildpkgonly requires all dependencies to be merged."
+				print "!!! You have to merge the dependencies before you can build this package.\n"
+				sys.exit(1)
+	else:
+		if ("--buildpkgonly" in myopts):
+			if not mydepgraph.digraph.hasallzeros(ignore_priority=DepPriority.MEDIUM):
+				print "\n!!! --buildpkgonly requires all dependencies to be merged."
+				print "!!! Cannot merge requested packages. Merge deps and try again.\n"
+				sys.exit(1)
+
+		if ("--resume" in myopts):
+			favorites=mtimedb["resume"]["favorites"]
+			mergetask = MergeTask(settings, trees, myopts)
+			if "--fetchonly" in myopts:
+				""" parallel-fetch uses --resume --fetchonly and we don't want
+				it to write the mtimedb"""
+				mtimedb.filename = None
+				time.sleep(3) # allow the parent to have first fetch
+			del mydepgraph
+			retval = mergetask.merge(
+				mtimedb["resume"]["mergelist"], favorites, mtimedb)
+			if retval != os.EX_OK:
+				sys.exit(retval)
+		else:
+			if "resume" in mtimedb and \
+			"mergelist" in mtimedb["resume"] and \
+			len(mtimedb["resume"]["mergelist"]) > 1:
+				mtimedb["resume_backup"] = mtimedb["resume"]
+				del mtimedb["resume"]
+				mtimedb.commit()
+			mtimedb["resume"]={}
+			# XXX: Stored as a list for backward compatibility.
+			mtimedb["resume"]["myopts"] = \
+				[k for k in myopts if myopts[k] is True]
+			mtimedb["resume"]["favorites"]=favorites
+			if ("--digest" in myopts) and not ("--fetchonly" in myopts or "--fetch-all-uri" in myopts):
+				for pkgline in mydepgraph.altlist():
+					if pkgline[0]=="ebuild" and pkgline[3]=="merge":
+						y = trees[pkgline[1]]["porttree"].dbapi.findname(pkgline[2])
+						tmpsettings = portage.config(clone=settings)
+						edebug = 0
+						if settings.get("PORTAGE_DEBUG", "") == "1":
+							edebug = 1
+						retval = portage.doebuild(
+							y, "digest", settings["ROOT"], tmpsettings, edebug,
+							("--pretend" in myopts),
+							mydbapi=trees[pkgline[1]]["porttree"].dbapi,
+							tree="porttree")
+			if "--fetchonly" in myopts or "--fetch-all-uri" in myopts:
+				pkglist = []
+				for pkg in mydepgraph.altlist():
+					if pkg[0] != "blocks":
+						pkglist.append(pkg)
+			else:
+				pkglist = mydepgraph.altlist()
+			del mydepgraph
+			mergetask = MergeTask(settings, trees, myopts)
+			retval = mergetask.merge(pkglist, favorites, mtimedb)
+			if retval != os.EX_OK:
+				sys.exit(retval)
+
+		if mtimedb.has_key("resume"):
+			del mtimedb["resume"]
+		if settings["AUTOCLEAN"] and "yes"==settings["AUTOCLEAN"]:
+			portage.writemsg_stdout(">>> Auto-cleaning packages...\n")
+			vartree = trees[settings["ROOT"]]["vartree"]
+			unmerge(settings, myopts, vartree, "clean", ["world"],
+				ldpath_mtimes, autoclean=1)
+		else:
+			portage.writemsg_stdout(colorize("WARN", "WARNING:")
+				+ " AUTOCLEAN is disabled.  This can cause serious"
+				+ " problems due to overlapping packages.\n")
+
+def multiple_actions(action1, action2):
+	sys.stderr.write("\n!!! Multiple actions requested... Please choose one only.\n")
+	sys.stderr.write("!!! '%s' or '%s'\n\n" % (action1, action2))
+	sys.exit(1)
+
+def parse_opts(tmpcmdline, silent=False):
+	myaction=None
+	myopts = {}
+	myfiles=[]
+
+	global actions, options, shortmapping
+
+	longopt_aliases = {"--cols":"--columns", "--skip-first":"--skipfirst"}
+	argument_options = {
+		"--config-root": {
+			"help":"specify the location for portage configuration files",
+			"action":"store"
+		},
+		"--color": {
+			"help":"enable or disable color output",
+			"type":"choice",
+			"choices":("y", "n")
+		},
+		"--with-bdeps": {
+			"help":"include unnecessary build time dependencies",
+			"type":"choice",
+			"choices":("y", "n")
+		}
+	}
+
+	from optparse import OptionParser
+	parser = OptionParser()
+	if parser.has_option("--help"):
+		parser.remove_option("--help")
+
+	for action_opt in actions:
+		parser.add_option("--" + action_opt, action="store_true",
+			dest=action_opt.replace("-", "_"), default=False)
+	for myopt in options:
+		parser.add_option(myopt, action="store_true",
+			dest=myopt.lstrip("--").replace("-", "_"), default=False)
+	for shortopt, longopt in shortmapping.iteritems():
+		parser.add_option("-" + shortopt, action="store_true",
+			dest=longopt.lstrip("--").replace("-", "_"), default=False)
+	for myalias, myopt in longopt_aliases.iteritems():
+		parser.add_option(myalias, action="store_true",
+			dest=myopt.lstrip("--").replace("-", "_"), default=False)
+
+	for myopt, kwargs in argument_options.iteritems():
+		parser.add_option(myopt,
+			dest=myopt.lstrip("--").replace("-", "_"), **kwargs)
+
+	myoptions, myargs = parser.parse_args(args=tmpcmdline)
+
+	for myopt in options:
+		v = getattr(myoptions, myopt.lstrip("--").replace("-", "_"))
+		if v:
+			myopts[myopt] = True
+
+	for myopt in argument_options:
+		v = getattr(myoptions, myopt.lstrip("--").replace("-", "_"), None)
+		if v is not None:
+			myopts[myopt] = v
+
+	for action_opt in actions:
+		v = getattr(myoptions, action_opt.replace("-", "_"))
+		if v:
+			if myaction:
+				multiple_actions(myaction, action_opt)
+				sys.exit(1)
+			myaction = action_opt
+
+	for x in myargs:
+		if x in actions and myaction != "search":
+			if not silent and x not in ["system", "world"]:
+				print red("*** Deprecated use of action '%s', use '--%s' instead" % (x,x))
+			# special case "search" so people can search for action terms, e.g. emerge -s sync
+			if myaction:
+				multiple_actions(myaction, x)
+				sys.exit(1)
+			myaction = x
+		else:
+			myfiles.append(x)
+
+	if "--nocolor" in myopts:
+		if not silent:
+			sys.stderr.write("*** Deprecated use of '--nocolor', " + \
+				"use '--color=n' instead.\n")
+		del myopts["--nocolor"]
+		myopts["--color"] = "n"
+
+	return myaction, myopts, myfiles
+
+def validate_ebuild_environment(trees):
+	for myroot in trees:
+		mysettings = trees[myroot]["vartree"].settings
+		for var in "ARCH", "USERLAND":
+			if mysettings.get(var):
+				continue
+			print >> sys.stderr, bad(("\a!!! %s is not set... " % var) + \
+				"Are you missing the '%setc/make.profile' symlink?" % \
+				mysettings["PORTAGE_CONFIGROOT"])
+			print >> sys.stderr, bad("\a!!! Is the symlink correct? " + \
+				"Is your portage tree complete?\n")
+			sys.exit(9)
+		del myroot, mysettings
+
+def load_emerge_config(trees=None):
+	kwargs = {}
+	for k, envvar in (("config_root", "PORTAGE_CONFIGROOT"), ("target_root", "ROOT")):
+		kwargs[k] = os.environ.get(envvar, None)
+	trees = portage.create_trees(trees=trees, **kwargs)
+
+	settings = trees["/"]["vartree"].settings
+
+	for myroot in trees:
+		if myroot != "/":
+			settings = trees[myroot]["vartree"].settings
+			break
+
+	mtimedbfile = os.path.join("/", portage.CACHE_PATH.lstrip(os.path.sep), "mtimedb")
+	mtimedb = portage.MtimeDB(mtimedbfile)
+	return settings, trees, mtimedb
+
+def adjust_config(myopts, settings):
+	"""Make emerge specific adjustments to the config."""
+
+	# To enhance usability, make some vars case insensitive by forcing them to
+	# lower case.
+	for myvar in ("AUTOCLEAN", "NOCOLOR"):
+		if myvar in settings:
+			settings[myvar] = settings[myvar].lower()
+			settings.backup_changes(myvar)
+	del myvar
+
+	# Kill noauto as it will break merges otherwise.
+	if "noauto" in settings.features:
+		while "noauto" in settings.features:
+			settings.features.remove("noauto")
+		settings["FEATURES"] = " ".join(settings.features)
+		settings.backup_changes("FEATURES")
+
+	CLEAN_DELAY = 5
+	try:
+		CLEAN_DELAY = int(settings.get("CLEAN_DELAY", str(CLEAN_DELAY)))
+	except ValueError, e:
+		portage.writemsg("!!! %s\n" % str(e), noiselevel=-1)
+		portage.writemsg("!!! Unable to parse integer: CLEAN_DELAY='%s'\n" % \
+			settings["CLEAN_DELAY"], noiselevel=-1)
+	settings["CLEAN_DELAY"] = str(CLEAN_DELAY)
+	settings.backup_changes("CLEAN_DELAY")
+
+	EMERGE_WARNING_DELAY = 10
+	try:
+		EMERGE_WARNING_DELAY = int(settings.get(
+			"EMERGE_WARNING_DELAY", str(EMERGE_WARNING_DELAY)))
+	except ValueError, e:
+		portage.writemsg("!!! %s\n" % str(e), noiselevel=-1)
+		portage.writemsg("!!! Unable to parse integer: EMERGE_WARNING_DELAY='%s'\n" % \
+			settings["EMERGE_WARNING_DELAY"], noiselevel=-1)
+	settings["EMERGE_WARNING_DELAY"] = str(EMERGE_WARNING_DELAY)
+	settings.backup_changes("EMERGE_WARNING_DELAY")
+
+	if "--quiet" in myopts:
+		settings["PORTAGE_QUIET"]="1"
+		settings.backup_changes("PORTAGE_QUIET")
+
+	# Set so that configs will be merged regardless of remembered status
+	if ("--noconfmem" in myopts):
+		settings["NOCONFMEM"]="1"
+		settings.backup_changes("NOCONFMEM")
+
+	# Set various debug markers... They should be merged somehow.
+	PORTAGE_DEBUG = 0
+	try:
+		PORTAGE_DEBUG = int(settings.get("PORTAGE_DEBUG", str(PORTAGE_DEBUG)))
+		if PORTAGE_DEBUG not in (0, 1):
+			portage.writemsg("!!! Invalid value: PORTAGE_DEBUG='%i'\n" % \
+				PORTAGE_DEBUG, noiselevel=-1)
+			portage.writemsg("!!! PORTAGE_DEBUG must be either 0 or 1\n",
+				noiselevel=-1)
+			PORTAGE_DEBUG = 0
+	except ValueError, e:
+		portage.writemsg("!!! %s\n" % str(e), noiselevel=-1)
+		portage.writemsg("!!! Unable to parse integer: PORTAGE_DEBUG='%s'\n" %\
+			settings["PORTAGE_DEBUG"], noiselevel=-1)
+		del e
+	if "--debug" in myopts:
+		PORTAGE_DEBUG = 1
+	settings["PORTAGE_DEBUG"] = str(PORTAGE_DEBUG)
+	settings.backup_changes("PORTAGE_DEBUG")
+
+	if settings.get("NOCOLOR") not in ("yes","true"):
+		portage.output.havecolor = 1
+
+	"""The explicit --color < y | n > option overrides the NOCOLOR environment
+	variable and stdout auto-detection."""
+	if "--color" in myopts:
+		if "y" == myopts["--color"]:
+			portage.output.havecolor = 1
+			settings["NOCOLOR"] = "false"
+		else:
+			portage.output.havecolor = 0
+			settings["NOCOLOR"] = "true"
+		settings.backup_changes("NOCOLOR")
+	elif not sys.stdout.isatty() and settings.get("NOCOLOR") != "no":
+		portage.output.havecolor = 0
+		settings["NOCOLOR"] = "true"
+		settings.backup_changes("NOCOLOR")
+
+def emerge_main():
+	global portage	# NFC why this is necessary now - genone
+	# Disable color until we're sure that it should be enabled (after
+	# EMERGE_DEFAULT_OPTS has been parsed).
+	portage.output.havecolor = 0
+	# This first pass is just for options that need to be known as early as
+	# possible, such as --config-root.  They will be parsed again later,
+	# together with EMERGE_DEFAULT_OPTS (which may vary depending on the
+	# the value of --config-root).
+	myaction, myopts, myfiles = parse_opts(sys.argv[1:], silent=True)
+	if "--debug" in myopts:
+		os.environ["PORTAGE_DEBUG"] = "1"
+	if "--config-root" in myopts:
+		os.environ["PORTAGE_CONFIGROOT"] = myopts["--config-root"]
+
+	# Portage needs to ensure a sane umask for the files it creates.
+	os.umask(022)
+	settings, trees, mtimedb = load_emerge_config()
+	portdb = trees[settings["ROOT"]]["porttree"].dbapi
+
+	try:
+		os.nice(int(settings.get("PORTAGE_NICENESS", "0")))
+	except (OSError, ValueError), e:
+		portage.writemsg("!!! Failed to change nice value to '%s'\n" % \
+			settings["PORTAGE_NICENESS"])
+		portage.writemsg("!!! %s\n" % str(e))
+		del e
+
+	if portage._global_updates(trees, mtimedb["updates"]):
+		mtimedb.commit()
+		# Reload the whole config from scratch.
+		settings, trees, mtimedb = load_emerge_config(trees=trees)
+		portdb = trees[settings["ROOT"]]["porttree"].dbapi
+
+	xterm_titles = "notitles" not in settings.features
+
+	tmpcmdline = []
+	if "--ignore-default-opts" not in sys.argv:
+		tmpcmdline.extend(settings["EMERGE_DEFAULT_OPTS"].split())
+	tmpcmdline.extend(sys.argv[1:])
+	myaction, myopts, myfiles = parse_opts(tmpcmdline)
+
+	if "--digest" in myopts:
+		os.environ["FEATURES"] = os.environ.get("FEATURES","") + " digest"
+		# Reload the whole config from scratch so that the portdbapi internal
+		# config is updated with new FEATURES.
+		settings, trees, mtimedb = load_emerge_config(trees=trees)
+		portdb = trees[settings["ROOT"]]["porttree"].dbapi
+
+	for myroot in trees:
+		mysettings =  trees[myroot]["vartree"].settings
+		mysettings.unlock()
+		adjust_config(myopts, mysettings)
+		mysettings.lock()
+		del myroot, mysettings
+
+	spinner = stdout_spinner()
+	if "candy" in settings.features:
+		spinner.update = spinner.update_scroll
+
+	if "--quiet" not in myopts:
+		portage.deprecated_profile_check()
+
+	#Freeze the portdbapi for enhanced performance:
+	for myroot in trees:
+		trees[myroot]["porttree"].dbapi.freeze()
+		del myroot
+
+	if "moo" in myfiles:
+		print """
+
+  Larry loves Gentoo (""" + os.uname()[0] + """)
+
+ _______________________
+< Have you mooed today? >
+ -----------------------
+        \   ^__^
+         \  (oo)\_______
+            (__)\       )\/\ 
+                ||----w |
+                ||     ||
+
+"""
+
+	if (myaction in ["world", "system"]) and myfiles:
+		print "emerge: please specify a package class (\"world\" or \"system\") or individual packages, but not both."
+		sys.exit(1)
+
+	for x in myfiles:
+		ext = os.path.splitext(x)[1]
+		if (ext == ".ebuild" or ext == ".tbz2") and os.path.exists(os.path.abspath(x)):
+			print "emerging by path implies --oneshot... adding --oneshot to options."
+			print colorize("BAD", "\n*** emerging by path is broken and may not always work!!!\n")
+			break
+
+	if ("--tree" in myopts) and ("--columns" in myopts):
+		print "emerge: can't specify both of \"--tree\" and \"--columns\"."
+		sys.exit(1)
+
+	if ("--quiet" in myopts):
+		spinner.update = spinner.update_quiet
+		portage.util.noiselimit = -1
+
+	# Always create packages if FEATURES=buildpkg
+	# Imply --buildpkg if --buildpkgonly
+	if ("buildpkg" in settings.features) or ("--buildpkgonly" in myopts):
+		if "--buildpkg" not in myopts:
+			myopts["--buildpkg"] = True
+
+	# Also allow -S to invoke search action (-sS)
+	if ("--searchdesc" in myopts):
+		if myaction and myaction != "search":
+			myfiles.append(myaction)
+		if "--search" not in myopts:
+			myopts["--search"] = True
+		myaction = "search"
+
+	# Always try and fetch binary packages if FEATURES=getbinpkg
+	if ("getbinpkg" in settings.features):
+		myopts["--getbinpkg"] = True
+
+	if "--skipfirst" in myopts and "--resume" not in myopts:
+		myopts["--resume"] = True
+
+	if ("--getbinpkgonly" in myopts) and not ("--usepkgonly" in myopts):
+		myopts["--usepkgonly"] = True
+
+	if ("--getbinpkgonly" in myopts) and not ("--getbinpkg" in myopts):
+		myopts["--getbinpkg"] = True
+
+	if ("--getbinpkg" in myopts) and not ("--usepkg" in myopts):
+		myopts["--usepkg"] = True
+
+	# Also allow -K to apply --usepkg/-k
+	if ("--usepkgonly" in myopts) and not ("--usepkg" in myopts):
+		myopts["--usepkg"] = True
+
+	# Allow -p to remove --ask
+	if ("--pretend" in myopts) and ("--ask" in myopts):
+		print ">>> --pretend disables --ask... removing --ask from options."
+		del myopts["--ask"]
+
+	# forbid --ask when not in a terminal
+	# note: this breaks `emerge --ask | tee logfile`, but that doesn't work anyway.
+	if ("--ask" in myopts) and (not sys.stdin.isatty()):
+		portage.writemsg("!!! \"--ask\" should only be used in a terminal. Exiting.\n",
+			noiselevel=-1)
+		sys.exit(1)
+
+	if settings.get("PORTAGE_DEBUG", "") == "1":
+		spinner.update = spinner.update_quiet
+		portage.debug=1
+		if "python-trace" in settings.features:
+			import portage.debug
+			portage.debug.set_trace(True)
+
+	if ("--resume" in myopts):
+		if "--tree" in myopts:
+			print "* --tree is currently broken with --resume. Disabling..."
+			del myopts["--tree"]
+
+	if not ("--quiet" in myopts):
+		if not sys.stdout.isatty() or ("--nospinner" in myopts):
+			spinner.update = spinner.update_basic
+
+	if "--version" in myopts:
+		print getportageversion(settings["PORTDIR"], settings["ROOT"],
+			settings.profile_path, settings["CHOST"],
+			trees[settings["ROOT"]]["vartree"].dbapi)
+		sys.exit(0)
+	elif "--help" in myopts:
+		emerge.help.help(myaction, myopts, portage.output.havecolor)
+		sys.exit(0)
+
+	if "--debug" in myopts:
+		print "myaction", myaction
+		print "myopts", myopts
+
+	if not myaction and not myfiles and "--resume" not in myopts:
+		emerge.help.help(myaction, myopts, portage.output.havecolor)
+		sys.exit(1)
+
+	# check if root user is the current user for the actions where emerge needs this
+	if portage.secpass < 2:
+		# We've already allowed "--version" and "--help" above.
+		if "--pretend" not in myopts and \
+		myaction not in ("search","info"):
+			need_superuser = not \
+				("--fetchonly" in myopts or \
+				"--fetch-all-uri" in myopts or \
+				myaction in ("metadata", "regen"))
+			if portage.secpass < 1 or \
+				need_superuser:
+				if need_superuser:
+					access_desc = "superuser"
+				else:
+					access_desc = "portage group"
+				# Always show portage_group_warning() when only portage group
+				# access is required but the user is not in the portage group.
+				from portage.data import portage_group_warning
+				if "--ask" in myopts:
+					myopts["--pretend"] = True
+					del myopts["--ask"]
+					print ("%s access would be required... " + \
+						"adding --pretend to options.\n") % access_desc
+					if portage.secpass < 1 and not need_superuser:
+						portage_group_warning()
+				else:
+					sys.stderr.write(("emerge: %s access would be " + \
+						"required.\n\n") % access_desc)
+					if portage.secpass < 1 and not need_superuser:
+						portage_group_warning()
+					return 1
+
+	disable_emergelog = False
+	for x in ("--pretend", "--fetchonly", "--fetch-all-uri"):
+		if x in myopts:
+			disable_emergelog = True
+			break
+	if myaction in ("search", "info"):
+		disable_emergelog = True
+	if disable_emergelog:
+		""" Disable emergelog for everything except build or unmerge
+		operations.  This helps minimize parallel emerge.log entries that can
+		confuse log parsers.  We especially want it disabled during
+		parallel-fetch, which uses --resume --fetchonly."""
+		global emergelog
+		def emergelog(*pargs, **kargs):
+			pass
+
+	if not "--pretend" in myopts:
+		emergelog(xterm_titles, "Started emerge on: "+\
+			time.strftime("%b %d, %Y %H:%M:%S", time.localtime()))
+		myelogstr=""
+		if myopts:
+			myelogstr=" ".join(myopts)
+		if myaction:
+			myelogstr+=" "+myaction
+		if myfiles:
+			myelogstr+=" "+" ".join(myfiles)
+		emergelog(xterm_titles, " *** emerge " + myelogstr)
+
+	def emergeexitsig(signum, frame):
+		signal.signal(signal.SIGINT, signal.SIG_IGN)
+		signal.signal(signal.SIGTERM, signal.SIG_IGN)
+		portage.util.writemsg("\n\nExiting on signal %(signal)s\n" % {"signal":signum})
+		sys.exit(100+signum)
+	signal.signal(signal.SIGINT, emergeexitsig)
+	signal.signal(signal.SIGTERM, emergeexitsig)
+
+	def emergeexit():
+		"""This gets out final log message in before we quit."""
+		if "--pretend" not in myopts:
+			emergelog(xterm_titles, " *** terminating.")
+		if "notitles" not in settings.features:
+			xtermTitleReset()
+	portage.atexit_register(emergeexit)
+
+	if myaction in ("config", "metadata", "regen", "sync"):
+		if "--pretend" in myopts:
+			sys.stderr.write(("emerge: The '%s' action does " + \
+				"not support '--pretend'.\n") % myaction)
+			return 1
+	if "sync" == myaction:
+		action_sync(settings, trees, mtimedb, myopts, myaction)
+	elif "metadata" == myaction:
+		action_metadata(settings, portdb, myopts)
+	elif myaction=="regen":
+		validate_ebuild_environment(trees)
+		action_regen(settings, portdb)
+	# HELP action
+	elif "config"==myaction:
+		validate_ebuild_environment(trees)
+		action_config(settings, trees, myopts, myfiles)
+	
+	# INFO action
+	elif "info"==myaction:
+		action_info(settings, trees, myopts, myfiles)
+
+	# SEARCH action
+	elif "search"==myaction:
+		validate_ebuild_environment(trees)
+		action_search(settings, portdb, trees["/"]["vartree"],
+			myopts, myfiles, spinner)
+	elif "unmerge"==myaction or "prune"==myaction or "clean"==myaction:
+		validate_ebuild_environment(trees)
+		vartree = trees[settings["ROOT"]]["vartree"]
+		if 1 == unmerge(settings, myopts, vartree, myaction, myfiles,
+			mtimedb["ldpath"]):
+			if "--pretend" not in myopts:
+				post_emerge(settings, mtimedb, 0)
+
+	elif "depclean"==myaction:
+		validate_ebuild_environment(trees)
+		action_depclean(settings, trees, mtimedb["ldpath"],
+			myopts, spinner)
+		if "--pretend" not in myopts:
+			post_emerge(settings, mtimedb, 0)
+	# "update", "system", or just process files:
+	else:
+		validate_ebuild_environment(trees)
+		if "--pretend" not in myopts:
+			display_news_notification(settings)
+		action_build(settings, trees, mtimedb,
+			myopts, myaction, myfiles, spinner)
+		if "--pretend" not in myopts:
+			post_emerge(settings, mtimedb, 0)
+		else:
+			display_news_notification(settings)
+
+if __name__ == "__main__":
+	retval = emerge_main()
+	sys.exit(retval)
Index: /vendor/prefix-portage/current/pym/emerge/help.py
===================================================================
--- /vendor/prefix-portage/current/pym/emerge/help.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/emerge/help.py	(revision 3489)
@@ -0,0 +1,422 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: help.py 6752 2007-06-08 07:10:30Z grobian $
+
+
+import os,sys
+from portage.output import bold, turquoise, green
+
+def shorthelp():
+	print bold("emerge:")+" the other white meat (command-line interface to the Portage system)"
+	print bold("Usage:")
+	print "   "+turquoise("emerge")+" [ "+green("options")+" ] [ "+green("action")+" ] [ "+turquoise("ebuildfile")+" | "+turquoise("tbz2file")+" | "+turquoise("dependency")+" ] [ ... ]"
+	print "   "+turquoise("emerge")+" [ "+green("options")+" ] [ "+green("action")+" ] < "+turquoise("system")+" | "+turquoise("world")+" >"
+	print "   "+turquoise("emerge")+" < "+turquoise("--sync")+" | "+turquoise("--metadata")+" | "+turquoise("--info")+" >"
+	print "   "+turquoise("emerge")+" "+turquoise("--resume")+" [ "+green("--pretend")+" | "+green("--ask")+" | "+green("--skipfirst")+" ]"
+	print "   "+turquoise("emerge")+" "+turquoise("--help")+" [ "+green("system")+" | "+green("world")+" | "+green("config")+" | "+green("--sync")+" ] "
+	print bold("Options:")+" "+green("-")+"["+green("abBcCdDefgGhikKlnNoOpqPsStuvV")+"] ["+green("--oneshot")+"] ["+green("--newuse")+"] ["+green("--noconfmem")+"]"
+	print      "                                          [ " + green("--color")+" < " + turquoise("y") + " | "+ turquoise("n")+" >  ] [ "+green("--columns")+" ]"
+	print      "                                                                 ["+green("--nospinner")+"]"
+	print "                                          [ "+green("--deep")+"  ] [" + green("--with-bdeps")+" < " + turquoise("y") + " | "+ turquoise("n")+" > ]"
+	print bold("Actions:")+" [ "+green("--clean")+" | "+green("--depclean")+" | "+green("--prune")+" | "+green("--regen")+" | "+green("--search")+" | "+green("--unmerge")+" ]"
+
+def help(myaction,myopts,havecolor=1):
+	if not myaction and ("--verbose" not in myopts):
+		shorthelp()
+		print
+		print "   For more help try 'emerge --help --verbose' or consult the man page."
+	elif not myaction:
+		shorthelp()
+		print
+		print turquoise("Help (this screen):")
+		print "       "+green("--help")+" ("+green("-h")+" short option)"
+		print "              Displays this help; an additional argument (see above) will tell"
+		print "              emerge to display detailed help."
+		print
+		print turquoise("Actions:")
+		print "       "+green("--clean")+" ("+green("-c")+" short option)"
+		print "              Cleans the system by removing outdated packages which will not"
+		print "              remove functionalities or prevent your system from working."
+		print "              The arguments can be in several different formats :"
+		print "              * world "
+		print "              * system or"
+		print "              * 'dependency specification' (in single quotes is best.)"
+		print "              Here are a few examples of the dependency specification format:"
+		print "              "+bold("binutils")+" matches"
+		print "                  binutils-2.11.90.0.7 and binutils-2.11.92.0.12.3-r1"
+		print "              "+bold("sys-devel/binutils")+" matches"
+		print "                  binutils-2.11.90.0.7 and binutils-2.11.92.0.12.3-r1"
+		print "              "+bold(">sys-devel/binutils-2.11.90.0.7")+" matches"
+		print "                  binutils-2.11.92.0.12.3-r1"
+		print "              "+bold(">=sys-devel/binutils-2.11.90.0.7")+" matches"
+		print "                  binutils-2.11.90.0.7 and binutils-2.11.92.0.12.3-r1"
+		print "              "+bold("<=sys-devel/binutils-2.11.92.0.12.3-r1")+" matches"
+		print "                  binutils-2.11.90.0.7 and binutils-2.11.92.0.12.3-r1"
+		print
+		print "       "+green("--config")
+		print "              Runs package-specific operations that must be executed after an"
+		print "              emerge process has completed.  This usually entails configuration"
+		print "              file setup or other similar setups that the user may wish to run."
+		print
+		print "       "+green("--depclean")
+		print "              Cleans the system by removing packages that are not associated"
+		print "              with explicitly merged packages. Depclean works by creating the"
+		print "              full dependency tree from the system list and the world file,"
+		print "              then comparing it to installed packages. Packages installed, but"
+		print "              not associated with an explicit merge are listed as candidates"
+		print "              for unmerging."+turquoise(" WARNING: This can seriously affect your system by")
+		print "              "+turquoise("removing packages that may have been linked against, but due to")
+		print "              "+turquoise("changes in USE flags may no longer be part of the dep tree. Use")
+		print "              "+turquoise("caution when employing this feature.")
+		print
+		print "       "+green("--info")
+		print "              Displays important portage variables that will be exported to"
+		print "              ebuild.sh when performing merges. This information is useful"
+		print "              for bug reports and verification of settings. All settings in"
+		print "              make.{conf,globals,defaults} and the environment show up if"
+		print "              run with the '--verbose' flag."
+		print
+		print "       "+green("--metadata")
+		print "              Transfers metadata cache from ${PORTDIR}/metadata/cache/ to"
+		print "              /var/cache/edb/dep/ as is normally done on the tail end of an"
+		print "              rsync update using " + bold("emerge --sync") + ". This process populates the"
+		print "              cache database that portage uses for pre-parsed lookups of"
+		print "              package data.  It does not populate cache for the overlays"
+		print "              listed in PORTDIR_OVERLAY.  In order to generate cache for"
+		print "              overlays, use " + bold("--regen") + "."
+		print
+		print "       "+green("--prune")+" ("+green("-P")+" short option)"
+		print "              "+turquoise("WARNING: This action can remove important packages!")
+		print "              Removes all but the most recently installed version of a package"
+		print "              from your system. This action doesn't verify the possible binary"
+		print "              compatibility between versions and can thus remove essential"
+		print "              dependencies from your system."
+		print "              The argument format is the same as for the "+bold("--clean")+" action."
+		print
+		print "       "+green("--regen")
+		print "              Causes portage to check and update the dependency cache of all"
+		print "              ebuilds in the portage tree. This is not recommended for rsync"
+		print "              users as rsync updates the cache using server-side caches."
+		print "              Rsync users should simply 'emerge --sync' to regenerate."
+		print
+		print "       "+green("--resume")
+		print "              Resumes the most recent merge list that has been aborted due to an"
+		print "              error. Please note that this operation will only return an error"
+		print "              on failure. If there is nothing for portage to do, then portage"
+		print "              will exit with a message and a success condition. A resume list"
+		print "              will persist until it has been completed in entirety or until"
+		print "              another aborted merge list replaces it. The resume history is"
+		print "              capable of storing two merge lists. After one resume list"
+		print "              completes, it is possible to invoke --resume once again in order"
+		print "              to resume an older list."
+		print
+		print "       "+green("--search")+" ("+green("-s")+" short option)"
+		print "              Searches for matches of the supplied string in the current local"
+		print "              portage tree. By default emerge uses a case-insensitive simple "
+		print "              search, but you can enable a regular expression search by "
+		print "              prefixing the search string with %."
+		print "              Prepending the expression with a '@' will cause the category to"
+		print "              be included in the search."
+		print "              A few examples:"
+		print "              "+bold("emerge --search libc")
+		print "                  list all packages that contain libc in their name"
+		print "              "+bold("emerge --search '%^kde'")
+		print "                  list all packages starting with kde"
+		print "              "+bold("emerge --search '%gcc$'")
+		print "                  list all packages ending with gcc"
+		print "              "+bold("emerge --search '%@^dev-java.*jdk'")
+		print "                  list all available Java JDKs"
+		print
+		print "       "+green("--searchdesc")+" ("+green("-S")+" short option)"
+		print "              Matches the search string against the description field as well"
+		print "              the package's name. Take caution as the descriptions are also"
+		print "              matched as regular expressions."
+		print "                emerge -S html"
+		print "                emerge -S applet"
+		print "                emerge -S 'perl.*module'"
+		print
+		print "       "+green("--unmerge")+" ("+green("-C")+" short option)"
+		print "              "+turquoise("WARNING: This action can remove important packages!")
+		print "              Removes all matching packages "+bold("completely")+" from"
+		print "              your system. Specify arguments using the dependency specification"
+		print "              format described in the "+bold("--clean")+" action above."
+		print
+		print "       "+green("--update")+" ("+green("-u")+" short option)"
+		print "              Updates packages to the best version available, which may not"
+		print "              always be the highest version number due to masking for testing"
+		print "              and development. This will also update direct dependencies which"
+		print "              may not what you want. Package atoms specified on the command line"
+		print "              are greedy, meaning that unspecific atoms may match multiple"
+		print "              installed versions of slotted packages."
+		print
+		print "       "+green("--version")+" ("+green("-V")+" short option)"
+		print "              Displays the currently installed version of portage along with"
+		print "              other information useful for quick reference on a system. See"
+		print "              "+bold("emerge info")+" for more advanced information."
+		print
+		print turquoise("Options:")
+		print "       "+green("--alphabetical")
+		print "              When displaying USE and other flag output, combines the enabled"
+		print "              and disabled flags into a single list and sorts it alphabetically."
+		print "              With this option, output such as USE=\"dar -bar -foo\" will instead"
+		print "              be displayed as USE=\"-bar dar -foo\""
+		print
+		print "       "+green("--ask")+" ("+green("-a")+" short option)"
+		print "              before performing the merge, display what ebuilds and tbz2s will"
+		print "              be installed, in the same format as when using --pretend; then"
+		print "              ask whether to continue with the merge or abort. Using --ask is"
+		print "              more efficient than using --pretend and then executing the same"
+		print "              command without --pretend, as dependencies will only need to be"
+		print "              calculated once. WARNING: If the \"Enter\" key is pressed at the"
+		print "              prompt (with no other input), it is interpreted as acceptance of"
+		print "              the first choice.  Note that the input buffer is not cleared prior"
+		print "              to the prompt, so an accidental press of the \"Enter\" key at any"
+		print "              time prior to the prompt will be interpreted as a choice!"
+		print
+		print "       "+green("--buildpkg")+" ("+green("-b")+" short option)"
+		print "              Tell emerge to build binary packages for all ebuilds processed"
+		print "              (in addition to actually merging the packages.  Useful for"
+		print "              maintainers or if you administrate multiple Gentoo Linux"
+		print "              systems (build once, emerge tbz2s everywhere) as well as disaster"
+		print "              recovery."
+		print
+		print "       "+green("--buildpkgonly")+" ("+green("-B")+" short option)"
+		print "              Creates a binary package, but does not merge it to the"
+		print "              system. This has the restriction that unsatisfied dependencies"
+		print "              must not exist for the desired package as they cannot be used if"
+		print "              they do not exist on the system."
+		print
+		print "       "+green("--changelog")+" ("+green("-l")+" short option)"
+		print "              When pretending, also display the ChangeLog entries for packages"
+		print "              that will be upgraded."
+		print
+		print "       "+green("--color") + " < " + turquoise("y") + " | "+ turquoise("n")+" >"
+		print "              Enable or disable color output. This option will override NOCOLOR"
+		print "              (see make.conf(5)) and may also be used to force color output when"
+		print "              stdout is not a tty (by default, color is disabled unless stdout"
+		print "              is a tty)."
+		print
+		print "       "+green("--columns")
+		print "              Display the pretend output in a tabular form. Versions are"
+		print "              aligned vertically."
+		print
+		print "       "+green("--debug")+" ("+green("-d")+" short option)"
+		print "              Tell emerge to run the ebuild command in --debug mode. In this"
+		print "              mode, the bash build environment will run with the -x option,"
+		print "              causing it to output verbose debug information print to stdout."
+		print "              --debug is great for finding bash syntax errors as providing"
+		print "              very verbose information about the dependency and build process."
+		print
+		print "       "+green("--deep")+" ("+green("-D")+" short option)"
+		print "              This flag forces emerge to consider the entire dependency tree of"
+		print "              packages, instead of checking only the immediate dependencies of"
+		print "              the packages. As an example, this catches updates in libraries"
+		print "              that are not directly listed in the dependencies of a package."
+		print "              Also see --with-bdeps for behavior with respect to build time"
+		print "              dependencies that are not strictly required."
+		print 
+		print "       "+green("--emptytree")+" ("+green("-e")+" short option)"
+		print "              Virtually tweaks the tree of installed packages to contain"
+		print "              nothing. This is great to use together with --pretend. This makes"
+		print "              it possible for developers to get a complete overview of the"
+		print "              complete dependency tree of a certain package."
+		print
+		print "       "+green("--fetchonly")+" ("+green("-f")+" short option)"
+		print "              Instead of doing any package building, just perform fetches for"
+		print "              all packages (main package as well as all dependencies.) When"
+		print "              used in combination with --pretend all the SRC_URIs will be"
+		print "              displayed multiple mirrors per line, one line per file."
+		print
+		print "       "+green("--fetch-all-uri")+" ("+green("-F")+" short option)"
+		print "              Same as --fetchonly except that all package files, including those"
+		print "              not required to build the package, will be processed."
+		print
+		print "       "+green("--getbinpkg")+" ("+green("-g")+" short option)"
+		print "              Using the server and location defined in PORTAGE_BINHOST, portage"
+		print "              will download the information from each binary file there and it"
+		print "              will use that information to help build the dependency list. This"
+		print "              option implies '-k'. (Use -gK for binary-only merging.)"
+		print
+		print "       "+green("--getbinpkgonly")+" ("+green("-G")+" short option)"
+		print "              This option is identical to -g, as above, except it will not use"
+		print "              ANY information from the local machine. All binaries will be"
+		print "              downloaded from the remote server without consulting packages"
+		print "              existing in the packages directory."
+		print
+		print "       "+green("--newuse")+" ("+green("-N")+" short option)"
+		print "              Tells emerge to include installed packages where USE flags have "
+		print "              changed since installation."
+		print
+		print "       "+green("--noconfmem")
+		print "              Portage keeps track of files that have been placed into"
+		print "              CONFIG_PROTECT directories, and normally it will not merge the"
+		print "              same file more than once, as that would become annoying. This"
+		print "              can lead to problems when the user wants the file in the case"
+		print "              of accidental deletion. With this option, files will always be"
+		print "              merged to the live fs instead of silently dropped."
+		print
+		print "       "+green("--nodeps")+" ("+green("-O")+" short option)"
+		print "              Merge specified packages, but don't merge any dependencies."
+		print "              Note that the build may fail if deps aren't satisfied."
+		print 
+		print "       "+green("--noreplace")+" ("+green("-n")+" short option)"
+		print "              Skip the packages specified on the command-line that have"
+		print "              already been installed.  Without this option, any packages,"
+		print "              ebuilds, or deps you specify on the command-line *will* cause"
+		print "              Portage to remerge the package, even if it is already installed."
+		print "              Note that Portage won't remerge dependencies by default."
+		print 
+		print "       "+green("--nospinner")
+		print "              Disables the spinner regardless of terminal type."
+		print
+		print "       "+green("--oneshot")+" ("+green("-1")+" short option)"
+		print "              Emerge as normal, but don't add packages to the world profile."
+		print "              This package will only be updated if it is depended upon by"
+		print "              another package."
+		print
+		print "       "+green("--onlydeps")+" ("+green("-o")+" short option)"
+		print "              Only merge (or pretend to merge) the dependencies of the"
+		print "              specified packages, not the packages themselves."
+		print
+		print "       "+green("--pretend")+" ("+green("-p")+" short option)"
+		print "              Instead of actually performing the merge, simply display what"
+		print "              ebuilds and tbz2s *would* have been installed if --pretend"
+		print "              weren't used.  Using --pretend is strongly recommended before"
+		print "              installing an unfamiliar package.  In the printout, N = new,"
+		print "              U = updating, R = replacing, F = fetch  restricted, B = blocked"
+		print "              by an already installed package, D = possible downgrading,"
+		print "              S = slotted install. --verbose causes affecting use flags to be"
+		print "              printed out accompanied by a '+' for enabled and a '-' for"
+		print "              disabled USE flags."
+		print
+		print "       "+green("--quiet")+" ("+green("-q")+" short option)"
+		print "              Effects vary, but the general outcome is a reduced or condensed"
+		print "              output from portage's displays."
+		print
+		print "       "+green("--skipfirst")
+		print "              This option is only valid in a resume situation. It removes the"
+		print "              first package in the resume list so that a merge may continue in"
+		print "              the presence of an uncorrectable or inconsequential error. This"
+		print "              should only be used in cases where skipping the package will not"
+		print "              result in failed dependencies."
+		print
+		print "       "+green("--tree")+" ("+green("-t")+" short option)"
+		print "              Shows the dependency tree using indentation for dependencies."
+		print "              The packages are also listed in reverse merge order so that"
+		print "              a package's dependencies follow the package. Only really useful"
+		print "              in combination with --emptytree, --update or --deep."
+		print
+		print "       "+green("--usepkg")+" ("+green("-k")+" short option)"
+		print "              Tell emerge to use binary packages (from $PKGDIR) if they are"
+		print "              available, thus possibly avoiding some time-consuming compiles."
+		print "              This option is useful for CD installs; you can export"
+		print "              PKGDIR=/mnt/cdrom/packages and then use this option to have"
+		print "              emerge \"pull\" binary packages from the CD in order to satisfy" 
+		print "              dependencies."
+		print
+		print "       "+green("--usepkgonly")+" ("+green("-K")+" short option)"
+		print "              Like --usepkg above, except this only allows the use of binary"
+		print "              packages, and it will abort the emerge if the package is not"
+		print "              available at the time of dependency calculation."
+		print
+		print "       "+green("--verbose")+" ("+green("-v")+" short option)"
+		print "              Effects vary, but the general outcome is an increased or expanded"
+		print "              display of content in portage's displays."
+		print
+		print "       "+green("--with-bdeps")+" < " + turquoise("y") + " | "+ turquoise("n")+" >"
+		print "              In dependency calculations, pull in build time dependencies that"
+		print "              are not strictly required. This defaults to 'n' for installation"
+		print "              actions and 'y' for the --depclean action. This setting can be"
+		print "              added to EMERGE_DEFAULT_OPTS (see make.conf(5)) and later"
+		print "              overridden via the command line."
+		print
+	elif myaction == "sync":
+		print
+		print bold("Usage: ")+turquoise("emerge")+" "+turquoise("--sync")
+		print
+		print "       'emerge --sync' tells emerge to update the Portage tree as specified in"
+		print "       The SYNC variable found in /etc/make.conf.  By default, SYNC instructs"
+		print "       emerge to perform an rsync-style update with rsync.gentoo.org."
+		print
+		print "       'emerge-webrsync' exists as a helper app to emerge --sync, providing a"
+		print "       method to receive the entire portage tree as a tarball that can be"
+		print "       extracted and used. First time syncs would benefit greatly from this."
+		print
+		print "       "+turquoise("WARNING:")
+		print "       If using our rsync server, emerge will clean out all files that do not"
+		print "       exist on it, including ones that you may have created. The exceptions"
+		print "       to this are the distfiles, local and packages directories."
+		print
+	elif myaction=="system":
+		print
+		print bold("Usage: ")+turquoise("emerge")+" [ "+green("options")+" ] "+turquoise("system")
+		print
+		print "       \"emerge system\" is the Portage system update command.  When run, it"
+		print "       will scan the etc/make.profile/packages file and determine what"
+		print "       packages need to be installed so that your system meets the minimum"
+		print "       requirements of your current system profile.  Note that this doesn't"
+		print "       necessarily bring your system up-to-date at all; instead, it just"
+		print "       ensures that you have no missing parts.  For example, if your system"
+		print "       profile specifies that you should have sys-apps/iptables installed"
+		print "       and you don't, then \"emerge system\" will install it (the most"
+		print "       recent version that matches the profile spec) for you.  It's always a"
+		print "       good idea to do an \"emerge --pretend system\" before an \"emerge"
+		print "       system\", just so you know what emerge is planning to do."
+		print
+	elif myaction=="world":
+		print
+		print bold("Usage: ")+turquoise("emerge")+" [ "+green("options")+" ] "+turquoise("world")
+		print
+		print "       'emerge world' is the Portage command for completely updating your"
+		print "       system.  The normal procedure is to first do an 'emerge --sync' and"
+		print "       then an 'emerge --update --deep world'.  The first command brings your"
+		print "       local Portage tree up-to-date with the latest version information and"
+		print "       ebuilds.  The second command then rebuilds all packages for which newer"
+		print "       versions or newer ebuilds have become available since you last did a"
+		print "       sync and update."
+		print
+	elif myaction=="config":
+		outstuff=green("Config file management support (preliminary)")+"""
+
+Portage has a special feature called "config file protection".  The purpose of
+this feature is to prevent new package installs from clobbering existing
+configuration files.  By default, config file protection is turned on for /etc
+and the KDE configuration dirs; more may be added in the future.
+
+When Portage installs a file into a protected directory tree like /etc, any
+existing files will not be overwritten.  If a file of the same name already
+exists, Portage will change the name of the to-be-installed file from 'foo' to
+'._cfg0000_foo'.  If '._cfg0000_foo' already exists, this name becomes
+'._cfg0001_foo', etc.  In this way, existing files are not overwritten,
+allowing the administrator to manually merge the new config files and avoid any
+unexpected changes.
+
+In addition to protecting overwritten files, Portage will not delete any files
+from a protected directory when a package is unmerged.  While this may be a
+little bit untidy, it does prevent potentially valuable config files from being
+deleted, which is of paramount importance.
+
+Protected directories are set using the CONFIG_PROTECT variable, normally
+defined in /etc/make.globals.  Directory exceptions to the CONFIG_PROTECTed
+directories can be specified using the CONFIG_PROTECT_MASK variable.  To find
+files that need to be updated in /etc, type:
+
+# find /etc -iname '._cfg????_*'
+
+You can disable this feature by setting CONFIG_PROTECT="-*" in /etc/make.conf.
+Then, Portage will mercilessly auto-update your config files.  Alternatively,
+you can leave Config File Protection on but tell Portage that it can overwrite
+files in certain specific /etc subdirectories.  For example, if you wanted
+Portage to automatically update your rc scripts and your wget configuration,
+but didn't want any other changes made without your explicit approval, you'd
+add this to /etc/make.conf:
+
+CONFIG_PROTECT_MASK="/etc/wget /etc/rc.d"
+
+Tools such as dispatch-conf, cfg-update, and etc-update are also available to
+aid in the merging of these files. They provide interactive merging and can
+auto-merge trivial changes.
+
+"""
+		print outstuff
+
Index: /vendor/prefix-portage/current/pym/emergehelp.py
===================================================================
--- /vendor/prefix-portage/current/pym/emergehelp.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/emergehelp.py	(revision 3489)
@@ -0,0 +1,35 @@
+# portage_compat_namespace.py -- provide compability layer with new namespace
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_compat_namespace.py 5981 2007-02-17 13:11:28Z genone $
+
+""" 
+This module checks the name under which it is imported and attempts to load
+the corresponding module of the new portage namespace, inserting it into the
+loaded modules list.
+It also issues a warning to the caller to migrate to the new namespace.
+Note that this module should never be used with it's true name, but only by 
+links pointing to it. Also it is limited to portage_foo -> portage.foo 
+translations, however existing subpackages shouldn't use it anyway to maintain 
+compability with 3rd party modules (like elog or cache plugins), and they 
+shouldn't be directly imported by external consumers.
+
+This module is based on an idea by Brian Harring.
+"""
+
+import sys, warnings
+
+__oldname = __name__
+if __name__.startswith("portage_"):
+	__newname = __name__.replace("_", ".")
+else:
+	__newname = "portage."+__name__
+
+try:
+	__package = __import__(__newname, globals(), locals())
+	__realmodule = getattr(__package, __newname[8:])
+except ImportError, AttributeError:
+	raise ImportError("No module named %s" % __oldname)
+
+warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname))
+sys.modules[__oldname] = __realmodule
Index: /vendor/prefix-portage/current/pym/getbinpkg.py
===================================================================
--- /vendor/prefix-portage/current/pym/getbinpkg.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/getbinpkg.py	(revision 3489)
@@ -0,0 +1,35 @@
+# portage_compat_namespace.py -- provide compability layer with new namespace
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_compat_namespace.py 5981 2007-02-17 13:11:28Z genone $
+
+""" 
+This module checks the name under which it is imported and attempts to load
+the corresponding module of the new portage namespace, inserting it into the
+loaded modules list.
+It also issues a warning to the caller to migrate to the new namespace.
+Note that this module should never be used with it's true name, but only by 
+links pointing to it. Also it is limited to portage_foo -> portage.foo 
+translations, however existing subpackages shouldn't use it anyway to maintain 
+compability with 3rd party modules (like elog or cache plugins), and they 
+shouldn't be directly imported by external consumers.
+
+This module is based on an idea by Brian Harring.
+"""
+
+import sys, warnings
+
+__oldname = __name__
+if __name__.startswith("portage_"):
+	__newname = __name__.replace("_", ".")
+else:
+	__newname = "portage."+__name__
+
+try:
+	__package = __import__(__newname, globals(), locals())
+	__realmodule = getattr(__package, __newname[8:])
+except ImportError, AttributeError:
+	raise ImportError("No module named %s" % __oldname)
+
+warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname))
+sys.modules[__oldname] = __realmodule
Index: /vendor/prefix-portage/current/pym/output.py
===================================================================
--- /vendor/prefix-portage/current/pym/output.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/output.py	(revision 3489)
@@ -0,0 +1,35 @@
+# portage_compat_namespace.py -- provide compability layer with new namespace
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_compat_namespace.py 5981 2007-02-17 13:11:28Z genone $
+
+""" 
+This module checks the name under which it is imported and attempts to load
+the corresponding module of the new portage namespace, inserting it into the
+loaded modules list.
+It also issues a warning to the caller to migrate to the new namespace.
+Note that this module should never be used with it's true name, but only by 
+links pointing to it. Also it is limited to portage_foo -> portage.foo 
+translations, however existing subpackages shouldn't use it anyway to maintain 
+compability with 3rd party modules (like elog or cache plugins), and they 
+shouldn't be directly imported by external consumers.
+
+This module is based on an idea by Brian Harring.
+"""
+
+import sys, warnings
+
+__oldname = __name__
+if __name__.startswith("portage_"):
+	__newname = __name__.replace("_", ".")
+else:
+	__newname = "portage."+__name__
+
+try:
+	__package = __import__(__newname, globals(), locals())
+	__realmodule = getattr(__package, __newname[8:])
+except ImportError, AttributeError:
+	raise ImportError("No module named %s" % __oldname)
+
+warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname))
+sys.modules[__oldname] = __realmodule
Index: /vendor/prefix-portage/current/pym/portage/__init__.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/__init__.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/__init__.py	(revision 3489)
@@ -0,0 +1,5390 @@
+# portage.py -- core Portage functionality
+# Copyright 1998-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: $
+
+
+VERSION="2.2.00.6804"
+
+# ===========================================================================
+# START OF IMPORTS -- START OF IMPORTS -- START OF IMPORTS -- START OF IMPORT
+# ===========================================================================
+
+try:
+	import sys
+	import copy
+	import errno
+	import os
+	import re
+	import shutil
+	import time
+	try:
+		import cPickle
+	except ImportError:
+		import pickle as cPickle
+
+	import stat
+	import commands
+	from time import sleep
+	from random import shuffle
+	import UserDict
+	if getattr(__builtins__, "set", None) is None:
+		from sets import Set as set
+	from itertools import chain, izip
+except ImportError, e:
+	sys.stderr.write("\n\n")
+	sys.stderr.write("!!! Failed to complete python imports. These are internal modules for\n")
+	sys.stderr.write("!!! python and failure here indicates that you have a problem with python\n")
+	sys.stderr.write("!!! itself and thus portage is not able to continue processing.\n\n")
+
+	sys.stderr.write("!!! You might consider starting python with verbose flags to see what has\n")
+	sys.stderr.write("!!! gone wrong. Here is the information we got for this exception:\n")
+	sys.stderr.write("    "+str(e)+"\n\n");
+	raise
+
+bsd_chflags = None
+if os.uname()[0] in ["FreeBSD"]:
+	try:
+		import freebsd as bsd_chflags
+	except ImportError:
+		pass
+
+try:
+	from portage.cache.cache_errors import CacheError
+	import portage.cvstree
+	import portage.xpak
+	import portage.getbinpkg
+	import portage.dep
+	from portage.dep import dep_getcpv, dep_getkey, get_operator, \
+		isjustname, isspecific, isvalidatom, \
+		match_from_list, match_to_list, best_match_to_list
+
+	# XXX: This needs to get cleaned up.
+	import portage.output
+	from portage.output import bold, colorize, green, red, yellow
+
+	import portage.const
+	from portage.const import VDB_PATH, PRIVATE_PATH, CACHE_PATH, DEPCACHE_PATH, \
+	  USER_CONFIG_PATH, MODULES_FILE_PATH, CUSTOM_PROFILE_PATH, PORTAGE_BASE_PATH, \
+	  PORTAGE_BIN_PATH, PORTAGE_PYM_PATH, PROFILE_PATH, LOCALE_DATA_PATH, \
+	  EBUILD_SH_BINARY, SANDBOX_BINARY, BASH_BINARY, \
+	  MOVE_BINARY, PRELINK_BINARY, WORLD_FILE, MAKE_CONF_FILE, MAKE_DEFAULTS_FILE, \
+	  DEPRECATED_PROFILE_FILE, USER_VIRTUALS_FILE, EBUILD_SH_ENV_FILE, \
+	  INVALID_ENV_FILE, CUSTOM_MIRRORS_FILE, CONFIG_MEMORY_FILE,\
+	  INCREMENTALS, EAPI, MISC_SH_BINARY, REPO_NAME_LOC, REPO_NAME_FILE, \
+	  EPREFIX
+
+	from portage.data import ostype, lchown, userland, secpass, uid, wheelgid, \
+	                         portage_uid, portage_gid, userpriv_groups
+	from portage.manifest import Manifest
+
+	import portage.util
+	from portage.util import atomic_ofstream, apply_secpass_permissions, apply_recursive_permissions, \
+		dump_traceback, getconfig, grabdict, grabdict_package, grabfile, grabfile_package, \
+		map_dictlist_vals, new_protect_filename, normalize_path, \
+		pickle_read, pickle_write, stack_dictlist, stack_dicts, stack_lists, \
+		unique_array, varexpand, writedict, writemsg, writemsg_stdout, write_atomic
+	import portage.exception
+	import portage.gpg
+	import portage.locks
+	import portage.process
+	from portage.process import atexit_register, run_exitfuncs
+	from portage.locks import unlockfile,unlockdir,lockfile,lockdir
+	import portage.checksum
+	from portage.checksum import perform_md5,perform_checksum,prelink_capable
+	import portage.eclass_cache
+	from portage.localization import _
+	from portage.update import dep_transform, fixdbentries, grab_updates, \
+		parse_updates, update_config_files, update_dbentries
+
+	# Need these functions directly in portage namespace to not break every external tool in existence
+	from portage.versions import best, catpkgsplit, catsplit, pkgcmp, \
+		pkgsplit, vercmp, ververify
+
+	# endversion and endversion_keys are for backward compatibility only.
+	from portage.versions import endversion_keys
+	from portage.versions import suffix_value as endversion
+
+except ImportError, e:
+	sys.stderr.write("\n\n")
+	sys.stderr.write("!!! Failed to complete portage imports. There are internal modules for\n")
+	sys.stderr.write("!!! portage and failure here indicates that you have a problem with your\n")
+	sys.stderr.write("!!! installation of portage. Please try a rescue portage located in the\n")
+	sys.stderr.write("!!! portage tree under '/usr/portage/sys-apps/portage/files/' (default).\n")
+	sys.stderr.write("!!! There is a README.RESCUE file that details the steps required to perform\n")
+	sys.stderr.write("!!! a recovery of portage.\n")
+	sys.stderr.write("    "+str(e)+"\n\n")
+	raise
+
+
+try:
+	import portage.selinux as selinux
+except OSError, e:
+	writemsg("!!! SELinux not loaded: %s\n" % str(e), noiselevel=-1)
+	del e
+except ImportError:
+	pass
+
+# ===========================================================================
+# END OF IMPORTS -- END OF IMPORTS -- END OF IMPORTS -- END OF IMPORTS -- END
+# ===========================================================================
+
+
+def load_mod(name):
+	modname = ".".join(name.split(".")[:-1])
+	mod = __import__(modname)
+	components = name.split('.')
+	for comp in components[1:]:
+		mod = getattr(mod, comp)
+	return mod
+
+def best_from_dict(key, top_dict, key_order, EmptyOnError=1, FullCopy=1, AllowEmpty=1):
+	for x in key_order:
+		if top_dict.has_key(x) and top_dict[x].has_key(key):
+			if FullCopy:
+				return copy.deepcopy(top_dict[x][key])
+			else:
+				return top_dict[x][key]
+	if EmptyOnError:
+		return ""
+	else:
+		raise KeyError, "Key not found in list; '%s'" % key
+
+def getcwd():
+	"this fixes situations where the current directory doesn't exist"
+	try:
+		return os.getcwd()
+	except OSError: #dir doesn't exist
+		os.chdir("/")
+		return "/"
+getcwd()
+
+def abssymlink(symlink):
+	"This reads symlinks, resolving the relative symlinks, and returning the absolute."
+	mylink=os.readlink(symlink)
+	if mylink[0] != '/':
+		mydir=os.path.dirname(symlink)
+		mylink=mydir+"/"+mylink
+	return os.path.normpath(mylink)
+
+dircache = {}
+cacheHit=0
+cacheMiss=0
+cacheStale=0
+def cacheddir(my_original_path, ignorecvs, ignorelist, EmptyOnError, followSymlinks=True):
+	global cacheHit,cacheMiss,cacheStale
+	mypath = normalize_path(my_original_path)
+	if dircache.has_key(mypath):
+		cacheHit += 1
+		cached_mtime, list, ftype = dircache[mypath]
+	else:
+		cacheMiss += 1
+		cached_mtime, list, ftype = -1, [], []
+	try:
+		pathstat = os.stat(mypath)
+		if stat.S_ISDIR(pathstat[stat.ST_MODE]):
+			mtime = pathstat[stat.ST_MTIME]
+		else:
+			raise portage.exception.DirectoryNotFound(mypath)
+	except (IOError,OSError,portage.exception.PortageException):
+		if EmptyOnError:
+			return [], []
+		return None, None
+	# Python retuns mtime in seconds, so if it was changed in the last few seconds, it could be invalid
+	if mtime != cached_mtime or time.time() - mtime < 4:
+		if dircache.has_key(mypath):
+			cacheStale += 1
+		list = os.listdir(mypath)
+		ftype = []
+		for x in list:
+			try:
+				if followSymlinks:
+					pathstat = os.stat(mypath+"/"+x)
+				else:
+					pathstat = os.lstat(mypath+"/"+x)
+
+				if stat.S_ISREG(pathstat[stat.ST_MODE]):
+					ftype.append(0)
+				elif stat.S_ISDIR(pathstat[stat.ST_MODE]):
+					ftype.append(1)
+				elif stat.S_ISLNK(pathstat[stat.ST_MODE]):
+					ftype.append(2)
+				else:
+					ftype.append(3)
+			except (IOError, OSError):
+				ftype.append(3)
+		dircache[mypath] = mtime, list, ftype
+
+	ret_list = []
+	ret_ftype = []
+	for x in range(0, len(list)):
+		if(ignorecvs and (len(list[x]) > 2) and (list[x][:2]!=".#")):
+			ret_list.append(list[x])
+			ret_ftype.append(ftype[x])
+		elif (list[x] not in ignorelist):
+			ret_list.append(list[x])
+			ret_ftype.append(ftype[x])
+
+	writemsg("cacheddirStats: H:%d/M:%d/S:%d\n" % (cacheHit, cacheMiss, cacheStale),10)
+	return ret_list, ret_ftype
+
+def listdir(mypath, recursive=False, filesonly=False, ignorecvs=False, ignorelist=[], followSymlinks=True,
+	EmptyOnError=False, dirsonly=False):
+	"""
+	Portage-specific implementation of os.listdir
+
+	@param mypath: Path whose contents you wish to list
+	@type mypath: String
+	@param recursive: Recursively scan directories contained within mypath
+	@type recursive: Boolean
+	@param filesonly; Only return files, not more directories
+	@type filesonly: Boolean
+	@param ignorecvs: Ignore CVS directories ('CVS','.svn','SCCS')
+	@type ignorecvs: Boolean
+	@param ignorelist: List of filenames/directories to exclude
+	@type ignorelist: List
+	@param followSymlinks: Follow Symlink'd files and directories
+	@type followSymlinks: Boolean
+	@param EmptyOnError: Return [] if an error occurs.
+	@type EmptyOnError: Boolean
+	@param dirsonly: Only return directories.
+	@type dirsonly: Boolean
+	@rtype: List
+	@returns: A list of files and directories (or just files or just directories) or an empty list.
+	"""
+
+	list, ftype = cacheddir(mypath, ignorecvs, ignorelist, EmptyOnError, followSymlinks)
+
+	if list is None:
+		list=[]
+	if ftype is None:
+		ftype=[]
+
+	if not (filesonly or dirsonly or recursive):
+		return list
+
+	if recursive:
+		x=0
+		while x<len(ftype):
+			if ftype[x]==1 and not (ignorecvs and os.path.basename(list[x]) in ('CVS','.svn','SCCS')):
+				l,f = cacheddir(mypath+"/"+list[x], ignorecvs, ignorelist, EmptyOnError,
+					followSymlinks)
+
+				l=l[:]
+				for y in range(0,len(l)):
+					l[y]=list[x]+"/"+l[y]
+				list=list+l
+				ftype=ftype+f
+			x+=1
+	if filesonly:
+		rlist=[]
+		for x in range(0,len(ftype)):
+			if ftype[x]==0:
+				rlist=rlist+[list[x]]
+	elif dirsonly:
+		rlist = []
+		for x in range(0, len(ftype)):
+			if ftype[x] == 1:
+				rlist = rlist + [list[x]]	
+	else:
+		rlist=list
+
+	return rlist
+
+def flatten(mytokens):
+	"""this function now turns a [1,[2,3]] list into
+	a [1,2,3] list and returns it."""
+	newlist=[]
+	for x in mytokens:
+		if isinstance(x, list):
+			newlist.extend(flatten(x))
+		else:
+			newlist.append(x)
+	return newlist
+
+#beautiful directed graph object
+
+class digraph:
+	def __init__(self):
+		"""Create an empty digraph"""
+		
+		# { node : ( { child : priority } , { parent : priority } ) }
+		self.nodes = {}
+		self.order = []
+
+	def add(self, node, parent, priority=0):
+		"""Adds the specified node with the specified parent.
+		
+		If the dep is a soft-dep and the node already has a hard
+		relationship to the parent, the relationship is left as hard."""
+		
+		if node not in self.nodes:
+			self.nodes[node] = ({}, {})
+			self.order.append(node)
+		
+		if not parent:
+			return
+		
+		if parent not in self.nodes:
+			self.nodes[parent] = ({}, {})
+			self.order.append(parent)
+		
+		if parent in self.nodes[node][1]:
+			if priority > self.nodes[node][1][parent]:
+				self.nodes[node][1][parent] = priority
+		else:
+			self.nodes[node][1][parent] = priority
+		
+		if node in self.nodes[parent][0]:
+			if priority > self.nodes[parent][0][node]:
+				self.nodes[parent][0][node] = priority
+		else:
+			self.nodes[parent][0][node] = priority
+
+	def remove(self, node):
+		"""Removes the specified node from the digraph, also removing
+		and ties to other nodes in the digraph. Raises KeyError if the
+		node doesn't exist."""
+		
+		if node not in self.nodes:
+			raise KeyError(node)
+		
+		for parent in self.nodes[node][1]:
+			del self.nodes[parent][0][node]
+		for child in self.nodes[node][0]:
+			del self.nodes[child][1][node]
+		
+		del self.nodes[node]
+		self.order.remove(node)
+
+	def contains(self, node):
+		"""Checks if the digraph contains mynode"""
+		return node in self.nodes
+
+	def all_nodes(self):
+		"""Return a list of all nodes in the graph"""
+		return self.order[:]
+
+	def child_nodes(self, node, ignore_priority=None):
+		"""Return all children of the specified node"""
+		if ignore_priority is None:
+			return self.nodes[node][0].keys()
+		children = []
+		for child, priority in self.nodes[node][0].iteritems():
+			if priority > ignore_priority:
+				children.append(child)
+		return children
+
+	def parent_nodes(self, node):
+		"""Return all parents of the specified node"""
+		return self.nodes[node][1].keys()
+
+	def leaf_nodes(self, ignore_priority=None):
+		"""Return all nodes that have no children
+		
+		If ignore_soft_deps is True, soft deps are not counted as
+		children in calculations."""
+		
+		leaf_nodes = []
+		for node in self.order:
+			is_leaf_node = True
+			for child in self.nodes[node][0]:
+				if self.nodes[node][0][child] > ignore_priority:
+					is_leaf_node = False
+					break
+			if is_leaf_node:
+				leaf_nodes.append(node)
+		return leaf_nodes
+
+	def root_nodes(self, ignore_priority=None):
+		"""Return all nodes that have no parents.
+		
+		If ignore_soft_deps is True, soft deps are not counted as
+		parents in calculations."""
+		
+		root_nodes = []
+		for node in self.order:
+			is_root_node = True
+			for parent in self.nodes[node][1]:
+				if self.nodes[node][1][parent] > ignore_priority:
+					is_root_node = False
+					break
+			if is_root_node:
+				root_nodes.append(node)
+		return root_nodes
+
+	def is_empty(self):
+		"""Checks if the digraph is empty"""
+		return len(self.nodes) == 0
+
+	def clone(self):
+		clone = digraph()
+		clone.nodes = copy.deepcopy(self.nodes)
+		clone.order = self.order[:]
+		return clone
+
+	# Backward compatibility
+	addnode = add
+	allnodes = all_nodes
+	allzeros = leaf_nodes
+	hasnode = contains
+	empty = is_empty
+	copy = clone
+
+	def delnode(self, node):
+		try:
+			self.remove(node)
+		except KeyError:
+			pass
+
+	def firstzero(self):
+		leaf_nodes = self.leaf_nodes()
+		if leaf_nodes:
+			return leaf_nodes[0]
+		return None
+
+	def hasallzeros(self, ignore_priority=None):
+		return len(self.leaf_nodes(ignore_priority=ignore_priority)) == \
+			len(self.order)
+
+	def debug_print(self):
+		for node in self.nodes:
+			print node,
+			if self.nodes[node][0]:
+				print "depends on"
+			else:
+				print "(no children)"
+			for child in self.nodes[node][0]:
+				print "  ",child,
+				print "(%s)" % self.nodes[node][0][child]
+
+
+#parse /etc/env.d and generate /etc/profile.env
+
+def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None,
+	env=None):
+	if target_root is None:
+		global root
+		target_root = root
+	if prev_mtimes is None:
+		global mtimedb
+		prev_mtimes = mtimedb["ldpath"]
+	if env is None:
+		env = os.environ
+	envd_dir = os.path.join(target_root + EPREFIX, "etc", "env.d")
+	portage.util.ensure_dirs(envd_dir, mode=0755)
+	fns = listdir(envd_dir, EmptyOnError=1)
+	fns.sort()
+	templist = []
+	for x in fns:
+		if len(x) < 3:
+			continue
+		if not x[0].isdigit() or not x[1].isdigit():
+			continue
+		if x.startswith(".") or x.endswith("~") or x.endswith(".bak"):
+			continue
+		templist.append(x)
+	fns = templist
+	del templist
+
+	space_separated = set(["CONFIG_PROTECT", "CONFIG_PROTECT_MASK"])
+	colon_separated = set(["ADA_INCLUDE_PATH", "ADA_OBJECTS_PATH",
+		"CLASSPATH", "INFODIR", "INFOPATH", "KDEDIRS", "LDPATH", "MANPATH",
+		  "PATH", "PKG_CONFIG_PATH", "PRELINK_PATH", "PRELINK_PATH_MASK",
+		  "PYTHONPATH", "ROOTPATH"])
+
+	config_list = []
+
+	for x in fns:
+		file_path = os.path.join(envd_dir, x)
+		try:
+			myconfig = getconfig(file_path, expand=False)
+		except portage.exception.ParseError, e:
+			writemsg("!!! '%s'\n" % str(e), noiselevel=-1)
+			del e
+			continue
+		if myconfig is None:
+			# broken symlink or file removed by a concurrent process
+			writemsg("!!! File Not Found: '%s'\n" % file_path, noiselevel=-1)
+			continue
+		config_list.append(myconfig)
+		if "SPACE_SEPARATED" in myconfig:
+			space_separated.update(myconfig["SPACE_SEPARATED"].split())
+			del myconfig["SPACE_SEPARATED"]
+		if "COLON_SEPARATED" in myconfig:
+			colon_separated.update(myconfig["COLON_SEPARATED"].split())
+			del myconfig["COLON_SEPARATED"]
+
+	env = {}
+	specials = {}
+	for var in space_separated:
+		mylist = []
+		for myconfig in config_list:
+			if var in myconfig:
+				for item in myconfig[var].split():
+					if item and not item in mylist:
+						mylist.append(item)
+				del myconfig[var] # prepare for env.update(myconfig)
+		if mylist:
+			env[var] = " ".join(mylist)
+		specials[var] = mylist
+
+	for var in colon_separated:
+		mylist = []
+		for myconfig in config_list:
+			if var in myconfig:
+				for item in myconfig[var].split(":"):
+					if item and not item in mylist:
+						mylist.append(item)
+				del myconfig[var] # prepare for env.update(myconfig)
+		if mylist:
+			env[var] = ":".join(mylist)
+		specials[var] = mylist
+
+	for myconfig in config_list:
+		"""Cumulative variables have already been deleted from myconfig so that
+		they won't be overwritten by this dict.update call."""
+		env.update(myconfig)
+
+	ldsoconf_path = os.path.join(target_root + EPREFIX, "etc", "ld.so.conf")
+	try:
+		myld = open(ldsoconf_path)
+		myldlines=myld.readlines()
+		myld.close()
+		oldld=[]
+		for x in myldlines:
+			#each line has at least one char (a newline)
+			if x[0]=="#":
+				continue
+			oldld.append(x[:-1])
+	except (IOError, OSError), e:
+		if e.errno != errno.ENOENT:
+			raise
+		oldld = None
+
+	ld_cache_update=False
+
+	newld = specials["LDPATH"]
+	if (oldld!=newld):
+		#ld.so.conf needs updating and ldconfig needs to be run
+		myfd = atomic_ofstream(ldsoconf_path)
+		myfd.write("# ld.so.conf autogenerated by env-update; make all changes to\n")
+		myfd.write("# contents of "+EPREFIX+"/etc/env.d directory\n")
+		for x in specials["LDPATH"]:
+			myfd.write(x+"\n")
+		myfd.close()
+		ld_cache_update=True
+
+	# Update prelink.conf if we are prelink-enabled
+	if prelink_capable:
+		newprelink = atomic_ofstream(
+			os.path.join(target_root + EPREFIX, "etc", "prelink.conf"))
+		newprelink.write("# prelink.conf autogenerated by env-update; make all changes to\n")
+		newprelink.write("# contents of "+EPREFIX+"/etc/env.d directory\n")
+
+		for x in map(lambda x: os.path.join(EPREFIX,x), ["bin","sbin","usr/bin","usr/sbin","lib","usr/lib"]):
+			newprelink.write("-l "+x+"\n");
+		for x in specials["LDPATH"]+specials["PATH"]+specials["PRELINK_PATH"]:
+			if not x:
+				continue
+			if x[-1]!='/':
+				x=x+"/"
+			plmasked=0
+			for y in specials["PRELINK_PATH_MASK"]:
+				if not y:
+					continue
+				if y[-1]!='/':
+					y=y+"/"
+				if y==x[0:len(y)]:
+					plmasked=1
+					break
+			if not plmasked:
+				newprelink.write("-h "+x+"\n")
+		for x in specials["PRELINK_PATH_MASK"]:
+			newprelink.write("-b "+x+"\n")
+		newprelink.close()
+
+	# Portage stores mtimes with 1 second granularity but in >=python-2.5 finer
+	# granularity is possible.  In order to avoid the potential ambiguity of
+	# mtimes that differ by less than 1 second, sleep here if any of the
+	# directories have been modified during the current second.
+	sleep_for_mtime_granularity = False
+	current_time = long(time.time())
+	mtime_changed = False
+	lib_dirs = set()
+	for lib_dir in portage.util.unique_array(specials["LDPATH"]+['usr/lib','usr/lib64','usr/lib32','lib','lib64','lib32']):
+		x = os.path.join(target_root + EPREFIX, lib_dir.lstrip(os.sep))
+		try:
+			newldpathtime = long(os.stat(x).st_mtime)
+			lib_dirs.add(normalize_path(x))
+		except OSError, oe:
+			if oe.errno == errno.ENOENT:
+				try:
+					del prev_mtimes[x]
+				except KeyError:
+					pass
+				# ignore this path because it doesn't exist
+				continue
+			raise
+		if newldpathtime == current_time:
+			sleep_for_mtime_granularity = True
+		if x in prev_mtimes:
+			if prev_mtimes[x] == newldpathtime:
+				pass
+			else:
+				prev_mtimes[x] = newldpathtime
+				mtime_changed = True
+		else:
+			prev_mtimes[x] = newldpathtime
+			mtime_changed = True
+
+	if mtime_changed:
+		ld_cache_update = True
+
+	if makelinks and \
+		not ld_cache_update and \
+		contents is not None:
+		libdir_contents_changed = False
+		for mypath, mydata in contents.iteritems():
+			if mydata[0] not in ("obj","sym"):
+				continue
+			head, tail = os.path.split(mypath)
+			if head in lib_dirs:
+				libdir_contents_changed = True
+				break
+		if not libdir_contents_changed:
+			makelinks = False
+
+	ldconfig = EPREFIX+"/sbin/ldconfig"
+	if "CHOST" in env and "CBUILD" in env and \
+		env["CHOST"] != env["CBUILD"]:
+		from portage.process import find_binary
+		ldconfig = find_binary("%s-ldconfig" % env["CHOST"])
+
+	# Only run ldconfig as needed
+	if (ld_cache_update or makelinks) and ldconfig:
+		# ldconfig has very different behaviour between FreeBSD and Linux
+		if ostype=="Linux" or ostype.lower().endswith("gnu"):
+			# We can't update links if we haven't cleaned other versions first, as
+			# an older package installed ON TOP of a newer version will cause ldconfig
+			# to overwrite the symlinks we just made. -X means no links. After 'clean'
+			# we can safely create links.
+			writemsg(">>> Regenerating %s/etc/ld.so.cache...\n" % (target_root+EPREFIX))
+			if makelinks:
+				os.system("cd / ; %s -r '%s'" % (ldconfig, target_root))
+			else:
+				os.system("cd / ; %s -X -r '%s'" % (ldconfig, target_root))
+		elif ostype in ("FreeBSD","DragonFly"):
+			writemsg(">>> Regenerating %svar/run/ld-elf.so.hints...\n" % \
+				target_root+EPREFIX)
+			os.system(("cd / ; %s -elf -i " + \
+				"-f '%svar/run/ld-elf.so.hints' '%setc/ld.so.conf'") % \
+				(ldconfig, target_root+EPREFIX, target_root+EPREFIX))
+
+	del specials["LDPATH"]
+
+	penvnotice  = "# THIS FILE IS AUTOMATICALLY GENERATED BY env-update.\n"
+	penvnotice += "# DO NOT EDIT THIS FILE. CHANGES TO STARTUP PROFILES\n"
+	cenvnotice  = penvnotice[:]
+	penvnotice += "# GO INTO "+EPREFIX+"/etc/profile NOT "+EPREFIX+"/etc/profile.env\n\n"
+	cenvnotice += "# GO INTO "+EPREFIX+"/etc/csh.cshrc NOT "+EPREFIX+"/etc/csh.env\n\n"
+
+	#create /etc/profile.env for bash support
+	outfile = atomic_ofstream(os.path.join(target_root + EPREFIX, "etc", "profile.env"))
+	outfile.write(penvnotice)
+
+	env_keys = [ x for x in env if x != "LDPATH" ]
+	env_keys.sort()
+	for x in env_keys:
+		outfile.write("export %s='%s'\n" % (x, env[x]))
+	outfile.close()
+
+	#create /etc/csh.env for (t)csh support
+	outfile = atomic_ofstream(os.path.join(target_root + EPREFIX, "etc", "csh.env"))
+	outfile.write(cenvnotice)
+	for x in env_keys:
+		outfile.write("setenv %s '%s'\n" % (x, env[x]))
+	outfile.close()
+
+	if sleep_for_mtime_granularity:
+		while current_time == long(time.time()):
+			sleep(1)
+
+def ExtractKernelVersion(base_dir):
+	"""
+	Try to figure out what kernel version we are running
+	@param base_dir: Path to sources (usually /usr/src/linux)
+	@type base_dir: string
+	@rtype: tuple( version[string], error[string])
+	@returns:
+	1. tuple( version[string], error[string])
+	Either version or error is populated (but never both)
+
+	"""
+	lines = []
+	pathname = os.path.join(base_dir, 'Makefile')
+	try:
+		f = open(pathname, 'r')
+	except OSError, details:
+		return (None, str(details))
+	except IOError, details:
+		return (None, str(details))
+
+	try:
+		for i in range(4):
+			lines.append(f.readline())
+	except OSError, details:
+		return (None, str(details))
+	except IOError, details:
+		return (None, str(details))
+
+	lines = [l.strip() for l in lines]
+
+	version = ''
+
+	#XXX: The following code relies on the ordering of vars within the Makefile
+	for line in lines:
+		# split on the '=' then remove annoying whitespace
+		items = line.split("=")
+		items = [i.strip() for i in items]
+		if items[0] == 'VERSION' or \
+			items[0] == 'PATCHLEVEL':
+			version += items[1]
+			version += "."
+		elif items[0] == 'SUBLEVEL':
+			version += items[1]
+		elif items[0] == 'EXTRAVERSION' and \
+			items[-1] != items[0]:
+			version += items[1]
+
+	# Grab a list of files named localversion* and sort them
+	localversions = os.listdir(base_dir)
+	for x in range(len(localversions)-1,-1,-1):
+		if localversions[x][:12] != "localversion":
+			del localversions[x]
+	localversions.sort()
+
+	# Append the contents of each to the version string, stripping ALL whitespace
+	for lv in localversions:
+		version += "".join( " ".join( grabfile( base_dir+ "/" + lv ) ).split() )
+
+	# Check the .config for a CONFIG_LOCALVERSION and append that too, also stripping whitespace
+	kernelconfig = getconfig(base_dir+"/.config")
+	if kernelconfig and kernelconfig.has_key("CONFIG_LOCALVERSION"):
+		version += "".join(kernelconfig["CONFIG_LOCALVERSION"].split())
+
+	return (version,None)
+
+def autouse(myvartree, use_cache=1, mysettings=None):
+	"""
+	autuse returns a list of USE variables auto-enabled to packages being installed
+
+	@param myvartree: Instance of the vartree class (from /var/db/pkg...)
+	@type myvartree: vartree
+	@param use_cache: read values from cache
+	@type use_cache: Boolean
+	@param mysettings: Instance of config
+	@type mysettings: config
+	@rtype: string
+	@returns: A string containing a list of USE variables that are enabled via use.defaults
+	"""
+	if mysettings is None:
+		global settings
+		mysettings = settings
+	if mysettings.profile_path is None:
+		return ""
+	myusevars=""
+	usedefaults = mysettings.use_defs
+	for myuse in usedefaults:
+		dep_met = True
+		for mydep in usedefaults[myuse]:
+			if not myvartree.dep_match(mydep,use_cache=True):
+				dep_met = False
+				break
+		if dep_met:
+			myusevars += " "+myuse
+	return myusevars
+
+def check_config_instance(test):
+	if not test or (str(test.__class__) != 'portage.config'):
+		raise TypeError, "Invalid type for config object: %s" % test.__class__
+
+class config:
+	"""
+	This class encompasses the main portage configuration.  Data is pulled from
+	ROOT/PORTDIR/profiles/, from ROOT/etc/make.profile incrementally through all 
+	parent profiles as well as from ROOT/PORTAGE_CONFIGROOT/* for user specified
+	overrides.
+	
+	Generally if you need data like USE flags, FEATURES, environment variables,
+	virtuals ...etc you look in here.
+	"""
+	
+	def __init__(self, clone=None, mycpv=None, config_profile_path=None,
+		config_incrementals=None, config_root=None, target_root=None,
+		local_config=True):
+		"""
+		@param clone: If provided, init will use deepcopy to copy by value the instance.
+		@type clone: Instance of config class.
+		@param mycpv: CPV to load up (see setcpv), this is the same as calling init with mycpv=None
+		and then calling instance.setcpv(mycpv).
+		@type mycpv: String
+		@param config_profile_path: Configurable path to the profile (usually PROFILE_PATH from portage.const)
+		@type config_profile_path: String
+		@param config_incrementals: List of incremental variables (usually portage.const.INCREMENTALS)
+		@type config_incrementals: List
+		@param config_root: path to read local config from (defaults to "/", see PORTAGE_CONFIGROOT)
+		@type config_root: String
+		@param target_root: __init__ override of $ROOT env variable.
+		@type target_root: String
+		@param local_config: Enables loading of local config (/etc/portage); used most by repoman to
+		ignore local config (keywording and unmasking)
+		@type local_config: Boolean
+		"""
+
+		debug = os.environ.get("PORTAGE_DEBUG") == "1"
+
+		self.already_in_regenerate = 0
+
+		self.locked   = 0
+		self.mycpv    = None
+		self.puse     = []
+		self.modifiedkeys = []
+		self.uvlist = []
+
+		self.virtuals = {}
+		self.virts_p = {}
+		self.dirVirtuals = None
+		self.v_count  = 0
+
+		# Virtuals obtained from the vartree
+		self.treeVirtuals = {}
+		# Virtuals by user specification. Includes negatives.
+		self.userVirtuals = {}
+		# Virtual negatives from user specifications.
+		self.negVirtuals  = {}
+
+		self.user_profile_dir = None
+		self.local_config = local_config
+
+		if clone:
+			self.incrementals = copy.deepcopy(clone.incrementals)
+			self.profile_path = copy.deepcopy(clone.profile_path)
+			self.user_profile_dir = copy.deepcopy(clone.user_profile_dir)
+			self.local_config = copy.deepcopy(clone.local_config)
+
+			self.module_priority = copy.deepcopy(clone.module_priority)
+			self.modules         = copy.deepcopy(clone.modules)
+
+			self.depcachedir = copy.deepcopy(clone.depcachedir)
+
+			self.packages = copy.deepcopy(clone.packages)
+			self.virtuals = copy.deepcopy(clone.virtuals)
+
+			self.treeVirtuals = copy.deepcopy(clone.treeVirtuals)
+			self.userVirtuals = copy.deepcopy(clone.userVirtuals)
+			self.negVirtuals  = copy.deepcopy(clone.negVirtuals)
+
+			self.use_defs = copy.deepcopy(clone.use_defs)
+			self.usemask  = copy.deepcopy(clone.usemask)
+			self.usemask_list = copy.deepcopy(clone.usemask_list)
+			self.pusemask_list = copy.deepcopy(clone.pusemask_list)
+			self.useforce      = copy.deepcopy(clone.useforce)
+			self.useforce_list = copy.deepcopy(clone.useforce_list)
+			self.puseforce_list = copy.deepcopy(clone.puseforce_list)
+			self.puse     = copy.deepcopy(clone.puse)
+			self.make_defaults_use = copy.deepcopy(clone.make_defaults_use)
+			self.pkgprofileuse = copy.deepcopy(clone.pkgprofileuse)
+			self.mycpv    = copy.deepcopy(clone.mycpv)
+
+			self.configlist = copy.deepcopy(clone.configlist)
+			self.lookuplist = self.configlist[:]
+			self.lookuplist.reverse()
+			self.configdict = {
+				"env.d":     self.configlist[0],
+				"pkginternal": self.configlist[1],
+				"globals":     self.configlist[2],
+				"defaults":    self.configlist[3],
+				"conf":        self.configlist[4],
+				"pkg":         self.configlist[5],
+				"auto":        self.configlist[6],
+				"backupenv":   self.configlist[7],
+				"env":         self.configlist[8] }
+			self.profiles = copy.deepcopy(clone.profiles)
+			self.backupenv  = self.configdict["backupenv"]
+			self.pusedict   = copy.deepcopy(clone.pusedict)
+			self.categories = copy.deepcopy(clone.categories)
+			self.pkeywordsdict = copy.deepcopy(clone.pkeywordsdict)
+			self.pmaskdict = copy.deepcopy(clone.pmaskdict)
+			self.punmaskdict = copy.deepcopy(clone.punmaskdict)
+			self.prevmaskdict = copy.deepcopy(clone.prevmaskdict)
+			self.pprovideddict = copy.deepcopy(clone.pprovideddict)
+			self.dirVirtuals = copy.deepcopy(clone.dirVirtuals)
+			self.treeVirtuals = copy.deepcopy(clone.treeVirtuals)
+			self.features = copy.deepcopy(clone.features)
+
+			self._accept_license = copy.deepcopy(clone._accept_license)
+			self._plicensedict = copy.deepcopy(clone._plicensedict)
+		else:
+
+			# backupenv is for calculated incremental variables.
+			self.backupenv = os.environ.copy()
+
+			def check_var_directory(varname, var):
+				if not os.path.isdir(var):
+					writemsg(("!!! Error: %s='%s' is not a directory. " + \
+						"Please correct this.\n") % (varname, var),
+						noiselevel=-1)
+					raise portage.exception.DirectoryNotFound(var)
+
+			if config_root is None:
+				config_root = "/"
+
+			config_root = normalize_path(os.path.abspath(
+				config_root)).rstrip(os.path.sep) + os.path.sep
+
+			check_var_directory("PORTAGE_CONFIGROOT", config_root + EPREFIX)
+
+			self.depcachedir = DEPCACHE_PATH
+
+			if not config_profile_path:
+				config_profile_path = \
+					os.path.join(config_root, PROFILE_PATH.lstrip(os.path.sep))
+				if os.path.isdir(config_profile_path):
+					self.profile_path = config_profile_path
+				else:
+					self.profile_path = None
+			else:
+				self.profile_path = config_profile_path[:]
+
+			if not config_incrementals:
+				writemsg("incrementals not specified to class config\n")
+				self.incrementals = copy.deepcopy(portage.const.INCREMENTALS)
+			else:
+				self.incrementals = copy.deepcopy(config_incrementals)
+
+			self.module_priority    = ["user","default"]
+			self.modules            = {}
+			self.modules["user"] = getconfig(
+				os.path.join(config_root, MODULES_FILE_PATH.lstrip(os.path.sep)))
+			if self.modules["user"] is None:
+				self.modules["user"] = {}
+			self.modules["default"] = {
+				"portdbapi.metadbmodule": "portage.cache.metadata.database",
+				"portdbapi.auxdbmodule":  "portage.cache.flat_hash.database",
+			}
+
+			self.usemask=[]
+			self.configlist=[]
+
+			# back up our incremental variables:
+			self.configdict={}
+			# configlist will contain: [ env.d, globals, defaults, conf, pkg, auto, backupenv, env ]
+			self.configlist.append({})
+			self.configdict["env.d"] = self.configlist[-1]
+
+			self.configlist.append({})
+			self.configdict["pkginternal"] = self.configlist[-1]
+
+			# The symlink might not exist or might not be a symlink.
+			if self.profile_path is None:
+				self.profiles = []
+			else:
+				self.profiles = []
+				def addProfile(currentPath):
+					parentsFile = os.path.join(currentPath, "parent")
+					if os.path.exists(parentsFile):
+						parents = grabfile(parentsFile)
+						if not parents:
+							raise portage.exception.ParseError(
+								"Empty parent file: '%s'" % parents_file)
+						for parentPath in parents:
+							parentPath = normalize_path(os.path.join(
+								currentPath, parentPath))
+							if os.path.exists(parentPath):
+								addProfile(parentPath)
+							else:
+								raise portage.exception.ParseError(
+									"Parent '%s' not found: '%s'" %  \
+									(parentPath, parentsFile))
+					self.profiles.append(currentPath)
+				addProfile(os.path.realpath(self.profile_path))
+			if local_config:
+				custom_prof = os.path.join(
+					config_root, CUSTOM_PROFILE_PATH.lstrip(os.path.sep))
+				if os.path.exists(custom_prof):
+					self.user_profile_dir = custom_prof
+					self.profiles.append(custom_prof)
+				del custom_prof
+
+			self.packages_list = [grabfile_package(os.path.join(x, "packages")) for x in self.profiles]
+			self.packages      = stack_lists(self.packages_list, incremental=1)
+			del self.packages_list
+			#self.packages = grab_stacked("packages", self.profiles, grabfile, incremental_lines=1)
+
+			# revmaskdict
+			self.prevmaskdict={}
+			for x in self.packages:
+				mycatpkg=dep_getkey(x)
+				if not self.prevmaskdict.has_key(mycatpkg):
+					self.prevmaskdict[mycatpkg]=[x]
+				else:
+					self.prevmaskdict[mycatpkg].append(x)
+
+			# get profile-masked use flags -- INCREMENTAL Child over parent
+			self.usemask_list = [grabfile(os.path.join(x, "use.mask")) \
+				for x in self.profiles]
+			self.usemask  = set(stack_lists(
+				self.usemask_list, incremental=True))
+			use_defs_lists = [grabdict(os.path.join(x, "use.defaults")) for x in self.profiles]
+			self.use_defs  = stack_dictlist(use_defs_lists, incremental=True)
+			del use_defs_lists
+
+			self.pusemask_list = []
+			rawpusemask = [grabdict_package(
+				os.path.join(x, "package.use.mask")) \
+				for x in self.profiles]
+			for i in xrange(len(self.profiles)):
+				cpdict = {}
+				for k, v in rawpusemask[i].iteritems():
+					cpdict.setdefault(dep_getkey(k), {})[k] = v
+				self.pusemask_list.append(cpdict)
+			del rawpusemask
+
+			self.pkgprofileuse = []
+			rawprofileuse = [grabdict_package(
+				os.path.join(x, "package.use"), juststrings=True) \
+				for x in self.profiles]
+			for i in xrange(len(self.profiles)):
+				cpdict = {}
+				for k, v in rawprofileuse[i].iteritems():
+					cpdict.setdefault(dep_getkey(k), {})[k] = v
+				self.pkgprofileuse.append(cpdict)
+			del rawprofileuse
+
+			self.useforce_list = [grabfile(os.path.join(x, "use.force")) \
+				for x in self.profiles]
+			self.useforce  = set(stack_lists(
+				self.useforce_list, incremental=True))
+
+			self.puseforce_list = []
+			rawpuseforce = [grabdict_package(
+				os.path.join(x, "package.use.force")) \
+				for x in self.profiles]
+			for i in xrange(len(self.profiles)):
+				cpdict = {}
+				for k, v in rawpuseforce[i].iteritems():
+					cpdict.setdefault(dep_getkey(k), {})[k] = v
+				self.puseforce_list.append(cpdict)
+			del rawpuseforce
+
+			try:
+				self.mygcfg   = getconfig(os.path.join(config_root + EPREFIX, "etc", "make.globals"))
+
+				if self.mygcfg is None:
+					self.mygcfg = {}
+			except SystemExit, e:
+				raise
+			except Exception, e:
+				if debug:
+					raise
+				writemsg("!!! %s\n" % (e), noiselevel=-1)
+				if not isinstance(e, EnvironmentError):
+					writemsg("!!! Incorrect multiline literals can cause " + \
+						"this. Do not use them.\n", noiselevel=-1)
+				sys.exit(1)
+			self.configlist.append(self.mygcfg)
+			self.configdict["globals"]=self.configlist[-1]
+
+			self.make_defaults_use = []
+			self.mygcfg = {}
+			if self.profiles:
+				try:
+					mygcfg_dlists = [getconfig(os.path.join(x, "make.defaults")) for x in self.profiles]
+					for cfg in mygcfg_dlists:
+						if cfg:
+							self.make_defaults_use.append(cfg.get("USE", ""))
+						else:
+							self.make_defaults_use.append("")
+					self.mygcfg   = stack_dicts(mygcfg_dlists, incrementals=portage.const.INCREMENTALS, ignore_none=1)
+					#self.mygcfg = grab_stacked("make.defaults", self.profiles, getconfig)
+					if self.mygcfg is None:
+						self.mygcfg = {}
+				except SystemExit, e:
+					raise
+				except Exception, e:
+					if debug:
+						raise
+					writemsg("!!! %s\n" % (e), noiselevel=-1)
+					if not isinstance(e, EnvironmentError):
+						writemsg("!!! 'rm -Rf %s/usr/portage/profiles; " + \
+							"emerge sync' may fix this. If it does\n" % EPREFIX,
+							noiselevel=-1)
+						writemsg("!!! not then please report this to " + \
+							"bugs.gentoo.org and, if possible, a dev\n",
+								noiselevel=-1)
+						writemsg("!!! on #gentoo (irc.freenode.org)\n",
+							noiselevel=-1)
+					sys.exit(1)
+			self.configlist.append(self.mygcfg)
+			self.configdict["defaults"]=self.configlist[-1]
+
+			try:
+				self.mygcfg = getconfig(
+					os.path.join(config_root, MAKE_CONF_FILE.lstrip(os.path.sep)),
+					allow_sourcing=True)
+				if self.mygcfg is None:
+					self.mygcfg = {}
+			except SystemExit, e:
+				raise
+			except Exception, e:
+				if debug:
+					raise
+				writemsg("!!! %s\n" % (e), noiselevel=-1)
+				if not isinstance(e, EnvironmentError):
+					writemsg("!!! Incorrect multiline literals can cause " + \
+						"this. Do not use them.\n", noiselevel=-1)
+				sys.exit(1)
+
+			# Allow ROOT setting to come from make.conf if it's not overridden
+			# by the constructor argument (from the calling environment).  As a
+			# special exception for a very common use case, config_root == "/"
+			# implies that ROOT in make.conf should be ignored.  That way, the
+			# user can chroot into $ROOT and the ROOT setting in make.conf will
+			# be automatically ignored (unless config_root is other than "/").
+			if config_root != "/" and \
+				target_root is None and "ROOT" in self.mygcfg:
+				target_root = self.mygcfg["ROOT"]
+			
+			self.configlist.append(self.mygcfg)
+			self.configdict["conf"]=self.configlist[-1]
+
+			self.configlist.append({})
+			self.configdict["pkg"]=self.configlist[-1]
+
+			#auto-use:
+			self.configlist.append({})
+			self.configdict["auto"]=self.configlist[-1]
+
+			self.configlist.append(self.backupenv) # XXX Why though?
+			self.configdict["backupenv"]=self.configlist[-1]
+
+			self.configlist.append(os.environ.copy())
+			self.configdict["env"]=self.configlist[-1]
+
+			# make lookuplist for loading package.*
+			self.lookuplist=self.configlist[:]
+			self.lookuplist.reverse()
+
+			# Blacklist vars that could interfere with portage internals.
+			for blacklisted in "CATEGORY", "PKGUSE", "PORTAGE_CONFIGROOT", \
+				"ROOT", "EPREFIX", "EROOT":
+				for cfg in self.lookuplist:
+					cfg.pop(blacklisted, None)
+			del blacklisted, cfg
+
+			if target_root is None:
+				target_root = "/"
+
+			target_root = normalize_path(os.path.abspath(
+				target_root)).rstrip(os.path.sep) + os.path.sep
+
+			check_var_directory("ROOT", target_root + EPREFIX)
+
+			env_d = getconfig(
+				os.path.join(target_root + EPREFIX, "etc", "profile.env"), expand=False)
+			# env_d will be None if profile.env doesn't exist.
+			if env_d:
+				self.configdict["env.d"].update(env_d)
+				# Remove duplicate values so they don't override updated
+				# profile.env values later (profile.env is reloaded in each
+				# call to self.regenerate).
+				for cfg in (self.configdict["backupenv"],
+					self.configdict["env"]):
+					for k, v in env_d.iteritems():
+						try:
+							if cfg[k] == v:
+								del cfg[k]
+						except KeyError:
+							pass
+				del cfg, k, v
+
+			self["PORTAGE_CONFIGROOT"] = config_root
+			self.backup_changes("PORTAGE_CONFIGROOT")
+			self["ROOT"] = target_root
+			self.backup_changes("ROOT")
+			self["EPREFIX"] = EPREFIX
+			self.backup_changes("EPREFIX")
+			self["EROOT"] = normalize_path(target_root + EPREFIX) + os.sep
+			self.backup_changes("EROOT")
+
+			self.pusedict = {}
+			self.pkeywordsdict = {}
+			self._plicensedict = {}
+			self.punmaskdict = {}
+			abs_user_config = os.path.join(config_root,
+				USER_CONFIG_PATH.lstrip(os.path.sep))
+
+			# locations for "categories" and "arch.list" files
+			locations = [os.path.join(self["PORTDIR"], "profiles")]
+			pmask_locations = [os.path.join(self["PORTDIR"], "profiles")]
+			pmask_locations.extend(self.profiles)
+
+			""" repoman controls PORTDIR_OVERLAY via the environment, so no
+			special cases are needed here."""
+			overlay_profiles = []
+			for ov in self["PORTDIR_OVERLAY"].split():
+				ov = normalize_path(ov)
+				profiles_dir = os.path.join(ov, "profiles")
+				if os.path.isdir(profiles_dir):
+					overlay_profiles.append(profiles_dir)
+			locations += overlay_profiles
+			
+			pmask_locations.extend(overlay_profiles)
+
+			if local_config:
+				locations.append(abs_user_config)
+				pmask_locations.append(abs_user_config)
+				pusedict = grabdict_package(
+					os.path.join(abs_user_config, "package.use"), recursive=1)
+				for key in pusedict.keys():
+					cp = dep_getkey(key)
+					if not self.pusedict.has_key(cp):
+						self.pusedict[cp] = {}
+					self.pusedict[cp][key] = pusedict[key]
+
+				#package.keywords
+				pkgdict = grabdict_package(
+					os.path.join(abs_user_config, "package.keywords"),
+					recursive=1)
+				for key in pkgdict.keys():
+					# default to ~arch if no specific keyword is given
+					if not pkgdict[key]:
+						mykeywordlist = []
+						if self.configdict["defaults"] and self.configdict["defaults"].has_key("ACCEPT_KEYWORDS"):
+							groups = self.configdict["defaults"]["ACCEPT_KEYWORDS"].split()
+						else:
+							groups = []
+						for keyword in groups:
+							if not keyword[0] in "~-":
+								mykeywordlist.append("~"+keyword)
+						pkgdict[key] = mykeywordlist
+					cp = dep_getkey(key)
+					if not self.pkeywordsdict.has_key(cp):
+						self.pkeywordsdict[cp] = {}
+					self.pkeywordsdict[cp][key] = pkgdict[key]
+				
+				#package.license
+				licdict = grabdict_package(os.path.join(
+					abs_user_config, "package.license"), recursive=1)
+				for k, v in licdict.iteritems():
+					cp = dep_getkey(k)
+					cp_dict = self._plicensedict.get(cp)
+					if not cp_dict:
+						cp_dict = {}
+						self._plicensedict[cp] = cp_dict
+					cp_dict[k] = self.expandLicenseTokens(v)
+
+				#package.unmask
+				pkgunmasklines = grabfile_package(
+					os.path.join(abs_user_config, "package.unmask"),
+					recursive=1)
+				for x in pkgunmasklines:
+					mycatpkg=dep_getkey(x)
+					if self.punmaskdict.has_key(mycatpkg):
+						self.punmaskdict[mycatpkg].append(x)
+					else:
+						self.punmaskdict[mycatpkg]=[x]
+
+			#getting categories from an external file now
+			categories = [grabfile(os.path.join(x, "categories")) for x in locations]
+			self.categories = stack_lists(categories, incremental=1)
+			del categories
+
+			archlist = [grabfile(os.path.join(x, "arch.list")) for x in locations]
+			archlist = stack_lists(archlist, incremental=1)
+			self.configdict["conf"]["PORTAGE_ARCHLIST"] = " ".join(archlist)
+
+			#package.mask
+			pkgmasklines = []
+			for x in pmask_locations:
+				pkgmasklines.append(grabfile_package(
+					os.path.join(x, "package.mask"), recursive=1))
+			pkgmasklines = stack_lists(pkgmasklines, incremental=1)
+
+			self.pmaskdict = {}
+			for x in pkgmasklines:
+				mycatpkg=dep_getkey(x)
+				if self.pmaskdict.has_key(mycatpkg):
+					self.pmaskdict[mycatpkg].append(x)
+				else:
+					self.pmaskdict[mycatpkg]=[x]
+
+			pkgprovidedlines = [grabfile(os.path.join(x, "package.provided")) for x in self.profiles]
+			pkgprovidedlines = stack_lists(pkgprovidedlines, incremental=1)
+			has_invalid_data = False
+			for x in range(len(pkgprovidedlines)-1, -1, -1):
+				myline = pkgprovidedlines[x]
+				if not isvalidatom("=" + myline):
+					writemsg("Invalid package name in package.provided:" + \
+						" %s\n" % myline, noiselevel=-1)
+					has_invalid_data = True
+					del pkgprovidedlines[x]
+					continue
+				cpvr = catpkgsplit(pkgprovidedlines[x])
+				if not cpvr or cpvr[0] == "null":
+					writemsg("Invalid package name in package.provided: "+pkgprovidedlines[x]+"\n",
+						noiselevel=-1)
+					has_invalid_data = True
+					del pkgprovidedlines[x]
+					continue
+				if cpvr[0] == "virtual":
+					writemsg("Virtual package in package.provided: %s\n" % \
+						myline, noiselevel=-1)
+					has_invalid_data = True
+					del pkgprovidedlines[x]
+					continue
+			if has_invalid_data:
+				writemsg("See portage(5) for correct package.provided usage.\n",
+					noiselevel=-1)
+			self.pprovideddict = {}
+			for x in pkgprovidedlines:
+				cpv=catpkgsplit(x)
+				if not x:
+					continue
+				mycatpkg=dep_getkey(x)
+				if self.pprovideddict.has_key(mycatpkg):
+					self.pprovideddict[mycatpkg].append(x)
+				else:
+					self.pprovideddict[mycatpkg]=[x]
+
+			# parse licensegroups
+			self._license_groups = {}
+			for x in locations:
+				self._license_groups.update(
+					grabdict(os.path.join(x, "license_groups")))
+
+			# reasonable defaults; this is important as without USE_ORDER,
+			# USE will always be "" (nothing set)!
+			if "USE_ORDER" not in self:
+				self.backupenv["USE_ORDER"] = "env:pkg:conf:defaults:pkginternal"
+
+			self["PORTAGE_GID"] = str(portage_gid)
+			self.backup_changes("PORTAGE_GID")
+
+			if self.get("PORTAGE_DEPCACHEDIR", None):
+				self.depcachedir = self["PORTAGE_DEPCACHEDIR"]
+			self["PORTAGE_DEPCACHEDIR"] = self.depcachedir
+			self.backup_changes("PORTAGE_DEPCACHEDIR")
+
+			overlays = self.get("PORTDIR_OVERLAY","").split()
+			if overlays:
+				new_ov = []
+				for ov in overlays:
+					ov = normalize_path(ov)
+					if os.path.isdir(ov):
+						new_ov.append(ov)
+					else:
+						writemsg("!!! Invalid PORTDIR_OVERLAY" + \
+							" (not a dir): '%s'\n" % ov, noiselevel=-1)
+				self["PORTDIR_OVERLAY"] = " ".join(new_ov)
+				self.backup_changes("PORTDIR_OVERLAY")
+
+			if "CBUILD" not in self and "CHOST" in self:
+				self["CBUILD"] = self["CHOST"]
+				self.backup_changes("CBUILD")
+
+			self["PORTAGE_BIN_PATH"] = PORTAGE_BIN_PATH
+			self.backup_changes("PORTAGE_BIN_PATH")
+			self["PORTAGE_PYM_PATH"] = PORTAGE_PYM_PATH
+			self.backup_changes("PORTAGE_PYM_PATH")
+
+			# Expand license groups
+			# This has to do be done for each config layer before regenerate()
+			# in order for incremental negation to work properly.
+			if local_config:
+				for c in self.configdict.itervalues():
+					v = c.get("ACCEPT_LICENSE")
+					if not v:
+						continue
+					v = " ".join(self.expandLicenseTokens(v.split()))
+					c["ACCEPT_LICENSE"] = v
+					del c, v
+
+			for var in ("PORTAGE_INST_UID", "PORTAGE_INST_GID"):
+				try:
+					self[var] = str(int(self.get(var, "0")))
+				except ValueError:
+					writemsg(("!!! %s='%s' is not a valid integer.  " + \
+						"Falling back to '0'.\n") % (var, self[var]),
+						noiselevel=-1)
+					self[var] = "0"
+				self.backup_changes(var)
+
+			self.regenerate()
+			self.features = portage.util.unique_array(self["FEATURES"].split())
+
+			if local_config:
+				self._accept_license = \
+					set(self.get("ACCEPT_LICENSE", "").split())
+				# In order to enforce explicit acceptance for restrictive
+				# licenses that require it, "*" will not be allowed in the
+				# user config.  Don't enforce this until license groups are
+				# fully implemented in the tree.
+				#self._accept_license.discard("*")
+				if not self._accept_license:
+					self._accept_license = set(["*"])
+			else:
+				# repoman will accept any license
+				self._accept_license = set(["*"])
+
+			if "gpg" in self.features:
+				if not os.path.exists(self["PORTAGE_GPG_DIR"]) or \
+					not os.path.isdir(self["PORTAGE_GPG_DIR"]):
+					writemsg(colorize("BAD", "PORTAGE_GPG_DIR is invalid." + \
+						" Removing gpg from FEATURES.\n"), noiselevel=-1)
+					self.features.remove("gpg")
+
+			if not portage.process.sandbox_capable and \
+				("sandbox" in self.features or "usersandbox" in self.features):
+				if self.profile_path is not None and \
+					os.path.realpath(self.profile_path) == \
+					os.path.realpath(PROFILE_PATH):
+					""" Don't show this warning when running repoman and the
+					sandbox feature came from a profile that doesn't belong to
+					the user."""
+					writemsg(colorize("BAD", "!!! Problem with sandbox" + \
+						" binary. Disabling...\n\n"), noiselevel=-1)
+				if "sandbox" in self.features:
+					self.features.remove("sandbox")
+				if "usersandbox" in self.features:
+					self.features.remove("usersandbox")
+
+			self.features.sort()
+			self["FEATURES"] = " ".join(self.features)
+			self.backup_changes("FEATURES")
+
+			# inject EPREFIX as it's in no single config file (I hope),
+			# but needs to be available using portageq
+			self["EPREFIX"] = EPREFIX
+
+			self._init_dirs()
+
+		if mycpv:
+			self.setcpv(mycpv)
+
+	def _init_dirs(self):
+		"""
+		Create a few directories that are critical to portage operation
+		"""
+		if not os.access(self["ROOT"] + EPREFIX, os.W_OK):
+			return
+
+		dir_mode_map = {
+			"tmp"             :(-1,          01777, 0),
+			"var/tmp"         :(-1,          01777, 0),
+			"var/lib/portage" :(portage_gid, 02750, 02),
+			"var/cache/edb"   :(portage_gid,  0755, 02)
+		}
+
+		for mypath, (gid, mode, modemask) in dir_mode_map.iteritems():
+			try:
+				mydir = normalize_path(os.path.join(self["ROOT"] + EPREFIX, mypath))
+				portage.util.ensure_dirs(mydir, gid=gid, mode=mode, mask=modemask)
+			except portage.exception.PortageException, e:
+				writemsg("!!! Directory initialization failed: '%s'\n" % mydir,
+					noiselevel=-1)
+				writemsg("!!! %s\n" % str(e),
+					noiselevel=-1)
+
+	def expandLicenseTokens(self, tokens):
+		""" Take a token from ACCEPT_LICENSE or package.license and expand it
+		if it's a group token (indicated by @) or just return it if it's not a
+		group.  If a group is negated then negate all group elements."""
+		expanded_tokens = []
+		for x in tokens:
+			expanded_tokens.extend(self._expandLicenseToken(x, None))
+		return expanded_tokens
+
+	def _expandLicenseToken(self, token, traversed_groups):
+		negate = False
+		rValue = []
+		if token.startswith("-"):
+			negate = True
+			license_name = token[1:]
+		else:
+			license_name = token
+		if not license_name.startswith("@"):
+			rValue.append(token)
+			return rValue
+		group_name = license_name[1:]
+		if not traversed_groups:
+			traversed_groups = set()
+		license_group = self._license_groups.get(group_name)
+		if group_name in traversed_groups:
+			writemsg(("Circular license group reference" + \
+				" detected in '%s'\n") % group_name, noiselevel=-1)
+			rValue.append("@"+group_name)
+		elif license_group:
+			traversed_groups.add(group_name)
+			for l in license_group:
+				if l.startswith("-"):
+					writemsg(("Skipping invalid element %s" + \
+						" in license group '%s'\n") % (l, group_name),
+						noiselevel=-1)
+				else:
+					rValue.extend(self._expandLicenseToken(l, traversed_groups))
+		else:
+			writemsg("Undefined license group '%s'\n" % group_name,
+				noiselevel=-1)
+			rValue.append("@"+group_name)
+		if negate:
+			rValue = ["-" + token for token in rValue]
+		return rValue
+
+	def validate(self):
+		"""Validate miscellaneous settings and display warnings if necessary.
+		(This code was previously in the global scope of portage.py)"""
+
+		groups = self["ACCEPT_KEYWORDS"].split()
+		archlist = self.archlist()
+		if not archlist:
+			writemsg("--- 'profiles/arch.list' is empty or not available. Empty portage tree?\n")
+		else:
+			for group in groups:
+				if group not in archlist and group[0] != '-':
+					writemsg("!!! INVALID ACCEPT_KEYWORDS: %s\n" % str(group),
+						noiselevel=-1)
+
+		abs_profile_path = os.path.join(self["PORTAGE_CONFIGROOT"],
+			PROFILE_PATH.lstrip(os.path.sep))
+		if not os.path.islink(abs_profile_path) and \
+			not os.path.exists(os.path.join(abs_profile_path, "parent")) and \
+			os.path.exists(os.path.join(self["PORTDIR"], "profiles")):
+			writemsg("\a\n\n!!! %s is not a symlink and will probably prevent most merges.\n" % abs_profile_path,
+				noiselevel=-1)
+			writemsg("!!! It should point into a profile within %s/profiles/\n" % self["PORTDIR"])
+			writemsg("!!! (You can safely ignore this message when syncing. It's harmless.)\n\n\n")
+
+		abs_user_virtuals = os.path.join(self["PORTAGE_CONFIGROOT"],
+			USER_VIRTUALS_FILE.lstrip(os.path.sep))
+		if os.path.exists(abs_user_virtuals):
+			writemsg("\n!!! /etc/portage/virtuals is deprecated in favor of\n")
+			writemsg("!!! /etc/portage/profile/virtuals. Please move it to\n")
+			writemsg("!!! this new location.\n\n")
+
+	def loadVirtuals(self,root):
+		"""Not currently used by portage."""
+		writemsg("DEPRECATED: portage.config.loadVirtuals\n")
+		self.getvirtuals(root)
+
+	def load_best_module(self,property_string):
+		best_mod = best_from_dict(property_string,self.modules,self.module_priority)
+		mod = None
+		try:
+			mod = load_mod(best_mod)
+		except ImportError:
+			if best_mod.startswith("cache."):
+				best_mod = "portage." + best_mod
+				try:
+					mod = load_mod(best_mod)
+				except ImportError:
+					pass
+		if mod is None:
+			raise
+		return mod
+
+	def lock(self):
+		self.locked = 1
+
+	def unlock(self):
+		self.locked = 0
+
+	def modifying(self):
+		if self.locked:
+			raise Exception, "Configuration is locked."
+
+	def backup_changes(self,key=None):
+		self.modifying()
+		if key and self.configdict["env"].has_key(key):
+			self.backupenv[key] = copy.deepcopy(self.configdict["env"][key])
+		else:
+			raise KeyError, "No such key defined in environment: %s" % key
+
+	def reset(self,keeping_pkg=0,use_cache=1):
+		"""
+		Restore environment from self.backupenv, call self.regenerate()
+		@param keeping_pkg: Should we keep the set_cpv() data or delete it.
+		@type keeping_pkg: Boolean
+		@param use_cache: Should self.regenerate use the cache or not
+		@type use_cache: Boolean
+		@rype: None
+		"""
+		self.modifying()
+		self.configdict["env"].clear()
+		self.configdict["env"].update(self.backupenv)
+
+		self.modifiedkeys = []
+		if not keeping_pkg:
+			self.mycpv = None
+			self.puse = ""
+			self.configdict["pkg"].clear()
+			self.configdict["pkginternal"].clear()
+			self.configdict["defaults"]["USE"] = \
+				" ".join(self.make_defaults_use)
+			self.usemask  = set(stack_lists(
+				self.usemask_list, incremental=True))
+			self.useforce  = set(stack_lists(
+				self.useforce_list, incremental=True))
+		self.regenerate(use_cache=use_cache)
+
+	def load_infodir(self,infodir):
+		self.modifying()
+		if self.configdict.has_key("pkg"):
+			for x in self.configdict["pkg"].keys():
+				del self.configdict["pkg"][x]
+		else:
+			writemsg("No pkg setup for settings instance?\n",
+				noiselevel=-1)
+			sys.exit(17)
+
+		if os.path.exists(infodir):
+			if os.path.exists(infodir+"/environment"):
+				self.configdict["pkg"]["PORT_ENV_FILE"] = infodir+"/environment"
+
+			myre = re.compile('^[A-Z]+$')
+			null_byte = "\0"
+			for filename in listdir(infodir,filesonly=1,EmptyOnError=1):
+				if filename == "FEATURES":
+					# FEATURES from the build host shouldn't be interpreted as
+					# FEATURES on the client system.
+					continue
+				if myre.match(filename):
+					try:
+						file_path = os.path.join(infodir, filename)
+						mydata = open(file_path).read().strip()
+						if len(mydata) < 2048 or filename == "USE":
+							if null_byte in mydata:
+								writemsg("!!! Null byte found in metadata " + \
+									"file: '%s'\n" % file_path, noiselevel=-1)
+								continue
+							if filename == "USE":
+								binpkg_flags = "-* " + mydata
+								self.configdict["pkg"][filename] = binpkg_flags
+								self.configdict["env"][filename] = mydata
+							else:
+								self.configdict["pkg"][filename] = mydata
+								self.configdict["env"][filename] = mydata
+						# CATEGORY is important because it's used in doebuild
+						# to infer the cpv.  If it's corrupted, it leads to
+						# strange errors later on, so we'll validate it and
+						# print a warning if necessary.
+						if filename == "CATEGORY":
+							matchobj = re.match("[-a-zA-Z0-9_.+]+", mydata)
+							if not matchobj or matchobj.start() != 0 or \
+								matchobj.end() != len(mydata):
+								writemsg("!!! CATEGORY file is corrupt: %s\n" % \
+									os.path.join(infodir, filename), noiselevel=-1)
+					except (OSError, IOError):
+						writemsg("!!! Unable to read file: %s\n" % infodir+"/"+filename,
+							noiselevel=-1)
+						pass
+			return 1
+		return 0
+
+	def setcpv(self, mycpv, use_cache=1, mydb=None):
+		"""
+		Load a particular CPV into the config, this lets us see the
+		Default USE flags for a particular ebuild as well as the USE
+		flags from package.use.
+
+		@param mycpv: A cpv to load
+		@type mycpv: string
+		@param use_cache: Enables caching
+		@type use_cache: Boolean
+		@param mydb: a dbapi instance that supports aux_get with the IUSE key.
+		@type mydb: dbapi or derivative.
+		@rtype: None
+		"""
+
+		self.modifying()
+		if self.mycpv == mycpv:
+			return
+		has_changed = False
+		self.mycpv = mycpv
+		cp = dep_getkey(mycpv)
+		cpv_slot = self.mycpv
+		pkginternaluse = ""
+		iuse = ""
+		if mydb:
+			slot, iuse = mydb.aux_get(self.mycpv, ["SLOT", "IUSE"])
+			cpv_slot = "%s:%s" % (self.mycpv, slot)
+			pkginternaluse = []
+			for x in iuse.split():
+				if x.startswith("+"):
+					pkginternaluse.append(x[1:])
+				elif x.startswith("-"):
+					pkginternaluse.append(x)
+			pkginternaluse = " ".join(pkginternaluse)
+		if pkginternaluse != self.configdict["pkginternal"].get("USE", ""):
+			self.configdict["pkginternal"]["USE"] = pkginternaluse
+			has_changed = True
+		defaults = []
+		for i in xrange(len(self.profiles)):
+			defaults.append(self.make_defaults_use[i])
+			cpdict = self.pkgprofileuse[i].get(cp, None)
+			if cpdict:
+				best_match = best_match_to_list(cpv_slot, cpdict.keys())
+				if best_match:
+					defaults.append(cpdict[best_match])
+		defaults = " ".join(defaults)
+		if defaults != self.configdict["defaults"].get("USE",""):
+			self.configdict["defaults"]["USE"] = defaults
+			has_changed = True
+		useforce = []
+		for i in xrange(len(self.profiles)):
+			useforce.append(self.useforce_list[i])
+			cpdict = self.puseforce_list[i].get(cp, None)
+			if cpdict:
+				best_match = best_match_to_list(cpv_slot, cpdict.keys())
+				if best_match:
+					useforce.append(cpdict[best_match])
+		useforce = set(stack_lists(useforce, incremental=True))
+		if useforce != self.useforce:
+			self.useforce = useforce
+			has_changed = True
+		usemask = []
+		for i in xrange(len(self.profiles)):
+			usemask.append(self.usemask_list[i])
+			cpdict = self.pusemask_list[i].get(cp, None)
+			if cpdict:
+				best_match = best_match_to_list(cpv_slot, cpdict.keys())
+				if best_match:
+					usemask.append(cpdict[best_match])
+		usemask = set(stack_lists(usemask, incremental=True))
+		if usemask != self.usemask:
+			self.usemask = usemask
+			has_changed = True
+		oldpuse = self.puse
+		self.puse = ""
+		cpdict = self.pusedict.get(cp)
+		if cpdict:
+			self.pusekey = best_match_to_list(cpv_slot, cpdict.keys())
+			if self.pusekey:
+				self.puse = " ".join(cpdict[self.pusekey])
+		if oldpuse != self.puse:
+			has_changed = True
+		self.configdict["pkg"]["PKGUSE"] = self.puse[:] # For saving to PUSE file
+		self.configdict["pkg"]["USE"]    = self.puse[:] # this gets appended to USE
+		if iuse != self.configdict["pkg"].get("IUSE",""):
+			self.configdict["pkg"]["IUSE"] = iuse
+			has_changed = True
+		# CATEGORY is essential for doebuild calls
+		self.configdict["pkg"]["CATEGORY"] = mycpv.split("/")[0]
+		if has_changed:
+			self.reset(keeping_pkg=1,use_cache=use_cache)
+
+	def getMissingLicenses(self, licenses, cpv, uselist):
+		"""
+		Take a LICENSE string and return a list any licenses that the user may
+		may need to accept for the given package.  The returned list will not
+		contain any licenses that have already been accepted.  This method
+		can throw an InvalidDependString exception.
+
+		@param licenses: A raw LICENSE string as returned form dbapi.aux_get()
+		@type licenses: String
+		@param cpv: The package name (for package.license support)
+		@type cpv: String
+		@param uselist: A list of flags for evaluation of USE conditionals
+		@type uselist: List
+		@rtype: List
+		@return: A list of licenses that have not been accepted.
+		"""
+		if "*" in self._accept_license:
+			return []
+		acceptable_licenses = self._accept_license
+		cpdict = self._plicensedict.get(dep_getkey(cpv), None)
+		if cpdict:
+			acceptable_licenses = self._accept_license.copy()
+			for atom in match_to_list(cpv, cpdict.keys()):
+				acceptable_licenses.update(cpdict[atom])
+		license_struct = portage.dep.paren_reduce(licenses)
+		license_struct = portage.dep.use_reduce(
+			license_struct, uselist=uselist)
+		license_struct = portage.dep.dep_opconvert(license_struct)
+		return self._getMissingLicenses(license_struct, acceptable_licenses)
+
+	def _getMissingLicenses(self, license_struct, acceptable_licenses):
+		if not license_struct:
+			return []
+		if license_struct[0] == "||":
+			ret = []
+			for element in license_struct[1:]:
+				if isinstance(element, list):
+					if element:
+						ret.append(self._getMissingLicenses(
+							element, acceptable_licenses))
+						if not ret[-1]:
+							return []
+				else:
+					if element in acceptable_licenses:
+						return []
+					ret.append(element)
+			# Return all masked licenses, since we don't know which combination
+			# (if any) the user will decide to unmask.
+			return flatten(ret)
+
+		ret = []
+		for element in license_struct:
+			if isinstance(element, list):
+				if element:
+					ret.extend(self._getMissingLicenses(element,
+						acceptable_licenses))
+			else:
+				if element not in acceptable_licenses:
+					ret.append(element)
+		return ret
+
+	def setinst(self,mycpv,mydbapi):
+		self.modifying()
+		if len(self.virtuals) == 0:
+			self.getvirtuals()
+		# Grab the virtuals this package provides and add them into the tree virtuals.
+		provides = mydbapi.aux_get(mycpv, ["PROVIDE"])[0]
+		if isinstance(mydbapi, portdbapi):
+			myuse = self["USE"]
+		else:
+			myuse = mydbapi.aux_get(mycpv, ["USE"])[0]
+		virts = flatten(portage.dep.use_reduce(portage.dep.paren_reduce(provides), uselist=myuse.split()))
+
+		cp = dep_getkey(mycpv)
+		for virt in virts:
+			virt = dep_getkey(virt)
+			if not self.treeVirtuals.has_key(virt):
+				self.treeVirtuals[virt] = []
+			# XXX: Is this bad? -- It's a permanent modification
+			if cp not in self.treeVirtuals[virt]:
+				self.treeVirtuals[virt].append(cp)
+
+		self.virtuals = self.__getvirtuals_compile()
+
+
+	def regenerate(self,useonly=0,use_cache=1):
+		"""
+		Regenerate settings
+		This involves regenerating valid USE flags, re-expanding USE_EXPAND flags
+		re-stacking USE flags (-flag and -*), as well as any other INCREMENTAL
+		variables.  This also updates the env.d configdict; useful in case an ebuild
+		changes the environment.
+
+		If FEATURES has already stacked, it is not stacked twice.
+
+		@param useonly: Only regenerate USE flags (not any other incrementals)
+		@type useonly: Boolean
+		@param use_cache: Enable Caching (only for autouse)
+		@type use_cache: Boolean
+		@rtype: None
+		"""
+
+		self.modifying()
+		if self.already_in_regenerate:
+			# XXX: THIS REALLY NEEDS TO GET FIXED. autouse() loops.
+			writemsg("!!! Looping in regenerate.\n",1)
+			return
+		else:
+			self.already_in_regenerate = 1
+
+		# We grab the latest profile.env here since it changes frequently.
+		self.configdict["env.d"].clear()
+		env_d = getconfig(
+			os.path.join(self["ROOT"] + EPREFIX, "etc", "profile.env"), expand=False)
+		if env_d:
+			# env_d will be None if profile.env doesn't exist.
+			self.configdict["env.d"].update(env_d)
+
+		if useonly:
+			myincrementals=["USE"]
+		else:
+			myincrementals = self.incrementals
+		myincrementals = set(myincrementals)
+		# If self.features exists, it has already been stacked and may have
+		# been mutated, so don't stack it again or else any mutations will be
+		# reverted.
+		if "FEATURES" in myincrementals and hasattr(self, "features"):
+			myincrementals.remove("FEATURES")
+
+		if "USE" in myincrementals:
+			# Process USE last because it depends on USE_EXPAND which is also
+			# an incremental!
+			myincrementals.remove("USE")
+
+		for mykey in myincrementals:
+
+			mydbs=self.configlist[:-1]
+
+			myflags=[]
+			for curdb in mydbs:
+				if mykey not in curdb:
+					continue
+				#variables are already expanded
+				mysplit = curdb[mykey].split()
+
+				for x in mysplit:
+					if x=="-*":
+						# "-*" is a special "minus" var that means "unset all settings".
+						# so USE="-* gnome" will have *just* gnome enabled.
+						myflags = []
+						continue
+
+					if x[0]=="+":
+						# Not legal. People assume too much. Complain.
+						writemsg(red("USE flags should not start with a '+': %s\n" % x),
+							noiselevel=-1)
+						x=x[1:]
+						if not x:
+							continue
+
+					if (x[0]=="-"):
+						if (x[1:] in myflags):
+							# Unset/Remove it.
+							del myflags[myflags.index(x[1:])]
+						continue
+
+					# We got here, so add it now.
+					if x not in myflags:
+						myflags.append(x)
+
+			myflags.sort()
+			#store setting in last element of configlist, the original environment:
+			if myflags or mykey in self:
+				self.configlist[-1][mykey] = " ".join(myflags)
+			del myflags
+
+		# Do the USE calculation last because it depends on USE_EXPAND.
+		if "auto" in self["USE_ORDER"].split(":"):
+			self.configdict["auto"]["USE"] = autouse(
+				vartree(root=self["ROOT"], categories=self.categories,
+					settings=self),
+				use_cache=use_cache, mysettings=self)
+		else:
+			self.configdict["auto"]["USE"] = ""
+
+		use_expand = self.get("USE_EXPAND", "").split()
+
+		if not self.uvlist:
+			for x in self["USE_ORDER"].split(":"):
+				if x in self.configdict:
+					self.uvlist.append(self.configdict[x])
+			self.uvlist.reverse()
+
+		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()
+			if not mysplit and not cur_use_expand:
+				continue
+			for x in mysplit:
+				if x == "-*":
+					myflags.clear()
+					continue
+
+				if x[0] == "+":
+					writemsg(colorize("BAD", "USE flags should not start " + \
+						"with a '+': %s\n" % x), noiselevel=-1)
+					x = x[1:]
+					if not x:
+						continue
+
+				if x[0] == "-":
+					myflags.discard(x[1:])
+					continue
+
+				myflags.add(x)
+
+			for var in cur_use_expand:
+				var_lower = var.lower()
+				is_not_incremental = var not in myincrementals
+				if is_not_incremental:
+					prefix = var_lower + "_"
+					for x in list(myflags):
+						if x.startswith(prefix):
+							myflags.remove(x)
+				for x in curdb[var].split():
+					if x[0] == "+":
+						if is_not_incremental:
+							writemsg(colorize("BAD", "Invalid '+' " + \
+								"operator in non-incremental variable " + \
+								 "'%s': '%s'\n" % (var, x)), noiselevel=-1)
+							continue
+						else:
+							writemsg(colorize("BAD", "Invalid '+' " + \
+								"operator in incremental variable " + \
+								 "'%s': '%s'\n" % (var, x)), noiselevel=-1)
+						x = x[1:]
+					if x[0] == "-":
+						if is_not_incremental:
+							writemsg(colorize("BAD", "Invalid '-' " + \
+								"operator in non-incremental variable " + \
+								 "'%s': '%s'\n" % (var, x)), noiselevel=-1)
+							continue
+						myflags.discard(var_lower + "_" + x[1:])
+						continue
+					myflags.add(var_lower + "_" + x)
+
+		myflags.update(self.useforce)
+
+		# FEATURES=test should imply USE=test
+		if "test" in self.configlist[-1].get("FEATURES","").split():
+			myflags.add("test")
+			if self.get("EBUILD_FORCE_TEST") == "1":
+				self.usemask.discard("test")
+
+		usesplit = [ x for x in myflags if \
+			x not in self.usemask]
+
+		# Use the calculated USE flags to regenerate the USE_EXPAND flags so
+		# that they are consistent.
+		iuse = self.configdict["pkg"].get("IUSE","").split()
+		iuse = [ x.lstrip("+-") for x in iuse ]
+		for var in use_expand:
+			prefix = var.lower() + "_"
+			prefix_len = len(prefix)
+			expand_flags = set([ x[prefix_len:] for x in usesplit \
+				if x.startswith(prefix) ])
+			var_split = self.get(var, "").split()
+			# Preserve the order of var_split because it can matter for things
+			# like LINGUAS.
+			var_split = [ x for x in var_split if x in expand_flags ]
+			var_split.extend(expand_flags.difference(var_split))
+			if (var_split or var in self) and \
+				"*" not in var_split:
+				# Don't export empty USE_EXPAND vars unless the user config
+				# exports them as empty.  This is required for vars such as
+				# LINGUAS, where unset and empty have different meanings.
+				self[var] = " ".join(var_split)
+			elif "*" in var_split:
+				# * means to enable everything in IUSE that's not masked
+				filtered_split = []
+				for x in var_split:
+					if x == "*":
+						continue
+					if (prefix + x) in iuse:
+						filtered_split.append(x)
+				var_split = filtered_split
+				for x in iuse:
+					if x.startswith(prefix) and x not in self.usemask:
+						suffix = x[prefix_len:]
+						if suffix in var_split:
+							continue
+						var_split.append(suffix)
+						usesplit.append(x)
+				if var_split:
+					self[var] = " ".join(var_split)
+				elif var in self:
+					# ebuild.sh will see this and unset the variable so
+					# that things like LINGUAS work properly
+					self[var] = "*"
+
+		# Pre-Pend ARCH variable to USE settings so '-*' in env doesn't kill arch.
+		if self.configdict["defaults"].has_key("ARCH"):
+			if self.configdict["defaults"]["ARCH"]:
+				if self.configdict["defaults"]["ARCH"] not in usesplit:
+					usesplit.insert(0,self.configdict["defaults"]["ARCH"])
+
+		usesplit.sort()
+		self.configlist[-1]["USE"]= " ".join(usesplit)
+
+		self.already_in_regenerate = 0
+
+	def get_virts_p(self, myroot):
+		if self.virts_p:
+			return self.virts_p
+		virts = self.getvirtuals(myroot)
+		if virts:
+			myvkeys = virts.keys()
+			for x in myvkeys:
+				vkeysplit = x.split("/")
+				if not self.virts_p.has_key(vkeysplit[1]):
+					self.virts_p[vkeysplit[1]] = virts[x]
+		return self.virts_p
+
+	def getvirtuals(self, myroot=None):
+		"""myroot is now ignored because, due to caching, it has always been
+		broken for all but the first call."""
+		myroot = self["ROOT"]
+		if self.virtuals:
+			return self.virtuals
+
+		virtuals_list = []
+		for x in self.profiles:
+			virtuals_file = os.path.join(x, "virtuals")
+			virtuals_dict = grabdict(virtuals_file)
+			for k in virtuals_dict.keys():
+				if not isvalidatom(k) or dep_getkey(k) != k:
+					writemsg("--- Invalid virtuals atom in %s: %s\n" % \
+						(virtuals_file, k), noiselevel=-1)
+					del virtuals_dict[k]
+					continue
+				myvalues = virtuals_dict[k]
+				for x in myvalues:
+					myatom = x
+					if x.startswith("-"):
+						# allow incrementals
+						myatom = x[1:]
+					if not isvalidatom(myatom):
+						writemsg("--- Invalid atom in %s: %s\n" % \
+							(virtuals_file, x), noiselevel=-1)
+						myvalues.remove(x)
+				if not myvalues:
+					del virtuals_dict[k]
+			if virtuals_dict:
+				virtuals_list.append(virtuals_dict)
+
+		self.dirVirtuals = stack_dictlist(virtuals_list, incremental=True)
+		del virtuals_list
+
+		for virt in self.dirVirtuals:
+			# Preference for virtuals decreases from left to right.
+			self.dirVirtuals[virt].reverse()
+
+		# Repoman does not use user or tree virtuals.
+		if self.local_config and not self.treeVirtuals:
+			temp_vartree = vartree(myroot, None,
+				categories=self.categories, settings=self)
+			# Reduce the provides into a list by CP.
+			self.treeVirtuals = map_dictlist_vals(getCPFromCPV,temp_vartree.get_all_provides())
+
+		self.virtuals = self.__getvirtuals_compile()
+		return self.virtuals
+
+	def __getvirtuals_compile(self):
+		"""Stack installed and profile virtuals.  Preference for virtuals
+		decreases from left to right.
+		Order of preference:
+		1. installed and in profile
+		2. installed only
+		3. profile only
+		"""
+
+		# Virtuals by profile+tree preferences.
+		ptVirtuals   = {}
+
+		for virt, installed_list in self.treeVirtuals.iteritems():
+			profile_list = self.dirVirtuals.get(virt, None)
+			if not profile_list:
+				continue
+			for cp in installed_list:
+				if cp in profile_list:
+					ptVirtuals.setdefault(virt, [])
+					ptVirtuals[virt].append(cp)
+
+		virtuals = stack_dictlist([ptVirtuals, self.treeVirtuals,
+			self.dirVirtuals])
+		return virtuals
+
+	def __delitem__(self,mykey):
+		self.modifying()
+		for x in self.lookuplist:
+			if x != None:
+				if mykey in x:
+					del x[mykey]
+
+	def __getitem__(self,mykey):
+		match = ''
+		for x in self.lookuplist:
+			if x is None:
+				writemsg("!!! lookuplist is null.\n")
+			elif x.has_key(mykey):
+				match = x[mykey]
+				break
+		return match
+
+	def has_key(self,mykey):
+		for x in self.lookuplist:
+			if x.has_key(mykey):
+				return 1
+		return 0
+
+	def __contains__(self, mykey):
+		"""Called to implement membership test operators (in and not in)."""
+		return bool(self.has_key(mykey))
+
+	def setdefault(self, k, x=None):
+		if k in self:
+			return self[k]
+		else:
+			self[k] = x
+			return x
+
+	def get(self, k, x=None):
+		if k in self:
+			return self[k]
+		else:
+			return x
+
+	def keys(self):
+		return unique_array(flatten([x.keys() for x in self.lookuplist]))
+
+	def __setitem__(self,mykey,myvalue):
+		"set a value; will be thrown away at reset() time"
+		if not isinstance(myvalue, str):
+			raise ValueError("Invalid type being used as a value: '%s': '%s'" % (str(mykey),str(myvalue)))
+		self.modifying()
+		self.modifiedkeys += [mykey]
+		self.configdict["env"][mykey]=myvalue
+
+	def environ(self):
+		"return our locally-maintained environment"
+		mydict={}
+		for x in self.keys():
+			myvalue = self[x]
+			if not isinstance(myvalue, basestring):
+				writemsg("!!! Non-string value in config: %s=%s\n" % \
+					(x, myvalue), noiselevel=-1)
+				continue
+			mydict[x] = myvalue
+		if not mydict.has_key("HOME") and mydict.has_key("BUILD_PREFIX"):
+			writemsg("*** HOME not set. Setting to "+mydict["BUILD_PREFIX"]+"\n")
+			mydict["HOME"]=mydict["BUILD_PREFIX"][:]
+
+		return mydict
+
+	def thirdpartymirrors(self):
+		if getattr(self, "_thirdpartymirrors", None) is None:
+			profileroots = [os.path.join(self["PORTDIR"], "profiles")]
+			for x in self["PORTDIR_OVERLAY"].split():
+				profileroots.insert(0, os.path.join(x, "profiles"))
+			thirdparty_lists = [grabdict(os.path.join(x, "thirdpartymirrors")) for x in profileroots]
+			self._thirdpartymirrors = stack_dictlist(thirdparty_lists, incremental=True)
+		return self._thirdpartymirrors
+
+	def archlist(self):
+		return flatten([[myarch, "~" + myarch] \
+			for myarch in self["PORTAGE_ARCHLIST"].split()])
+
+	def selinux_enabled(self):
+		if getattr(self, "_selinux_enabled", None) is None:
+			self._selinux_enabled = 0
+			if "selinux" in self["USE"].split():
+				if "selinux" in globals():
+					if selinux.is_selinux_enabled() == 1:
+						self._selinux_enabled = 1
+					else:
+						self._selinux_enabled = 0
+				else:
+					writemsg("!!! SELinux module not found. Please verify that it was installed.\n",
+						noiselevel=-1)
+					self._selinux_enabled = 0
+			if self._selinux_enabled == 0:
+				try:	
+					del sys.modules["selinux"]
+				except KeyError:
+					pass
+		return self._selinux_enabled
+
+# XXX This would be to replace getstatusoutput completely.
+# XXX Issue: cannot block execution. Deadlock condition.
+def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, **keywords):
+	"""
+	Spawn a subprocess with extra portage-specific options.
+	Optiosn include:
+
+	Sandbox: Sandbox means the spawned process will be limited in its ability t
+	read and write files (normally this means it is restricted to ${IMAGE}/)
+	SElinux Sandbox: Enables sandboxing on SElinux
+	Reduced Privileges: Drops privilages such that the process runs as portage:portage
+	instead of as root.
+
+	Notes: os.system cannot be used because it messes with signal handling.  Instead we
+	use the portage.process spawn* family of functions.
+
+	This function waits for the process to terminate.
+
+	@param mystring: Command to run
+	@type mystring: String
+	@param mysettings: Either a Dict of Key,Value pairs or an instance of portage.config
+	@type mysettings: Dictionary or config instance
+	@param debug: Ignored
+	@type debug: Boolean
+	@param free: Enable sandboxing for this process
+	@type free: Boolean
+	@param droppriv: Drop to portage:portage when running this command
+	@type droppriv: Boolean
+	@param sesandbox: Enable SELinux Sandboxing (toggles a context switch)
+	@type sesandbox: Boolean
+	@param keywords: Extra options encoded as a dict, to be passed to spawn
+	@type keywords: Dictionary
+	@rtype: Integer
+	@returns:
+	1. The return code of the spawned process.
+	"""
+
+	if isinstance(mysettings, dict):
+		env=mysettings
+		keywords["opt_name"]="[ %s ]" % "portage"
+	else:
+		check_config_instance(mysettings)
+		env=mysettings.environ()
+		keywords["opt_name"]="[%s]" % mysettings["PF"]
+
+	# The default policy for the sesandbox domain only allows entry (via exec)
+	# from shells and from binaries that belong to portage (the number of entry
+	# points is minimized).  The "tee" binary is not among the allowed entry
+	# points, so it is spawned outside of the sesandbox domain and reads from a
+	# pseudo-terminal that connects two domains.
+	logfile = keywords.get("logfile")
+	mypids = []
+	slave_fd = None
+	output_pid = None
+	input_pid = None
+	stdin_termios = None
+	stdin_fd = None
+	if logfile:
+		del keywords["logfile"]
+		fd_pipes = keywords.get("fd_pipes")
+		if fd_pipes is None:
+			fd_pipes = {0:0, 1:1, 2:2}
+		elif 1 not in fd_pipes or 2 not in fd_pipes:
+			raise ValueError(fd_pipes)
+		from pty import openpty
+		master_fd, slave_fd = openpty()
+		fd_pipes.setdefault(0, sys.stdin.fileno())
+		stdin_fd = fd_pipes[0]
+		if os.isatty(stdin_fd):
+			# Copy the termios attributes from stdin_fd to the slave_fd and put
+			# the stdin_fd into raw mode with ECHO disabled.  The stdin
+			# termios attributes are reverted before returning, or via the
+			# atexit hook in portage.process when killed by a signal.
+			import termios, tty
+			stdin_termios = termios.tcgetattr(stdin_fd)
+			tty.setraw(stdin_fd)
+			term_attr = termios.tcgetattr(stdin_fd)
+			term_attr[3] &= ~termios.ECHO
+			termios.tcsetattr(stdin_fd, termios.TCSAFLUSH, term_attr)
+			termios.tcsetattr(slave_fd, termios.TCSAFLUSH, stdin_termios)
+			from output import get_term_size, set_term_size
+			rows, columns = get_term_size()
+			set_term_size(rows, columns, slave_fd)
+			pre_exec = keywords.get("pre_exec")
+			def setup_ctty():
+				os.setsid()
+				# Make it into the "controlling terminal".
+				import termios
+				if hasattr(termios, "TIOCSCTTY"):
+					# BSD 4.3 approach
+					import fcntl
+					fcntl.ioctl(0, termios.TIOCSCTTY)
+				else:
+					# SVR4 approach
+					fd = os.open(os.ttyname(0), os.O_RDWR)
+					for x in 0, 1, 2:
+						os.dup2(fd, x)
+					os.close(fd)
+				if pre_exec:
+					pre_exec()
+			keywords["pre_exec"] = setup_ctty
+		# tee will always exit with an IO error, so ignore it's stderr.
+		null_file = open('/dev/null', 'w')
+		mypids.extend(portage.process.spawn(['tee', '-i', '-a', logfile],
+			returnpid=True, fd_pipes={0:master_fd, 1:fd_pipes[1],
+			2:null_file.fileno()}))
+		output_pid = mypids[-1]
+		mypids.extend(portage.process.spawn(['cat'],
+			returnpid=True, fd_pipes={0:fd_pipes[0], 1:master_fd,
+			2:null_file.fileno()}))
+		input_pid = mypids[-1]
+		os.close(master_fd)
+		null_file.close()
+		fd_pipes[0] = slave_fd
+		fd_pipes[1] = slave_fd
+		fd_pipes[2] = slave_fd
+		keywords["fd_pipes"] = fd_pipes
+
+	features = mysettings.features
+	restrict = mysettings.get("PORTAGE_RESTRICT","").split()
+	droppriv=(droppriv and "userpriv" in features and not \
+		("nouserpriv" in restrict or "userpriv" in restrict))
+	if droppriv and not uid and portage_gid and portage_uid:
+		keywords.update({"uid":portage_uid,"gid":portage_gid,
+			"groups":userpriv_groups,"umask":002})
+	if not free:
+		free=((droppriv and "usersandbox" not in features) or \
+			(not droppriv and "sandbox" not in features and \
+			"usersandbox" not in features))
+
+	if free:
+		keywords["opt_name"] += " bash"
+		spawn_func = portage.process.spawn_bash
+	else:
+		keywords["opt_name"] += " sandbox"
+		spawn_func = portage.process.spawn_sandbox
+
+	if sesandbox:
+		con = selinux.getcontext()
+		con = con.replace(mysettings["PORTAGE_T"],
+			mysettings["PORTAGE_SANDBOX_T"])
+		selinux.setexec(con)
+
+	returnpid = keywords.get("returnpid")
+	keywords["returnpid"] = True
+	try:
+		mypids.extend(spawn_func(mystring, env=env, **keywords))
+	finally:
+		if slave_fd:
+			os.close(slave_fd)
+		if sesandbox:
+			selinux.setexec(None)
+
+	if returnpid:
+		return mypids
+
+	if output_pid:
+		# tee will exit when the other end of the pseudo-terminal is closed.
+		os.waitpid(output_pid, 0)
+		portage.process.spawned_pids.remove(output_pid)
+	if input_pid:
+		# cat is blocking on stdin, so it must be killed.
+		import signal
+		try:
+			os.kill(input_pid, signal.SIGTERM)
+		except OSError:
+			pass # it died by itself
+		os.waitpid(input_pid, 0)
+		portage.process.spawned_pids.remove(input_pid)
+	pid = mypids[-1]
+	try:
+		retval = os.waitpid(pid, 0)[1]
+		portage.process.spawned_pids.remove(pid)
+	finally:
+		if stdin_termios:
+			termios.tcsetattr(stdin_fd, termios.TCSAFLUSH, stdin_termios)
+	if retval != os.EX_OK:
+		if retval & 0xff:
+			return (retval & 0xff) << 8
+		return retval >> 8
+	return retval
+
+def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",use_locks=1, try_mirrors=1):
+	"fetch files.  Will use digest file if available."
+
+	features = mysettings.features
+	restrict = mysettings.get("PORTAGE_RESTRICT","").split()
+	# 'nomirror' is bad/negative logic. You Restrict mirroring, not no-mirroring.
+	if "mirror" in restrict or \
+	   "nomirror" in restrict:
+		if ("mirror" in features) and ("lmirror" not in features):
+			# lmirror should allow you to bypass mirror restrictions.
+			# XXX: This is not a good thing, and is temporary at best.
+			print ">>> \"mirror\" mode desired and \"mirror\" restriction found; skipping fetch."
+			return 1
+
+	thirdpartymirrors = mysettings.thirdpartymirrors()
+
+	check_config_instance(mysettings)
+
+	custommirrors = grabdict(os.path.join(mysettings["PORTAGE_CONFIGROOT"],
+		CUSTOM_MIRRORS_FILE.lstrip(os.path.sep)), recursive=1)
+
+	mymirrors=[]
+
+	if listonly or ("distlocks" not in features):
+		use_locks = 0
+
+	fetch_to_ro = 0
+	if "skiprocheck" in features:
+		fetch_to_ro = 1
+
+	if not os.access(mysettings["DISTDIR"],os.W_OK) and fetch_to_ro:
+		if use_locks:
+			writemsg(red("!!! For fetching to a read-only filesystem, " + \
+				"locking should be turned off.\n"), noiselevel=-1)
+			writemsg("!!! This can be done by adding -distlocks to " + \
+				"FEATURES in /etc/make.conf\n", noiselevel=-1)
+#			use_locks = 0
+
+	# local mirrors are always added
+	if custommirrors.has_key("local"):
+		mymirrors += custommirrors["local"]
+
+	if "nomirror" in restrict or \
+	   "mirror" in restrict:
+		# We don't add any mirrors.
+		pass
+	else:
+		if try_mirrors:
+			mymirrors += [x.rstrip("/") for x in mysettings["GENTOO_MIRRORS"].split() if x]
+
+	pkgdir = mysettings.get("O")
+	if pkgdir:
+		mydigests = Manifest(
+			pkgdir, mysettings["DISTDIR"]).getTypeDigests("DIST")
+	else:
+		# no digests because fetch was not called for a specific package
+		mydigests = {}
+
+	fsmirrors = []
+	for x in range(len(mymirrors)-1,-1,-1):
+		if mymirrors[x] and mymirrors[x][0]=='/':
+			fsmirrors += [mymirrors[x]]
+			del mymirrors[x]
+
+	restrict_fetch = "fetch" in restrict
+	custom_local_mirrors = custommirrors.get("local", [])
+	if restrict_fetch:
+		# With fetch restriction, a normal uri may only be fetched from
+		# custom local mirrors (if available).  A mirror:// uri may also
+		# be fetched from specific mirrors (effectively overriding fetch
+		# restriction, but only for specific mirrors).
+		locations = custom_local_mirrors
+	else:
+		locations = mymirrors
+
+	filedict={}
+	primaryuri_indexes={}
+	for myuri in myuris:
+		myfile=os.path.basename(myuri)
+		if not filedict.has_key(myfile):
+			filedict[myfile]=[]
+			for y in range(0,len(locations)):
+				filedict[myfile].append(locations[y]+"/distfiles/"+myfile)
+		if myuri[:9]=="mirror://":
+			eidx = myuri.find("/", 9)
+			if eidx != -1:
+				mirrorname = myuri[9:eidx]
+
+				# Try user-defined mirrors first
+				if custommirrors.has_key(mirrorname):
+					for cmirr in custommirrors[mirrorname]:
+						filedict[myfile].append(cmirr+"/"+myuri[eidx+1:])
+						# remove the mirrors we tried from the list of official mirrors
+						if cmirr.strip() in thirdpartymirrors[mirrorname]:
+							thirdpartymirrors[mirrorname].remove(cmirr)
+				# now try the official mirrors
+				if thirdpartymirrors.has_key(mirrorname):
+					shuffle(thirdpartymirrors[mirrorname])
+
+					for locmirr in thirdpartymirrors[mirrorname]:
+						filedict[myfile].append(locmirr+"/"+myuri[eidx+1:])
+
+				if not filedict[myfile]:
+					writemsg("No known mirror by the name: %s\n" % (mirrorname))
+			else:
+				writemsg("Invalid mirror definition in SRC_URI:\n", noiselevel=-1)
+				writemsg("  %s\n" % (myuri), noiselevel=-1)
+		else:
+			if restrict_fetch:
+				# Only fetch from specific mirrors is allowed.
+				continue
+			if "primaryuri" in restrict:
+				# Use the source site first.
+				if primaryuri_indexes.has_key(myfile):
+					primaryuri_indexes[myfile] += 1
+				else:
+					primaryuri_indexes[myfile] = 0
+				filedict[myfile].insert(primaryuri_indexes[myfile], myuri)
+			else:
+				filedict[myfile].append(myuri)
+
+	can_fetch=True
+
+	if listonly:
+		can_fetch = False
+
+	for var_name in ("FETCHCOMMAND", "RESUMECOMMAND"):
+		if not mysettings.get(var_name, None):
+			can_fetch = False
+
+	if can_fetch:
+		dirmode  = 02070
+		filemode =   060
+		modemask =    02
+		distdir_dirs = [""]
+		if "distlocks" in features:
+			distdir_dirs.append(".locks")
+		try:
+			
+			for x in distdir_dirs:
+				mydir = os.path.join(mysettings["DISTDIR"], x)
+				if portage.util.ensure_dirs(mydir, gid=portage_gid, mode=dirmode, mask=modemask):
+					writemsg("Adjusting permissions recursively: '%s'\n" % mydir,
+						noiselevel=-1)
+					def onerror(e):
+						raise # bail out on the first error that occurs during recursion
+					if not apply_recursive_permissions(mydir,
+						gid=portage_gid, dirmode=dirmode, dirmask=modemask,
+						filemode=filemode, filemask=modemask, onerror=onerror):
+						raise portage.exception.OperationNotPermitted(
+							"Failed to apply recursive permissions for the portage group.")
+		except portage.exception.PortageException, e:
+			if not os.path.isdir(mysettings["DISTDIR"]):
+				writemsg("!!! %s\n" % str(e), noiselevel=-1)
+				writemsg("!!! Directory Not Found: DISTDIR='%s'\n" % mysettings["DISTDIR"], noiselevel=-1)
+				writemsg("!!! Fetching will fail!\n", noiselevel=-1)
+
+	if can_fetch and \
+		not fetch_to_ro and \
+		not os.access(mysettings["DISTDIR"], os.W_OK):
+		writemsg("!!! No write access to '%s'\n" % mysettings["DISTDIR"],
+			noiselevel=-1)
+		can_fetch = False
+
+	if can_fetch and use_locks and locks_in_subdir:
+			distlocks_subdir = os.path.join(mysettings["DISTDIR"], locks_in_subdir)
+			if not os.access(distlocks_subdir, os.W_OK):
+				writemsg("!!! No write access to write to %s.  Aborting.\n" % distlocks_subdir,
+					noiselevel=-1)
+				return 0
+			del distlocks_subdir
+	for myfile in filedict.keys():
+		"""
+		fetched  status
+		0        nonexistent
+		1        partially downloaded
+		2        completely downloaded
+		"""
+		myfile_path = os.path.join(mysettings["DISTDIR"], myfile)
+		fetched=0
+		file_lock = None
+		if listonly:
+			writemsg_stdout("\n", noiselevel=-1)
+		else:
+			if use_locks and can_fetch:
+				waiting_msg = None
+				if "parallel-fetch" in features:
+					waiting_msg = ("Downloading '%s'... " + \
+						"see "+EPREFIX+"/var/log/emerge-fetch.log for details.") % myfile
+				if locks_in_subdir:
+					file_lock = portage.locks.lockfile(
+						os.path.join(mysettings["DISTDIR"],
+						locks_in_subdir, myfile), wantnewlockfile=1,
+						waiting_msg=waiting_msg)
+				else:
+					file_lock = portage.locks.lockfile(
+						myfile_path, wantnewlockfile=1,
+						waiting_msg=waiting_msg)
+		try:
+			if not listonly:
+				if fsmirrors and not os.path.exists(myfile_path):
+					for mydir in fsmirrors:
+						mirror_file = os.path.join(mydir, myfile)
+						try:
+							shutil.copyfile(mirror_file, myfile_path)
+							writemsg(_("Local mirror has file:" + \
+								" %(file)s\n" % {"file":myfile}))
+							break
+						except (IOError, OSError), e:
+							if e.errno != errno.ENOENT:
+								raise
+							del e
+
+				try:
+					mystat = os.stat(myfile_path)
+				except OSError, e:
+					if e.errno != errno.ENOENT:
+						raise
+					del e
+				else:
+					try:
+						apply_secpass_permissions(
+							myfile_path, gid=portage_gid, mode=0664, mask=02,
+							stat_cached=mystat)
+					except portage.exception.PortageException, e:
+						if not os.access(myfile_path, os.R_OK):
+							writemsg("!!! Failed to adjust permissions:" + \
+								" %s\n" % str(e), noiselevel=-1)
+					if myfile not in mydigests:
+						# We don't have a digest, but the file exists.  We must
+						# assume that it is fully downloaded.
+						continue
+					else:
+						if mystat.st_size < mydigests[myfile]["size"] and \
+							not restrict_fetch:
+							fetched = 1 # Try to resume this download.
+						else:
+							verified_ok, reason = portage.checksum.verify_all(
+								myfile_path, mydigests[myfile])
+							if not verified_ok:
+								writemsg("!!! Previously fetched" + \
+									" file: '%s'\n" % myfile, noiselevel=-1)
+								writemsg("!!! Reason: %s\n" % reason[0],
+									noiselevel=-1)
+								writemsg(("!!! Got:      %s\n" + \
+									"!!! Expected: %s\n") % \
+									(reason[1], reason[2]), noiselevel=-1)
+								if reason[0] == "Insufficient data for checksum verification":
+									return 0
+								if can_fetch and not restrict_fetch:
+									writemsg("Refetching...\n\n",
+										noiselevel=-1)
+									os.unlink(myfile_path)
+							else:
+								eout = portage.output.EOutput()
+								eout.quiet = \
+									mysettings.get("PORTAGE_QUIET", None) == "1"
+								for digest_name in mydigests[myfile]:
+									eout.ebegin(
+										"%s %s ;-)" % (myfile, digest_name))
+									eout.eend(0)
+								continue # fetch any remaining files
+
+			for loc in filedict[myfile]:
+				if listonly:
+					writemsg_stdout(loc+" ", noiselevel=-1)
+					continue
+				# allow different fetchcommands per protocol
+				protocol = loc[0:loc.find("://")]
+				if mysettings.has_key("FETCHCOMMAND_"+protocol.upper()):
+					fetchcommand=mysettings["FETCHCOMMAND_"+protocol.upper()]
+				else:
+					fetchcommand=mysettings["FETCHCOMMAND"]
+				if mysettings.has_key("RESUMECOMMAND_"+protocol.upper()):
+					resumecommand=mysettings["RESUMECOMMAND_"+protocol.upper()]
+				else:
+					resumecommand=mysettings["RESUMECOMMAND"]
+
+				if not can_fetch:
+					if fetched != 2:
+						if fetched == 0:
+							writemsg("!!! File %s isn't fetched but unable to get it.\n" % myfile,
+								noiselevel=-1)
+						else:
+							writemsg("!!! File %s isn't fully fetched, but unable to complete it\n" % myfile,
+								noiselevel=-1)
+						for var_name in ("FETCHCOMMAND", "RESUMECOMMAND"):
+							if not mysettings.get(var_name, None):
+								writemsg(("!!! %s is unset.  It should " + \
+								"have been defined in /etc/make.globals.\n") \
+								 % var_name, noiselevel=-1)
+						return 0
+					else:
+						continue
+
+				if fetched != 2:
+					#we either need to resume or start the download
+					#you can't use "continue" when you're inside a "try" block
+					if fetched==1:
+						#resume mode:
+						writemsg(">>> Resuming download...\n")
+						locfetch=resumecommand
+					else:
+						#normal mode:
+						locfetch=fetchcommand
+					writemsg_stdout(">>> Downloading '%s'\n" % \
+						re.sub(r'//(.+):.+@(.+)/',r'//\1:*password*@\2/', loc))
+					variables = {
+						"DISTDIR": mysettings["DISTDIR"],
+						"URI":     loc,
+						"FILE":    myfile
+					}
+					import shlex, StringIO
+					lexer = shlex.shlex(StringIO.StringIO(locfetch), posix=True)
+					lexer.whitespace_split = True
+					myfetch = [varexpand(x, mydict=variables) for x in lexer]
+
+					spawn_keywords = {}
+					if "userfetch" in mysettings.features and \
+						os.getuid() == 0 and portage_gid and portage_uid:
+						spawn_keywords.update({
+							"uid"    : portage_uid,
+							"gid"    : portage_gid,
+							"groups" : userpriv_groups,
+							"umask"  : 002})
+
+					try:
+
+						if mysettings.selinux_enabled():
+							con = selinux.getcontext()
+							con = con.replace(mysettings["PORTAGE_T"], mysettings["PORTAGE_FETCH_T"])
+							selinux.setexec(con)
+							# bash is an allowed entrypoint, while most binaries are not
+							myfetch = ["bash", "-c", "exec \"$@\"", myfetch[0]] + myfetch
+
+						myret = portage.process.spawn(myfetch,
+							env=mysettings.environ(), **spawn_keywords)
+
+						if mysettings.selinux_enabled():
+							selinux.setexec(None)
+
+					finally:
+						try:
+							apply_secpass_permissions(myfile_path,
+								gid=portage_gid, mode=0664, mask=02)
+						except portage.exception.FileNotFound, e:
+							pass
+						except portage.exception.PortageException, e:
+							if not os.access(myfile_path, os.R_OK):
+								writemsg("!!! Failed to adjust permissions:" + \
+									" %s\n" % str(e), noiselevel=-1)
+
+					if mydigests!=None and mydigests.has_key(myfile):
+						try:
+							mystat = os.stat(myfile_path)
+						except OSError, e:
+							if e.errno != errno.ENOENT:
+								raise
+							del e
+							fetched = 0
+						else:
+							# no exception?  file exists. let digestcheck() report
+							# an appropriately for size or checksum errors
+							if (mystat[stat.ST_SIZE]<mydigests[myfile]["size"]):
+								# Fetch failed... Try the next one... Kill 404 files though.
+								if (mystat[stat.ST_SIZE]<100000) and (len(myfile)>4) and not ((myfile[-5:]==".html") or (myfile[-4:]==".htm")):
+									html404=re.compile("<title>.*(not found|404).*</title>",re.I|re.M)
+									if html404.search(open(mysettings["DISTDIR"]+"/"+myfile).read()):
+										try:
+											os.unlink(mysettings["DISTDIR"]+"/"+myfile)
+											writemsg(">>> Deleting invalid distfile. (Improper 404 redirect from server.)\n")
+											fetched = 0
+											continue
+										except (IOError, OSError):
+											pass
+								fetched = 1
+								continue
+							if not fetchonly:
+								fetched=2
+								break
+							else:
+								# File is the correct size--check the checksums for the fetched
+								# file NOW, for those users who don't have a stable/continuous
+								# net connection. This way we have a chance to try to download
+								# from another mirror...
+								verified_ok,reason = portage.checksum.verify_all(mysettings["DISTDIR"]+"/"+myfile, mydigests[myfile])
+								if not verified_ok:
+									print reason
+									writemsg("!!! Fetched file: "+str(myfile)+" VERIFY FAILED!\n",
+										noiselevel=-1)
+									writemsg("!!! Reason: "+reason[0]+"\n",
+										noiselevel=-1)
+									writemsg("!!! Got:      %s\n!!! Expected: %s\n" % \
+										(reason[1], reason[2]), noiselevel=-1)
+									if reason[0] == "Insufficient data for checksum verification":
+										return 0
+									writemsg("Removing corrupt distfile...\n", noiselevel=-1)
+									os.unlink(mysettings["DISTDIR"]+"/"+myfile)
+									fetched=0
+								else:
+									eout = portage.output.EOutput()
+									eout.quiet = mysettings.get("PORTAGE_QUIET", None) == "1"
+									for x_key in mydigests[myfile].keys():
+										eout.ebegin("%s %s ;-)" % (myfile, x_key))
+										eout.eend(0)
+									fetched=2
+									break
+					else:
+						if not myret:
+							fetched=2
+							break
+						elif mydigests!=None:
+							writemsg("No digest file available and download failed.\n\n",
+								noiselevel=-1)
+		finally:
+			if use_locks and file_lock:
+				portage.locks.unlockfile(file_lock)
+
+		if listonly:
+			writemsg_stdout("\n", noiselevel=-1)
+		if fetched != 2:
+			if restrict_fetch:
+				print "\n!!!", mysettings["CATEGORY"] + "/" + \
+					mysettings["PF"], "has fetch restriction turned on."
+				print "!!! This probably means that this " + \
+					"ebuild's files must be downloaded"
+				print "!!! manually.  See the comments in" + \
+					" the ebuild for more information.\n"
+				spawn(EBUILD_SH_BINARY + " nofetch", mysettings)
+			elif listonly:
+				continue
+			elif not filedict[myfile]:
+				writemsg("Warning: No mirrors available for file" + \
+					" '%s'\n" % (myfile), noiselevel=-1)
+			else:
+				writemsg("!!! Couldn't download '%s'. Aborting.\n" % myfile,
+					noiselevel=-1)
+			return 0
+	return 1
+
+def digestgen(myarchives, mysettings, overwrite=1, manifestonly=0, myportdb=None):
+	"""
+	Generates a digest file if missing.  Assumes all files are available.
+	DEPRECATED: this now only is a compability wrapper for 
+	            portage.manifest.Manifest()
+	NOTE: manifestonly and overwrite are useless with manifest2 and
+	      are therefore ignored."""
+	if myportdb is None:
+		writemsg("Warning: myportdb not specified to digestgen\n")
+		global portdb
+		myportdb = portdb
+	global _doebuild_manifest_exempt_depend
+	try:
+		_doebuild_manifest_exempt_depend += 1
+		distfiles_map = {}
+		fetchlist_dict = FetchlistDict(mysettings["O"], mysettings, myportdb)
+		for cpv in fetchlist_dict:
+			try:
+				for myfile in fetchlist_dict[cpv]:
+					distfiles_map.setdefault(myfile, []).append(cpv)
+			except portage.exception.InvalidDependString, e:
+				writemsg("!!! %s\n" % str(e), noiselevel=-1)
+				writemsg("!!! Invalid SRC_URI for '%s'.\n" % cpv, noiselevel=-1)
+				del e
+				return 0
+		mytree = os.path.dirname(os.path.dirname(mysettings["O"]))
+		manifest1_compat = not os.path.exists(
+			os.path.join(mytree, "manifest1_obsolete"))
+		mf = Manifest(mysettings["O"], mysettings["DISTDIR"],
+			fetchlist_dict=fetchlist_dict, manifest1_compat=manifest1_compat)
+		# Don't require all hashes since that can trigger excessive
+		# fetches when sufficient digests already exist.  To ease transition
+		# while Manifest 1 is being removed, only require hashes that will
+		# exist before and after the transition.
+		required_hash_types = set()
+		required_hash_types.add("size")
+		required_hash_types.add(portage.const.MANIFEST2_REQUIRED_HASH)
+		dist_hashes = mf.fhashdict.get("DIST", {})
+		missing_hashes = set()
+		for myfile in distfiles_map:
+			myhashes = dist_hashes.get(myfile)
+			if not myhashes:
+				missing_hashes.add(myfile)
+				continue
+			if required_hash_types.difference(myhashes):
+				missing_hashes.add(myfile)
+		if missing_hashes:
+			missing_files = []
+			for myfile in missing_hashes:
+				try:
+					os.stat(os.path.join(mysettings["DISTDIR"], myfile))
+				except OSError, e:
+					if e.errno != errno.ENOENT:
+						raise
+					del e
+					missing_files.append(myfile)
+			if missing_files:
+				mytree = os.path.realpath(os.path.dirname(
+					os.path.dirname(mysettings["O"])))
+				fetch_settings = config(clone=mysettings)
+				debug = mysettings.get("PORTAGE_DEBUG") == "1"
+				for myfile in missing_files:
+					success = False
+					for cpv in distfiles_map[myfile]:
+						myebuild = os.path.join(mysettings["O"],
+							catsplit(cpv)[1] + ".ebuild")
+						# for RESTRICT=fetch, mirror, etc...
+						doebuild_environment(myebuild, "fetch",
+							mysettings["ROOT"], fetch_settings,
+							debug, 1, myportdb)
+						alluris, aalist = myportdb.getfetchlist(
+							cpv, mytree=mytree, all=True,
+							mysettings=fetch_settings)
+						myuris = [uri for uri in alluris \
+							if os.path.basename(uri) == myfile]
+						fetch_settings["A"] = myfile # for use by pkg_nofetch()
+						if fetch(myuris, fetch_settings):
+							success = True
+							break
+					if not success:
+						writemsg(("!!! File %s doesn't exist, can't update " + \
+							"Manifest\n") % myfile, noiselevel=-1)
+						return 0
+		writemsg_stdout(">>> Creating Manifest for %s\n" % mysettings["O"])
+		try:
+			mf.create(requiredDistfiles=myarchives,
+				assumeDistHashesSometimes=True,
+				assumeDistHashesAlways=(
+				"assume-digests" in mysettings.features))
+		except portage.exception.FileNotFound, e:
+			writemsg(("!!! File %s doesn't exist, can't update " + \
+				"Manifest\n") % e, noiselevel=-1)
+			return 0
+		mf.write(sign=False)
+		if "assume-digests" not in mysettings.features:
+			distlist = mf.fhashdict.get("DIST", {}).keys()
+			distlist.sort()
+			auto_assumed = []
+			for filename in distlist:
+				if not os.path.exists(
+					os.path.join(mysettings["DISTDIR"], filename)):
+					auto_assumed.append(filename)
+			if auto_assumed:
+				mytree = os.path.realpath(
+					os.path.dirname(os.path.dirname(mysettings["O"])))
+				cp = os.path.sep.join(mysettings["O"].split(os.path.sep)[-2:])
+				pkgs = myportdb.cp_list(cp, mytree=mytree)
+				pkgs.sort()
+				writemsg_stdout("  digest.assumed" + portage.output.colorize("WARN",
+					str(len(auto_assumed)).rjust(18)) + "\n")
+				for pkg_key in pkgs:
+					fetchlist = myportdb.getfetchlist(pkg_key,
+						mysettings=mysettings, all=True, mytree=mytree)[1]
+					pv = pkg_key.split("/")[1]
+					for filename in auto_assumed:
+						if filename in fetchlist:
+							writemsg_stdout(
+								"   digest-%s::%s\n" % (pv, filename))
+		return 1
+	finally:
+		_doebuild_manifest_exempt_depend -= 1
+
+def digestParseFile(myfilename, mysettings=None):
+	"""(filename) -- Parses a given file for entries matching:
+	<checksumkey> <checksum_hex_string> <filename> <filesize>
+	Ignores lines that don't start with a valid checksum identifier
+	and returns a dict with the filenames as keys and {checksumkey:checksum}
+	as the values.
+	DEPRECATED: this function is now only a compability wrapper for
+	            portage.manifest.Manifest()."""
+
+	mysplit = myfilename.split(os.sep)
+	if mysplit[-2] == "files" and mysplit[-1].startswith("digest-"):
+		pkgdir = os.sep + os.sep.join(mysplit[:-2]).strip(os.sep)
+	elif mysplit[-1] == "Manifest":
+		pkgdir = os.sep + os.sep.join(mysplit[:-1]).strip(os.sep)
+
+	if mysettings is None:
+		global settings
+		mysettings = config(clone=settings)
+
+	return Manifest(pkgdir, mysettings["DISTDIR"]).getDigests()
+
+def digestcheck(myfiles, mysettings, strict=0, justmanifest=0):
+	"""Verifies checksums.  Assumes all files have been downloaded.
+	DEPRECATED: this is now only a compability wrapper for 
+	            portage.manifest.Manifest()."""
+	if not strict:
+		return 1
+	pkgdir = mysettings["O"]
+	manifest_path = os.path.join(pkgdir, "Manifest")
+	if not os.path.exists(manifest_path):
+		writemsg("!!! Manifest file not found: '%s'\n" % manifest_path,
+			noiselevel=-1)
+		if strict:
+			return 0
+	mf = Manifest(pkgdir, mysettings["DISTDIR"])
+	eout = portage.output.EOutput()
+	eout.quiet = mysettings.get("PORTAGE_QUIET", None) == "1"
+	try:
+		eout.ebegin("checking ebuild checksums ;-)")
+		mf.checkTypeHashes("EBUILD")
+		eout.eend(0)
+		eout.ebegin("checking auxfile checksums ;-)")
+		mf.checkTypeHashes("AUX")
+		eout.eend(0)
+		eout.ebegin("checking miscfile checksums ;-)")
+		mf.checkTypeHashes("MISC", ignoreMissingFiles=True)
+		eout.eend(0)
+		for f in myfiles:
+			eout.ebegin("checking %s ;-)" % f)
+			mf.checkFileHashes(mf.findFile(f), f)
+			eout.eend(0)
+	except KeyError, e:
+		eout.eend(1)
+		writemsg("\n!!! Missing digest for %s\n" % str(e), noiselevel=-1)
+		return 0
+	except portage.exception.FileNotFound, e:
+		eout.eend(1)
+		writemsg("\n!!! A file listed in the Manifest could not be found: %s\n" % str(e),
+			noiselevel=-1)
+		return 0
+	except portage.exception.DigestException, e:
+		eout.eend(1)
+		writemsg("\n!!! Digest verification failed:\n", noiselevel=-1)
+		writemsg("!!! %s\n" % e.value[0], noiselevel=-1)
+		writemsg("!!! Reason: %s\n" % e.value[1], noiselevel=-1)
+		writemsg("!!! Got: %s\n" % e.value[2], noiselevel=-1)
+		writemsg("!!! Expected: %s\n" % e.value[3], noiselevel=-1)
+		return 0
+	# Make sure that all of the ebuilds are actually listed in the Manifest.
+	for f in os.listdir(pkgdir):
+		if f.endswith(".ebuild") and not mf.hasFile("EBUILD", f):
+			writemsg("!!! A file is not listed in the Manifest: '%s'\n" % \
+				os.path.join(pkgdir, f), noiselevel=-1)
+			return 0
+	""" epatch will just grab all the patches out of a directory, so we have to
+	make sure there aren't any foreign files that it might grab."""
+	filesdir = os.path.join(pkgdir, "files")
+	for parent, dirs, files in os.walk(filesdir):
+		for d in dirs:
+			if d.startswith(".") or d == "CVS":
+				dirs.remove(d)
+		for f in files:
+			if f.startswith("."):
+				continue
+			f = os.path.join(parent, f)[len(filesdir) + 1:]
+			file_type = mf.findFile(f)
+			if file_type != "AUX" and not f.startswith("digest-"):
+				writemsg("!!! A file is not listed in the Manifest: '%s'\n" % \
+					os.path.join(filesdir, f), noiselevel=-1)
+				return 0
+	return 1
+
+# parse actionmap to spawn ebuild with the appropriate args
+def spawnebuild(mydo,actionmap,mysettings,debug,alwaysdep=0,logfile=None):
+	if alwaysdep or "noauto" not in mysettings.features:
+		# process dependency first
+		if "dep" in actionmap[mydo].keys():
+			retval=spawnebuild(actionmap[mydo]["dep"],actionmap,mysettings,debug,alwaysdep=alwaysdep,logfile=logfile)
+			if retval:
+				return retval
+	kwargs = actionmap[mydo]["args"]
+	mysettings["EBUILD_PHASE"] = mydo
+	phase_retval = spawn(actionmap[mydo]["cmd"] % mydo, mysettings, debug=debug, logfile=logfile, **kwargs)
+	mysettings["EBUILD_PHASE"] = ""
+
+	if not kwargs["droppriv"] and secpass >= 2:
+		""" Privileged phases may have left files that need to be made
+		writable to a less privileged user."""
+		apply_recursive_permissions(mysettings["T"],
+			uid=portage_uid, gid=portage_gid, dirmode=070, dirmask=0,
+			filemode=060, filemask=0)
+
+	if phase_retval == os.EX_OK:
+		if mydo == "install":
+			# User and group bits that match the "portage" user or group are
+			# automatically mapped to PORTAGE_INST_UID and PORTAGE_INST_GID if
+			# necessary.  The chown system call may clear S_ISUID and S_ISGID
+			# bits, so those bits are restored if necessary.
+			inst_uid = int(mysettings["PORTAGE_INST_UID"])
+			inst_gid = int(mysettings["PORTAGE_INST_GID"])
+			for parent, dirs, files in os.walk(mysettings["D"]):
+				for fname in chain(dirs, files):
+					fpath = os.path.join(parent, fname)
+					mystat = os.lstat(fpath)
+					if mystat.st_uid != portage_uid and \
+						mystat.st_gid != portage_gid:
+						continue
+					myuid = -1
+					mygid = -1
+					if mystat.st_uid == portage_uid:
+						myuid = inst_uid
+					if mystat.st_gid == portage_gid:
+						mygid = inst_gid
+					apply_secpass_permissions(fpath, uid=myuid, gid=mygid,
+						mode=mystat.st_mode, stat_cached=mystat,
+						follow_links=False)
+			mycommand = " ".join([MISC_SH_BINARY, "install_qa_check", "install_symlink_html_docs"])
+			qa_retval = spawn(mycommand, mysettings, debug=debug, logfile=logfile, **kwargs)
+			if qa_retval:
+				writemsg("!!! install_qa_check failed; exiting.\n",
+					noiselevel=-1)
+			return qa_retval
+	return phase_retval
+
+
+def eapi_is_supported(eapi):
+	return str(eapi).strip() == str(portage.const.EAPI).strip()
+
+def doebuild_environment(myebuild, mydo, myroot, mysettings, debug, use_cache, mydbapi):
+
+	ebuild_path = os.path.abspath(myebuild)
+	pkg_dir     = os.path.dirname(ebuild_path)
+
+	if mysettings.configdict["pkg"].has_key("CATEGORY"):
+		cat = mysettings.configdict["pkg"]["CATEGORY"]
+	else:
+		cat = os.path.basename(normalize_path(os.path.join(pkg_dir, "..")))
+	mypv = os.path.basename(ebuild_path)[:-7]	
+	mycpv = cat+"/"+mypv
+	mysplit=pkgsplit(mypv,silent=0)
+	if mysplit is None:
+		raise portage.exception.IncorrectParameter(
+			"Invalid ebuild path: '%s'" % myebuild)
+
+	if mydo != "depend":
+		"""For performance reasons, setcpv only triggers reset when it
+		detects a package-specific change in config.  For the ebuild
+		environment, a reset call is forced in order to ensure that the
+		latest env.d variables are used."""
+		mysettings.reset(use_cache=use_cache)
+		mysettings.setcpv(mycpv, use_cache=use_cache, mydb=mydbapi)
+
+	mysettings["EBUILD_PHASE"] = mydo
+
+	mysettings["PORTAGE_MASTER_PID"] = str(os.getpid())
+
+	# We are disabling user-specific bashrc files.
+	mysettings["BASH_ENV"] = INVALID_ENV_FILE
+
+	if debug: # Otherwise it overrides emerge's settings.
+		# We have no other way to set debug... debug can't be passed in
+		# due to how it's coded... Don't overwrite this so we can use it.
+		mysettings["PORTAGE_DEBUG"] = "1"
+
+	mysettings["EPREFIX"]  = EPREFIX.rstrip(os.sep)
+	mysettings["ROOT"]     = myroot
+	mysettings["EROOT"]    = normalize_path(myroot + mysettings["EPREFIX"]) + os.sep
+	mysettings["STARTDIR"] = getcwd()
+
+	mysettings["EBUILD"]   = ebuild_path
+	mysettings["O"]        = pkg_dir
+	mysettings.configdict["pkg"]["CATEGORY"] = cat
+	mysettings["FILESDIR"] = os.path.join(pkg_dir, "files")
+	mysettings["PF"]       = mypv
+
+	mysettings["ECLASSDIR"]   = os.path.join(mysettings["PORTDIR"], "eclass")
+	mysettings["SANDBOX_LOG"] = mycpv.replace(os.path.sep, "_-_")
+
+	mysettings["PROFILE_PATHS"] = "\n".join(mysettings.profiles)+"\n"+CUSTOM_PROFILE_PATH
+	mysettings["P"]  = mysplit[0]+"-"+mysplit[1]
+	mysettings["PN"] = mysplit[0]
+	mysettings["PV"] = mysplit[1]
+	mysettings["PR"] = mysplit[2]
+
+	if portage.util.noiselimit < 0:
+		mysettings["PORTAGE_QUIET"] = "1"
+
+	if mydo != "depend":
+		eapi, mysettings["INHERITED"], mysettings["SLOT"], mysettings["RESTRICT"]  = \
+			mydbapi.aux_get(mycpv, ["EAPI", "INHERITED", "SLOT", "RESTRICT"])
+		if not eapi_is_supported(eapi):
+			# can't do anything with this.
+			raise portage.exception.UnsupportedAPIException(mycpv, eapi)
+		try:
+			mysettings["PORTAGE_RESTRICT"] = " ".join(flatten(
+				portage.dep.use_reduce(portage.dep.paren_reduce(
+				mysettings.get("RESTRICT","")),
+				uselist=mysettings.get("USE","").split())))
+		except portage.exception.InvalidDependString:
+			# RESTRICT is validated again inside doebuild, so let this go
+			mysettings["PORTAGE_RESTRICT"] = ""
+
+	if mysplit[2] == "r0":
+		mysettings["PVR"]=mysplit[1]
+	else:
+		mysettings["PVR"]=mysplit[1]+"-"+mysplit[2]
+
+	if mysettings.has_key("PATH"):
+		mysplit=mysettings["PATH"].split(":")
+	else:
+		mysplit=[]
+	if PORTAGE_BIN_PATH not in mysplit:
+		mysettings["PATH"]=PORTAGE_BIN_PATH+":"+mysettings["PATH"]
+
+	# Sandbox needs cannonical paths.
+	mysettings["PORTAGE_TMPDIR"] = os.path.realpath(
+		mysettings["PORTAGE_TMPDIR"])
+	mysettings["BUILD_PREFIX"] = os.path.join(mysettings["PORTAGE_TMPDIR"], "portage")
+	mysettings["PKG_TMPDIR"]   = os.path.join(mysettings["PORTAGE_TMPDIR"], "binpkgs")
+	
+	# Package {pre,post}inst and {pre,post}rm may overlap, so they must have separate
+	# locations in order to prevent interference.
+	if mydo in ("unmerge", "prerm", "postrm", "cleanrm"):
+		mysettings["PORTAGE_BUILDDIR"] = os.path.join(
+			mysettings["PKG_TMPDIR"],
+			mysettings["CATEGORY"], mysettings["PF"])
+	else:
+		mysettings["PORTAGE_BUILDDIR"] = os.path.join(
+			mysettings["BUILD_PREFIX"],
+			mysettings["CATEGORY"], mysettings["PF"])
+
+	mysettings["HOME"] = os.path.join(mysettings["PORTAGE_BUILDDIR"], "homedir")
+	mysettings["WORKDIR"] = os.path.join(mysettings["PORTAGE_BUILDDIR"], "work")
+	mysettings["D"] = os.path.join(mysettings["PORTAGE_BUILDDIR"], "image") + os.sep
+	mysettings["ED"] = os.path.join(mysettings["PORTAGE_BUILDDIR"], "image" + mysettings["EPREFIX"]) + os.sep
+	mysettings["T"] = os.path.join(mysettings["PORTAGE_BUILDDIR"], "temp")
+
+	mysettings["PORTAGE_BASHRC"] = os.path.join(
+		mysettings["PORTAGE_CONFIGROOT"], EBUILD_SH_ENV_FILE.lstrip(os.path.sep))
+
+	#set up KV variable -- DEP SPEEDUP :: Don't waste time. Keep var persistent.
+	if (mydo!="depend") or not mysettings.has_key("KV"):
+		mykv,err1=ExtractKernelVersion(os.path.join(myroot + EPREFIX, "usr/src/linux"))
+		if mykv:
+			# Regular source tree
+			mysettings["KV"]=mykv
+		else:
+			mysettings["KV"]=""
+
+	# Allow color.map to control colors associated with einfo, ewarn, etc...
+	mycolors = []
+	for c in ("GOOD", "WARN", "BAD", "HILITE", "BRACKET"):
+		mycolors.append("%s=$'%s'" % (c, portage.output.codes[c]))
+	mysettings["PORTAGE_COLORMAP"] = "\n".join(mycolors)
+
+def prepare_build_dirs(myroot, mysettings, cleanup):
+
+	clean_dirs = [mysettings["HOME"]]
+
+	# We enable cleanup when we want to make sure old cruft (such as the old
+	# environment) doesn't interfere with the current phase.
+	if cleanup:
+		clean_dirs.append(mysettings["T"])
+
+	for clean_dir in clean_dirs:
+		try:
+			shutil.rmtree(clean_dir)
+		except OSError, oe:
+			if errno.ENOENT == oe.errno:
+				pass
+			elif errno.EPERM == oe.errno:
+				writemsg("%s\n" % oe, noiselevel=-1)
+				writemsg("Operation Not Permitted: rmtree('%s')\n" % \
+					clean_dir, noiselevel=-1)
+				return 1
+			else:
+				raise
+
+	def makedirs(dir_path):
+		try:
+			os.makedirs(dir_path)
+		except OSError, oe:
+			if errno.EEXIST == oe.errno:
+				pass
+			elif errno.EPERM == oe.errno:
+				writemsg("%s\n" % oe, noiselevel=-1)
+				writemsg("Operation Not Permitted: makedirs('%s')\n" % \
+					dir_path, noiselevel=-1)
+				return False
+			else:
+				raise
+		return True
+
+	mysettings["PKG_LOGDIR"] = os.path.join(mysettings["T"], "logging")
+
+	mydirs = [os.path.dirname(mysettings["PORTAGE_BUILDDIR"])]
+	mydirs.append(os.path.dirname(mydirs[-1]))
+
+	try:
+		for mydir in mydirs:
+			portage.util.ensure_dirs(mydir)
+			portage.util.apply_secpass_permissions(mydir,
+				gid=portage_gid, uid=portage_uid, mode=070, mask=0)
+		for dir_key in ("PORTAGE_BUILDDIR", "HOME", "PKG_LOGDIR", "T"):
+			"""These directories don't necessarily need to be group writable.
+			However, the setup phase is commonly run as a privileged user prior
+			to the other phases being run by an unprivileged user.  Currently,
+			we use the portage group to ensure that the unprivleged user still
+			has write access to these directories in any case."""
+			portage.util.ensure_dirs(mysettings[dir_key], mode=0775)
+			portage.util.apply_secpass_permissions(mysettings[dir_key],
+				uid=portage_uid, gid=portage_gid)
+	except portage.exception.PermissionDenied, e:
+		writemsg("Permission Denied: %s\n" % str(e), noiselevel=-1)
+		return 1
+	except portage.exception.OperationNotPermitted, e:
+		writemsg("Operation Not Permitted: %s\n" % str(e), noiselevel=-1)
+		return 1
+	except portage.exception.FileNotFound, e:
+		writemsg("File Not Found: '%s'\n" % str(e), noiselevel=-1)
+		return 1
+
+	features_dirs = {
+		"ccache":{
+			"basedir_var":"CCACHE_DIR",
+			"default_dir":os.path.join(mysettings["PORTAGE_TMPDIR"], "ccache"),
+			"always_recurse":False},
+		"confcache":{
+			"basedir_var":"CONFCACHE_DIR",
+			"default_dir":os.path.join(mysettings["PORTAGE_TMPDIR"], "confcache"),
+			"always_recurse":False},
+		"distcc":{
+			"basedir_var":"DISTCC_DIR",
+			"default_dir":os.path.join(mysettings["BUILD_PREFIX"], ".distcc"),
+			"subdirs":("lock", "state"),
+			"always_recurse":True}
+	}
+	dirmode  = 02070
+	filemode =   060
+	modemask =    02
+	for myfeature, kwargs in features_dirs.iteritems():
+		if myfeature in mysettings.features:
+			basedir = mysettings[kwargs["basedir_var"]]
+			if basedir == "":
+				basedir = kwargs["default_dir"]
+				mysettings[kwargs["basedir_var"]] = basedir
+			try:
+				mydirs = [mysettings[kwargs["basedir_var"]]]
+				if "subdirs" in kwargs:
+					for subdir in kwargs["subdirs"]:
+						mydirs.append(os.path.join(basedir, subdir))
+				for mydir in mydirs:
+					modified = portage.util.ensure_dirs(mydir)
+					# Generally, we only want to apply permissions for
+					# initial creation.  Otherwise, we don't know exactly what
+					# permissions the user wants, so should leave them as-is.
+					if modified or kwargs["always_recurse"]:
+						if modified:
+							writemsg("Adjusting permissions recursively: '%s'\n" % mydir,
+								noiselevel=-1)
+						def onerror(e):
+							raise	# The feature is disabled if a single error
+									# occurs during permissions adjustment.
+						if not apply_recursive_permissions(mydir,
+						gid=portage_gid, dirmode=dirmode, dirmask=modemask,
+						filemode=filemode, filemask=modemask, onerror=onerror):
+							raise portage.exception.OperationNotPermitted(
+								"Failed to apply recursive permissions for the portage group.")
+			except portage.exception.PortageException, e:
+				mysettings.features.remove(myfeature)
+				mysettings["FEATURES"] = " ".join(mysettings.features)
+				writemsg("!!! %s\n" % str(e), noiselevel=-1)
+				writemsg("!!! Failed resetting perms on %s='%s'\n" % \
+					(kwargs["basedir_var"], basedir), noiselevel=-1)
+				writemsg("!!! Disabled FEATURES='%s'\n" % myfeature,
+					noiselevel=-1)
+				time.sleep(5)
+
+	workdir_mode = 0700
+	try:
+		mode = mysettings["PORTAGE_WORKDIR_MODE"]
+		if mode.isdigit():
+			parsed_mode = int(mode, 8)
+		elif mode == "":
+			raise KeyError()
+		else:
+			raise ValueError()
+		if parsed_mode & 07777 != parsed_mode:
+			raise ValueError("Invalid file mode: %s" % mode)
+		else:
+			workdir_mode = parsed_mode
+	except KeyError, e:
+		writemsg("!!! PORTAGE_WORKDIR_MODE is unset, using %s.\n" % oct(workdir_mode))
+	except ValueError, e:
+		if len(str(e)) > 0:
+			writemsg("%s\n" % e)
+		writemsg("!!! Unable to parse PORTAGE_WORKDIR_MODE='%s', using %s.\n" % \
+		(mysettings["PORTAGE_WORKDIR_MODE"], oct(workdir_mode)))
+	mysettings["PORTAGE_WORKDIR_MODE"] = oct(workdir_mode)
+	try:
+		apply_secpass_permissions(mysettings["WORKDIR"],
+		uid=portage_uid, gid=portage_gid, mode=workdir_mode)
+	except portage.exception.FileNotFound:
+		pass # ebuild.sh will create it
+
+	if mysettings.get("PORT_LOGDIR", "") == "":
+		while "PORT_LOGDIR" in mysettings:
+			del mysettings["PORT_LOGDIR"]
+	if "PORT_LOGDIR" in mysettings:
+		try:
+			modified = portage.util.ensure_dirs(mysettings["PORT_LOGDIR"])
+			if modified:
+				apply_secpass_permissions(mysettings["PORT_LOGDIR"],
+					uid=portage_uid, gid=portage_gid, mode=02770)
+		except portage.exception.PortageException, e:
+			writemsg("!!! %s\n" % str(e), noiselevel=-1)
+			writemsg("!!! Permission issues with PORT_LOGDIR='%s'\n" % \
+				mysettings["PORT_LOGDIR"], noiselevel=-1)
+			writemsg("!!! Disabling logging.\n", noiselevel=-1)
+			while "PORT_LOGDIR" in mysettings:
+				del mysettings["PORT_LOGDIR"]
+	if "PORT_LOGDIR" in mysettings:
+		logid_path = os.path.join(mysettings["PORTAGE_BUILDDIR"], ".logid")
+		if not os.path.exists(logid_path):
+			f = open(logid_path, "w")
+			f.close()
+			del f
+		logid_time = time.strftime("%Y%m%d-%H%M%S",
+			time.gmtime(os.stat(logid_path).st_mtime))
+		mysettings["PORTAGE_LOG_FILE"] = os.path.join(
+			mysettings["PORT_LOGDIR"], "%s:%s:%s.log" % \
+			(mysettings["CATEGORY"], mysettings["PF"], logid_time))
+		del logid_path, logid_time
+	else:
+		# When sesandbox is enabled, only log if PORT_LOGDIR is explicitly
+		# enabled since it is possible that local SELinux security policies
+		# do not allow ouput to be piped out of the sesandbox domain.
+		if not (mysettings.selinux_enabled() and \
+			"sesandbox" in mysettings.features):
+			mysettings["PORTAGE_LOG_FILE"] = os.path.join(
+				mysettings["T"], "build.log")
+
+_doebuild_manifest_exempt_depend = 0
+_doebuild_manifest_checked = None
+
+def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
+	fetchonly=0, cleanup=0, dbkey=None, use_cache=1, fetchall=0, tree=None,
+	mydbapi=None, vartree=None, prev_mtimes=None):
+	
+	"""
+	Wrapper function that invokes specific ebuild phases through the spawning
+	of ebuild.sh
+	
+	@param myebuild: name of the ebuild to invoke the phase on (CPV)
+	@type myebuild: String
+	@param mydo: Phase to run
+	@type mydo: String
+	@param myroot: $ROOT (usually '/', see man make.conf)
+	@type myroot: String
+	@param mysettings: Portage Configuration
+	@type mysettings: instance of portage.config
+	@param debug: Turns on various debug information (eg, debug for spawn)
+	@type debug: Boolean
+	@param listonly: Used to wrap fetch(); passed such that fetch only lists files required.
+	@type listonly: Boolean
+	@param fetchonly: Used to wrap fetch(); passed such that files are only fetched (no other actions)
+	@type fetchonly: Boolean
+	@param cleanup: Passed to prepare_build_dirs (TODO: what does it do?)
+	@type cleanup: Boolean
+	@param dbkey: A dict (usually keys and values from the depend phase, such as KEYWORDS, USE, etc..)
+	@type dbkey: Dict or String
+	@param use_cache: Enables the cache
+	@type use_cache: Boolean
+	@param fetchall: Used to wrap fetch(), fetches all URI's (even ones invalid due to USE conditionals)
+	@type fetchall: Boolean
+	@param tree: Which tree to use ('vartree','porttree','bintree', etc..), defaults to 'porttree'
+	@type tree: String
+	@param mydbapi: a dbapi instance to pass to various functions; this should be a portdbapi instance.
+	@type mydbapi: portdbapi instance
+	@param vartree: A instance of vartree; used for aux_get calls, defaults to db[myroot]['vartree']
+	@type vartree: vartree instance
+	@param prev_mtimes: A dict of { filename:mtime } keys used by merge() to do config_protection
+	@type prev_mtimes: dictionary
+	@rtype: Boolean
+	@returns:
+	1. 0 for success
+	2. 1 for error
+	
+	Most errors have an accompanying error message.
+	
+	listonly and fetchonly are only really necessary for operations involving 'fetch'
+	prev_mtimes are only necessary for merge operations.
+	Other variables may not be strictly required, many have defaults that are set inside of doebuild.
+	
+	"""
+	
+	if not tree:
+		writemsg("Warning: tree not specified to doebuild\n")
+		tree = "porttree"
+	global db
+	
+	# chunked out deps for each phase, so that ebuild binary can use it 
+	# to collapse targets down.
+	actionmap_deps={
+	"depend": [],
+	"setup":  [],
+	"unpack": ["setup"],
+	"compile":["unpack"],
+	"test":   ["compile"],
+	"install":["test"],
+	"rpm":    ["install"],
+	"package":["install"],
+	}
+	
+	if mydbapi is None:
+		mydbapi = db[myroot][tree].dbapi
+
+	if vartree is None and mydo in ("merge", "qmerge", "unmerge"):
+		vartree = db[myroot]["vartree"]
+
+	features = mysettings.features
+
+	validcommands = ["help","clean","prerm","postrm","cleanrm","preinst","postinst",
+	                "config","setup","depend","fetch","digest",
+	                "unpack","compile","test","install","rpm","qmerge","merge",
+	                "package","unmerge", "manifest"]
+
+	if mydo not in validcommands:
+		validcommands.sort()
+		writemsg("!!! doebuild: '%s' is not one of the following valid commands:" % mydo,
+			noiselevel=-1)
+		for vcount in range(len(validcommands)):
+			if vcount%6 == 0:
+				writemsg("\n!!! ", noiselevel=-1)
+			writemsg(validcommands[vcount].ljust(11), noiselevel=-1)
+		writemsg("\n", noiselevel=-1)
+		return 1
+
+	if not os.path.exists(myebuild):
+		writemsg("!!! doebuild: %s not found for %s\n" % (myebuild, mydo),
+			noiselevel=-1)
+		return 1
+
+	global _doebuild_manifest_exempt_depend
+
+	if "strict" in features and \
+		"digest" not in features and \
+		tree == "porttree" and \
+		mydo not in ("digest", "manifest", "help") and \
+		not _doebuild_manifest_exempt_depend:
+		# Always verify the ebuild checksums before executing it.
+		pkgdir = os.path.dirname(myebuild)
+		manifest_path = os.path.join(pkgdir, "Manifest")
+		global _doebuild_manifest_checked
+		# Avoid checking the same Manifest several times in a row during a
+		# regen with an empty cache.
+		if _doebuild_manifest_checked != manifest_path:
+			if not os.path.exists(manifest_path):
+				writemsg("!!! Manifest file not found: '%s'\n" % manifest_path,
+					noiselevel=-1)
+				return 1
+			mf = Manifest(pkgdir, mysettings["DISTDIR"])
+			try:
+				mf.checkTypeHashes("EBUILD")
+			except portage.exception.FileNotFound, e:
+				writemsg("!!! A file listed in the Manifest " + \
+					"could not be found: %s\n" % str(e), noiselevel=-1)
+				return 1
+			except portage.exception.DigestException, e:
+				writemsg("!!! Digest verification failed:\n", noiselevel=-1)
+				writemsg("!!! %s\n" % e.value[0], noiselevel=-1)
+				writemsg("!!! Reason: %s\n" % e.value[1], noiselevel=-1)
+				writemsg("!!! Got: %s\n" % e.value[2], noiselevel=-1)
+				writemsg("!!! Expected: %s\n" % e.value[3], noiselevel=-1)
+				return 1
+			# Make sure that all of the ebuilds are actually listed in the
+			# Manifest.
+			for f in os.listdir(pkgdir):
+				if f.endswith(".ebuild") and not mf.hasFile("EBUILD", f):
+					writemsg("!!! A file is not listed in the " + \
+					"Manifest: '%s'\n" % os.path.join(pkgdir, f),
+					noiselevel=-1)
+					return 1
+			_doebuild_manifest_checked = manifest_path
+
+	logfile=None
+	builddir_lock = None
+	try:
+		if mydo in ("digest", "manifest", "help"):
+			# Temporarily exempt the depend phase from manifest checks, in case
+			# aux_get calls trigger cache generation.
+			_doebuild_manifest_exempt_depend += 1
+
+		doebuild_environment(myebuild, mydo, myroot, mysettings, debug,
+			use_cache, mydbapi)
+
+		# get possible slot information from the deps file
+		if mydo == "depend":
+			writemsg("!!! DEBUG: dbkey: %s\n" % str(dbkey), 2)
+			if isinstance(dbkey, dict):
+				mysettings["dbkey"] = ""
+				pr, pw = os.pipe()
+				fd_pipes = {0:0, 1:1, 2:2, 9:pw}
+				mypids = spawn(EBUILD_SH_BINARY + " depend", mysettings,
+					fd_pipes=fd_pipes, returnpid=True)
+				os.close(pw) # belongs exclusively to the child process now
+				maxbytes = 1024
+				mybytes = []
+				while True:
+					mybytes.append(os.read(pr, maxbytes))
+					if not mybytes[-1]:
+						break
+				os.close(pr)
+				mybytes = "".join(mybytes)
+				global auxdbkeys
+				for k, v in izip(auxdbkeys, mybytes.splitlines()):
+					dbkey[k] = v
+				retval = os.waitpid(mypids[0], 0)[1]
+				portage.process.spawned_pids.remove(mypids[0])
+				# If it got a signal, return the signal that was sent, but
+				# shift in order to distinguish it from a return value. (just
+				# like portage.process.spawn() would do).
+				if retval & 0xff:
+					return (retval & 0xff) << 8
+				# Otherwise, return its exit code.
+				return retval >> 8
+			elif dbkey:
+				mysettings["dbkey"] = dbkey
+			else:
+				mysettings["dbkey"] = \
+					os.path.join(mysettings.depcachedir, "aux_db_key_temp")
+
+			return spawn(EBUILD_SH_BINARY + " depend", mysettings)
+
+		# Validate dependency metadata here to ensure that ebuilds with invalid
+		# data are never installed (even via the ebuild command).
+		invalid_dep_exempt_phases = \
+			set(["clean", "cleanrm", "help", "prerm", "postrm"])
+		mycpv = mysettings["CATEGORY"] + "/" + mysettings["PF"]
+		dep_keys = ["DEPEND", "RDEPEND", "PDEPEND"]
+		misc_keys = ["LICENSE", "PROVIDE", "RESTRICT", "SRC_URI"]
+		all_keys = dep_keys + misc_keys
+		metadata = dict(izip(all_keys, mydbapi.aux_get(mycpv, all_keys)))
+		class FakeTree(object):
+			def __init__(self, mydb):
+				self.dbapi = mydb
+		dep_check_trees = {myroot:{}}
+		dep_check_trees[myroot]["porttree"] = \
+			FakeTree(fakedbapi(settings=mysettings))
+		for dep_type in dep_keys:
+			mycheck = dep_check(metadata[dep_type], None, mysettings,
+				myuse="all", myroot=myroot, trees=dep_check_trees)
+			if not mycheck[0]:
+				writemsg("%s: %s\n%s\n" % (
+					dep_type, metadata[dep_type], mycheck[1]), noiselevel=-1)
+				if mydo not in invalid_dep_exempt_phases:
+					return 1
+			del dep_type, mycheck
+		for k in misc_keys:
+			try:
+				portage.dep.use_reduce(
+					portage.dep.paren_reduce(metadata[k]), matchall=True)
+			except portage.exception.InvalidDependString, e:
+				writemsg("%s: %s\n%s\n" % (
+					k, metadata[k], str(e)), noiselevel=-1)
+				del e
+				if mydo not in invalid_dep_exempt_phases:
+					return 1
+			del k
+		del mycpv, dep_keys, metadata, misc_keys, FakeTree, dep_check_trees
+
+		if "PORTAGE_TMPDIR" not in mysettings or \
+			not os.path.isdir(mysettings["PORTAGE_TMPDIR"]):
+			writemsg("The directory specified in your " + \
+				"PORTAGE_TMPDIR variable, '%s',\n" % \
+				mysettings.get("PORTAGE_TMPDIR", ""), noiselevel=-1)
+			writemsg("does not exist.  Please create this directory or " + \
+				"correct your PORTAGE_TMPDIR setting.\n", noiselevel=-1)
+			return 1
+
+		# Build directory creation isn't required for any of these.
+		if mydo not in ("digest", "fetch", "help", "manifest"):
+			mystatus = prepare_build_dirs(myroot, mysettings, cleanup)
+			if mystatus:
+				return mystatus
+			# PORTAGE_LOG_FILE is set above by the prepare_build_dirs() call.
+			logfile = mysettings.get("PORTAGE_LOG_FILE", None)
+		if mydo == "unmerge":
+			return unmerge(mysettings["CATEGORY"],
+				mysettings["PF"], myroot, mysettings, vartree=vartree)
+
+		# if any of these are being called, handle them -- running them out of
+		# the sandbox -- and stop now.
+		if mydo in ["clean","cleanrm"]:
+			return spawn(EBUILD_SH_BINARY + " clean", mysettings,
+				debug=debug, free=1, logfile=None)
+		elif mydo == "help":
+			return spawn(EBUILD_SH_BINARY + " " + mydo, mysettings,
+				debug=debug, free=1, logfile=logfile)
+		elif mydo == "setup":
+			infodir = os.path.join(
+				mysettings["PORTAGE_BUILDDIR"], "build-info")
+			if os.path.isdir(infodir):
+				"""Load USE flags for setup phase of a binary package.
+				Ideally, the environment.bz2 would be used instead."""
+				mysettings.load_infodir(infodir)
+			retval = spawn(EBUILD_SH_BINARY + " " + mydo, mysettings,
+				debug=debug, free=1, logfile=logfile)
+			if secpass >= 2:
+				""" Privileged phases may have left files that need to be made
+				writable to a less privileged user."""
+				apply_recursive_permissions(mysettings["T"],
+					uid=portage_uid, gid=portage_gid, dirmode=070, dirmask=0,
+					filemode=060, filemask=0)
+			return retval
+		elif mydo == "preinst":
+			mysettings["IMAGE"] = mysettings["D"]
+			phase_retval = spawn(" ".join((EBUILD_SH_BINARY, mydo)),
+				mysettings, debug=debug, free=1, logfile=logfile)
+			if phase_retval == os.EX_OK:
+				# Post phase logic and tasks that have been factored out of
+				# ebuild.sh.
+				myargs = [MISC_SH_BINARY, "preinst_bsdflags", "preinst_mask",
+					"preinst_sfperms", "preinst_selinux_labels",
+					"preinst_suid_scan"]
+				mysettings["EBUILD_PHASE"] = ""
+				phase_retval = spawn(" ".join(myargs),
+					mysettings, debug=debug, free=1, logfile=logfile)
+				if phase_retval != os.EX_OK:
+					writemsg("!!! post preinst failed; exiting.\n",
+						noiselevel=-1)
+			del mysettings["IMAGE"]
+			return phase_retval
+		elif mydo == "postinst":
+			mysettings.load_infodir(mysettings["O"])
+			phase_retval = spawn(" ".join((EBUILD_SH_BINARY, mydo)),
+				mysettings, debug=debug, free=1, logfile=logfile)
+			if phase_retval == os.EX_OK:
+				# Post phase logic and tasks that have been factored out of
+				# ebuild.sh.
+				myargs = [MISC_SH_BINARY, "postinst_bsdflags"]
+				mysettings["EBUILD_PHASE"] = ""
+				phase_retval = spawn(" ".join(myargs),
+					mysettings, debug=debug, free=1, logfile=logfile)
+				if phase_retval != os.EX_OK:
+					writemsg("!!! post postinst failed; exiting.\n",
+						noiselevel=-1)
+			return phase_retval
+		elif mydo in ["prerm","postrm","config"]:
+			mysettings.load_infodir(mysettings["O"])
+			return spawn(EBUILD_SH_BINARY + " " + mydo,
+				mysettings, debug=debug, free=1, logfile=logfile)
+
+		mycpv = "/".join((mysettings["CATEGORY"], mysettings["PF"]))
+
+		# Make sure we get the correct tree in case there are overlays.
+		mytree = os.path.realpath(
+			os.path.dirname(os.path.dirname(mysettings["O"])))
+		try:
+			newuris, alist = mydbapi.getfetchlist(
+				mycpv, mytree=mytree, mysettings=mysettings)
+			alluris, aalist = mydbapi.getfetchlist(
+				mycpv, mytree=mytree, all=True, mysettings=mysettings)
+		except portage.exception.InvalidDependString, e:
+			writemsg("!!! %s\n" % str(e), noiselevel=-1)
+			writemsg("!!! Invalid SRC_URI for '%s'.\n" % mycpv, noiselevel=-1)
+			del e
+			return 1
+		mysettings["A"] = " ".join(alist)
+		mysettings["AA"] = " ".join(aalist)
+		if ("mirror" in features) or fetchall:
+			fetchme = alluris[:]
+			checkme = aalist[:]
+		elif mydo == "digest":
+			fetchme = alluris[:]
+			checkme = aalist[:]
+			# Skip files that we already have digests for.
+			mf = Manifest(mysettings["O"], mysettings["DISTDIR"])
+			mydigests = mf.getTypeDigests("DIST")
+			required_hash_types = set()
+			required_hash_types.add("size")
+			required_hash_types.add(portage.const.MANIFEST2_REQUIRED_HASH)
+			for filename, hashes in mydigests.iteritems():
+				if not required_hash_types.difference(hashes):
+					checkme = [i for i in checkme if i != filename]
+					fetchme = [i for i in fetchme \
+						if os.path.basename(i) != filename]
+				del filename, hashes
+		else:
+			fetchme = newuris[:]
+			checkme = alist[:]
+
+		# Only try and fetch the files if we are going to need them ...
+		# otherwise, if user has FEATURES=noauto and they run `ebuild clean
+		# unpack compile install`, we will try and fetch 4 times :/
+		need_distfiles = (mydo in ("fetch", "unpack") or \
+			mydo not in ("digest", "manifest") and "noauto" not in features)
+		if need_distfiles and not fetch(
+			fetchme, mysettings, listonly=listonly, fetchonly=fetchonly):
+			return 1
+
+		if mydo == "fetch" and listonly:
+			return 0
+
+		try:
+			if mydo == "manifest":
+				return not digestgen(aalist, mysettings, overwrite=1,
+					manifestonly=1, myportdb=mydbapi)
+			elif mydo == "digest":
+				return not digestgen(aalist, mysettings, overwrite=1,
+					myportdb=mydbapi)
+			elif "digest" in mysettings.features:
+				digestgen(aalist, mysettings, overwrite=0, myportdb=mydbapi)
+		except portage.exception.PermissionDenied, e:
+			writemsg("!!! %s\n" % str(e), noiselevel=-1)
+			if mydo in ("digest", "manifest"):
+				return 1
+
+		# See above comment about fetching only when needed
+		if not digestcheck(checkme, mysettings, ("strict" in features),
+			(mydo not in ["digest","fetch","unpack"] and \
+			mysettings.get("PORTAGE_CALLER", None) == "ebuild" and \
+			"noauto" in features)):
+			return 1
+
+		if mydo == "fetch":
+			return 0
+
+		# remove PORTAGE_ACTUAL_DISTDIR once cvs/svn is supported via SRC_URI
+		if (mydo != "setup" and "noauto" not in features) or mydo == "unpack":
+			orig_distdir = mysettings["DISTDIR"]
+			mysettings["PORTAGE_ACTUAL_DISTDIR"] = orig_distdir
+			edpath = mysettings["DISTDIR"] = \
+				os.path.join(mysettings["PORTAGE_BUILDDIR"], "distdir")
+			if os.path.exists(edpath):
+				try:
+					if os.path.isdir(edpath) and not os.path.islink(edpath):
+						shutil.rmtree(edpath)
+					else:
+						os.unlink(edpath)
+				except OSError:
+					print "!!! Failed reseting ebuild distdir path, " + edpath
+					raise
+			os.mkdir(edpath)
+			apply_secpass_permissions(edpath, uid=portage_uid, mode=0755)
+			try:
+				for file in alist:
+					os.symlink(os.path.join(orig_distdir, file),
+						os.path.join(edpath, file))
+			except OSError:
+				print "!!! Failed symlinking in '%s' to ebuild distdir" % file
+				raise
+
+		#initial dep checks complete; time to process main commands
+
+		restrict = mysettings["PORTAGE_RESTRICT"].split()
+		nosandbox = (("userpriv" in features) and \
+			("usersandbox" not in features) and \
+			"userpriv" not in restrict and \
+			"nouserpriv" not in restrict)
+		if nosandbox and ("userpriv" not in features or \
+			"userpriv" in restrict or \
+			"nouserpriv" in restrict):
+			nosandbox = ("sandbox" not in features and \
+				"usersandbox" not in features)
+
+		sesandbox = mysettings.selinux_enabled() and \
+			"sesandbox" in mysettings.features
+		ebuild_sh = EBUILD_SH_BINARY + " %s"
+		misc_sh = MISC_SH_BINARY + " dyn_%s"
+
+		# args are for the to spawn function
+		actionmap = {
+"depend": {"cmd":ebuild_sh, "args":{"droppriv":1, "free":0,         "sesandbox":0}},
+"setup":  {"cmd":ebuild_sh, "args":{"droppriv":0, "free":1,         "sesandbox":0}},
+"unpack": {"cmd":ebuild_sh, "args":{"droppriv":1, "free":0,         "sesandbox":sesandbox}},
+"compile":{"cmd":ebuild_sh, "args":{"droppriv":1, "free":nosandbox, "sesandbox":sesandbox}},
+"test":   {"cmd":ebuild_sh, "args":{"droppriv":1, "free":nosandbox, "sesandbox":sesandbox}},
+"install":{"cmd":ebuild_sh, "args":{"droppriv":0, "free":0,         "sesandbox":sesandbox}},
+"rpm":    {"cmd":misc_sh,   "args":{"droppriv":0, "free":0,         "sesandbox":0}},
+"package":{"cmd":misc_sh,   "args":{"droppriv":0, "free":0,         "sesandbox":0}},
+		}
+
+		# merge the deps in so we have again a 'full' actionmap
+		# be glad when this can die.
+		for x in actionmap.keys():
+			if len(actionmap_deps.get(x, [])):
+				actionmap[x]["dep"] = ' '.join(actionmap_deps[x])
+
+		if mydo in actionmap.keys():
+			retval = spawnebuild(mydo,
+				actionmap, mysettings, debug, logfile=logfile)
+		elif mydo=="qmerge":
+			# check to ensure install was run.  this *only* pops up when users
+			# forget it and are using ebuild
+			if not os.path.exists(
+				os.path.join(mysettings["PORTAGE_BUILDDIR"], ".installed")):
+				writemsg("!!! mydo=qmerge, but the install phase has not been run\n",
+					noiselevel=-1)
+				return 1
+			# qmerge is a special phase that implies noclean.
+			if "noclean" not in mysettings.features:
+				mysettings.features.append("noclean")
+			#qmerge is specifically not supposed to do a runtime dep check
+			retval = merge(
+				mysettings["CATEGORY"], mysettings["PF"], mysettings["D"],
+				os.path.join(mysettings["PORTAGE_BUILDDIR"], "build-info"),
+				myroot, mysettings, myebuild=mysettings["EBUILD"], mytree=tree,
+				mydbapi=mydbapi, vartree=vartree, prev_mtimes=prev_mtimes)
+		elif mydo=="merge":
+			retval = spawnebuild("install", actionmap, mysettings, debug,
+				alwaysdep=1, logfile=logfile)
+			if retval == os.EX_OK:
+				retval = merge(mysettings["CATEGORY"], mysettings["PF"],
+					mysettings["D"], os.path.join(mysettings["PORTAGE_BUILDDIR"],
+					"build-info"), myroot, mysettings,
+					myebuild=mysettings["EBUILD"], mytree=tree, mydbapi=mydbapi,
+					vartree=vartree, prev_mtimes=prev_mtimes)
+		else:
+			print "!!! Unknown mydo:",mydo
+			return 1
+
+		if retval != os.EX_OK and tree == "porttree":
+			for i in xrange(len(mydbapi.porttrees)-1):
+				t = mydbapi.porttrees[i+1]
+				if myebuild.startswith(t):
+					# Display the non-cannonical path, in case it's different, to
+					# prevent confusion.
+					overlays = mysettings["PORTDIR_OVERLAY"].split()
+					try:
+						writemsg("!!! This ebuild is from an overlay: '%s'\n" % \
+							overlays[i], noiselevel=-1)
+					except IndexError:
+						pass
+					break
+		return retval
+
+	finally:
+		if builddir_lock:
+			portage.locks.unlockdir(builddir_lock)
+
+		# Make sure that DISTDIR is restored to it's normal value before we return!
+		if "PORTAGE_ACTUAL_DISTDIR" in mysettings:
+			mysettings["DISTDIR"] = mysettings["PORTAGE_ACTUAL_DISTDIR"]
+			del mysettings["PORTAGE_ACTUAL_DISTDIR"]
+
+		if logfile:
+			try:
+				if os.stat(logfile).st_size == 0:
+					os.unlink(logfile)
+			except OSError:
+				pass
+
+		if mydo in ("digest", "manifest", "help"):
+			# If necessary, depend phase has been triggered by aux_get calls
+			# and the exemption is no longer needed.
+			_doebuild_manifest_exempt_depend -= 1
+
+expandcache={}
+
+def movefile(src,dest,newmtime=None,sstat=None,mysettings=None):
+	"""moves a file from src to dest, preserving all permissions and attributes; mtime will
+	be preserved even when moving across filesystems.  Returns true on success and false on
+	failure.  Move is atomic."""
+	#print "movefile("+str(src)+","+str(dest)+","+str(newmtime)+","+str(sstat)+")"
+	global lchown
+	if mysettings is None:
+		global settings
+		mysettings = settings
+	selinux_enabled = mysettings.selinux_enabled()
+	try:
+		if not sstat:
+			sstat=os.lstat(src)
+
+	except SystemExit, e:
+		raise
+	except Exception, e:
+		print "!!! Stating source file failed... movefile()"
+		print "!!!",e
+		return None
+
+	destexists=1
+	try:
+		dstat=os.lstat(dest)
+	except (OSError, IOError):
+		dstat=os.lstat(os.path.dirname(dest))
+		destexists=0
+
+	if bsd_chflags:
+		if destexists and dstat.st_flags != 0:
+			bsd_chflags.lchflags(dest, 0)
+		pflags = os.stat(os.path.dirname(dest)).st_flags
+		if pflags != 0:
+			bsd_chflags.lchflags(os.path.dirname(dest), 0)
+
+	if destexists:
+		if stat.S_ISLNK(dstat[stat.ST_MODE]):
+			try:
+				os.unlink(dest)
+				destexists=0
+			except SystemExit, e:
+				raise
+			except Exception, e:
+				pass
+
+	if stat.S_ISLNK(sstat[stat.ST_MODE]):
+		try:
+			target=os.readlink(src)
+			if mysettings and mysettings["D"]:
+				if target.find(mysettings["D"])==0:
+					target=target[len(mysettings["D"]):]
+			if destexists and not stat.S_ISDIR(dstat[stat.ST_MODE]):
+				os.unlink(dest)
+			if selinux_enabled:
+				sid = selinux.get_lsid(src)
+				selinux.secure_symlink(target,dest,sid)
+			else:
+				os.symlink(target,dest)
+			lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID])
+			# utime() only works on the target of a symlink, so it's not
+			# possible to perserve mtime on symlinks.
+			return os.lstat(dest)[stat.ST_MTIME]
+		except SystemExit, e:
+			raise
+		except Exception, e:
+			print "!!! failed to properly create symlink:"
+			print "!!!",dest,"->",target
+			print "!!!",e
+			return None
+
+	renamefailed=1
+	if sstat[stat.ST_DEV]==dstat[stat.ST_DEV] or selinux_enabled:
+		try:
+			if selinux_enabled:
+				ret=selinux.secure_rename(src,dest)
+			else:
+				ret=os.rename(src,dest)
+			renamefailed=0
+		except SystemExit, e:
+			raise
+		except Exception, e:
+			if e[0]!=errno.EXDEV:
+				# Some random error.
+				print "!!! Failed to move",src,"to",dest
+				print "!!!",e
+				return None
+			# Invalid cross-device-link 'bind' mounted or actually Cross-Device
+	if renamefailed:
+		didcopy=0
+		if stat.S_ISREG(sstat[stat.ST_MODE]):
+			try: # For safety copy then move it over.
+				if selinux_enabled:
+					selinux.secure_copy(src,dest+"#new")
+					selinux.secure_rename(dest+"#new",dest)
+				else:
+					shutil.copyfile(src,dest+"#new")
+					os.rename(dest+"#new",dest)
+				didcopy=1
+			except SystemExit, e:
+				raise
+			except Exception, e:
+				print '!!! copy',src,'->',dest,'failed.'
+				print "!!!",e
+				return None
+		else:
+			#we don't yet handle special, so we need to fall back to /bin/mv
+			if selinux_enabled:
+				a=commands.getstatusoutput(MOVE_BINARY+" -c -f "+"'"+src+"' '"+dest+"'")
+			else:
+				a=commands.getstatusoutput(MOVE_BINARY+" -f "+"'"+src+"' '"+dest+"'")
+				if a[0]!=0:
+					print "!!! Failed to move special file:"
+					print "!!! '"+src+"' to '"+dest+"'"
+					print "!!!",a
+					return None # failure
+		try:
+			if didcopy:
+				if stat.S_ISLNK(sstat[stat.ST_MODE]):
+					lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID])
+				else:
+					os.chown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID])
+				os.chmod(dest, stat.S_IMODE(sstat[stat.ST_MODE])) # Sticky is reset on chown
+				os.unlink(src)
+		except SystemExit, e:
+			raise
+		except Exception, e:
+			print "!!! Failed to chown/chmod/unlink in movefile()"
+			print "!!!",dest
+			print "!!!",e
+			return None
+
+	if newmtime:
+		os.utime(dest,(newmtime,newmtime))
+	else:
+		os.utime(dest, (sstat[stat.ST_ATIME], sstat[stat.ST_MTIME]))
+		newmtime=sstat[stat.ST_MTIME]
+
+	if bsd_chflags:
+		# Restore the flags we saved before moving
+		if pflags:
+			bsd_chflags.lchflags(os.path.dirname(dest), pflags)
+
+	return newmtime
+
+def merge(mycat, mypkg, pkgloc, infloc, myroot, mysettings, myebuild=None,
+	mytree=None, mydbapi=None, vartree=None, prev_mtimes=None):
+	if not os.access(myroot+EPREFIX.lstrip("/"), os.W_OK):
+		writemsg("Permission denied: access('%s', W_OK)\n" %
+				(myroot+EPREFIX.lstrip("/")), noiselevel=-1)
+		return errno.EACCES
+	mylink = dblink(mycat, mypkg, myroot, mysettings, treetype=mytree,
+		vartree=vartree)
+	return mylink.merge(pkgloc, infloc, myroot, myebuild,
+		mydbapi=mydbapi, prev_mtimes=prev_mtimes)
+
+def unmerge(cat, pkg, myroot, mysettings, mytrimworld=1, vartree=None, ldpath_mtimes=None):
+	mylink = dblink(
+		cat, pkg, myroot, mysettings, treetype="vartree", vartree=vartree)
+	try:
+		mylink.lockdb()
+		if mylink.exists():
+			retval = mylink.unmerge(trimworld=mytrimworld, cleanup=1,
+				ldpath_mtimes=ldpath_mtimes)
+			if retval == os.EX_OK:
+				mylink.delete()
+			return retval
+		return os.EX_OK
+	finally:
+		mylink.unlockdb()
+
+def getCPFromCPV(mycpv):
+	"""Calls pkgsplit on a cpv and returns only the cp."""
+	return pkgsplit(mycpv)[0]
+
+def dep_virtual(mysplit, mysettings):
+	"Does virtual dependency conversion"
+	newsplit=[]
+	myvirtuals = mysettings.getvirtuals()
+	for x in mysplit:
+		if isinstance(x, list):
+			newsplit.append(dep_virtual(x, mysettings))
+		else:
+			mykey=dep_getkey(x)
+			mychoices = myvirtuals.get(mykey, None)
+			if mychoices:
+				if len(mychoices) == 1:
+					a = x.replace(mykey, mychoices[0])
+				else:
+					if x[0]=="!":
+						# blocker needs "and" not "or(||)".
+						a=[]
+					else:
+						a=['||']
+					for y in mychoices:
+						a.append(x.replace(mykey, y))
+				newsplit.append(a)
+			else:
+				newsplit.append(x)
+	return newsplit
+
+def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
+	trees=None, **kwargs):
+	"""Recursively expand new-style virtuals so as to collapse one or more
+	levels of indirection.  In dep_zapdeps, new-style virtuals will be assigned
+	zero cost regardless of whether or not they are currently installed. Virtual
+	blockers are supported but only when the virtual expands to a single
+	atom because it wouldn't necessarily make sense to block all the components
+	of a compound virtual.  When more than one new-style virtual is matched,
+	the matches are sorted from highest to lowest versions and the atom is
+	expanded to || ( highest match ... lowest match )."""
+	newsplit = []
+	# According to GLEP 37, RDEPEND is the only dependency type that is valid
+	# for new-style virtuals.  Repoman should enforce this.
+	dep_keys = ["RDEPEND", "DEPEND", "PDEPEND"]
+	def compare_pkgs(a, b):
+		return pkgcmp(b[1], a[1])
+	portdb = trees[myroot]["porttree"].dbapi
+	if kwargs["use_binaries"]:
+		portdb = trees[myroot]["bintree"].dbapi
+	myvirtuals = mysettings.getvirtuals()
+	for x in mysplit:
+		if x == "||":
+			newsplit.append(x)
+			continue
+		elif isinstance(x, list):
+			newsplit.append(_expand_new_virtuals(x, edebug, mydbapi,
+				mysettings, myroot=myroot, trees=trees, **kwargs))
+			continue
+		if portage.dep._dep_check_strict and \
+			not isvalidatom(x, allow_blockers=True):
+			raise portage.exception.ParseError(
+				"invalid atom: '%s'" % x)
+		mykey = dep_getkey(x)
+		if not mykey.startswith("virtual/"):
+			newsplit.append(x)
+			continue
+		mychoices = myvirtuals.get(mykey, [])
+		isblocker = x.startswith("!")
+		match_atom = x
+		if isblocker:
+			match_atom = x[1:]
+		pkgs = {}
+		for cpv in portdb.match(match_atom):
+			# only use new-style matches
+			if cpv.startswith("virtual/"):
+				pkgs[cpv] = (cpv, catpkgsplit(cpv)[1:], portdb)
+		if kwargs["use_binaries"] and "vartree" in trees[myroot]:
+			vardb = trees[myroot]["vartree"].dbapi
+			for cpv in vardb.match(match_atom):
+				# only use new-style matches
+				if cpv.startswith("virtual/"):
+					if cpv in pkgs:
+						continue
+					pkgs[cpv] = (cpv, catpkgsplit(cpv)[1:], vardb)
+		if not (pkgs or mychoices):
+			# This one couldn't be expanded as a new-style virtual.  Old-style
+			# virtuals have already been expanded by dep_virtual, so this one
+			# is unavailable and dep_zapdeps will identify it as such.  The
+			# atom is not eliminated here since it may still represent a
+			# dependency that needs to be satisfied.
+			newsplit.append(x)
+			continue
+		if not pkgs and len(mychoices) == 1:
+			newsplit.append(x.replace(mykey, mychoices[0]))
+			continue
+		pkgs = pkgs.values()
+		pkgs.sort(compare_pkgs) # Prefer higher versions.
+		if isblocker:
+			a = []
+		else:
+			a = ['||']
+		for y in pkgs:
+			depstring = " ".join(y[2].aux_get(y[0], dep_keys))
+			if edebug:
+				print "Virtual Parent:   ", y[0]
+				print "Virtual Depstring:", depstring
+			mycheck = dep_check(depstring, mydbapi, mysettings, myroot=myroot,
+				trees=trees, **kwargs)
+			if not mycheck[0]:
+				raise portage.exception.ParseError(
+					"%s: %s '%s'" % (y[0], mycheck[1], depstring))
+			if isblocker:
+				virtual_atoms = [atom for atom in mycheck[1] \
+					if not atom.startswith("!")]
+				if len(virtual_atoms) == 1:
+					# It wouldn't make sense to block all the components of a
+					# compound virtual, so only a single atom block is allowed.
+					a.append("!" + virtual_atoms[0])
+			else:
+				mycheck[1].append("="+y[0]) # pull in the new-style virtual
+				a.append(mycheck[1])
+		# Plain old-style virtuals.  New-style virtuals are preferred.
+		for y in mychoices:
+			a.append(x.replace(mykey, y))
+		if isblocker and not a:
+			# Probably a compound virtual.  Pass the atom through unprocessed.
+			newsplit.append(x)
+			continue
+		newsplit.append(a)
+	return newsplit
+
+def dep_eval(deplist):
+	if not deplist:
+		return 1
+	if deplist[0]=="||":
+		#or list; we just need one "1"
+		for x in deplist[1:]:
+			if isinstance(x, list):
+				if dep_eval(x)==1:
+					return 1
+			elif x==1:
+					return 1
+		#XXX: unless there's no available atoms in the list
+		#in which case we need to assume that everything is
+		#okay as some ebuilds are relying on an old bug.
+		if len(deplist) == 1:
+			return 1
+		return 0
+	else:
+		for x in deplist:
+			if isinstance(x, list):
+				if dep_eval(x)==0:
+					return 0
+			elif x==0 or x==2:
+				return 0
+		return 1
+
+def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
+	"""Takes an unreduced and reduced deplist and removes satisfied dependencies.
+	Returned deplist contains steps that must be taken to satisfy dependencies."""
+	if trees is None:
+		global db
+		trees = db
+	writemsg("ZapDeps -- %s\n" % (use_binaries), 2)
+	if not reduced or unreduced == ["||"] or dep_eval(reduced):
+		return []
+
+	if unreduced[0] != "||":
+		unresolved = []
+		for dep, satisfied in izip(unreduced, reduced):
+			if isinstance(dep, list):
+				unresolved += dep_zapdeps(dep, satisfied, myroot,
+					use_binaries=use_binaries, trees=trees)
+			elif not satisfied:
+				unresolved.append(dep)
+		return unresolved
+
+	# We're at a ( || atom ... ) type level and need to make a choice
+	deps = unreduced[1:]
+	satisfieds = reduced[1:]
+
+	# Our preference order is for an the first item that:
+	# a) contains all unmasked packages with the same key as installed packages
+	# b) contains all unmasked packages
+	# c) contains masked installed packages
+	# d) is the first item
+
+	preferred = []
+	preferred_any_slot = []
+	possible_upgrades = []
+	other = []
+
+	# Alias the trees we'll be checking availability against
+	vardb = None
+	if "vartree" in trees[myroot]:
+		vardb = trees[myroot]["vartree"].dbapi
+	if use_binaries:
+		mydbapi = trees[myroot]["bintree"].dbapi
+	else:
+		mydbapi = trees[myroot]["porttree"].dbapi
+
+	# Sort the deps into preferred (installed) and other
+	# with values of [[required_atom], availablility]
+	for dep, satisfied in izip(deps, satisfieds):
+		if isinstance(dep, list):
+			atoms = dep_zapdeps(dep, satisfied, myroot,
+				use_binaries=use_binaries, trees=trees)
+		else:
+			atoms = [dep]
+
+		if not vardb:
+			# called by repoman
+			other.append((atoms, None, False))
+			continue
+
+		all_available = True
+		versions = {}
+		for atom in atoms:
+			avail_pkg = best(mydbapi.match(atom))
+			if avail_pkg:
+				avail_slot = "%s:%s" % (dep_getkey(atom),
+					mydbapi.aux_get(avail_pkg, ["SLOT"])[0])
+			elif not avail_pkg and use_binaries:
+				# With --usepkgonly, count installed packages as "available".
+				# Note that --usepkgonly currently has no package.mask support.
+				# See bug #149816.
+				avail_pkg = best(vardb.match(atom))
+				if avail_pkg:
+					avail_slot = "%s:%s" % (dep_getkey(atom),
+						vardb.aux_get(avail_pkg, ["SLOT"])[0])
+			if not avail_pkg:
+				all_available = False
+				break
+
+			versions[avail_slot] = avail_pkg
+
+		this_choice = (atoms, versions, all_available)
+		if all_available:
+			# The "all installed" criterion is not version or slot specific.
+			# If any version of a package is installed then we assume that it
+			# is preferred over other possible packages choices.
+			all_installed = True
+			for atom in set([dep_getkey(atom) for atom in atoms]):
+				# New-style virtuals have zero cost to install.
+				if not vardb.match(atom) and not atom.startswith("virtual/"):
+					all_installed = False
+					break
+			all_installed_slots = False
+			if all_installed:
+				all_installed_slots = True
+				for slot_atom in versions:
+					# New-style virtuals have zero cost to install.
+					if not vardb.match(slot_atom) and \
+						not slot_atom.startswith("virtual/"):
+						all_installed_slots = False
+						break
+			if all_installed:
+				if all_installed_slots:
+					preferred.append(this_choice)
+				else:
+					preferred_any_slot.append(this_choice)
+			else:
+				possible_upgrades.append(this_choice)
+		else:
+			other.append(this_choice)
+
+	# Compare the "all_installed" choices against the "all_available" choices
+	# for possible missed upgrades.  The main purpose of this code is to find
+	# upgrades of new-style virtuals since _expand_new_virtuals() expands them
+	# into || ( highest version ... lowest version ).  We want to prefer the
+	# highest all_available version of the new-style virtual when there is a
+	# lower all_installed version.
+	preferred.extend(preferred_any_slot)
+	preferred.extend(possible_upgrades)
+	possible_upgrades = preferred[1:]
+	for possible_upgrade in possible_upgrades:
+		atoms, versions, all_available = possible_upgrade
+		myslots = set(versions)
+		for other_choice in preferred:
+			if possible_upgrade is other_choice:
+				# possible_upgrade will not be promoted, so move on
+				break
+			o_atoms, o_versions, o_all_available = other_choice
+			intersecting_slots = myslots.intersection(o_versions)
+			if not intersecting_slots:
+				continue
+			has_upgrade = False
+			has_downgrade = False
+			for myslot in intersecting_slots:
+				myversion = versions[myslot]
+				o_version = o_versions[myslot]
+				if myversion != o_version:
+					if myversion == best([myversion, o_version]):
+						has_upgrade = True
+					else:
+						has_downgrade = True
+						break
+			if has_upgrade and not has_downgrade:
+				preferred.remove(possible_upgrade)
+				o_index = preferred.index(other_choice)
+				preferred.insert(o_index, possible_upgrade)
+				break
+
+	# preferred now contains a) and c) from the order above with
+	# the masked flag differentiating the two. other contains b)
+	# and d) so adding other to preferred will give us a suitable
+	# list to iterate over.
+	preferred.extend(other)
+
+	for allow_masked in (False, True):
+		for atoms, versions, all_available in preferred:
+			if all_available or allow_masked:
+				return atoms
+
+	assert(False) # This point should not be reachable
+
+
+def dep_expand(mydep, mydb=None, use_cache=1, settings=None):
+	if not len(mydep):
+		return mydep
+	if mydep[0]=="*":
+		mydep=mydep[1:]
+	orig_dep = mydep
+	mydep = dep_getcpv(orig_dep)
+	myindex = orig_dep.index(mydep)
+	prefix = orig_dep[:myindex]
+	postfix = orig_dep[myindex+len(mydep):]
+	return prefix + cpv_expand(
+		mydep, mydb=mydb, use_cache=use_cache, settings=settings) + postfix
+
+def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None,
+	use_cache=1, use_binaries=0, myroot="/", trees=None):
+	"""Takes a depend string and parses the condition."""
+	edebug = mysettings.get("PORTAGE_DEBUG", None) == "1"
+	#check_config_instance(mysettings)
+	if trees is None:
+		trees = globals()["db"]
+	if use=="yes":
+		if myuse is None:
+			#default behavior
+			myusesplit = mysettings["USE"].split()
+		else:
+			myusesplit = myuse
+			# We've been given useflags to use.
+			#print "USE FLAGS PASSED IN."
+			#print myuse
+			#if "bindist" in myusesplit:
+			#	print "BINDIST is set!"
+			#else:
+			#	print "BINDIST NOT set."
+	else:
+		#we are being run by autouse(), don't consult USE vars yet.
+		# WE ALSO CANNOT USE SETTINGS
+		myusesplit=[]
+
+	#convert parenthesis to sublists
+	try:
+		mysplit = portage.dep.paren_reduce(depstring)
+	except portage.exception.InvalidDependString, e:
+		return [0, str(e)]
+
+	mymasks = set()
+	useforce = set()
+	useforce.add(mysettings["ARCH"])
+	if use == "all":
+		# This masking/forcing is only for repoman.  In other cases, relevant
+		# masking/forcing should have already been applied via
+		# config.regenerate().  Also, binary or installed packages may have
+		# been built with flags that are now masked, and it would be
+		# inconsistent to mask them now.  Additionally, myuse may consist of
+		# flags from a parent package that is being merged to a $ROOT that is
+		# different from the one that mysettings represents.
+		mymasks.update(mysettings.usemask)
+		mymasks.update(mysettings.archlist())
+		mymasks.discard(mysettings["ARCH"])
+		useforce.update(mysettings.useforce)
+		useforce.difference_update(mymasks)
+	try:
+		mysplit = portage.dep.use_reduce(mysplit, uselist=myusesplit,
+			masklist=mymasks, matchall=(use=="all"), excludeall=useforce)
+	except portage.exception.InvalidDependString, e:
+		return [0, str(e)]
+
+	# Do the || conversions
+	mysplit=portage.dep.dep_opconvert(mysplit)
+
+	if mysplit == []:
+		#dependencies were reduced to nothing
+		return [1,[]]
+
+	# Recursively expand new-style virtuals so as to
+	# collapse one or more levels of indirection.
+	try:
+		mysplit = _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings,
+			use=use, mode=mode, myuse=myuse, use_cache=use_cache,
+			use_binaries=use_binaries, myroot=myroot, trees=trees)
+	except portage.exception.ParseError, e:
+		return [0, str(e)]
+
+	mysplit2=mysplit[:]
+	mysplit2=dep_wordreduce(mysplit2,mysettings,mydbapi,mode,use_cache=use_cache)
+	if mysplit2 is None:
+		return [0,"Invalid token"]
+
+	writemsg("\n\n\n", 1)
+	writemsg("mysplit:  %s\n" % (mysplit), 1)
+	writemsg("mysplit2: %s\n" % (mysplit2), 1)
+
+	myzaps = dep_zapdeps(mysplit, mysplit2, myroot,
+		use_binaries=use_binaries, trees=trees)
+	mylist = flatten(myzaps)
+	writemsg("myzaps:   %s\n" % (myzaps), 1)
+	writemsg("mylist:   %s\n" % (mylist), 1)
+	#remove duplicates
+	mydict={}
+	for x in mylist:
+		mydict[x]=1
+	writemsg("mydict:   %s\n" % (mydict), 1)
+	return [1,mydict.keys()]
+
+def dep_wordreduce(mydeplist,mysettings,mydbapi,mode,use_cache=1):
+	"Reduces the deplist to ones and zeros"
+	deplist=mydeplist[:]
+	for mypos in xrange(len(deplist)):
+		if isinstance(deplist[mypos], list):
+			#recurse
+			deplist[mypos]=dep_wordreduce(deplist[mypos],mysettings,mydbapi,mode,use_cache=use_cache)
+		elif deplist[mypos]=="||":
+			pass
+		else:
+			mykey = dep_getkey(deplist[mypos])
+			if mysettings and mysettings.pprovideddict.has_key(mykey) and \
+			        match_from_list(deplist[mypos], mysettings.pprovideddict[mykey]):
+				deplist[mypos]=True
+			elif mydbapi is None:
+				# Assume nothing is satisfied.  This forces dep_zapdeps to
+				# return all of deps the deps that have been selected
+				# (excluding those satisfied by package.provided).
+				deplist[mypos] = False
+			else:
+				if mode:
+					mydep=mydbapi.xmatch(mode,deplist[mypos])
+				else:
+					mydep=mydbapi.match(deplist[mypos],use_cache=use_cache)
+				if mydep!=None:
+					tmp=(len(mydep)>=1)
+					if deplist[mypos][0]=="!":
+						tmp=False
+					deplist[mypos]=tmp
+				else:
+					#encountered invalid string
+					return None
+	return deplist
+
+def cpv_getkey(mycpv):
+	myslash=mycpv.split("/")
+	mysplit=pkgsplit(myslash[-1])
+	mylen=len(myslash)
+	if mylen==2:
+		return myslash[0]+"/"+mysplit[0]
+	elif mylen==1:
+		return mysplit[0]
+	else:
+		return mysplit
+
+def key_expand(mykey, mydb=None, use_cache=1, settings=None):
+	mysplit=mykey.split("/")
+	if settings is None:
+		settings = globals()["settings"]
+	virts = settings.getvirtuals("/")
+	virts_p = settings.get_virts_p("/")
+	if len(mysplit)==1:
+		if hasattr(mydb, "cp_list"):
+			for x in settings.categories:
+				if mydb.cp_list(x+"/"+mykey,use_cache=use_cache):
+					return x+"/"+mykey
+			if virts_p.has_key(mykey):
+				return(virts_p[mykey][0])
+		return "null/"+mykey
+	elif mydb:
+		if hasattr(mydb, "cp_list"):
+			if (not mydb.cp_list(mykey,use_cache=use_cache)) and virts and virts.has_key(mykey):
+				return virts[mykey][0]
+		return mykey
+
+def cpv_expand(mycpv, mydb=None, use_cache=1, settings=None):
+	"""Given a string (packagename or virtual) expand it into a valid
+	cat/package string. Virtuals use the mydb to determine which provided
+	virtual is a valid choice and defaults to the first element when there
+	are no installed/available candidates."""
+	myslash=mycpv.split("/")
+	mysplit=pkgsplit(myslash[-1])
+	if settings is None:
+		settings = globals()["settings"]
+	virts = settings.getvirtuals("/")
+	virts_p = settings.get_virts_p("/")
+	if len(myslash)>2:
+		# this is illegal case.
+		mysplit=[]
+		mykey=mycpv
+	elif len(myslash)==2:
+		if mysplit:
+			mykey=myslash[0]+"/"+mysplit[0]
+		else:
+			mykey=mycpv
+		if mydb and virts and mykey in virts:
+			writemsg("mydb.__class__: %s\n" % (mydb.__class__), 1)
+			if hasattr(mydb, "cp_list"):
+				if not mydb.cp_list(mykey, use_cache=use_cache):
+					writemsg("virts[%s]: %s\n" % (str(mykey),virts[mykey]), 1)
+					mykey_orig = mykey[:]
+					for vkey in virts[mykey]:
+						if mydb.cp_list(vkey,use_cache=use_cache):
+							mykey = vkey
+							writemsg("virts chosen: %s\n" % (mykey), 1)
+							break
+					if mykey == mykey_orig:
+						mykey=virts[mykey][0]
+						writemsg("virts defaulted: %s\n" % (mykey), 1)
+			#we only perform virtual expansion if we are passed a dbapi
+	else:
+		#specific cpv, no category, ie. "foo-1.0"
+		if mysplit:
+			myp=mysplit[0]
+		else:
+			# "foo" ?
+			myp=mycpv
+		mykey=None
+		matches=[]
+		if mydb:
+			for x in settings.categories:
+				if mydb.cp_list(x+"/"+myp,use_cache=use_cache):
+					matches.append(x+"/"+myp)
+		if len(matches) > 1:
+			virtual_name_collision = False
+			if len(matches) == 2:
+				for x in matches:
+					if not x.startswith("virtual/"):
+						# Assume that the non-virtual is desired.  This helps
+						# avoid the ValueError for invalid deps that come from
+						# installed packages (during reverse blocker detection,
+						# for example).
+						mykey = x
+					else:
+						virtual_name_collision = True
+			if not virtual_name_collision:
+				raise ValueError, matches
+		elif matches:
+			mykey=matches[0]
+
+		if not mykey and not isinstance(mydb, list):
+			if virts_p.has_key(myp):
+				mykey=virts_p[myp][0]
+			#again, we only perform virtual expansion if we have a dbapi (not a list)
+		if not mykey:
+			mykey="null/"+myp
+	if mysplit:
+		if mysplit[2]=="r0":
+			return mykey+"-"+mysplit[1]
+		else:
+			return mykey+"-"+mysplit[1]+"-"+mysplit[2]
+	else:
+		return mykey
+
+def getmaskingreason(mycpv, settings=None, portdb=None, return_location=False):
+	from portage.util import grablines
+	if settings is None:
+		settings = globals()["settings"]
+	if portdb is None:
+		portdb = globals()["portdb"]
+	mysplit = catpkgsplit(mycpv)
+	if not mysplit:
+		raise ValueError("invalid CPV: %s" % mycpv)
+	if not portdb.cpv_exists(mycpv):
+		raise KeyError("CPV %s does not exist" % mycpv)
+	mycp=mysplit[0]+"/"+mysplit[1]
+
+	# XXX- This is a temporary duplicate of code from the config constructor.
+	locations = [os.path.join(settings["PORTDIR"], "profiles")]
+	locations.extend(settings.profiles)
+	for ov in settings["PORTDIR_OVERLAY"].split():
+		profdir = os.path.join(normalize_path(ov), "profiles")
+		if os.path.isdir(profdir):
+			locations.append(profdir)
+	locations.append(os.path.join(settings["PORTAGE_CONFIGROOT"],
+		USER_CONFIG_PATH.lstrip(os.path.sep)))
+	locations.reverse()
+	pmasklists = [(x, grablines(os.path.join(x, "package.mask"), recursive=1)) for x in locations]
+
+	if settings.pmaskdict.has_key(mycp):
+		for x in settings.pmaskdict[mycp]:
+			if mycpv in portdb.xmatch("match-all", x):
+				comment = ""
+				l = "\n"
+				comment_valid = -1
+				for pmask in pmasklists:
+					pmask_filename = os.path.join(pmask[0], "package.mask")
+					for i in xrange(len(pmask[1])):
+						l = pmask[1][i].strip()
+						if l == "":
+							comment = ""
+							comment_valid = -1
+						elif l[0] == "#":
+							comment += (l+"\n")
+							comment_valid = i + 1
+						elif l == x:
+							if comment_valid != i:
+								comment = ""
+							if return_location:
+								return (comment, pmask_filename)
+							else:
+								return comment
+						elif comment_valid != -1:
+							# Apparently this comment applies to muliple masks, so
+							# it remains valid until a blank line is encountered.
+							comment_valid += 1
+	if return_location:
+		return (None, None)
+	else:
+		return None
+
+def getmaskingstatus(mycpv, settings=None, portdb=None):
+	if settings is None:
+		settings = config(clone=globals()["settings"])
+	if portdb is None:
+		portdb = globals()["portdb"]
+	mysplit = catpkgsplit(mycpv)
+	if not mysplit:
+		raise ValueError("invalid CPV: %s" % mycpv)
+	if not portdb.cpv_exists(mycpv):
+		raise KeyError("CPV %s does not exist" % mycpv)
+	mycp=mysplit[0]+"/"+mysplit[1]
+
+	rValue = []
+
+	# package.mask checking
+	maskdict=settings.pmaskdict
+	unmaskdict=settings.punmaskdict
+	if maskdict.has_key(mycp):
+		for x in maskdict[mycp]:
+			if mycpv in portdb.xmatch("match-all", x):
+				unmask=0
+				if unmaskdict.has_key(mycp):
+					for z in unmaskdict[mycp]:
+						if mycpv in portdb.xmatch("match-all",z):
+							unmask=1
+							break
+				if unmask==0:
+					rValue.append("package.mask")
+
+	# keywords checking
+	try:
+		mygroups, licenses, eapi = portdb.aux_get(
+			mycpv, ["KEYWORDS", "LICENSE", "EAPI"])
+	except KeyError:
+		# The "depend" phase apparently failed for some reason.  An associated
+		# error message will have already been printed to stderr.
+		return ["corruption"]
+	if not eapi_is_supported(eapi):
+		return ["required EAPI %s, supported EAPI %s" % (eapi, portage.const.EAPI)]
+	mygroups = mygroups.split()
+	pgroups = settings["ACCEPT_KEYWORDS"].split()
+	myarch = settings["ARCH"]
+	if pgroups and myarch not in pgroups:
+		"""For operating systems other than Linux, ARCH is not necessarily a
+		valid keyword."""
+		myarch = pgroups[0].lstrip("~")
+	pkgdict = settings.pkeywordsdict
+
+	cp = dep_getkey(mycpv)
+	if pkgdict.has_key(cp):
+		matches = match_to_list(mycpv, pkgdict[cp].keys())
+		for match in matches:
+			pgroups.extend(pkgdict[cp][match])
+		if matches:
+			inc_pgroups = []
+			for x in pgroups:
+				if x == "-*":
+					inc_pgroups = []
+				elif x[0] == "-":
+					try:
+						inc_pgroups.remove(x[1:])
+					except ValueError:
+						pass
+				elif x not in inc_pgroups:
+					inc_pgroups.append(x)
+			pgroups = inc_pgroups
+			del inc_pgroups
+
+	kmask = "missing"
+
+	for keyword in pgroups:
+		if keyword in mygroups:
+			kmask=None
+
+	if kmask:
+		fallback = None
+		for gp in mygroups:
+			if gp=="*":
+				kmask=None
+				break
+			elif gp=="-"+myarch and myarch in pgroups:
+				kmask="-"+myarch
+				break
+			elif gp=="~"+myarch and myarch in pgroups:
+				kmask="~"+myarch
+				break
+
+	if kmask:
+		rValue.append(kmask+" keyword")
+
+	uselist = []
+	if "?" in licenses:
+		settings.setcpv(mycpv, mydb=portdb)
+		uselist = settings.get("USE", "").split()
+	try:
+		missing_licenses = settings.getMissingLicenses(
+			licenses, mycpv, uselist)
+		if missing_licenses:
+			allowed_tokens = set(["||", "(", ")"])
+			allowed_tokens.update(missing_licenses)
+			license_split = licenses.split()
+			license_split = [x for x in license_split \
+				if x in allowed_tokens]
+			msg = license_split[:]
+			msg.append("license(s)")
+			rValue.append(" ".join(msg))
+	except portage.exception.InvalidDependString, e:
+		rValue.append("LICENSE: "+str(e))
+
+	return rValue
+
+
+auxdbkeys=[
+  'DEPEND',    'RDEPEND',   'SLOT',      'SRC_URI',
+	'RESTRICT',  'HOMEPAGE',  'LICENSE',   'DESCRIPTION',
+	'KEYWORDS',  'INHERITED', 'IUSE',      'CDEPEND',
+	'PDEPEND',   'PROVIDE', 'EAPI',
+	'UNUSED_01', 'UNUSED_02', 'UNUSED_03', 'UNUSED_04',
+	'UNUSED_05', 'UNUSED_06', 'UNUSED_07',
+	]
+auxdbkeylen=len(auxdbkeys)
+
+from portage.dbapi import dbapi
+from portage.dbapi.virtual import fakedbapi
+from portage.dbapi.bintree import bindbapi, binarytree
+from portage.dbapi.vartree import vardbapi, vartree, dblink
+from portage.dbapi.porttree import close_portdbapi_caches, portdbapi, portagetree
+
+class FetchlistDict(UserDict.DictMixin):
+	"""This provide a mapping interface to retrieve fetch lists.  It's used
+	to allow portage.manifest.Manifest to access fetch lists via a standard
+	mapping interface rather than use the dbapi directly."""
+	def __init__(self, pkgdir, settings, mydbapi):
+		"""pkgdir is a directory containing ebuilds and settings is passed into
+		portdbapi.getfetchlist for __getitem__ calls."""
+		self.pkgdir = pkgdir
+		self.cp = os.sep.join(pkgdir.split(os.sep)[-2:])
+		self.settings = settings
+		self.mytree = os.path.realpath(os.path.dirname(os.path.dirname(pkgdir)))
+		self.portdb = mydbapi
+	def __getitem__(self, pkg_key):
+		"""Returns the complete fetch list for a given package."""
+		return self.portdb.getfetchlist(pkg_key, mysettings=self.settings,
+			all=True, mytree=self.mytree)[1]
+	def has_key(self, pkg_key):
+		"""Returns true if the given package exists within pkgdir."""
+		return pkg_key in self.keys()
+	def keys(self):
+		"""Returns keys for all packages within pkgdir"""
+		return self.portdb.cp_list(self.cp, mytree=self.mytree)
+
+def pkgmerge(mytbz2, myroot, mysettings, mydbapi=None, vartree=None, prev_mtimes=None):
+	"""will merge a .tbz2 file, returning a list of runtime dependencies
+		that must be satisfied, or None if there was a merge error.	This
+		code assumes the package exists."""
+	global db
+	if mydbapi is None:
+		mydbapi = db[myroot]["bintree"].dbapi
+	if vartree is None:
+		vartree = db[myroot]["vartree"]
+	if mytbz2[-5:]!=".tbz2":
+		print "!!! Not a .tbz2 file"
+		return 1
+
+	tbz2_lock = None
+	builddir_lock = None
+	catdir_lock = None
+	try:
+		""" Don't lock the tbz2 file because the filesytem could be readonly or
+		shared by a cluster."""
+		#tbz2_lock = portage.locks.lockfile(mytbz2, wantnewlockfile=1)
+
+		mypkg = os.path.basename(mytbz2)[:-5]
+		xptbz2 = portage.xpak.tbz2(mytbz2)
+		mycat = xptbz2.getfile("CATEGORY")
+		if not mycat:
+			writemsg("!!! CATEGORY info missing from info chunk, aborting...\n",
+				noiselevel=-1)
+			return 1
+		mycat = mycat.strip()
+
+		# These are the same directories that would be used at build time.
+		builddir = os.path.join(
+			mysettings["PORTAGE_TMPDIR"], "portage", mycat, mypkg)
+		catdir = os.path.dirname(builddir)
+		pkgloc = os.path.join(builddir, "image")
+		infloc = os.path.join(builddir, "build-info")
+		myebuild = os.path.join(
+			infloc, os.path.basename(mytbz2)[:-4] + "ebuild")
+		portage.util.ensure_dirs(os.path.dirname(catdir),
+			uid=portage_uid, gid=portage_gid, mode=070, mask=0)
+		catdir_lock = portage.locks.lockdir(catdir)
+		portage.util.ensure_dirs(catdir,
+			uid=portage_uid, gid=portage_gid, mode=070, mask=0)
+		builddir_lock = portage.locks.lockdir(builddir)
+		try:
+			portage.locks.unlockdir(catdir_lock)
+		finally:
+			catdir_lock = None
+		try:
+			shutil.rmtree(builddir)
+		except (IOError, OSError), e:
+			if e.errno != errno.ENOENT:
+				raise
+			del e
+		for mydir in (builddir, pkgloc, infloc):
+			portage.util.ensure_dirs(mydir, uid=portage_uid,
+				gid=portage_gid, mode=0755)
+		writemsg_stdout(">>> Extracting info\n")
+		xptbz2.unpackinfo(infloc)
+		mysettings.load_infodir(infloc)
+		# Store the md5sum in the vdb.
+		fp = open(os.path.join(infloc, "BINPKGMD5"), "w")
+		fp.write(str(portage.checksum.perform_md5(mytbz2))+"\n")
+		fp.close()
+
+		debug = mysettings.get("PORTAGE_DEBUG", "") == "1"
+
+		# Eventually we'd like to pass in the saved ebuild env here.
+		retval = doebuild(myebuild, "setup", myroot, mysettings, debug=debug,
+			tree="bintree", mydbapi=mydbapi, vartree=vartree)
+		if retval != os.EX_OK:
+			writemsg("!!! Setup failed: %s\n" % retval, noiselevel=-1)
+			return retval
+
+		writemsg_stdout(">>> Extracting %s\n" % mypkg)
+		retval = portage.process.spawn_bash(
+			"bzip2 -dqc -- '%s' | tar -xp -C '%s' -f -" % (mytbz2, pkgloc),
+			env=mysettings.environ())
+		if retval != os.EX_OK:
+			writemsg("!!! Error Extracting '%s'\n" % mytbz2, noiselevel=-1)
+			return retval
+		#portage.locks.unlockfile(tbz2_lock)
+		#tbz2_lock = None
+
+		mylink = dblink(mycat, mypkg, myroot, mysettings, vartree=vartree,
+			treetype="bintree")
+		retval = mylink.merge(pkgloc, infloc, myroot, myebuild, cleanup=0,
+			mydbapi=mydbapi, prev_mtimes=prev_mtimes)
+		return retval
+	finally:
+		if tbz2_lock:
+			portage.locks.unlockfile(tbz2_lock)
+		if builddir_lock:
+			try:
+				shutil.rmtree(builddir)
+			except (IOError, OSError), e:
+				if e.errno != errno.ENOENT:
+					raise
+				del e
+			portage.locks.unlockdir(builddir_lock)
+			try:
+				if not catdir_lock:
+					# Lock catdir for removal if empty.
+					catdir_lock = portage.locks.lockdir(catdir)
+			finally:
+				if catdir_lock:
+					try:
+						os.rmdir(catdir)
+					except OSError, e:
+						if e.errno not in (errno.ENOENT,
+							errno.ENOTEMPTY, errno.EEXIST):
+							raise
+						del e
+					portage.locks.unlockdir(catdir_lock)
+
+def deprecated_profile_check():
+	if not os.access(DEPRECATED_PROFILE_FILE, os.R_OK):
+		return False
+	deprecatedfile = open(DEPRECATED_PROFILE_FILE, "r")
+	dcontent = deprecatedfile.readlines()
+	deprecatedfile.close()
+	newprofile = dcontent[0]
+	writemsg(red("\n!!! Your current profile is deprecated and not supported anymore.\n"),
+		noiselevel=-1)
+	writemsg(red("!!! Please upgrade to the following profile if possible:\n"),
+		noiselevel=-1)
+	writemsg(8*" "+green(newprofile)+"\n", noiselevel=-1)
+	if len(dcontent) > 1:
+		writemsg("To upgrade do the following steps:\n", noiselevel=-1)
+		for myline in dcontent[1:]:
+			writemsg(myline, noiselevel=-1)
+		writemsg("\n\n", noiselevel=-1)
+	return True
+
+# gets virtual package settings
+def getvirtuals(myroot):
+	global settings
+	writemsg("--- DEPRECATED call to getvirtual\n")
+	return settings.getvirtuals(myroot)
+
+def commit_mtimedb(mydict=None, filename=None):
+	if mydict is None:
+		global mtimedb
+		if "mtimedb" not in globals() or mtimedb is None:
+			return
+		mtimedb.commit()
+		return
+	if filename is None:
+		global mtimedbfile
+		filename = mtimedbfile
+	mydict["version"] = VERSION
+	d = {} # for full backward compat, pickle it as a plain dict object.
+	d.update(mydict)
+	try:
+		f = atomic_ofstream(filename)
+		cPickle.dump(d, f, -1)
+		f.close()
+		portage.util.apply_secpass_permissions(filename, uid=uid, gid=portage_gid, mode=0664)
+	except (IOError, OSError), e:
+		pass
+
+def portageexit():
+	global uid,portage_gid,portdb,db
+	if secpass and not os.environ.has_key("SANDBOX_ACTIVE"):
+		close_portdbapi_caches()
+		commit_mtimedb()
+
+atexit_register(portageexit)
+
+def _global_updates(trees, prev_mtimes):
+	"""
+	Perform new global updates if they exist in $PORTDIR/profiles/updates/.
+
+	@param trees: A dictionary containing portage trees.
+	@type trees: dict
+	@param prev_mtimes: A dictionary containing mtimes of files located in
+		$PORTDIR/profiles/updates/.
+	@type prev_mtimes: dict
+	@rtype: None or List
+	@return: None if no were no updates, otherwise a list of update commands
+		that have been performed.
+	"""
+	# only do this if we're root and not running repoman/ebuild digest
+	global secpass
+	if secpass < 2 or "SANDBOX_ACTIVE" in os.environ:
+		return
+	mysettings = trees["/"]["vartree"].settings
+	updpath = os.path.join(mysettings["PORTDIR"], "profiles", "updates")
+
+	try:
+		if mysettings["PORTAGE_CALLER"] == "fixpackages":
+			update_data = grab_updates(updpath)
+		else:
+			update_data = grab_updates(updpath, prev_mtimes)
+	except portage.exception.DirectoryNotFound:
+		writemsg("--- 'profiles/updates' is empty or not available. Empty portage tree?\n")
+		return
+	myupd = None
+	if len(update_data) > 0:
+		do_upgrade_packagesmessage = 0
+		myupd = []
+		timestamps = {}
+		for mykey, mystat, mycontent in update_data:
+			writemsg_stdout("\n\n")
+			writemsg_stdout(green("Performing Global Updates: ")+bold(mykey)+"\n")
+			writemsg_stdout("(Could take a couple of minutes if you have a lot of binary packages.)\n")
+			writemsg_stdout("  "+bold(".")+"='update pass'  "+bold("*")+"='binary update'  "+bold("@")+"='/var/db move'\n"+"  "+bold("s")+"='/var/db SLOT move' "+bold("S")+"='binary SLOT move' "+bold("p")+"='update /etc/portage/package.*'\n")
+			valid_updates, errors = parse_updates(mycontent)
+			myupd.extend(valid_updates)
+			writemsg_stdout(len(valid_updates) * "." + "\n")
+			if len(errors) == 0:
+				# Update our internal mtime since we
+				# processed all of our directives.
+				timestamps[mykey] = long(mystat.st_mtime)
+			else:
+				for msg in errors:
+					writemsg("%s\n" % msg, noiselevel=-1)
+
+		update_config_files("/",
+			mysettings.get("CONFIG_PROTECT","").split(),
+			mysettings.get("CONFIG_PROTECT_MASK","").split(),
+			myupd)
+
+		trees["/"]["bintree"] = binarytree("/", mysettings["PKGDIR"],
+			settings=mysettings)
+		vardb = trees["/"]["vartree"].dbapi
+		bindb = trees["/"]["bintree"].dbapi
+		if not os.access(bindb.bintree.pkgdir, os.W_OK):
+			bindb = None
+		for update_cmd in myupd:
+			if update_cmd[0] == "move":
+				moves = vardb.move_ent(update_cmd)
+				if moves:
+					writemsg_stdout(moves * "@")
+				if bindb:
+					moves = bindb.move_ent(update_cmd)
+					if moves:
+						writemsg_stdout(moves * "%")
+			elif update_cmd[0] == "slotmove":
+				moves = vardb.move_slot_ent(update_cmd)
+				if moves:
+					writemsg_stdout(moves * "s")
+				if bindb:
+					moves = bindb.move_slot_ent(update_cmd)
+					if moves:
+						writemsg_stdout(moves * "S")
+
+		# The above global updates proceed quickly, so they
+		# are considered a single mtimedb transaction.
+		if len(timestamps) > 0:
+			# We do not update the mtime in the mtimedb
+			# until after _all_ of the above updates have
+			# been processed because the mtimedb will
+			# automatically commit when killed by ctrl C.
+			for mykey, mtime in timestamps.iteritems():
+				prev_mtimes[mykey] = mtime
+
+		# We gotta do the brute force updates for these now.
+		if mysettings["PORTAGE_CALLER"] == "fixpackages" or \
+		"fixpackages" in mysettings.features:
+			def onProgress(maxval, curval):
+				writemsg_stdout("*")
+			vardb.update_ents(myupd, onProgress=onProgress)
+			if bindb:
+				bindb.update_ents(myupd, onProgress=onProgress)
+		else:
+			do_upgrade_packagesmessage = 1
+
+		# Update progress above is indicated by characters written to stdout so
+		# we print a couple new lines here to separate the progress output from
+		# what follows.
+		print
+		print
+
+		if do_upgrade_packagesmessage and bindb and \
+			bindb.cpv_all():
+			writemsg_stdout(" ** Skipping packages. Run 'fixpackages' or set it in FEATURES to fix the")
+			writemsg_stdout("\n    tbz2's in the packages directory. "+bold("Note: This can take a very long time."))
+			writemsg_stdout("\n")
+	if myupd:
+		return myupd
+
+#continue setting up other trees
+
+class MtimeDB(dict):
+	def __init__(self, filename):
+		dict.__init__(self)
+		self.filename = filename
+		self._load(filename)
+
+	def _load(self, filename):
+		try:
+			f = open(filename)
+			mypickle = cPickle.Unpickler(f)
+			mypickle.find_global = None
+			d = mypickle.load()
+			f.close()
+			del f
+		except (IOError, OSError, EOFError, cPickle.UnpicklingError):
+			d = {}
+
+		if "old" in d:
+			d["updates"] = d["old"]
+			del d["old"]
+		if "cur" in d:
+			del d["cur"]
+
+		d.setdefault("starttime", 0)
+		d.setdefault("version", "")
+		for k in ("info", "ldpath", "updates"):
+			d.setdefault(k, {})
+
+		mtimedbkeys = set(("info", "ldpath", "resume", "resume_backup",
+			"starttime", "updates", "version"))
+
+		for k in d.keys():
+			if k not in mtimedbkeys:
+				writemsg("Deleting invalid mtimedb key: %s\n" % str(k))
+				del d[k]
+		self.update(d)
+		self._clean_data = copy.deepcopy(d)
+
+	def commit(self):
+		if not self.filename:
+			return
+		d = {}
+		d.update(self)
+		# Only commit if the internal state has changed.
+		if d != self._clean_data:
+			commit_mtimedb(mydict=d, filename=self.filename)
+			self._clean_data = copy.deepcopy(d)
+
+def create_trees(config_root=None, target_root=None, trees=None):
+	if trees is None:
+		trees = {}
+	else:
+		# clean up any existing portdbapi instances
+		for myroot in trees:
+			portdb = trees[myroot]["porttree"].dbapi
+			portdb.close_caches()
+			portdbapi.portdbapi_instances.remove(portdb)
+			del trees[myroot]["porttree"], myroot, portdb
+
+	settings = config(config_root=config_root, target_root=target_root,
+		config_incrementals=portage.const.INCREMENTALS)
+	settings.lock()
+	settings.validate()
+
+	myroots = [(settings["ROOT"], settings)]
+	if settings["ROOT"] != "/":
+		settings = config(config_root=None, target_root=None,
+			config_incrementals=portage.const.INCREMENTALS)
+		settings.lock()
+		settings.validate()
+		myroots.append((settings["ROOT"], settings))
+
+	for myroot, mysettings in myroots:
+		trees[myroot] = portage.util.LazyItemsDict(trees.get(myroot, None))
+		trees[myroot].addLazySingleton("virtuals", mysettings.getvirtuals, myroot)
+		trees[myroot].addLazySingleton(
+			"vartree", vartree, myroot, categories=mysettings.categories,
+				settings=mysettings)
+		trees[myroot].addLazySingleton("porttree",
+			portagetree, myroot, settings=mysettings)
+		trees[myroot].addLazySingleton("bintree",
+			binarytree, myroot, mysettings["PKGDIR"], settings=mysettings)
+	return trees
+
+# Initialization of legacy globals.  No functions/classes below this point
+# please!  When the above functions and classes become independent of the
+# below global variables, it will be possible to make the below code
+# conditional on a backward compatibility flag (backward compatibility could
+# be disabled via an environment variable, for example).  This will enable new
+# code that is aware of this flag to import portage without the unnecessary
+# overhead (and other issues!) of initializing the legacy globals.
+
+def init_legacy_globals():
+	global db, settings, root, portdb, selinux_enabled, mtimedbfile, mtimedb, \
+	archlist, features, groups, pkglines, thirdpartymirrors, usedefaults, \
+	profiledir, flushmtimedb
+
+	# Portage needs to ensure a sane umask for the files it creates.
+	os.umask(022)
+
+	kwargs = {}
+	for k, envvar in (("config_root", "PORTAGE_CONFIGROOT"), ("target_root", "ROOT")):
+		kwargs[k] = os.environ.get(envvar, "/")
+
+	db = create_trees(**kwargs)
+
+	settings = db["/"]["vartree"].settings
+	portdb = db["/"]["porttree"].dbapi
+
+	for myroot in db:
+		if myroot != "/":
+			settings = db[myroot]["vartree"].settings
+			portdb = db[myroot]["porttree"].dbapi
+			break
+
+	root = settings["ROOT"]
+
+	mtimedbfile = os.path.join("/", CACHE_PATH.lstrip(os.path.sep), "mtimedb")
+	mtimedb = MtimeDB(mtimedbfile)
+
+	# ========================================================================
+	# COMPATIBILITY
+	# These attributes should not be used
+	# within Portage under any circumstances.
+	# ========================================================================
+	archlist    = settings.archlist()
+	features    = settings.features
+	groups      = settings["ACCEPT_KEYWORDS"].split()
+	pkglines    = settings.packages
+	selinux_enabled   = settings.selinux_enabled()
+	thirdpartymirrors = settings.thirdpartymirrors()
+	usedefaults       = settings.use_defs
+	profiledir  = None
+	if os.path.isdir(PROFILE_PATH):
+		profiledir = PROFILE_PATH
+	def flushmtimedb(record):
+		writemsg("portage.flushmtimedb() is DEPRECATED\n")
+	# ========================================================================
+	# COMPATIBILITY
+	# These attributes should not be used
+	# within Portage under any circumstances.
+	# ========================================================================
+
+# WARNING!
+# The PORTAGE_LEGACY_GLOBALS environment variable is reserved for internal
+# use within Portage.  External use of this variable is unsupported because
+# it is experimental and it's behavior is likely to change.
+if "PORTAGE_LEGACY_GLOBALS" not in os.environ:
+	init_legacy_globals()
+
+# Clear the cache
+dircache={}
+
+# ============================================================================
+# ============================================================================
+
Index: /vendor/prefix-portage/current/pym/portage/cache/__init__.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/cache/__init__.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/cache/__init__.py	(revision 3489)
@@ -0,0 +1,5 @@
+# Copyright: 2005 Gentoo Foundation
+# Author(s): Brian Harring (ferringb@gentoo.org)
+# License: GPL2
+# $Id: __init__.py 1911 2005-08-25 03:44:21Z ferringb $
+
Index: /vendor/prefix-portage/current/pym/portage/cache/anydbm.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/cache/anydbm.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/cache/anydbm.py	(revision 3489)
@@ -0,0 +1,72 @@
+# Copyright: 2005 Gentoo Foundation
+# Author(s): Brian Harring (ferringb@gentoo.org)
+# License: GPL2
+# $Id: anydbm.py 1911 2005-08-25 03:44:21Z ferringb $
+
+anydbm_module = __import__("anydbm")
+try:
+	import cPickle as pickle
+except ImportError:
+	import pickle
+import os
+from portage.cache import fs_template
+from portage.cache import cache_errors
+
+
+class database(fs_template.FsBased):
+
+	autocommits = True
+	cleanse_keys = True
+	serialize_eclasses = False
+
+	def __init__(self, *args, **config):
+		super(database,self).__init__(*args, **config)
+
+		default_db = config.get("dbtype","anydbm")
+		if not default_db.startswith("."):
+			default_db = '.' + default_db
+
+		self._db_path = os.path.join(self.location, fs_template.gen_label(self.location, self.label)+default_db)
+		self.__db = None
+		try:
+			self.__db = anydbm_module.open(self._db_path, "w", self._perms)
+				
+		except anydbm_module.error:
+			# XXX handle this at some point
+			try:
+				self._ensure_dirs()
+				self._ensure_dirs(self._db_path)
+				self._ensure_access(self._db_path)
+			except (OSError, IOError), e:
+				raise cache_errors.InitializationError(self.__class__, e)
+
+			# try again if failed
+			try:
+				if self.__db == None:
+					self.__db = anydbm_module.open(self._db_path, "c", self._perms)
+			except andbm_module.error, e:
+				raise cache_errors.InitializationError(self.__class__, e)
+
+	def iteritems(self):
+		return self.__db.iteritems()
+
+	def _getitem(self, cpv):
+		# we override getitem because it's just a cpickling of the data handed in.
+		return pickle.loads(self.__db[cpv])
+
+	def _setitem(self, cpv, values):
+		self.__db[cpv] = pickle.dumps(values,pickle.HIGHEST_PROTOCOL)
+
+	def _delitem(self, cpv):
+		del self.__db[cpv]
+
+	def iterkeys(self):
+		return iter(self.__db)
+
+	def __contains__(self, cpv):
+		return cpv in self.__db
+
+	def __del__(self):
+		if "__db" in self.__dict__ and self.__db != None:
+			self.__db.sync()
+			self.__db.close()
Index: /vendor/prefix-portage/current/pym/portage/cache/cache_errors.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/cache/cache_errors.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/cache/cache_errors.py	(revision 3489)
@@ -0,0 +1,41 @@
+# Copyright: 2005 Gentoo Foundation
+# Author(s): Brian Harring (ferringb@gentoo.org)
+# License: GPL2
+# $Id: cache_errors.py 1911 2005-08-25 03:44:21Z ferringb $
+
+class CacheError(Exception):	pass
+
+class InitializationError(CacheError):
+	def __init__(self, class_name, error):
+		self.error, self.class_name = error, class_name
+	def __str__(self):
+		return "Creation of instance %s failed due to %s" % \
+			(self.class_name, str(self.error))
+
+
+class CacheCorruption(CacheError):
+	def __init__(self, key, ex):
+		self.key, self.ex = key, ex
+	def __str__(self):
+		return "%s is corrupt: %s" % (self.key, str(self.ex))
+
+
+class GeneralCacheCorruption(CacheError):
+	def __init__(self,ex):	self.ex = ex
+	def __str__(self):	return "corruption detected: %s" % str(self.ex)
+
+
+class InvalidRestriction(CacheError):
+	def __init__(self, key, restriction, exception=None):
+		if exception == None:	exception = ''
+		self.key, self.restriction, self.ex = key, restriction, ex
+	def __str__(self):
+		return "%s:%s is not valid: %s" % \
+			(self.key, self.restriction, str(self.ex))
+
+
+class ReadOnlyRestriction(CacheError):
+	def __init__(self, info=''):
+		self.info = info
+	def __str__(self):
+		return "cache is non-modifiable"+str(self.info)
Index: /vendor/prefix-portage/current/pym/portage/cache/flat_hash.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/cache/flat_hash.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/cache/flat_hash.py	(revision 3489)
@@ -0,0 +1,128 @@
+# Copyright: 2005 Gentoo Foundation
+# Author(s): Brian Harring (ferringb@gentoo.org)
+# License: GPL2
+# $Id: flat_list.py 1911 2005-08-25 03:44:21Z ferringb $
+
+from portage.cache import fs_template
+from portage.cache import cache_errors
+import errno, os, stat
+from portage.cache.template import reconstruct_eclasses
+# store the current key order *here*.
+class database(fs_template.FsBased):
+
+	autocommits = True
+
+	def __init__(self, *args, **config):
+		super(database,self).__init__(*args, **config)
+		self.location = os.path.join(self.location, 
+			self.label.lstrip(os.path.sep).rstrip(os.path.sep))
+
+		if not self.readonly and not os.path.exists(self.location):
+			self._ensure_dirs()
+
+	def __getitem__(self, cpv):
+		fp = os.path.join(self.location, cpv)
+		try:
+			myf = open(fp, "r")
+			try:
+				d = self._parse_data(myf, cpv)
+				if "_mtime_" not in d:
+					"""Backward compatibility with old cache that uses mtime
+					mangling."""
+					d["_mtime_"] = long(os.fstat(myf.fileno()).st_mtime)
+				return d
+			finally:
+				myf.close()
+		except (IOError, OSError), e:
+			if e.errno != errno.ENOENT:
+				raise cache_errors.CacheCorruption(cpv, e)
+			raise KeyError(cpv)
+
+	def _parse_data(self, data, cpv):
+		try:
+			d = dict(map(lambda x:x.rstrip("\n").split("=", 1), data))
+		except ValueError, e:
+			# If a line is missing an "=", the split length is 1 instead of 2.
+			raise cache_errors.CacheCorruption(cpv, e)
+		if "_eclasses_" in d:
+			d["_eclasses_"] = reconstruct_eclasses(cpv, d["_eclasses_"])
+		return d
+		
+		for x in self._known_keys:
+			if x not in d:
+				d[x] = ''
+
+
+		return d
+
+
+	def _setitem(self, cpv, values):
+#		import pdb;pdb.set_trace()
+		s = cpv.rfind("/")
+		fp = os.path.join(self.location,cpv[:s],".update.%i.%s" % (os.getpid(), cpv[s+1:]))
+		try:	myf=open(fp, "w")
+		except (IOError, OSError), e:
+			if errno.ENOENT == e.errno:
+				try:
+					self._ensure_dirs(cpv)
+					myf=open(fp,"w")
+				except (OSError, IOError),e:
+					raise cache_errors.CacheCorruption(cpv, e)
+			else:
+				raise cache_errors.CacheCorruption(cpv, e)
+
+		for k, v in values.items():
+			if k != "_mtime_" and (k == "_eclasses_" or k in self._known_keys):
+				myf.writelines("%s=%s\n" % (k, v))
+
+		myf.close()
+		self._ensure_access(fp, mtime=values["_mtime_"])
+
+		#update written.  now we move it.
+
+		new_fp = os.path.join(self.location,cpv)
+		try:	os.rename(fp, new_fp)
+		except (OSError, IOError), e:
+			os.remove(fp)
+			raise cache_errors.CacheCorruption(cpv, e)
+
+
+	def _delitem(self, cpv):
+#		import pdb;pdb.set_trace()
+		try:
+			os.remove(os.path.join(self.location,cpv))
+		except OSError, e:
+			if errno.ENOENT == e.errno:
+				raise KeyError(cpv)
+			else:
+				raise cache_errors.CacheCorruption(cpv, e)
+
+
+	def __contains__(self, cpv):
+		return os.path.exists(os.path.join(self.location, cpv))
+
+
+	def iterkeys(self):
+		"""generator for walking the dir struct"""
+		dirs = [self.location]
+		len_base = len(self.location)
+		while len(dirs):
+			try:
+				dir_list = os.listdir(dirs[0])
+			except OSError, e:
+				if e.errno != errno.ENOENT:
+					raise
+				del e
+				dirs.pop(0)
+				continue
+			for l in dir_list:
+				if l.endswith(".cpickle"):
+					continue
+				p = os.path.join(dirs[0],l)
+				st = os.lstat(p)
+				if stat.S_ISDIR(st.st_mode):
+					dirs.append(p)
+					continue
+				yield p[len_base+1:]
+			dirs.pop(0)
+
Index: /vendor/prefix-portage/current/pym/portage/cache/flat_list.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/cache/flat_list.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/cache/flat_list.py	(revision 3489)
@@ -0,0 +1,106 @@
+from portage.cache import fs_template
+from portage.cache import cache_errors
+import errno, os, stat
+
+# store the current key order *here*.
+class database(fs_template.FsBased):
+
+	autocommits = True
+
+	# do not screw with this ordering. _eclasses_ needs to be last
+	auxdbkey_order=('DEPEND', 'RDEPEND', 'SLOT', 'SRC_URI',
+		'RESTRICT',  'HOMEPAGE',  'LICENSE', 'DESCRIPTION',
+		'KEYWORDS',  'IUSE', 'CDEPEND',
+		'PDEPEND',   'PROVIDE','_eclasses_')
+
+	def __init__(self, label, auxdbkeys, **config):
+		super(database,self).__init__(label, auxdbkeys, **config)
+		self._base = os.path.join(self._base, 
+			self.label.lstrip(os.path.sep).rstrip(os.path.sep))
+
+		if len(self._known_keys) > len(self.auxdbkey_order) + 2:
+			raise Exception("less ordered keys then auxdbkeys")
+		if not os.path.exists(self._base):
+			self._ensure_dirs()
+
+
+	def _getitem(self, cpv):
+		d = {}
+		try:
+			myf = open(os.path.join(self._base, cpv),"r")
+			for k,v in zip(self.auxdbkey_order, myf):
+				d[k] = v.rstrip("\n")
+		except (OSError, IOError),e:
+			if errno.ENOENT == e.errno:
+				raise KeyError(cpv)
+			raise cache_errors.CacheCorruption(cpv, e)
+
+		try:
+			d["_mtime_"] = long(os.fstat(myf.fileno()).st_mtime)
+		except OSError, e:	
+			myf.close()
+			raise cache_errors.CacheCorruption(cpv, e)
+		myf.close()
+		return d
+
+
+	def _setitem(self, cpv, values):
+		s = cpv.rfind("/")
+		fp=os.path.join(self._base,cpv[:s],".update.%i.%s" % (os.getpid(), cpv[s+1:]))
+		try:	myf=open(fp, "w")
+		except (OSError, IOError), e:
+			if errno.ENOENT == e.errno:
+				try:
+					self._ensure_dirs(cpv)
+					myf=open(fp,"w")
+				except (OSError, IOError),e:
+					raise cache_errors.CacheCorruption(cpv, e)
+			else:
+				raise cache_errors.CacheCorruption(cpv, e)
+		
+
+		for x in self.auxdbkey_order:
+			myf.write(values.get(x,"")+"\n")
+
+		myf.close()
+		self._ensure_access(fp, mtime=values["_mtime_"])
+		#update written.  now we move it.
+		new_fp = os.path.join(self._base,cpv)
+		try:	os.rename(fp, new_fp)
+		except (OSError, IOError), e:
+			os.remove(fp)
+			raise cache_errors.CacheCorruption(cpv, e)
+
+
+	def _delitem(self, cpv):
+		try:
+			os.remove(os.path.join(self._base,cpv))
+		except OSError, e:
+			if errno.ENOENT == e.errno:
+				raise KeyError(cpv)
+			else:
+				raise cache_errors.CacheCorruption(cpv, e)
+
+
+	def __contains__(self, cpv):
+		return os.path.exists(os.path.join(self._base, cpv))
+
+
+	def iterkeys(self):
+		"""generator for walking the dir struct"""
+		dirs = [self._base]
+		len_base = len(self._base)
+		while len(dirs):
+			for l in os.listdir(dirs[0]):
+				if l.endswith(".cpickle"):
+					continue
+				p = os.path.join(dirs[0],l)
+				st = os.lstat(p)
+				if stat.S_ISDIR(st.st_mode):
+					dirs.append(p)
+					continue
+				yield p[len_base+1:]
+			dirs.pop(0)
+
+
+	def commit(self):	pass
Index: /vendor/prefix-portage/current/pym/portage/cache/fs_template.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/cache/fs_template.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/cache/fs_template.py	(revision 3489)
@@ -0,0 +1,74 @@
+# Copyright: 2005 Gentoo Foundation
+# Author(s): Brian Harring (ferringb@gentoo.org)
+# License: GPL2
+# $Id: fs_template.py 1911 2005-08-25 03:44:21Z ferringb $
+
+import os
+from portage.cache import template
+from portage.data import portage_gid
+
+class FsBased(template.database):
+	"""template wrapping fs needed options, and providing _ensure_access as a way to 
+	attempt to ensure files have the specified owners/perms"""
+
+	def __init__(self, *args, **config):
+		"""throws InitializationError if needs args aren't specified
+		gid and perms aren't listed do to an oddity python currying mechanism
+		gid=portage_gid
+		perms=0665"""
+
+		for x,y in (("gid",portage_gid),("perms",0664)):
+			if x in config:
+				setattr(self, "_"+x, config[x])
+				del config[x]
+			else:
+				setattr(self, "_"+x, y)
+		super(FsBased, self).__init__(*args, **config)
+
+		if self.label.startswith(os.path.sep):
+			# normpath.
+			self.label = os.path.sep + os.path.normpath(self.label).lstrip(os.path.sep)
+
+
+	def _ensure_access(self, path, mtime=-1):
+		"""returns true or false if it's able to ensure that path is properly chmod'd and chowned.
+		if mtime is specified, attempts to ensure that's correct also"""
+		try:
+			os.chown(path, -1, self._gid)
+			os.chmod(path, self._perms)
+			if mtime:
+				mtime=long(mtime)
+				os.utime(path, (mtime, mtime))
+		except (OSError, IOError):
+			return False
+		return True
+
+	def _ensure_dirs(self, path=None):
+		"""with path!=None, ensure beyond self.location.  otherwise, ensure self.location"""
+		if path:
+			path = os.path.dirname(path)
+			base = self.location
+		else:
+			path = self.location
+			base='/'
+
+		for dir in path.lstrip(os.path.sep).rstrip(os.path.sep).split(os.path.sep):
+			base = os.path.join(base,dir)
+			if not os.path.exists(base):
+				um=os.umask(0)
+				try:
+					os.mkdir(base, self._perms | 0111)
+					os.chown(base, -1, self._gid)
+				finally:
+					os.umask(um)
+
+	
+def gen_label(base, label):
+	"""if supplied label is a path, generate a unique label based upon label, and supplied base path"""
+	if label.find(os.path.sep) == -1:
+		return label
+	label = label.strip("\"").strip("'")
+	label = os.path.join(*(label.rstrip(os.path.sep).split(os.path.sep)))
+	tail = os.path.split(label)[1]
+	return "%s-%X" % (tail, abs(label.__hash__()))
+
Index: /vendor/prefix-portage/current/pym/portage/cache/mappings.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/cache/mappings.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/cache/mappings.py	(revision 3489)
@@ -0,0 +1,103 @@
+# Copyright: 2005 Gentoo Foundation
+# Author(s): Brian Harring (ferringb@gentoo.org)
+# License: GPL2
+# $Id: mappings.py 2015 2005-09-20 23:14:26Z ferringb $
+
+import UserDict
+
+class ProtectedDict(UserDict.DictMixin):
+	"""
+	given an initial dict, this wraps that dict storing changes in a secondary dict, protecting
+	the underlying dict from changes
+	"""
+	__slots__=("orig","new","blacklist")
+
+	def __init__(self, orig):
+		self.orig = orig
+		self.new = {}
+		self.blacklist = {}
+
+
+	def __setitem__(self, key, val):
+		self.new[key] = val
+		if key in self.blacklist:
+			del self.blacklist[key]
+
+
+	def __getitem__(self, key):
+		if key in self.new:
+			return self.new[key]
+		if key in self.blacklist:
+			raise KeyError(key)
+		return self.orig[key]
+
+
+	def __delitem__(self, key):
+		if key in self.new:
+			del self.new[key]
+		elif key in self.orig:
+			if key not in self.blacklist:
+				self.blacklist[key] = True
+				return
+		raise KeyError(key)
+			
+
+	def __iter__(self):
+		for k in self.new.iterkeys():
+			yield k
+		for k in self.orig.iterkeys():
+			if k not in self.blacklist and k not in self.new:
+				yield k
+
+
+	def keys(self):
+		return list(self.__iter__())
+
+
+	def has_key(self, key):
+		return key in self.new or (key not in self.blacklist and key in self.orig)
+
+
+class LazyLoad(UserDict.DictMixin):
+	"""
+	Lazy loading of values for a dict
+	"""
+	__slots__=("pull", "d")
+
+	def __init__(self, pull_items_func, initial_items=[]):
+		self.d = {}
+		for k, v in initial_items:
+			self.d[k] = v
+		self.pull = pull_items_func
+
+	def __getitem__(self, key):
+		if key in self.d:
+			return self.d[key]
+		elif self.pull != None:
+			self.d.update(self.pull())
+			self.pull = None
+		return self.d[key]
+
+
+	def __iter__(self):
+		return iter(self.keys())
+
+	def keys(self):
+		if self.pull != None:
+			self.d.update(self.pull())
+			self.pull = None
+		return self.d.keys()
+
+
+	def has_key(self, key):
+		return key in self
+
+
+	def __contains__(self, key):
+		if key in self.d:
+			return True
+		elif self.pull != None:
+			self.d.update(self.pull())
+			self.pull = None
+		return key in self.d
+
Index: /vendor/prefix-portage/current/pym/portage/cache/metadata.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/cache/metadata.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/cache/metadata.py	(revision 3489)
@@ -0,0 +1,89 @@
+# Copyright: 2005 Gentoo Foundation
+# Author(s): Brian Harring (ferringb@gentoo.org)
+# License: GPL2
+# $Id: metadata.py 1964 2005-09-03 00:16:16Z ferringb $
+
+import os, stat
+from portage.cache import flat_hash
+import portage.eclass_cache 
+from portage.cache.template import reconstruct_eclasses
+from portage.cache.mappings import ProtectedDict
+
+# this is the old cache format, flat_list.  count maintained here.
+magic_line_count = 22
+
+# store the current key order *here*.
+class database(flat_hash.database):
+	complete_eclass_entries = False
+	auxdbkey_order=('DEPEND', 'RDEPEND', 'SLOT', 'SRC_URI',
+		'RESTRICT',  'HOMEPAGE',  'LICENSE', 'DESCRIPTION',
+		'KEYWORDS',  'INHERITED', 'IUSE', 'CDEPEND',
+		'PDEPEND',   'PROVIDE', 'EAPI')
+
+	autocommits = True
+
+	def __init__(self, location, *args, **config):
+		loc = location
+		super(database, self).__init__(location, *args, **config)
+		self.location = os.path.join(loc, "metadata","cache")
+		self.ec = portage.eclass_cache.cache(loc)
+
+	def __getitem__(self, cpv):
+		return flat_hash.database.__getitem__(self, cpv)
+
+
+	def _parse_data(self, data, cpv):
+		# easy attempt first.
+		data = list(data)
+		if len(data) != magic_line_count:
+			d = flat_hash.database._parse_data(self, data, cpv)
+		else:
+			# this one's interesting.
+			d = {}
+
+			for line in data:
+				# yes, meant to iterate over a string.
+				hashed = False
+				# poor mans enumerate.  replace when python 2.3 is required
+				for idx, c in zip(range(len(line)), line):
+					if not c.isalpha():
+						if c == "=" and idx > 0:
+							hashed = True
+							d[line[:idx]] = line[idx + 1:].rstrip("\n")
+						elif c == "_" or c.isdigit():
+							continue
+						break
+					elif not c.isupper():
+						break
+			
+				if not hashed:
+					# non hashed.
+					d.clear()
+					# poor mans enumerate.  replace when python 2.3 is required
+					for idx, key in zip(range(len(self.auxdbkey_order)), self.auxdbkey_order):
+						d[key] = data[idx].strip()
+					break
+
+		if "_eclasses_" not in d:
+			if "INHERITED" in d:
+				d["_eclasses_"] = self.ec.get_eclass_data(d["INHERITED"].split(), from_master_only=True)
+				del d["INHERITED"]
+		elif isinstance(d["_eclasses_"], basestring):
+			# We skip this if flat_hash.database._parse_data() was called above
+			# because it calls reconstruct_eclasses() internally.
+			d["_eclasses_"] = reconstruct_eclasses(None, d["_eclasses_"])
+
+		return d
+
+
+		
+	def _setitem(self, cpv, values):
+		values = ProtectedDict(values)
+		
+		# hack.  proper solution is to make this a __setitem__ override, since template.__setitem__ 
+		# serializes _eclasses_, then we reconstruct it.
+		if "_eclasses_" in values:
+			values["INHERITED"] = ' '.join(reconstruct_eclasses(cpv, values["_eclasses_"]).keys())
+			del values["_eclasses_"]
+
+		flat_hash.database._setitem(self, cpv, values)
Index: /vendor/prefix-portage/current/pym/portage/cache/metadata_overlay.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/cache/metadata_overlay.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/cache/metadata_overlay.py	(revision 3489)
@@ -0,0 +1,105 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+import time
+if not hasattr(__builtins__, "set"):
+	from sets import Set as set
+from portage.cache import template
+from portage.cache.cache_errors import CacheCorruption
+from portage.cache.flat_hash import database as db_rw
+from portage.cache.metadata import database as db_ro
+
+class database(template.database):
+
+	serialize_eclasses = False
+
+	def __init__(self, location, label, auxdbkeys, db_rw=db_rw, db_ro=db_ro,
+		*args, **config):
+		super_config = config.copy()
+		super_config.pop("gid", None)
+		super(database, self).__init__(location, label, auxdbkeys,
+			*args, **super_config)
+		self.db_rw = db_rw(location, label, auxdbkeys, **config)
+		self.commit = self.db_rw.commit
+		self.autocommits = self.db_rw.autocommits
+		if isinstance(db_ro, type):
+			ro_config = config.copy()
+			ro_config["readonly"] = True
+			self.db_ro = db_ro(label, "metadata/cache", auxdbkeys, **ro_config)
+		else:
+			self.db_ro = db_ro
+
+	def __getitem__(self, cpv):
+		"""funnel whiteout validation through here, since value needs to be fetched"""
+		try:
+			value = self.db_rw[cpv]
+		except KeyError:
+			return self.db_ro[cpv] # raises a KeyError when necessary
+		except CacheCorruption:
+			del self.db_rw[cpv]
+			return self.db_ro[cpv] # raises a KeyError when necessary
+		if self._is_whiteout(value):
+			if self._is_whiteout_valid(cpv, value):
+				raise KeyError(cpv)
+			else:
+				del self.db_rw[cpv]
+				return self.db_ro[cpv] # raises a KeyError when necessary
+		else:
+			return value
+
+	def _setitem(self, name, values):
+		try:
+			value_ro = self.db_ro[name]
+			if self._are_values_identical(value_ro,values):
+				# we have matching values in the underlying db_ro
+				# so it is unnecessary to store data in db_rw
+				try:
+					del self.db_rw[name] # delete unwanted whiteout when necessary
+				except KeyError:
+					pass
+		except KeyError:
+			self.db_rw[name] = values
+
+	def _delitem(self, cpv):
+		value = self[cpv] # validates whiteout and/or raises a KeyError when necessary
+		if self.db_ro.has_key(cpv):
+			self.db_rw[cpv] = self._create_whiteout(value)
+		else:
+			del self.db_rw[cpv]
+
+	def __contains__(self, cpv):
+		try:
+			self[cpv] # validates whiteout when necessary
+		except KeyError:
+			return False
+		return True
+
+	def iterkeys(self):
+		s = set()
+		for cpv in self.db_rw.iterkeys():
+			if self.has_key(cpv): # validates whiteout when necessary
+				yield cpv
+			# set includes whiteouts so they won't be yielded later
+			s.add(cpv)
+		for cpv in self.db_ro.iterkeys():
+			if cpv not in s:
+				yield cpv
+
+	def _is_whiteout(self, value):
+		return value["EAPI"] == "whiteout"
+
+	def _create_whiteout(self, value):
+		return {"EAPI":"whiteout","_eclasses_":value["_eclasses_"],"_mtime_":value["_mtime_"]}
+
+	def _is_whiteout_valid(self, name, value_rw):
+		try:
+			value_ro = self.db_ro[name]
+			return self._are_values_identical(value_rw,value_ro)
+		except KeyError:
+			return False
+
+	def _are_values_identical(self, value1, value2):
+		if long(value1["_mtime_"]) != long(value2["_mtime_"]):
+			return False
+		return value1["_eclasses_"] == value2["_eclasses_"]
Index: /vendor/prefix-portage/current/pym/portage/cache/sql_template.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/cache/sql_template.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/cache/sql_template.py	(revision 3489)
@@ -0,0 +1,275 @@
+# Copyright: 2005 Gentoo Foundation
+# Author(s): Brian Harring (ferringb@gentoo.org)
+# License: GPL2
+# $Id: sql_template.py 1911 2005-08-25 03:44:21Z ferringb $
+
+from portage.cache import template, cache_errors
+from portage.cache.template import reconstruct_eclasses
+
+class SQLDatabase(template.database):
+	"""template class for RDBM based caches
+	
+	This class is designed such that derivatives don't have to change much code, mostly constant strings.
+	_BaseError must be an exception class that all Exceptions thrown from the derived RDBMS are derived
+	from.
+
+	SCHEMA_INSERT_CPV_INTO_PACKAGE should be modified dependant on the RDBMS, as should SCHEMA_PACKAGE_CREATE-
+	basically you need to deal with creation of a unique pkgid.  If the dbapi2 rdbms class has a method of 
+	recovering that id, then modify _insert_cpv to remove the extra select.
+
+	Creation of a derived class involves supplying _initdb_con, and table_exists.
+	Additionally, the default schemas may have to be modified.
+	"""
+	
+	SCHEMA_PACKAGE_NAME	= "package_cache"
+	SCHEMA_PACKAGE_CREATE 	= "CREATE TABLE %s (\
+		pkgid INTEGER PRIMARY KEY, label VARCHAR(255), cpv VARCHAR(255), UNIQUE(label, cpv))" % SCHEMA_PACKAGE_NAME
+	SCHEMA_PACKAGE_DROP	= "DROP TABLE %s" % SCHEMA_PACKAGE_NAME
+
+	SCHEMA_VALUES_NAME	= "values_cache"
+	SCHEMA_VALUES_CREATE	= "CREATE TABLE %s ( pkgid integer references %s (pkgid) on delete cascade, \
+		key varchar(255), value text, UNIQUE(pkgid, key))" % (SCHEMA_VALUES_NAME, SCHEMA_PACKAGE_NAME)
+	SCHEMA_VALUES_DROP	= "DROP TABLE %s" % SCHEMA_VALUES_NAME
+	SCHEMA_INSERT_CPV_INTO_PACKAGE	= "INSERT INTO %s (label, cpv) VALUES(%%s, %%s)" % SCHEMA_PACKAGE_NAME
+
+	_BaseError = ()
+	_dbClass = None
+
+	autocommits = False
+#	cleanse_keys = True
+
+	# boolean indicating if the derived RDBMS class supports replace syntax
+	_supports_replace = False
+
+	def __init__(self, location, label, auxdbkeys, *args, **config):
+		"""initialize the instance.
+		derived classes shouldn't need to override this"""
+
+		super(SQLDatabase, self).__init__(location, label, auxdbkeys, *args, **config)
+
+		config.setdefault("host","127.0.0.1")
+		config.setdefault("autocommit", self.autocommits)
+		self._initdb_con(config)
+
+		self.label = self._sfilter(self.label)
+
+
+	def _dbconnect(self, config):
+		"""should be overridden if the derived class needs special parameters for initializing
+		the db connection, or cursor"""
+		self.db = self._dbClass(**config)
+		self.con = self.db.cursor()
+
+
+	def _initdb_con(self,config):
+		"""ensure needed tables are in place.
+		If the derived class needs a different set of table creation commands, overload the approriate
+		SCHEMA_ attributes.  If it needs additional execution beyond, override"""
+
+		self._dbconnect(config)
+		if not self._table_exists(self.SCHEMA_PACKAGE_NAME):
+			if self.readonly:
+				raise cache_errors.ReadOnlyRestriction("table %s doesn't exist" % \
+					self.SCHEMA_PACKAGE_NAME)
+			try:	self.con.execute(self.SCHEMA_PACKAGE_CREATE)
+			except  self._BaseError, e:
+				raise cache_errors.InitializationError(self.__class__, e)
+
+		if not self._table_exists(self.SCHEMA_VALUES_NAME):
+			if self.readonly:
+				raise cache_errors.ReadOnlyRestriction("table %s doesn't exist" % \
+					self.SCHEMA_VALUES_NAME)
+			try:	self.con.execute(self.SCHEMA_VALUES_CREATE)
+			except	self._BaseError, e:
+				raise cache_errors.InitializationError(self.__class__, e)
+
+
+	def _table_exists(self, tbl):
+		"""return true if a table exists
+		derived classes must override this"""
+		raise NotImplementedError
+
+
+	def _sfilter(self, s):
+		"""meta escaping, returns quoted string for use in sql statements"""
+		return "\"%s\"" % s.replace("\\","\\\\").replace("\"","\\\"")
+
+
+	def _getitem(self, cpv):
+		try:	self.con.execute("SELECT key, value FROM %s NATURAL JOIN %s "
+			"WHERE label=%s AND cpv=%s" % (self.SCHEMA_PACKAGE_NAME, self.SCHEMA_VALUES_NAME,
+			self.label, self._sfilter(cpv)))
+		except self._BaseError, e:
+			raise cache_errors.CacheCorruption(self, cpv, e)
+
+		rows = self.con.fetchall()
+
+		if len(rows) == 0:
+			raise KeyError(cpv)
+
+		vals = dict([(k,"") for k in self._known_keys])
+		vals.update(dict(rows))
+		return vals
+
+
+	def _delitem(self, cpv):
+		"""delete a cpv cache entry
+		derived RDBM classes for this *must* either support cascaded deletes, or 
+		override this method"""
+		try:
+			try:	
+				self.con.execute("DELETE FROM %s WHERE label=%s AND cpv=%s" % \
+				(self.SCHEMA_PACKAGE_NAME, self.label, self._sfilter(cpv)))
+				if self.autocommits:
+					self.commit()
+			except self._BaseError, e:
+				raise cache_errors.CacheCorruption(self, cpv, e)
+			if self.con.rowcount <= 0:
+				raise KeyError(cpv)
+		except Exception:
+			if not self.autocommits:
+				self.db.rollback()
+				# yes, this can roll back a lot more then just the delete.  deal.
+			raise
+
+	def __del__(self):
+		# just to be safe.
+		if "db" in self.__dict__ and self.db != None:
+			self.commit()
+			self.db.close()
+
+	def _setitem(self, cpv, values):
+
+		try:
+			# insert.
+			try:	pkgid = self._insert_cpv(cpv)
+			except self._BaseError, e:
+				raise cache_errors.CacheCorruption(cpv, e)
+
+			# __getitem__ fills out missing values, 
+			# so we store only what's handed to us and is a known key
+			db_values = []
+			for key in self._known_keys:
+				if values.has_key(key) and values[key] != '':
+					db_values.append({"key":key, "value":values[key]})
+
+			if len(db_values) > 0:
+				try:	self.con.executemany("INSERT INTO %s (pkgid, key, value) VALUES(\"%s\", %%(key)s, %%(value)s)" % \
+					(self.SCHEMA_VALUES_NAME, str(pkgid)), db_values)
+				except self._BaseError, e:
+					raise cache_errors.CacheCorruption(cpv, e)
+			if self.autocommits:
+				self.commit()
+
+		except Exception:
+			if not self.autocommits:
+				try:	self.db.rollback()
+				except self._BaseError: pass
+			raise
+
+
+	def _insert_cpv(self, cpv):
+		"""uses SCHEMA_INSERT_CPV_INTO_PACKAGE, which must be overloaded if the table definition
+		doesn't support auto-increment columns for pkgid.
+		returns the cpvs new pkgid
+		note this doesn't commit the transaction.  The caller is expected to."""
+		
+		cpv = self._sfilter(cpv)
+		if self._supports_replace:
+			query_str = self.SCHEMA_INSERT_CPV_INTO_PACKAGE.replace("INSERT","REPLACE",1)
+		else:
+			# just delete it.
+			try:	del self[cpv]
+			except	(cache_errors.CacheCorruption, KeyError):	pass
+			query_str = self.SCHEMA_INSERT_CPV_INTO_PACKAGE
+		try:
+			self.con.execute(query_str % (self.label, cpv))
+		except self._BaseError:
+			self.db.rollback()
+			raise
+		self.con.execute("SELECT pkgid FROM %s WHERE label=%s AND cpv=%s" % \
+			(self.SCHEMA_PACKAGE_NAME, self.label, cpv))
+			
+		if self.con.rowcount != 1:
+			raise cache_error.CacheCorruption(cpv, "Tried to insert the cpv, but found "
+				" %i matches upon the following select!" % len(rows))
+		return self.con.fetchone()[0]
+
+
+	def __contains__(self, cpv):
+		if not self.autocommits:
+			try:	self.commit()
+			except self._BaseError, e:
+				raise cache_errors.GeneralCacheCorruption(e)
+
+		try:	self.con.execute("SELECT cpv FROM %s WHERE label=%s AND cpv=%s" % \
+				(self.SCHEMA_PACKAGE_NAME, self.label, self._sfilter(cpv)))
+		except self._BaseError, e:
+			raise cache_errors.GeneralCacheCorruption(e)
+		return self.con.rowcount > 0
+
+
+	def iterkeys(self):
+		if not self.autocommits:
+			try:	self.commit()
+			except self._BaseError, e:
+				raise cache_errors.GeneralCacheCorruption(e)
+
+		try:	self.con.execute("SELECT cpv FROM %s WHERE label=%s" % 
+				(self.SCHEMA_PACKAGE_NAME, self.label))
+		except self._BaseError, e:
+			raise cache_errors.GeneralCacheCorruption(e)
+#		return [ row[0] for row in self.con.fetchall() ]
+		for x in self.con.fetchall():
+			yield x[0]
+
+	def iteritems(self):
+		try:	self.con.execute("SELECT cpv, key, value FROM %s NATURAL JOIN %s "
+			"WHERE label=%s" % (self.SCHEMA_PACKAGE_NAME, self.SCHEMA_VALUES_NAME,
+			self.label))
+		except self._BaseError, e:
+			raise cache_errors.CacheCorruption(self, cpv, e)
+		
+		oldcpv = None
+		l = []
+		for x, y, v in self.con.fetchall():
+			if oldcpv != x:
+				if oldcpv != None:
+					d = dict(l)
+					if "_eclasses_" in d:
+						d["_eclasses_"] = reconstruct_eclasses(oldcpv, d["_eclasses_"])
+					yield cpv, d
+				l.clear()
+				oldcpv = x
+			l.append((y,v))
+		if oldcpv != None:
+			d = dict(l)
+			if "_eclasses_" in d:
+				d["_eclasses_"] = reconstruct_eclasses(oldcpv, d["_eclasses_"])
+			yield cpv, d			
+
+	def commit(self):
+		self.db.commit()
+
+	def get_matches(self,match_dict):
+		query_list = []
+		for k,v in match_dict.items():
+			if k not in self._known_keys:
+				raise cache_errors.InvalidRestriction(k, v, "key isn't known to this cache instance")
+			v = v.replace("%","\\%")
+			v = v.replace(".*","%")
+			query_list.append("(key=%s AND value LIKE %s)" % (self._sfilter(k), self._sfilter(v)))
+
+		if len(query_list):
+			query = " AND "+" AND ".join(query_list)
+		else:
+			query = ''
+
+		print "query = SELECT cpv from package_cache natural join values_cache WHERE label=%s %s" % (self.label, query)
+		try:	self.con.execute("SELECT cpv from package_cache natural join values_cache WHERE label=%s %s" % \
+				(self.label, query))
+		except self._BaseError, e:
+			raise cache_errors.GeneralCacheCorruption(e)
+
+		return [ row[0] for row in self.con.fetchall() ]
+
Index: /vendor/prefix-portage/current/pym/portage/cache/sqlite.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/cache/sqlite.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/cache/sqlite.py	(revision 3489)
@@ -0,0 +1,236 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+from portage.cache import fs_template
+from portage.cache import cache_errors
+import os
+from portage.cache.template import reconstruct_eclasses
+from portage.util import writemsg, apply_secpass_permissions
+from portage.data import portage_gid
+try:
+	import sqlite3 as db_module # sqlite3 is optional with >=python-2.5
+except ImportError:
+	from pysqlite2 import dbapi2 as db_module
+DBError = db_module.Error
+
+class database(fs_template.FsBased):
+
+	autocommits = False
+	synchronous = False
+	# cache_bytes is used together with page_size (set at sqlite build time)
+	# to calculate the number of pages requested, according to the following
+	# equation: cache_bytes = page_bytes * page_count
+	cache_bytes = 1024 * 1024 * 10
+	_db_module = db_module
+	_db_error = DBError
+	_db_table = None
+
+	def __init__(self, *args, **config):
+		super(database, self).__init__(*args, **config)
+		self._allowed_keys = ["_mtime_", "_eclasses_"] + self._known_keys
+		self.location = os.path.join(self.location, 
+			self.label.lstrip(os.path.sep).rstrip(os.path.sep))
+
+		if not os.path.exists(self.location):
+			self._ensure_dirs()
+
+		config.setdefault("autocommit", self.autocommits)
+		config.setdefault("cache_bytes", self.cache_bytes)
+		config.setdefault("synchronous", self.synchronous)
+		# Timeout for throwing a "database is locked" exception (pysqlite
+		# default is 5.0 seconds).
+		config.setdefault("timeout", 15)
+		self._db_init_connection(config)
+		self._db_init_structures()
+
+	def _db_escape_string(self, s):
+		"""meta escaping, returns quoted string for use in sql statements"""
+		return "'%s'" % str(s).replace("\\","\\\\").replace("'","''")
+
+	def _db_init_connection(self, config):
+		self._dbpath = self.location + ".sqlite"
+		#if os.path.exists(self._dbpath):
+		#	os.unlink(self._dbpath)
+		connection_kwargs = {}
+		connection_kwargs["timeout"] = config["timeout"]
+		try:
+			self._ensure_dirs()
+			self._db_connection = self._db_module.connect(
+				database=self._dbpath, **connection_kwargs)
+			self._db_cursor = self._db_connection.cursor()
+			self._db_cursor.execute("PRAGMA encoding = %s" % self._db_escape_string("UTF-8"))
+			if not apply_secpass_permissions(self._dbpath, gid=portage_gid, mode=070, mask=02):
+				raise cache_errors.InitializationError(self.__class__, "can't ensure perms on %s" % self._dbpath)
+			self._db_init_cache_size(config["cache_bytes"])
+			self._db_init_synchronous(config["synchronous"])
+		except self._db_error, e:
+			raise cache_errors.InitializationError(self.__class__, e)
+
+	def _db_init_structures(self):
+		self._db_table = {}
+		self._db_table["packages"] = {}
+		mytable = "portage_packages"
+		self._db_table["packages"]["table_name"] = mytable
+		self._db_table["packages"]["package_id"] = "internal_db_package_id"
+		self._db_table["packages"]["package_key"] = "portage_package_key"
+		self._db_table["packages"]["internal_columns"] = \
+			[self._db_table["packages"]["package_id"],
+			self._db_table["packages"]["package_key"]]
+		create_statement = []
+		create_statement.append("CREATE TABLE")
+		create_statement.append(mytable)
+		create_statement.append("(")
+		table_parameters = []
+		table_parameters.append("%s INTEGER PRIMARY KEY AUTOINCREMENT" % self._db_table["packages"]["package_id"])
+		table_parameters.append("%s TEXT" % self._db_table["packages"]["package_key"])
+		for k in self._allowed_keys:
+			table_parameters.append("%s TEXT" % k)
+		table_parameters.append("UNIQUE(%s)" % self._db_table["packages"]["package_key"])
+		create_statement.append(",".join(table_parameters))
+		create_statement.append(")")
+		
+		self._db_table["packages"]["create"] = " ".join(create_statement)
+		self._db_table["packages"]["columns"] = \
+			self._db_table["packages"]["internal_columns"] + \
+			self._allowed_keys
+
+		cursor = self._db_cursor
+		for k, v in self._db_table.iteritems():
+			if self._db_table_exists(v["table_name"]):
+				create_statement = self._db_table_get_create(v["table_name"])
+				if create_statement != v["create"]:
+					writemsg("sqlite: dropping old table: %s\n" % v["table_name"])
+					cursor.execute("DROP TABLE %s" % v["table_name"])
+					cursor.execute(v["create"])
+			else:
+				cursor.execute(v["create"])
+
+	def _db_table_exists(self, table_name):
+		"""return true/false dependant on a tbl existing"""
+		cursor = self._db_cursor
+		cursor.execute("SELECT name FROM sqlite_master WHERE type=\"table\" AND name=%s" % \
+			self._db_escape_string(table_name))
+		return len(cursor.fetchall()) == 1
+
+	def _db_table_get_create(self, table_name):
+		"""return true/false dependant on a tbl existing"""
+		cursor = self._db_cursor
+		cursor.execute("SELECT sql FROM sqlite_master WHERE name=%s" % \
+			self._db_escape_string(table_name))
+		return cursor.fetchall()[0][0]
+
+	def _db_init_cache_size(self, cache_bytes):
+		cursor = self._db_cursor
+		cursor.execute("PRAGMA page_size")
+		page_size=int(cursor.fetchone()[0])
+		# number of pages, sqlite default is 2000
+		cache_size = cache_bytes / page_size
+		cursor.execute("PRAGMA cache_size = %d" % cache_size)
+		cursor.execute("PRAGMA cache_size")
+		actual_cache_size = int(cursor.fetchone()[0])
+		del cursor
+		if actual_cache_size != cache_size:
+			raise cache_errors.InitializationError(self.__class__,"actual cache_size = "+actual_cache_size+" does does not match requested size of "+cache_size)
+
+	def _db_init_synchronous(self, synchronous):
+		cursor = self._db_cursor
+		cursor.execute("PRAGMA synchronous = %d" % synchronous)
+		cursor.execute("PRAGMA synchronous")
+		actual_synchronous=int(cursor.fetchone()[0])
+		del cursor
+		if actual_synchronous!=synchronous:
+			raise cache_errors.InitializationError(self.__class__,"actual synchronous = "+actual_synchronous+" does does not match requested value of "+synchronous)
+
+	def __getitem__(self, cpv):
+		cursor = self._db_cursor
+		cursor.execute("select * from %s where %s=%s" % \
+			(self._db_table["packages"]["table_name"],
+			self._db_table["packages"]["package_key"],
+			self._db_escape_string(cpv)))
+		result = cursor.fetchall()
+		if len(result) == 1:
+			pass
+		elif len(result) == 0:
+			raise KeyError(cpv)
+		else:
+			raise cache_errors.CacheCorruption(cpv, "key is not unique")
+		d = {}
+		internal_columns = self._db_table["packages"]["internal_columns"]
+		column_index = -1
+		for k in self._db_table["packages"]["columns"]:
+			column_index +=1
+			if k not in internal_columns:
+				d[k] = result[0][column_index]
+		# XXX: The resolver chokes on unicode strings so we convert them here.
+		for k in d.keys():
+			try:
+				d[k]=str(d[k]) # convert unicode strings to normal
+			except UnicodeEncodeError, e:
+				pass #writemsg("%s: %s\n" % (cpv, str(e)))
+		if "_eclasses_" in d:
+			d["_eclasses_"] = reconstruct_eclasses(cpv, d["_eclasses_"])
+		for x in self._known_keys:
+			d.setdefault(x,'')
+		return d
+
+	def _setitem(self, cpv, values):
+		update_statement = []
+		update_statement.append("REPLACE INTO %s" % self._db_table["packages"]["table_name"])
+		update_statement.append("(")
+		update_statement.append(','.join([self._db_table["packages"]["package_key"]] + self._allowed_keys))
+		update_statement.append(")")
+		update_statement.append("VALUES")
+		update_statement.append("(")
+		values_parameters = []
+		values_parameters.append(self._db_escape_string(cpv))
+		for k in self._allowed_keys:
+			values_parameters.append(self._db_escape_string(values.get(k, '')))
+		update_statement.append(",".join(values_parameters))
+		update_statement.append(")")
+		cursor = self._db_cursor
+		try:
+			s = " ".join(update_statement)
+			cursor.execute(s)
+		except self._db_error, e:
+			writemsg("%s: %s\n" % (cpv, str(e)))
+			raise
+
+	def commit(self):
+		self._db_connection.commit()
+
+	def _delitem(self, cpv):
+		cursor = self._db_cursor
+		cursor.execute("DELETE FROM %s WHERE %s=%s" % \
+			(self._db_table["packages"]["table_name"],
+			self._db_table["packages"]["package_key"],
+			self._db_escape_string(cpv)))
+
+	def __contains__(self, cpv):
+		cursor = self._db_cursor
+		cursor.execute(" ".join(
+			["SELECT %s FROM %s" %
+			(self._db_table["packages"]["package_id"],
+			self._db_table["packages"]["table_name"]),
+			"WHERE %s=%s" % (
+			self._db_table["packages"]["package_key"],
+			self._db_escape_string(cpv))]))
+		result = cursor.fetchall()
+		if len(result) == 0:
+			return False
+		elif len(result) == 1:
+			return True
+		else:
+			raise cache_errors.CacheCorruption(cpv, "key is not unique")
+
+	def iterkeys(self):
+		"""generator for walking the dir struct"""
+		cursor = self._db_cursor
+		cursor.execute("SELECT %s FROM %s" % \
+			(self._db_table["packages"]["package_key"],
+			self._db_table["packages"]["table_name"]))
+		result = cursor.fetchall()
+		key_list = [x[0] for x in result]
+		del result
+		while key_list:
+			yield key_list.pop()
Index: /vendor/prefix-portage/current/pym/portage/cache/template.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/cache/template.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/cache/template.py	(revision 3489)
@@ -0,0 +1,194 @@
+# Copyright: 2005 Gentoo Foundation
+# Author(s): Brian Harring (ferringb@gentoo.org)
+# License: GPL2
+# $Id: template.py 1911 2005-08-25 03:44:21Z ferringb $
+
+from portage.cache import cache_errors
+from portage.cache.cache_errors import InvalidRestriction
+from portage.cache.mappings import ProtectedDict
+
+class database(object):
+	# this is for metadata/cache transfer.
+	# basically flags the cache needs be updated when transfered cache to cache.
+	# leave this.
+
+	complete_eclass_entries = True
+	autocommits = False
+	cleanse_keys = False
+	serialize_eclasses = True
+
+	def __init__(self, location, label, auxdbkeys, readonly=False):
+		""" initialize the derived class; specifically, store label/keys"""
+		self._known_keys = auxdbkeys
+		self.location = location
+		self.label = label
+		self.readonly = readonly
+		self.sync_rate = 0
+		self.updates = 0
+	
+	def __getitem__(self, cpv):
+		"""set a cpv to values
+		This shouldn't be overriden in derived classes since it handles the __eclasses__ conversion.
+		that said, if the class handles it, they can override it."""
+		if self.updates > self.sync_rate:
+			self.commit()
+			self.updates = 0
+		d=self._getitem(cpv)
+		if self.serialize_eclasses and "_eclasses_" in d:
+			d["_eclasses_"] = reconstruct_eclasses(cpv, d["_eclasses_"])
+		return d
+
+	def _getitem(self, cpv):
+		"""get cpv's values.
+		override this in derived classess"""
+		raise NotImplementedError
+
+	def __setitem__(self, cpv, values):
+		"""set a cpv to values
+		This shouldn't be overriden in derived classes since it handles the readonly checks"""
+		if self.readonly:
+			raise cache_errors.ReadOnlyRestriction()
+		if self.cleanse_keys:
+			d=ProtectedDict(values)
+			for k in d.keys():
+				if d[k] == '':
+					del d[k]
+			if self.serialize_eclasses and "_eclasses_" in values:
+				d["_eclasses_"] = serialize_eclasses(d["_eclasses_"])
+		elif self.serialize_eclasses and "_eclasses_" in values:
+			d = ProtectedDict(values)
+			d["_eclasses_"] = serialize_eclasses(d["_eclasses_"])
+		else:
+			d = values
+		self._setitem(cpv, d)
+		if not self.autocommits:
+			self.updates += 1
+			if self.updates > self.sync_rate:
+				self.commit()
+				self.updates = 0
+
+	def _setitem(self, name, values):
+		"""__setitem__ calls this after readonly checks.  override it in derived classes
+		note _eclassees_ key *must* be handled"""
+		raise NotImplementedError
+
+	def __delitem__(self, cpv):
+		"""delete a key from the cache.
+		This shouldn't be overriden in derived classes since it handles the readonly checks"""
+		if self.readonly:
+			raise cache_errors.ReadOnlyRestriction()
+		if not self.autocommits:
+			self.updates += 1
+		self._delitem(cpv)
+		if self.updates > self.sync_rate:
+			self.commit()
+			self.updates = 0
+
+	def _delitem(self,cpv):
+		"""__delitem__ calls this after readonly checks.  override it in derived classes"""
+		raise NotImplementedError
+
+	def has_key(self, cpv):
+		return cpv in self
+
+	def keys(self):
+		return tuple(self.iterkeys())
+
+	def iterkeys(self):
+		raise NotImplementedError
+
+	def iteritems(self):
+		for x in self.iterkeys():
+			yield (x, self[x])
+
+	def items(self):
+		return list(self.iteritems())
+
+	def sync(self, rate=0):
+		self.sync_rate = rate
+		if(rate == 0):
+			self.commit()
+
+	def commit(self):
+		if not self.autocommits:
+			raise NotImplementedError
+
+	def __contains__(self, cpv):
+		"""This method should always be overridden.  It is provided only for
+		backward compatibility with modules that override has_key instead.  It
+		will automatically raise a NotImplementedError if has_key has not been
+		overridden."""
+		if self.has_key is database.has_key:
+			# prevent a possible recursive loop
+			raise NotImplementedError
+		return self.has_key(cpv)
+
+	def get_matches(self, match_dict):
+		"""generic function for walking the entire cache db, matching restrictions to
+		filter what cpv's are returned.  Derived classes should override this if they
+		can implement a faster method then pulling each cpv:values, and checking it.
+		
+		For example, RDBMS derived classes should push the matching logic down to the
+		actual RDBM."""
+
+		import re
+		restricts = {}
+		for key,match in match_dict.iteritems():
+			# XXX this sucks.
+			try:
+				if isinstance(match, str):
+					restricts[key] = re.compile(match).match
+				else:
+					restricts[key] = re.compile(match[0],match[1]).match
+			except re.error, e:
+				raise InvalidRestriction(key, match, e)
+			if key not in self.__known_keys:
+				raise InvalidRestriction(key, match, "Key isn't valid")
+
+		for cpv in self.keys():
+			cont = True
+			vals = self[cpv]
+			for key, match in restricts.iteritems():
+				if not match(vals[key]):
+					cont = False
+					break
+			if cont:
+				yield cpv
+
+
+def serialize_eclasses(eclass_dict):
+	"""takes a dict, returns a string representing said dict"""
+	"""The "new format", which causes older versions of <portage-2.1.2 to
+	traceback with a ValueError due to failed long() conversion.  This format
+	isn't currently written, but the the capability to read it is already built
+	in.
+	return "\t".join(["%s\t%s" % (k, str(v)) \
+		for k, v in eclass_dict.iteritems()])
+	"""
+	if not eclass_dict:
+		return ""
+	return "\t".join(["%s\t%s\t%s" % (k, v[0], str(v[1])) \
+		for k, v in eclass_dict.iteritems()])
+
+def reconstruct_eclasses(cpv, eclass_string):
+	"""returns a dict when handed a string generated by serialize_eclasses"""
+	eclasses = eclass_string.rstrip().lstrip().split("\t")
+	if eclasses == [""]:
+		# occasionally this occurs in the fs backends.  they suck.
+		return {}
+	
+	if len(eclasses) % 2 != 0 and len(eclasses) % 3 != 0:
+		raise cache_errors.CacheCorruption(cpv, "_eclasses_ was of invalid len %i" % len(eclasses))
+	d={}
+	try:
+		if eclasses[1].isdigit():
+			for x in xrange(0, len(eclasses), 2):
+				d[eclasses[x]] = ("", long(eclasses[x + 1]))
+		else:
+			# The old format contains paths that will be discarded.
+			for x in xrange(0, len(eclasses), 3):
+				d[eclasses[x]] = (eclasses[x + 1], long(eclasses[x + 2]))
+	except ValueError:
+		raise cache_errors.CacheCorruption(cpv, "_eclasses_ mtime conversion to long failed")
+	del eclasses
+	return d
Index: /vendor/prefix-portage/current/pym/portage/cache/util.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/cache/util.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/cache/util.py	(revision 3489)
@@ -0,0 +1,125 @@
+# Copyright: 2005 Gentoo Foundation
+# Author(s): Brian Harring (ferringb@gentoo.org)
+# License: GPL2
+# $Id: util.py 1911 2005-08-25 03:44:21Z ferringb $
+
+if not hasattr(__builtins__, "set"):
+	from sets import Set as set
+from itertools import chain
+from portage.cache import cache_errors
+
+def mirror_cache(valid_nodes_iterable, src_cache, trg_cache, eclass_cache=None, verbose_instance=None):
+
+	if not src_cache.complete_eclass_entries and not eclass_cache:
+		raise Exception("eclass_cache required for cache's of class %s!" % src_cache.__class__)
+
+	if verbose_instance == None:
+		noise=quiet_mirroring()
+	else:
+		noise=verbose_instance
+
+	dead_nodes = {}
+	dead_nodes = dict.fromkeys(trg_cache.keys())
+	count=0
+
+	if not trg_cache.autocommits:
+		trg_cache.sync(100)
+
+	for x in valid_nodes_iterable:
+#		print "processing x=",x
+		count+=1
+		if dead_nodes.has_key(x):
+			del dead_nodes[x]
+		try:	entry = src_cache[x]
+		except KeyError, e:
+			noise.missing_entry(x)
+			del e
+			continue
+		write_it = True
+		trg = None
+		try:
+			trg = trg_cache[x]
+			if long(trg["_mtime_"]) == long(entry["_mtime_"]) and \
+				eclass_cache.is_eclass_data_valid(trg["_eclasses_"]) and \
+				set(trg["_eclasses_"]) == set(entry["_eclasses_"]):
+				write_it = False
+		except (cache_errors.CacheError, KeyError):
+			pass
+
+		if trg and not write_it:
+			""" We don't want to skip the write unless we're really sure that
+			the existing cache is identical, so don't trust _mtime_ and
+			_eclasses_ alone."""
+			for d in (entry, trg):
+				if "EAPI" in d and d["EAPI"] in ("", "0"):
+					del d["EAPI"]
+			for k in set(chain(entry, trg)).difference(
+				("_mtime_", "_eclasses_")):
+				if trg.get(k, "") != entry.get(k, ""):
+					write_it = True
+					break
+
+		if write_it:
+			if entry.get("INHERITED",""):
+				if src_cache.complete_eclass_entries:
+					if not "_eclasses_" in entry:
+						noise.corruption(x,"missing _eclasses_ field")
+						continue
+					if not portage.eclass_cache.is_eclass_data_valid(entry["_eclasses_"]):
+						noise.eclass_stale(x)
+						continue
+				else:
+					entry["_eclasses_"] = portage.eclass_cache.get_eclass_data(entry["INHERITED"].split(), \
+						from_master_only=True)
+					if not entry["_eclasses_"]:
+						noise.eclass_stale(x)
+						continue
+
+			# by this time, if it reaches here, the eclass has been validated, and the entry has 
+			# been updated/translated (if needs be, for metadata/cache mainly)
+			try:	trg_cache[x] = entry
+			except cache_errors.CacheError, ce:
+				noise.exception(x, ce)
+				del ce
+				continue
+		if count >= noise.call_update_min:
+			noise.update(x)
+			count = 0
+
+	if not trg_cache.autocommits:
+		trg_cache.commit()
+
+	# ok.  by this time, the trg_cache is up to date, and we have a dict
+	# with a crapload of cpv's.  we now walk the target db, removing stuff if it's in the list.
+	for key in dead_nodes:
+		try:
+			del trg_cache[key]
+		except KeyError:
+			pass
+		except cache_errors.CacheError, ce:
+			noise.exception(ce)
+			del ce
+	dead_nodes.clear()
+	noise.finish()
+
+
+class quiet_mirroring(object):
+	# call_update_every is used by mirror_cache to determine how often to call in.
+	# quiet defaults to 2^24 -1.  Don't call update, 'cept once every 16 million or so :)
+	call_update_min = 0xffffff
+	def update(self,key,*arg):		pass
+	def exception(self,key,*arg):	pass
+	def eclass_stale(self,*arg):	pass
+	def missing_entry(self, key):	pass
+	def misc(self,key,*arg):		pass
+	def corruption(self, key, s):	pass
+	def finish(self, *arg):			pass
+	
+class non_quiet_mirroring(quiet_mirroring):
+	call_update_min=1
+	def update(self,key,*arg):	print "processed",key
+	def exception(self, key, *arg):	print "exec",key,arg
+	def missing(self,key):		print "key %s is missing", key
+	def corruption(self,key,*arg):	print "corrupt %s:" % key,arg
+	def eclass_stale(self,key,*arg):print "stale %s:"%key,arg
+
Index: /vendor/prefix-portage/current/pym/portage/cache/volatile.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/cache/volatile.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/cache/volatile.py	(revision 3489)
@@ -0,0 +1,27 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+import copy
+if not hasattr(__builtins__, "set"):
+	from sets import Set as set
+from portage.cache import template
+
+class database(template.database):
+
+	autocommits = True
+	serialize_eclasses = False
+
+	def __init__(self, *args, **config):
+		config.pop("gid", None)
+		super(database, self).__init__(*args, **config)
+		self._data = {}
+		self.iterkeys = self._data.iterkeys
+		self._delitem = self._data.__delitem__
+		self.__contains__ = self._data.__contains__
+
+	def _setitem(self, name, values):
+		self._data[name] = copy.deepcopy(values)
+
+	def _getitem(self, cpv):
+		return copy.deepcopy(self._data[cpv])
Index: /vendor/prefix-portage/current/pym/portage/checksum.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/checksum.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/checksum.py	(revision 3489)
@@ -0,0 +1,242 @@
+# checksum.py -- core Portage functionality
+# Copyright 1998-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_checksum.py 3835 2006-07-11 00:59:10Z zmedico $
+
+if not hasattr(__builtins__, "set"):
+	from sets import Set as set
+
+from portage.const import PRIVATE_PATH,PRELINK_BINARY,HASHING_BLOCKSIZE
+import os
+import errno
+import shutil
+import stat
+import portage.exception
+import portage.process
+import portage.util
+import portage.locks
+import commands
+import sha
+
+
+# actual hash functions first
+
+#dict of all available hash functions
+hashfunc_map = {}
+
+# We _try_ to load this module. If it fails we do the slightly slower fallback.
+try:
+	import fchksum
+	
+	def md5hash(filename):
+		return fchksum.fmd5t(filename)
+
+except ImportError:
+	import md5
+	def md5hash(filename):
+		return pyhash(filename, md5)
+hashfunc_map["MD5"] = md5hash
+
+def sha1hash(filename):
+	return pyhash(filename, sha)
+hashfunc_map["SHA1"] = sha1hash
+	
+# Keep pycrypto optional for now, there are no internal fallbacks for these
+try:
+	import Crypto.Hash.SHA256
+	
+	def sha256hash(filename):
+		return pyhash(filename, Crypto.Hash.SHA256)
+	hashfunc_map["SHA256"] = sha256hash
+except ImportError:
+	pass
+
+try:
+	import Crypto.Hash.RIPEMD
+	
+	def rmd160hash(filename):
+		return pyhash(filename, Crypto.Hash.RIPEMD)
+	hashfunc_map["RMD160"] = rmd160hash
+except ImportError:
+	pass
+
+def getsize(filename):
+	size = os.stat(filename).st_size
+	return (size, size)
+hashfunc_map["size"] = getsize
+
+# end actual hash functions
+
+prelink_capable = False
+if os.path.exists(PRELINK_BINARY):
+	results = commands.getstatusoutput(PRELINK_BINARY+" --version > /dev/null 2>&1")
+	if (results[0] >> 8) == 0:
+		prelink_capable=1
+	del results
+
+def perform_md5(x, calc_prelink=0):
+	return perform_checksum(x, "MD5", calc_prelink)[0]
+
+def perform_all(x, calc_prelink=0):
+	mydict = {}
+	for k in hashfunc_map.keys():
+		mydict[k] = perform_checksum(x, hashfunc_map[k], calc_prelink)[0]
+	return mydict
+
+def get_valid_checksum_keys():
+	return hashfunc_map.keys()
+
+def verify_all(filename, mydict, calc_prelink=0, strict=0):
+	"""
+	Verify all checksums against a file.
+
+	@param filename: File to run the checksums against
+	@type filename: String
+	@param calc_prelink: Whether or not to reverse prelink before running the checksum
+	@type calc_prelink: Integer
+	@param strict: Enable/Disable strict checking (which stops exactly at a checksum failure and throws an exception)
+	@type strict: Integer
+	@rtype: Tuple
+	@return: Result of the checks and possible message:
+		1) If size fails, False, and a tuple containing a message, the given size, and the actual size
+		2) If there is an os error, False, and a tuple containing the system error followed by 2 nulls
+		3) If a checksum fails, False and a tuple containing a message, the given hash, and the actual hash
+		4) If all checks succeed, return True and a fake reason
+	"""
+	# Dict relates to single file only.
+	# returns: (passed,reason)
+	file_is_ok = True
+	reason     = "Reason unknown"
+	try:
+		mysize = os.stat(filename)[stat.ST_SIZE]
+		if mydict["size"] != mysize:
+			return False,("Filesize does not match recorded size", mysize, mydict["size"])
+	except OSError, e:
+		if e.errno == errno.ENOENT:
+			raise portage.exception.FileNotFound(filename)
+		return False, (str(e), None, None)
+
+	verifiable_hash_types = set(mydict).intersection(hashfunc_map)
+	verifiable_hash_types.discard("size")
+	if not verifiable_hash_types:
+		expected = set(hashfunc_map)
+		expected.discard("size")
+		expected = list(expected)
+		expected.sort()
+		expected = " ".join(expected)
+		got = set(mydict)
+		got.discard("size")
+		got = list(got)
+		got.sort()
+		got = " ".join(got)
+		return False, ("Insufficient data for checksum verification", got, expected)
+
+	for x in mydict.keys():
+		if   x == "size":
+			continue
+		elif x in hashfunc_map.keys():
+			myhash = perform_checksum(filename, x, calc_prelink=calc_prelink)[0]
+			if mydict[x] != myhash:
+				if strict:
+					raise portage.exception.DigestException, "Failed to verify '$(file)s' on checksum type '%(type)s'" % {"file":filename, "type":x}
+				else:
+					file_is_ok = False
+					reason     = (("Failed on %s verification" % x), myhash,mydict[x])
+					break
+	return file_is_ok,reason
+
+def pyhash(filename, hashobject):
+	"""
+	Run a checksum against a file.
+
+	@param filename: File to run the checksum against
+	@type filename: String
+	@param hashname: The hash object that will execute the checksum on the file
+	@type hashname: Object
+	@return: The hash and size of the data
+	"""
+	f = open(filename, 'rb')
+	blocksize = HASHING_BLOCKSIZE
+	data = f.read(blocksize)
+	size = 0L
+	sum = hashobject.new()
+	while data:
+		sum.update(data)
+		size = size + len(data)
+		data = f.read(blocksize)
+	f.close()
+
+	return (sum.hexdigest(), size)
+
+def perform_checksum(filename, hashname="MD5", calc_prelink=0):
+	"""
+	Run a specific checksum against a file.
+
+	@param filename: File to run the checksum against
+	@type filename: String
+	@param hashname: The type of hash function to run
+	@type hashname: String
+	@param calc_prelink: Whether or not to reverse prelink before running the checksum
+	@type calc_prelink: Integer
+	@rtype: Tuple
+	@return: The hash and size of the data
+	"""
+	global prelink_capable
+	myfilename      = filename[:]
+	prelink_tmpfile = os.path.join("/", PRIVATE_PATH, "prelink-checksum.tmp." + str(os.getpid()))
+	mylock          = None
+	try:
+		if calc_prelink and prelink_capable:
+			mylock = portage.locks.lockfile(prelink_tmpfile, wantnewlockfile=1)
+			# Create non-prelinked temporary file to checksum.
+			# Files rejected by prelink are summed in place.
+			try:
+				retval = portage.process.spawn([PRELINK_BINARY, "--undo", "-o",
+					prelink_tmpfile, filename], fd_pipes={})
+				if retval == os.EX_OK:
+					myfilename = prelink_tmpfile
+			except portage.exception.CommandNotFound:
+				# This happens during uninstallation of prelink.
+				prelink_capable = False
+		try:
+			if hashname not in hashfunc_map:
+				raise portage.exception.DigestException(hashname + \
+					" hash function not available (needs dev-python/pycrypto)")
+			myhash, mysize = hashfunc_map[hashname](myfilename)
+		except (OSError, IOError), e:
+			if e.errno == errno.ENOENT:
+				raise portage.exception.FileNotFound(myfilename)
+			raise
+		if calc_prelink and prelink_capable:
+			try:
+				os.unlink(prelink_tmpfile)
+			except OSError, e:
+				if e.errno != errno.ENOENT:
+					raise
+				del e
+		return myhash, mysize
+	finally:
+		if mylock:
+			portage.locks.unlockfile(mylock)
+
+def perform_multiple_checksums(filename, hashes=["MD5"], calc_prelink=0):
+	"""
+	Run a group of checksums against a file.
+
+	@param filename: File to run the checksums against
+	@type filename: String
+	@param hashes: A list of checksum functions to run against the file
+	@type hashname: List
+	@param calc_prelink: Whether or not to reverse prelink before running the checksum
+	@type calc_prelink: Integer
+	@rtype: Tuple
+	@return: A dictionary in the form:
+		return_value[hash_name] = (hash_result,size)
+		for each given checksum
+	"""
+	rVal = {}
+	for x in hashes:
+		if x not in hashfunc_map:
+			raise portage.exception.DigestException, x+" hash function not available (needs dev-python/pycrypto)"
+		rVal[x] = perform_checksum(filename, x, calc_prelink)[0]
+	return rVal
Index: /vendor/prefix-portage/current/pym/portage/const.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/const.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/const.py	(revision 3489)
@@ -0,0 +1,71 @@
+# portage: Constants
+# Copyright 1998-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_const.py 3483 2006-06-10 21:40:40Z genone $
+import os
+
+# ===========================================================================
+# autotool supplied constants.
+# ===========================================================================
+from portage.const_autotool import *
+
+
+# ===========================================================================
+# START OF CONSTANTS -- START OF CONSTANTS -- START OF CONSTANTS -- START OF
+# ===========================================================================
+
+VDB_PATH                = EPREFIX+"/var/db/pkg"
+PRIVATE_PATH            = EPREFIX+"/var/lib/portage"
+CACHE_PATH              = EPREFIX+"/var/cache/edb"
+DEPCACHE_PATH           = CACHE_PATH+"/dep"
+
+USER_CONFIG_PATH        = EPREFIX+"/etc/portage"
+MODULES_FILE_PATH       = USER_CONFIG_PATH+"/modules"
+CUSTOM_PROFILE_PATH     = USER_CONFIG_PATH+"/profile"
+
+PORTAGE_BASE_PATH       = PORTAGE_BASE
+PORTAGE_BIN_PATH        = PORTAGE_BASE_PATH+"/bin"
+PORTAGE_PYM_PATH        = PORTAGE_BASE_PATH+"/pym"
+NEWS_LIB_PATH           = EPREFIX+"/var/lib/gentoo"
+PROFILE_PATH            = EPREFIX+"/etc/make.profile"
+LOCALE_DATA_PATH        = PORTAGE_BASE_PATH+"/locale"
+
+EBUILD_SH_BINARY        = PORTAGE_BIN_PATH+"/ebuild.sh"
+MISC_SH_BINARY          = PORTAGE_BIN_PATH+"/misc-functions.sh"
+SANDBOX_BINARY          = EPREFIX+"/usr/bin/sandbox"
+BASH_BINARY             = "bash"
+MOVE_BINARY             = "mv"
+PRELINK_BINARY          = "prelink"
+
+WORLD_FILE              = PRIVATE_PATH + "/world"
+MAKE_CONF_FILE          = EPREFIX+"/etc/make.conf"
+MAKE_DEFAULTS_FILE      = PROFILE_PATH + "/make.defaults"
+DEPRECATED_PROFILE_FILE = PROFILE_PATH+"/deprecated"
+USER_VIRTUALS_FILE      = USER_CONFIG_PATH+"/virtuals"
+EBUILD_SH_ENV_FILE      = USER_CONFIG_PATH+"/bashrc"
+INVALID_ENV_FILE        = "/etc/spork/is/not/valid/profile.env"
+CUSTOM_MIRRORS_FILE     = USER_CONFIG_PATH+"/mirrors"
+CONFIG_MEMORY_FILE      = PRIVATE_PATH + "/config"
+COLOR_MAP_FILE          = USER_CONFIG_PATH + "/color.map"
+
+REPO_NAME_FILE         = "repo_name"
+REPO_NAME_LOC          = "profiles" + "/" + REPO_NAME_FILE
+
+INCREMENTALS = ["USE", "USE_EXPAND", "USE_EXPAND_HIDDEN", "FEATURES",
+	"ACCEPT_KEYWORDS", "ACCEPT_LICENSE",
+	"CONFIG_PROTECT_MASK", "CONFIG_PROTECT",
+	"PRELINK_PATH", "PRELINK_PATH_MASK"]
+EBUILD_PHASES           = ["setup", "unpack", "compile", "test", "install",
+                          "preinst", "postinst", "prerm", "postrm", "other"]
+
+EAPI = "prefix"
+
+HASHING_BLOCKSIZE        = 32768
+MANIFEST1_HASH_FUNCTIONS = ["MD5","SHA256","RMD160"]
+MANIFEST2_HASH_FUNCTIONS = ["SHA1","SHA256","RMD160"]
+MANIFEST2_REQUIRED_HASH = "SHA1"
+
+MANIFEST2_IDENTIFIERS = ["AUX","MISC","DIST","EBUILD"]
+# ===========================================================================
+# END OF CONSTANTS -- END OF CONSTANTS -- END OF CONSTANTS -- END OF CONSTANT
+# ===========================================================================
Index: /vendor/prefix-portage/current/pym/portage/const_autotool.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/const_autotool.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/const_autotool.py	(revision 3489)
@@ -0,0 +1,19 @@
+# Copyright: 2005 Gentoo Foundation
+# Author(s): Brian Harring (ferringb@gentoo.org)
+# License: GPL2
+# $Id:$
+
+# all vars that are to wind up in portage_const must have their name listed in __all__
+
+__all__ = ["EPREFIX", "SYSCONFDIR", "PORTAGE_BASE", "portageuser", "portagegroup", "rootuser", "rootuid", "wheelgid"]
+
+from os import path
+
+EPREFIX=path.normpath("@DOMAIN_PREFIX@")
+SYSCONFDIR=path.normpath("@sysconfdir@")
+PORTAGE_BASE=path.normpath("@PORTAGE_BASE@")
+portagegroup="@portagegroup@"
+portageuser="@portageuser@"
+rootuser="@rootuser@"
+rootuid=int("@rootuid@")
+wheelgid=int("@wheelgid@")
Index: /vendor/prefix-portage/current/pym/portage/cvstree.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/cvstree.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/cvstree.py	(revision 3489)
@@ -0,0 +1,295 @@
+# cvstree.py -- cvs tree utilities
+# Copyright 1998-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/pym/cvstree.py,v 1.12.2.1 2005/01/16 02:35:33 carpaski Exp $
+
+
+import os,time,sys,re
+from stat import *
+
+# [D]/Name/Version/Date/Flags/Tags
+
+def pathdata(entries, path):
+	"""(entries,path)
+	Returns the data(dict) for a specific file/dir at the path specified."""
+	mysplit=path.split("/")
+	myentries=entries
+	mytarget=mysplit[-1]
+	mysplit=mysplit[:-1]
+	for mys in mysplit:
+		if myentries["dirs"].has_key(mys):
+			myentries=myentries["dirs"][mys]
+		else:
+			return None
+	if myentries["dirs"].has_key(mytarget):
+		return myentries["dirs"][mytarget]
+	elif myentries["files"].has_key(mytarget):
+		return myentries["files"][mytarget]
+	else:
+		return None
+
+def fileat(entries, path):
+	return pathdata(entries,path)
+
+def isadded(entries, path):
+	"""(entries,path)
+	Returns true if the path exists and is added to the cvs tree."""
+	mytarget=pathdata(entries, path)
+	if mytarget:
+		if "cvs" in mytarget["status"]:
+			return 1
+
+	basedir=os.path.dirname(path)
+	filename=os.path.basename(path)
+
+	try:
+		myfile=open(basedir+"/CVS/Entries","r")
+	except IOError:
+		return 0
+	mylines=myfile.readlines()
+	myfile.close()
+
+	rep=re.compile("^\/"+re.escape(filename)+"\/");
+	for x in mylines:
+		if rep.search(x):
+			return 1
+
+	return 0
+
+def findnew(entries,recursive=0,basedir=""):
+	"""(entries,recursive=0,basedir="")
+	Recurses the entries tree to find all elements that have been added but
+	have not yet been committed. Returns a list of paths, optionally prepended
+	with a basedir."""
+	if basedir and basedir[-1]!="/":
+		basedir=basedir+"/"
+	mylist=[]
+	for myfile in entries["files"].keys():
+		if "cvs" in entries["files"][myfile]["status"]:
+			if "0" == entries["files"][myfile]["revision"]:
+				mylist.append(basedir+myfile)
+	if recursive:
+		for mydir in entries["dirs"].keys():
+			mylist+=findnew(entries["dirs"][mydir],recursive,basedir+mydir)
+	return mylist
+					
+def findchanged(entries,recursive=0,basedir=""):
+	"""(entries,recursive=0,basedir="")
+	Recurses the entries tree to find all elements that exist in the cvs tree
+	and differ from the committed version. Returns a list of paths, optionally
+	prepended with a basedir."""
+	if basedir and basedir[-1]!="/":
+		basedir=basedir+"/"
+	mylist=[]
+	for myfile in entries["files"].keys():
+		if "cvs" in entries["files"][myfile]["status"]:
+			if "current" not in entries["files"][myfile]["status"]:
+				if "exists" in entries["files"][myfile]["status"]:
+					if entries["files"][myfile]["revision"]!="0":
+						mylist.append(basedir+myfile)
+	if recursive:
+		for mydir in entries["dirs"].keys():
+			mylist+=findchanged(entries["dirs"][mydir],recursive,basedir+mydir)
+	return mylist
+	
+def findmissing(entries,recursive=0,basedir=""):
+	"""(entries,recursive=0,basedir="")
+	Recurses the entries tree to find all elements that are listed in the cvs
+	tree but do not exist on the filesystem. Returns a list of paths,
+	optionally prepended with a basedir."""
+	if basedir and basedir[-1]!="/":
+		basedir=basedir+"/"
+	mylist=[]
+	for myfile in entries["files"].keys():
+		if "cvs" in entries["files"][myfile]["status"]:
+			if "exists" not in entries["files"][myfile]["status"]:
+				if "removed" not in entries["files"][myfile]["status"]:
+					mylist.append(basedir+myfile)
+	if recursive:
+		for mydir in entries["dirs"].keys():
+			mylist+=findmissing(entries["dirs"][mydir],recursive,basedir+mydir)
+	return mylist
+
+def findunadded(entries,recursive=0,basedir=""):
+	"""(entries,recursive=0,basedir="")
+	Recurses the entries tree to find all elements that are in valid cvs
+	directories but are not part of the cvs tree. Returns a list of paths,
+	optionally prepended with a basedir."""
+	if basedir and basedir[-1]!="/":
+		basedir=basedir+"/"
+	mylist=[]
+
+	#ignore what cvs ignores.
+	for myfile in entries["files"].keys():
+		if "cvs" not in entries["files"][myfile]["status"]:
+			mylist.append(basedir+myfile)
+	if recursive:
+		for mydir in entries["dirs"].keys():
+			mylist+=findunadded(entries["dirs"][mydir],recursive,basedir+mydir)
+	return mylist
+
+def findremoved(entries,recursive=0,basedir=""):
+	"""(entries,recursive=0,basedir="")
+	Recurses the entries tree to find all elements that are in flagged for cvs
+	deletions. Returns a list of paths,	optionally prepended with a basedir."""
+	if basedir and basedir[-1]!="/":
+		basedir=basedir+"/"
+	mylist=[]
+	for myfile in entries["files"].keys():
+		if "removed" in entries["files"][myfile]["status"]:
+			mylist.append(basedir+myfile)
+	if recursive:
+		for mydir in entries["dirs"].keys():
+			mylist+=findremoved(entries["dirs"][mydir],recursive,basedir+mydir)
+	return mylist
+
+def findall(entries, recursive=0, basedir=""):
+	"""(entries,recursive=0,basedir="")
+	Recurses the entries tree to find all new, changed, missing, and unadded
+	entities. Returns a 4 element list of lists as returned from each find*()."""
+
+	if basedir and basedir[-1]!="/":
+		basedir=basedir+"/"
+	mynew     = findnew(entries,recursive,basedir)
+	mychanged = findchanged(entries,recursive,basedir)
+	mymissing = findmissing(entries,recursive,basedir)
+	myunadded = findunadded(entries,recursive,basedir)
+	myremoved = findremoved(entries,recursive,basedir)
+	return [mynew, mychanged, mymissing, myunadded, myremoved]
+
+ignore_list = re.compile("(^|/)(RCS(|LOG)|SCCS|CVS(|\.adm)|cvslog\..*|tags|TAGS|\.(make\.state|nse_depinfo)|.*~|(\.|)#.*|,.*|_$.*|.*\$|\.del-.*|.*\.(old|BAK|bak|orig|rej|a|olb|o|obj|so|exe|Z|elc|ln)|core)$")
+def apply_cvsignore_filter(list):
+	x=0
+	while x < len(list):
+		if ignore_list.match(list[x].split("/")[-1]):
+			list.pop(x)
+		else:
+			x+=1
+	return list
+	
+def getentries(mydir,recursive=0):
+	"""(basedir,recursive=0)
+	Scans the given directory and returns an datadict of all the entries in
+	the directory seperated as a dirs dict and a files dict."""
+	myfn=mydir+"/CVS/Entries"
+	# entries=[dirs, files]
+	entries={"dirs":{},"files":{}}
+	if not os.path.exists(mydir):
+		return entries
+	try:
+		myfile=open(myfn, "r")
+		mylines=myfile.readlines()
+		myfile.close()
+	except SystemExit, e:
+		raise
+	except:
+		mylines=[]
+	for line in mylines:
+		if line and line[-1]=="\n":
+			line=line[:-1]
+		if not line:
+			continue
+		if line=="D": # End of entries file
+			break
+		mysplit=line.split("/")
+		if len(mysplit)!=6:
+			print "Confused:",mysplit
+			continue
+		if mysplit[0]=="D":
+			entries["dirs"][mysplit[1]]={"dirs":{},"files":{},"status":[]}
+			entries["dirs"][mysplit[1]]["status"]=["cvs"]
+			if os.path.isdir(mydir+"/"+mysplit[1]):
+				entries["dirs"][mysplit[1]]["status"]+=["exists"]
+				entries["dirs"][mysplit[1]]["flags"]=mysplit[2:]
+				if recursive:
+					rentries=getentries(mydir+"/"+mysplit[1],recursive)
+					#print rentries.keys()
+					#print entries["files"].keys()
+					#print entries["files"][mysplit[1]]
+					entries["dirs"][mysplit[1]]["dirs"]=rentries["dirs"]
+					entries["dirs"][mysplit[1]]["files"]=rentries["files"]
+		else:
+			# [D]/Name/revision/Date/Flags/Tags
+			entries["files"][mysplit[1]]={}
+			entries["files"][mysplit[1]]["revision"]=mysplit[2]
+			entries["files"][mysplit[1]]["date"]=mysplit[3]
+			entries["files"][mysplit[1]]["flags"]=mysplit[4]
+			entries["files"][mysplit[1]]["tags"]=mysplit[5]
+			entries["files"][mysplit[1]]["status"]=["cvs"]
+			if entries["files"][mysplit[1]]["revision"][0]=="-":
+				entries["files"][mysplit[1]]["status"]+=["removed"]
+
+	for file in apply_cvsignore_filter(os.listdir(mydir)):
+		if file=="CVS":
+			continue
+		if file=="digest-framerd-2.4.3":
+			print mydir,file
+		if os.path.isdir(mydir+"/"+file):
+			if not entries["dirs"].has_key(file):
+				entries["dirs"][file]={"dirs":{},"files":{}}
+			if entries["dirs"][file].has_key("status"):
+				if "exists" not in entries["dirs"][file]["status"]:
+					entries["dirs"][file]["status"]+=["exists"]
+			else:
+				entries["dirs"][file]["status"]=["exists"]
+		elif os.path.isfile(mydir+"/"+file):
+			if file=="digest-framerd-2.4.3":
+				print "isfile"
+			if not entries["files"].has_key(file):
+				entries["files"][file]={"revision":"","date":"","flags":"","tags":""}
+			if entries["files"][file].has_key("status"):
+				if file=="digest-framerd-2.4.3":
+					print "has status"
+				if "exists" not in entries["files"][file]["status"]:
+					if file=="digest-framerd-2.4.3":
+						print "no exists in status"
+					entries["files"][file]["status"]+=["exists"]
+			else:
+				if file=="digest-framerd-2.4.3":
+					print "no status"
+				entries["files"][file]["status"]=["exists"]
+			try:
+				if file=="digest-framerd-2.4.3":
+					print "stat'ing"
+				mystat=os.stat(mydir+"/"+file)
+				mytime=time.asctime(time.gmtime(mystat[ST_MTIME]))
+				if not entries["files"][file].has_key("status"):
+					if file=="digest-framerd-2.4.3":
+						print "status not set"
+					entries["files"][file]["status"]=[]
+				if file=="digest-framerd-2.4.3":
+					print "date:",entries["files"][file]["date"]
+					print "sdate:",mytime
+				if mytime==entries["files"][file]["date"]:
+					entries["files"][file]["status"]+=["current"]
+				if file=="digest-framerd-2.4.3":
+					print "stat done"
+				
+				del mystat
+			except SystemExit, e:
+				raise
+			except Exception, e:
+				print "failed to stat",file
+				print e
+				return
+				
+		else:
+			print
+			print "File of unknown type:",mydir+"/"+file
+			print
+	return entries
+
+#class cvstree:
+#	def __init__(self,basedir):
+#		self.refdir=os.cwd()
+#		self.basedir=basedir
+#		self.entries={}
+#		self.entries["dirs"]={}
+#		self.entries["files"]={}
+#		self.entries["dirs"][self.basedir]=getentries(self.basedir)
+#		self.getrealdirs(self.dirs, self.files)
+#	def getrealdirs(self,dirs,files):
+#		for mydir in dirs.keys():
+#			list = os.listdir(
+			
+		
Index: /vendor/prefix-portage/current/pym/portage/data.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/data.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/data.py	(revision 3489)
@@ -0,0 +1,120 @@
+# data.py -- Calculated/Discovered Data Values
+# Copyright 1998-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id:$
+
+if not hasattr(__builtins__, "set"):
+	from sets import Set as set
+
+import os, sys, pwd, grp
+from portage.const import wheelgid, rootuid, portageuser, portagegroup
+from portage.util import writemsg
+from portage.output import green,red
+from portage.output import create_color_func
+bad = create_color_func("BAD")
+
+ostype=os.uname()[0]
+
+userland = None
+lchown = getattr(os, "lchown", None)
+os.environ.setdefault("XARGS", "xargs")
+os.environ["XARGS"]="xargs -r"
+
+# "fix" for lchown on Darwin
+if ostype == "Darwin":
+	def lchown(*pos_args, **key_args):
+		pass
+
+if not lchown:
+	if "lchown" in dir(os):
+		# Included in python-2.3
+		lchown = os.lchown
+	else:
+		try:
+			import missingos
+			lchown = missingos.lchown
+		except ImportError:
+			def lchown(*pos_args, **key_args):
+				writemsg(red("!!!") + " It seems that os.lchown does not" + \
+					" exist.  Please rebuild python.\n", noiselevel=-1)
+			lchown()
+
+def portage_group_warning():
+	warn_prefix = bad("*** WARNING ***  ")
+	mylines = [
+		"For security reasons, only system administrators should be",
+		"allowed in the portage group.  Untrusted users or processes",
+		"can potentially exploit the portage group for attacks such as",
+		"local privilege escalation."
+	]
+	for x in mylines:
+		writemsg(warn_prefix, noiselevel=-1)
+		writemsg(x, noiselevel=-1)
+		writemsg("\n", noiselevel=-1)
+	writemsg("\n", noiselevel=-1)
+
+# Portage has 3 security levels that depend on the uid and gid of the main
+# process and are assigned according to the following table:
+#
+# Privileges  secpass  uid    gid
+# normal      0        any    any
+# group       1        any    portage_gid
+# super       2        0      any
+#
+# If the "wheel" group does not exist then wheelgid falls back to 0.
+# If the "portage" group does not exist then portage_uid falls back to wheelgid.
+
+secpass=0
+
+uid=os.getuid()
+wheelgroup=grp.getgrgid(wheelgid)[0]
+
+if uid==0 or uid==int(rootuid):
+	secpass=2
+try:
+	if (not secpass) and (wheelgid in os.getgroups()):
+		secpass=1
+except KeyError:
+	writemsg("portage initialization: your system doesn't have a '%s' group.\n" % wheelgroup)
+	writemsg("Please fix this as it is a normal system requirement. '%s' is GID %d\n" % (wheelgroup, wheelgid))
+	writemsg("`emerge baselayout` and a config update with dispatch-conf, etc-update\n")
+	writemsg("or cfg-update should remedy this problem.\n")
+	pass
+
+#Discover the uid and gid of the portage user/group
+try:
+	portage_uid=pwd.getpwnam(portageuser)[2]
+	portage_gid=grp.getgrnam(portagegroup)[2]
+	if secpass < 1 and portage_gid in os.getgroups():
+		secpass=1
+except KeyError:
+	portage_uid=0
+	portage_gid=wheelgid
+	writemsg("\n")
+	writemsg(  red("portage: "+portageuser+" user or group missing. Please update baselayout\n"))
+	writemsg(  red("         and merge portage user(250) and group(250) into your passwd\n"))
+	writemsg(  red("         and group files. Non-root compilation is disabled until then.\n"))
+	writemsg(      "         Also note that non-root/wheel users will need to be added to\n")
+	writemsg(      "         the portage group to do portage commands.\n")
+	writemsg("\n")
+	writemsg(      "         For the defaults, line 1 goes into passwd, and 2 into group.\n")
+	writemsg(green("         portage:x:250:250:portage:/var/tmp/portage:/bin/false\n"))
+	writemsg(green("         portage::250:portage\n"))
+	writemsg("\n")
+	portage_group_warning()
+
+userpriv_groups = [portage_gid]
+if secpass >= 2:
+	# Get a list of group IDs for the portage user.  Do not use grp.getgrall()
+	# since it is known to trigger spurious SIGPIPE problems with nss_ldap.
+	from commands import getstatusoutput
+	mystatus, myoutput = getstatusoutput("id -G " + portageuser)
+	if mystatus == os.EX_OK:
+		for x in myoutput.split():
+			try:
+				userpriv_groups.append(int(x))
+			except ValueError:
+				pass
+			del x
+		userpriv_groups = list(set(userpriv_groups))
+	del getstatusoutput, mystatus, myoutput
Index: /vendor/prefix-portage/current/pym/portage/dbapi/__init__.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/dbapi/__init__.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/dbapi/__init__.py	(revision 3489)
@@ -0,0 +1,103 @@
+# Copyright 1998-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: __init__.py 6734 2007-06-05 16:37:29Z grobian $
+
+
+from portage.dep import dep_getslot, dep_getkey, match_from_list
+from portage.locks import unlockfile
+from portage.output import red
+from portage.util import writemsg
+
+from portage import dep_expand
+
+import os, re
+
+class dbapi(object):
+	def __init__(self):
+		pass
+
+	def close_caches(self):
+		pass
+
+	def cp_list(self, cp, use_cache=1):
+		return
+
+	def cpv_all(self):
+		cpv_list = []
+		for cp in self.cp_all():
+			cpv_list.extend(self.cp_list(cp))
+		return cpv_list
+
+	def aux_get(self, mycpv, mylist):
+		"stub code for returning auxiliary db information, such as SLOT, DEPEND, etc."
+		'input: "sys-apps/foo-1.0",["SLOT","DEPEND","HOMEPAGE"]'
+		'return: ["0",">=sys-libs/bar-1.0","http://www.foo.com"] or [] if mycpv not found'
+		raise NotImplementedError
+
+	def match(self, origdep, use_cache=1):
+		mydep = dep_expand(origdep, mydb=self, settings=self.settings)
+		mykey = dep_getkey(mydep)
+		mylist = match_from_list(mydep, self.cp_list(mykey, use_cache=use_cache))
+		myslot = dep_getslot(mydep)
+		if myslot is not None:
+			mylist = [cpv for cpv in mylist \
+				if self.aux_get(cpv, ["SLOT"])[0] == myslot]
+		return mylist
+
+	def invalidentry(self, mypath):
+		if re.search("portage_lockfile$", mypath):
+			if not os.environ.has_key("PORTAGE_MASTER_PID"):
+				writemsg("Lockfile removed: %s\n" % mypath, 1)
+				unlockfile((mypath, None, None))
+			else:
+				# Nothing we can do about it. We're probably sandboxed.
+				pass
+		elif re.search(".*/-MERGING-(.*)", mypath):
+			if os.path.exists(mypath):
+				writemsg(red("INCOMPLETE MERGE:")+" "+mypath+"\n", noiselevel=-1)
+		else:
+			writemsg("!!! Invalid db entry: %s\n" % mypath, noiselevel=-1)
+
+	def update_ents(self, updates, onProgress=None):
+		"""
+		Update metadata of all packages for packages moves.
+		@param updates: A list of move commands
+		@type updates: List
+		@param onProgress: A progress callback function
+		@type onProgress: a callable that takes 2 integer arguments: maxval and curval
+		"""
+		cpv_all = self.cpv_all()
+		cpv_all.sort()
+		maxval = len(cpv_all)
+		aux_get = self.aux_get
+		aux_update = self.aux_update
+		update_keys = ["DEPEND", "RDEPEND", "PDEPEND", "PROVIDE"]
+		from itertools import izip
+		from portage.update import update_dbentries
+		if onProgress:
+			onProgress(maxval, 0)
+		for i, cpv in enumerate(cpv_all):
+			metadata = dict(izip(update_keys, aux_get(cpv, update_keys)))
+			metadata_updates = update_dbentries(updates, metadata)
+			if metadata_updates:
+				aux_update(cpv, metadata_updates)
+			if onProgress:
+				onProgress(maxval, i+1)
+
+	def move_slot_ent(self, mylist):
+		pkg = mylist[1]
+		origslot = mylist[2]
+		newslot = mylist[3]
+		origmatches = self.match(pkg)
+		moves = 0
+		if not origmatches:
+			return moves
+		from portage.versions import catsplit
+		for mycpv in origmatches:
+			slot = self.aux_get(mycpv, ["SLOT"])[0]
+			if slot != origslot:
+				continue
+			moves += 1
+			mydata = {"SLOT": newslot+"\n"}
+			self.aux_update(mycpv, mydata)
+		return moves
Index: /vendor/prefix-portage/current/pym/portage/dbapi/bintree.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/dbapi/bintree.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/dbapi/bintree.py	(revision 3489)
@@ -0,0 +1,901 @@
+# Copyright 1998-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: bintree.py 6804 2007-06-11 14:26:02Z grobian $
+
+from portage.dep import isvalidatom, isjustname, dep_getkey, match_from_list
+from portage.dbapi.virtual import fakedbapi
+from portage.exception import InvalidPackageName, InvalidAtom
+from portage.output import green
+from portage.util import normalize_path, writemsg, writemsg_stdout
+from portage.versions import best, catpkgsplit, catsplit
+from portage.update import update_dbentries
+
+from portage import listdir, dep_expand
+
+import portage.xpak, portage.getbinpkg
+
+import os, errno, stat
+
+class bindbapi(fakedbapi):
+	def __init__(self, mybintree=None, settings=None):
+		self.bintree = mybintree
+		self.move_ent = mybintree.move_ent
+		self.cpvdict={}
+		self.cpdict={}
+		if settings is None:
+			from portage import settings
+		self.settings = settings
+		self._match_cache = {}
+		# Selectively cache metadata in order to optimize dep matching.
+		self._aux_cache_keys = set(["SLOT"])
+		self._aux_cache = {}
+
+	def match(self, *pargs, **kwargs):
+		if self.bintree and not self.bintree.populated:
+			self.bintree.populate()
+		return fakedbapi.match(self, *pargs, **kwargs)
+
+	def aux_get(self, mycpv, wants):
+		if self.bintree and not self.bintree.populated:
+			self.bintree.populate()
+		cache_me = False
+		if not set(wants).difference(self._aux_cache_keys):
+			aux_cache = self._aux_cache.get(mycpv)
+			if aux_cache is not None:
+				return [aux_cache[x] for x in wants]
+			cache_me = True
+		mysplit = mycpv.split("/")
+		mylist = []
+		tbz2name = mysplit[1]+".tbz2"
+		if not self.bintree._remotepkgs or \
+			not self.bintree.isremote(mycpv):
+			tbz2_path = self.bintree.getname(mycpv)
+			if not os.path.exists(tbz2_path):
+				raise KeyError(mycpv)
+			getitem = portage.xpak.tbz2(tbz2_path).getfile
+		else:
+			getitem = self.bintree._remotepkgs[mycpv].get
+		mydata = {}
+		mykeys = wants
+		if cache_me:
+			mykeys = self._aux_cache_keys.union(wants)
+		for x in mykeys:
+			myval = getitem(x)
+			# myval is None if the key doesn't exist
+			# or the tbz2 is corrupt.
+			if myval:
+				mydata[x] = " ".join(myval.split())
+		if "EAPI" in mykeys:
+			if not mydata.setdefault("EAPI", "0"):
+				mydata["EAPI"] = "0"
+		if cache_me:
+			aux_cache = {}
+			for x in self._aux_cache_keys:
+				aux_cache[x] = mydata.get(x, "")
+			self._aux_cache[mycpv] = aux_cache
+		return [mydata.get(x, "") for x in wants]
+
+	def aux_update(self, cpv, values):
+		if not self.bintree.populated:
+			self.bintree.populate()
+		tbz2path = self.bintree.getname(cpv)
+		if not os.path.exists(tbz2path):
+			raise KeyError(cpv)
+		mytbz2 = portage.xpak.tbz2(tbz2path)
+		mydata = mytbz2.get_data()
+		mydata.update(values)
+		for k, v in mydata.items():
+			if not v:
+				del mydata[k]
+		mytbz2.recompose_mem(portage.xpak.xpak_mem(mydata))
+		self.bintree.inject(cpv)
+
+	def cp_list(self, *pargs, **kwargs):
+		if not self.bintree.populated:
+			self.bintree.populate()
+		return fakedbapi.cp_list(self, *pargs, **kwargs)
+
+	def cp_all(self):
+		if not self.bintree.populated:
+			self.bintree.populate()
+		return fakedbapi.cp_all(self)
+
+	def cpv_all(self):
+		if not self.bintree.populated:
+			self.bintree.populate()
+		return fakedbapi.cpv_all(self)
+
+class binarytree(object):
+	"this tree scans for a list of all packages available in PKGDIR"
+	def __init__(self, root, pkgdir, virtual=None, settings=None, clone=None):
+		if clone:
+			writemsg("binartree.__init__(): deprecated " + \
+				"use of clone parameter\n", noiselevel=-1)
+			# XXX This isn't cloning. It's an instance of the same thing.
+			self.root = clone.root
+			self.pkgdir = clone.pkgdir
+			self.dbapi = clone.dbapi
+			self.populated = clone.populated
+			self.tree = clone.tree
+			self.remotepkgs = clone.remotepkgs
+			self.invalids = clone.invalids
+			self.settings = clone.settings
+		else:
+			self.root = root
+			#self.pkgdir=settings["PKGDIR"]
+			self.pkgdir = normalize_path(pkgdir)
+			self.dbapi = bindbapi(self, settings=settings)
+			self.update_ents = self.dbapi.update_ents
+			self.move_slot_ent = self.dbapi.move_slot_ent
+			self.populated = 0
+			self.tree = {}
+			self._remote_has_index = False
+			self._remote_base_uri = None
+			self._remotepkgs = None # remote metadata indexed by cpv
+			self.remotepkgs = {}  # indexed by tbz2 name (deprecated)
+			self.invalids = []
+			self.settings = settings
+			self._pkg_paths = {}
+			self._all_directory = os.path.isdir(
+				os.path.join(self.pkgdir, "All"))
+			self._pkgindex_version = 0
+			self._pkgindex_hashes = ["MD5","SHA1"]
+			self._pkgindex_file = os.path.join(self.pkgdir, "Packages")
+			self._pkgindex_keys = set(["CPV", "SLOT", "MTIME", "SIZE"])
+			self._pkgindex_header_keys = set(["ACCEPT_KEYWORDS", "CBUILD",
+				"CHOST", "CONFIG_PROTECT", "CONFIG_PROTECT_MASK", "FEATURES",
+				"GENTOO_MIRRORS", "INSTALL_MASK", "SYNC", "USE"])
+
+	def move_ent(self, mylist):
+		if not self.populated:
+			self.populate()
+		origcp = mylist[1]
+		newcp = mylist[2]
+		# sanity check
+		for cp in [origcp, newcp]:
+			if not (isvalidatom(cp) and isjustname(cp)):
+				raise InvalidPackageName(cp)
+		origcat = origcp.split("/")[0]
+		mynewcat = newcp.split("/")[0]
+		origmatches=self.dbapi.cp_list(origcp)
+		moves = 0
+		if not origmatches:
+			return moves
+		for mycpv in origmatches:
+
+			mycpsplit = catpkgsplit(mycpv)
+			mynewcpv = newcp + "-" + mycpsplit[2]
+			if mycpsplit[3] != "r0":
+				mynewcpv += "-" + mycpsplit[3]
+			myoldpkg = mycpv.split("/")[1]
+			mynewpkg = mynewcpv.split("/")[1]
+
+			if (mynewpkg != myoldpkg) and os.path.exists(self.getname(mynewcpv)):
+				writemsg("!!! Cannot update binary: Destination exists.\n",
+					noiselevel=-1)
+				writemsg("!!! "+mycpv+" -> "+mynewcpv+"\n", noiselevel=-1)
+				continue
+
+			tbz2path = self.getname(mycpv)
+			if os.path.exists(tbz2path) and not os.access(tbz2path,os.W_OK):
+				writemsg("!!! Cannot update readonly binary: "+mycpv+"\n",
+					noiselevel=-1)
+				continue
+
+			moves += 1
+			mytbz2 = portage.xpak.tbz2(tbz2path)
+			mydata = mytbz2.get_data()
+			updated_items = update_dbentries([mylist], mydata)
+			mydata.update(updated_items)
+			mydata["CATEGORY"] = mynewcat+"\n"
+			if mynewpkg != myoldpkg:
+				mydata[mynewpkg+".ebuild"] = mydata[myoldpkg+".ebuild"]
+				del mydata[myoldpkg+".ebuild"]
+				mydata["PF"] = mynewpkg + "\n"
+			mytbz2.recompose_mem(portage.xpak.xpak_mem(mydata))
+
+			self.dbapi.cpv_remove(mycpv)
+			del self._pkg_paths[mycpv]
+			new_path = self.getname(mynewcpv)
+			self._pkg_paths[mynewcpv] = os.path.join(
+				*new_path.split(os.path.sep)[-2:])
+			if new_path != mytbz2:
+				try:
+					os.makedirs(os.path.dirname(new_path))
+				except OSError, e:
+					if e.errno != errno.EEXIST:
+						raise
+					del e
+				os.rename(tbz2path, new_path)
+				self._remove_symlink(mycpv)
+				if new_path.split(os.path.sep)[-2] == "All":
+					self._create_symlink(mynewcpv)
+			self.inject(mynewcpv)
+
+		return moves
+
+	def _remove_symlink(self, cpv):
+		"""Remove a ${PKGDIR}/${CATEGORY}/${PF}.tbz2 symlink and also remove
+		the ${PKGDIR}/${CATEGORY} directory if empty.  The file will not be
+		removed if os.path.islink() returns False."""
+		mycat, mypkg = catsplit(cpv)
+		mylink = os.path.join(self.pkgdir, mycat, mypkg + ".tbz2")
+		if os.path.islink(mylink):
+			"""Only remove it if it's really a link so that this method never
+			removes a real package that was placed here to avoid a collision."""
+			os.unlink(mylink)
+		try:
+			os.rmdir(os.path.join(self.pkgdir, mycat))
+		except OSError, e:
+			if e.errno not in (errno.ENOENT,
+				errno.ENOTEMPTY, errno.EEXIST):
+				raise
+			del e
+
+	def _create_symlink(self, cpv):
+		"""Create a ${PKGDIR}/${CATEGORY}/${PF}.tbz2 symlink (and
+		${PKGDIR}/${CATEGORY} directory, if necessary).  Any file that may
+		exist in the location of the symlink will first be removed."""
+		mycat, mypkg = catsplit(cpv)
+		full_path = os.path.join(self.pkgdir, mycat, mypkg + ".tbz2")
+		try:
+			os.makedirs(os.path.dirname(full_path))
+		except OSError, e:
+			if e.errno != errno.EEXIST:
+				raise
+			del e
+		try:
+			os.unlink(full_path)
+		except OSError, e:
+			if e.errno != errno.ENOENT:
+				raise
+			del e
+		os.symlink(os.path.join("..", "All", mypkg + ".tbz2"), full_path)
+
+	def prevent_collision(self, cpv):
+		"""Make sure that the file location ${PKGDIR}/All/${PF}.tbz2 is safe to
+		use for a given cpv.  If a collision will occur with an existing
+		package from another category, the existing package will be bumped to
+		${PKGDIR}/${CATEGORY}/${PF}.tbz2 so that both can coexist."""
+		if not self._all_directory:
+			return
+		full_path = self.getname(cpv)
+		if "All" == full_path.split(os.path.sep)[-2]:
+			return
+		"""Move a colliding package if it exists.  Code below this point only
+		executes in rare cases."""
+		mycat, mypkg = catsplit(cpv)
+		myfile = mypkg + ".tbz2"
+		mypath = os.path.join("All", myfile)
+		dest_path = os.path.join(self.pkgdir, mypath)
+		if os.path.exists(dest_path):
+			# For invalid packages, other_cat could be None.
+			other_cat = portage.xpak.tbz2(dest_path).getfile("CATEGORY")
+			if other_cat:
+				other_cat = other_cat.strip()
+				other_cpv = other_cat + "/" + mypkg
+				self._move_from_all(other_cpv)
+				self.inject(other_cpv)
+		"""The file may or may not exist. Move it if necessary and update
+		internal state for future calls to getname()."""
+		self._move_to_all(cpv)
+		if os.path.exists(full_path):
+			self.inject(cpv)
+
+	def _move_to_all(self, cpv):
+		"""If the file exists, move it.  Whether or not it exists, update state
+		for future getname() calls."""
+		mycat, mypkg = catsplit(cpv)
+		myfile = mypkg + ".tbz2"
+		src_path = os.path.join(self.pkgdir, mycat, myfile)
+		try:
+			mystat = os.lstat(src_path)
+		except OSError, e:
+			mystat = None
+		if mystat and stat.S_ISREG(mystat.st_mode):
+			try:
+				os.makedirs(os.path.join(self.pkgdir, "All"))
+			except OSError, e:
+				if e.errno != errno.EEXIST:
+					raise
+				del e
+			os.rename(src_path, os.path.join(self.pkgdir, "All", myfile))
+			self._create_symlink(cpv)
+		self._pkg_paths[cpv] = os.path.join("All", myfile)
+
+	def _move_from_all(self, cpv):
+		"""Move a package from ${PKGDIR}/All/${PF}.tbz2 to
+		${PKGDIR}/${CATEGORY}/${PF}.tbz2 and update state from getname calls."""
+		self._remove_symlink(cpv)
+		mycat, mypkg = catsplit(cpv)
+		myfile = mypkg + ".tbz2"
+		mypath = os.path.join(mycat, myfile)
+		dest_path = os.path.join(self.pkgdir, mypath)
+		try:
+			os.makedirs(os.path.dirname(dest_path))
+		except OSError, e:
+			if e.errno != errno.EEXIST:
+				raise
+			del e
+		os.rename(os.path.join(self.pkgdir, "All", myfile), dest_path)
+		self._pkg_paths[cpv] = mypath
+
+	def populate(self, getbinpkgs=0, getbinpkgsonly=0):
+		"populates the binarytree"
+		from portage.locks import lockfile, unlockfile
+		pkgindex_lock = None
+		try:
+			if os.access(self.pkgdir, os.W_OK):
+				pkgindex_lock = lockfile(self._pkgindex_file,
+					wantnewlockfile=1)
+			self._populate(getbinpkgs, getbinpkgsonly)
+		finally:
+			if pkgindex_lock:
+				unlockfile(pkgindex_lock)
+
+	def _populate(self, getbinpkgs=0, getbinpkgsonly=0):
+		if (not os.path.isdir(self.pkgdir) and not getbinpkgs):
+			return 0
+
+		categories = set(self.settings.categories)
+
+		if not getbinpkgsonly:
+			pkg_paths = {}
+			dirs = listdir(self.pkgdir, dirsonly=True, EmptyOnError=True)
+			if "All" in dirs:
+				dirs.remove("All")
+			dirs.sort()
+			dirs.insert(0, "All")
+			pkgindex = portage.getbinpkg.PackageIndex()
+			pf_index = None
+			try:
+				f = open(self._pkgindex_file)
+			except EnvironmentError:
+				pass
+			else:
+				try:
+					pkgindex.read(f)
+				finally:
+					f.close()
+					del f
+			if not self._pkgindex_version_supported(pkgindex):
+				pkgindex = portage.getbinpkg.PackageIndex()
+			header = pkgindex.header
+			metadata = pkgindex.packages
+			update_pkgindex = False
+			for mydir in dirs:
+				for myfile in listdir(os.path.join(self.pkgdir, mydir)):
+					if not myfile.endswith(".tbz2"):
+						continue
+					mypath = os.path.join(mydir, myfile)
+					full_path = os.path.join(self.pkgdir, mypath)
+					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":
+						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):
+									continue
+							except (KeyError, ValueError):
+								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
+							# update the path if the package has been moved
+							oldpath = d.get("PATH")
+							if oldpath and oldpath != mypath:
+								update_pkgindex = True
+							if mypath != mycpv + ".tbz2":
+								d["PATH"] = mypath
+								if not oldpath:
+									update_pkgindex = True
+							else:
+								d.pop("PATH", None)
+								if oldpath:
+									update_pkgindex = True
+							self.dbapi.cpv_inject(mycpv)
+							if not self.dbapi._aux_cache_keys.difference(d):
+								aux_cache = {}
+								for k in self.dbapi._aux_cache_keys:
+									aux_cache[k] = d[k]
+								self.dbapi._aux_cache[mycpv] = aux_cache
+							continue
+					mytbz2 = portage.xpak.tbz2(full_path)
+					# For invalid packages, mycat could be None.
+					mycat = mytbz2.getfile("CATEGORY")
+					mypf = mytbz2.getfile("PF")
+					slot = mytbz2.getfile("SLOT")
+					mypkg = myfile[:-5]
+					if not mycat or not mypf or not slot:
+						#old-style or corrupt package
+						writemsg("!!! Invalid binary package: '%s'\n" % full_path,
+							noiselevel=-1)
+						writemsg("!!! This binary package is not " + \
+							"recoverable and should be deleted.\n",
+							noiselevel=-1)
+						self.invalids.append(mypkg)
+						continue
+					mycat = mycat.strip()
+					slot = slot.strip()
+					if mycat != mydir and mydir != "All":
+						continue
+					if mypkg != mypf.strip():
+						continue
+					mycpv = mycat + "/" + mypkg
+					if mycpv in pkg_paths:
+						# All is first, so it's preferred.
+						continue
+					if mycat not in categories:
+						writemsg(("!!! Binary package has an " + \
+							"unrecognized category: '%s'\n") % full_path,
+							noiselevel=-1)
+						writemsg(("!!! '%s' has a category that is not" + \
+							" listed in /etc/portage/categories\n") % mycpv,
+							noiselevel=-1)
+						continue
+					pkg_paths[mycpv] = mypath
+					self.dbapi.cpv_inject(mycpv)
+					update_pkgindex = True
+					d = metadata.get(mycpv, {})
+					if d:
+						try:
+							if long(d["MTIME"]) != long(s.st_mtime):
+								d.clear()
+						except (KeyError, ValueError):
+							d.clear()
+					if d:
+						try:
+							if long(d["SIZE"]) != long(s.st_size):
+								d.clear()
+						except (KeyError, ValueError):
+							d.clear()
+
+					d["CPV"] = mycpv
+					d["SLOT"] = slot
+					d["MTIME"] = str(long(s.st_mtime))
+					d["SIZE"] = str(s.st_size)
+					# record location if it's non-default
+					if mypath != mycpv + ".tbz2":
+						d["PATH"] = mypath
+					else:
+						d.pop("PATH", None)
+					metadata[mycpv] = d
+					if not self.dbapi._aux_cache_keys.difference(d):
+						aux_cache = {}
+						for k in self.dbapi._aux_cache_keys:
+							aux_cache[k] = d[k]
+						self.dbapi._aux_cache[mycpv] = aux_cache
+
+			self._pkg_paths = pkg_paths
+			# 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 os.access(self.pkgdir, os.W_OK):
+				cpv_all = self._pkg_paths.keys()
+				stale = set(metadata).difference(cpv_all)
+				for cpv in stale:
+					del metadata[cpv]
+				from portage.util import atomic_ofstream
+				f = atomic_ofstream(self._pkgindex_file)
+				try:
+					pkgindex.write(f)
+				finally:
+					f.close()
+
+		if getbinpkgs and not self.settings["PORTAGE_BINHOST"]:
+			writemsg("!!! PORTAGE_BINHOST unset, but use is requested.\n",
+				noiselevel=-1)
+
+		if getbinpkgs and \
+			"PORTAGE_BINHOST" in self.settings and \
+			not self._remotepkgs:
+
+			base_url = self.settings["PORTAGE_BINHOST"]
+			from portage.const import CACHE_PATH
+			from urlparse import urlparse
+			urldata = urlparse(base_url)
+			pkgindex_file = os.path.join(CACHE_PATH, "binhost",
+				urldata[1] + urldata[2], "Packages")
+			pkgindex = portage.getbinpkg.PackageIndex()
+			try:
+				f = open(pkgindex_file)
+				try:
+					pkgindex.read(f)
+				finally:
+					f.close()
+			except EnvironmentError, e:
+				if e.errno != errno.ENOENT:
+					raise
+			local_timestamp = pkgindex.header.get("TIMESTAMP", None)
+			import urllib, urlparse
+			rmt_idx = portage.getbinpkg.PackageIndex()
+			try:
+				f = urllib.urlopen(urlparse.urljoin(base_url, "Packages"))
+				try:
+					rmt_idx.readHeader(f)
+					remote_timestamp = rmt_idx.header.get("TIMESTAMP", None)
+					if not remote_timestamp:
+						# no timestamp in the header, something's wrong
+						pkgindex = None
+					else:
+						if not self._pkgindex_version_supported(rmt_idx):
+							writemsg("\n\n!!! Binhost package index version" + \
+							" is not supported: '%s'\n" % \
+							rmt_idx.header.get("VERSION"), noiselevel=-1)
+							pkgindex = None
+						elif local_timestamp != remote_timestamp:
+							rmt_idx.readBody(f)
+							pkgindex = rmt_idx
+				finally:
+					f.close()
+			except EnvironmentError, e:
+				writemsg("\n\n!!! Error fetching binhost package" + \
+					" info from '%s'\n" % base_url)
+				writemsg("!!! %s\n\n" % str(e))
+				del e
+				pkgindex = None
+			if pkgindex is rmt_idx:
+				pkgindex.modified = False # don't update the header
+				from portage.util import atomic_ofstream, ensure_dirs
+				ensure_dirs(os.path.dirname(pkgindex_file))
+				f = atomic_ofstream(pkgindex_file)
+				try:
+					pkgindex.write(f)
+				finally:
+					f.close()
+			if pkgindex:
+				self._remotepkgs = pkgindex.packages
+				self._remote_has_index = True
+				self._remote_base_uri = pkgindex.header.get("URI", base_url)
+				self.remotepkgs = {}
+				for cpv in self._remotepkgs:
+					self.dbapi.cpv_inject(cpv)
+				self.populated = 1
+				return
+			self._remotepkgs = {}
+			try:
+				chunk_size = long(self.settings["PORTAGE_BINHOST_CHUNKSIZE"])
+				if chunk_size < 8:
+					chunk_size = 8
+			except (ValueError, KeyError):
+				chunk_size = 3000
+			writemsg_stdout(green("Fetching binary packages info...\n"))
+			self.remotepkgs = portage.getbinpkg.dir_get_metadata(
+				self.settings["PORTAGE_BINHOST"], chunk_size=chunk_size)
+			writemsg(green("  -- DONE!\n\n"))
+
+			for mypkg in self.remotepkgs.keys():
+				if not self.remotepkgs[mypkg].has_key("CATEGORY"):
+					#old-style or corrupt package
+					writemsg("!!! Invalid remote binary package: "+mypkg+"\n",
+						noiselevel=-1)
+					del self.remotepkgs[mypkg]
+					continue
+				mycat = self.remotepkgs[mypkg]["CATEGORY"].strip()
+				fullpkg = mycat+"/"+mypkg[:-5]
+				if mycat not in categories:
+					writemsg(("!!! Remote binary package has an " + \
+						"unrecognized category: '%s'\n") % fullpkg,
+						noiselevel=-1)
+					writemsg(("!!! '%s' has a category that is not" + \
+						" listed in /etc/portage/categories\n") % fullpkg,
+						noiselevel=-1)
+					continue
+				mykey = dep_getkey(fullpkg)
+				try:
+					# invalid tbz2's can hurt things.
+					#print "cpv_inject("+str(fullpkg)+")"
+					self.dbapi.cpv_inject(fullpkg)
+					metadata = self.remotepkgs[mypkg]
+					for k, v in metadata.items():
+						metadata[k] = v.strip()
+					self._remotepkgs[fullpkg] = metadata
+					#print "  -- Injected"
+				except SystemExit, e:
+					raise
+				except:
+					writemsg("!!! Failed to inject remote binary package:"+str(fullpkg)+"\n",
+						noiselevel=-1)
+					del self.remotepkgs[mypkg]
+					continue
+		self.populated=1
+
+	def inject(self, cpv, filename=None):
+		"""Add a freshly built package to the database.  This updates
+		$PKGDIR/Packages with the new package metadata (including MD5).
+		@param cpv: The cpv of the new package to inject
+		@type cpv: string
+		@param filename: File path of the package to inject, or None if it's
+			already in the location returned by getname()
+		@type filename: string
+		@rtype: None
+		"""
+		mycat, mypkg = catsplit(cpv)
+		if not self.populated:
+			self.populate()
+		if filename is None:
+			full_path = self.getname(cpv)
+		else:
+			full_path = filename
+		try:
+			s = os.stat(full_path)
+		except OSError, e:
+			if e.errno != errno.ENOENT:
+				raise
+			del e
+			writemsg("!!! Binary package does not exist: '%s'\n" % full_path,
+				noiselevel=-1)
+			return
+		mytbz2 = portage.xpak.tbz2(full_path)
+		slot = mytbz2.getfile("SLOT")
+		if slot is None:
+			writemsg("!!! Invalid binary package: '%s'\n" % full_path,
+				noiselevel=-1)
+			return
+		slot = slot.strip()
+		from portage.checksum import perform_multiple_checksums
+		digests = perform_multiple_checksums(
+			full_path, hashes=self._pkgindex_hashes)
+		self.dbapi.cpv_inject(cpv)
+		self.dbapi._aux_cache.pop(cpv, None)
+
+		# 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
+		pkgindex_lock = None
+		try:
+			pkgindex_lock = lockfile(self._pkgindex_file,
+				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)
+			except EnvironmentError:
+				pass
+			else:
+				try:
+					pkgindex.read(f)
+				finally:
+					f.close()
+					del f
+			if not self._pkgindex_version_supported(pkgindex):
+				pkgindex = portage.getbinpkg.PackageIndex()
+			d = digests
+			d["CPV"] = cpv
+			d["SLOT"] = slot
+			d["MTIME"] = str(long(s.st_mtime))
+			d["SIZE"] = str(s.st_size)
+			rel_path = self._pkg_paths[cpv]
+			# record location if it's non-default
+			if rel_path != cpv + ".tbz2":
+				d["PATH"] = rel_path
+			keys = ["USE", "IUSE", "DESCRIPTION", "LICENSE", "PROVIDE", \
+				"RDEPEND", "DEPEND", "PDEPEND"]
+			from itertools import izip
+			d.update(izip(keys, self.dbapi.aux_get(cpv, keys)))
+			use = d["USE"].split()
+			iuse = set(d["IUSE"].split())
+			use = [f for f in use if f in iuse]
+			if not iuse:
+				del d["IUSE"]
+			use.sort()
+			d["USE"] = " ".join(use)
+			d["DESC"] = d["DESCRIPTION"]
+			del d["DESCRIPTION"]
+			from portage.dep import paren_reduce, use_reduce, \
+				paren_normalize, paren_enclose
+			for k in "LICENSE", "RDEPEND", "DEPEND", "PDEPEND", "PROVIDE":
+				try:
+					deps = paren_reduce(d[k])
+					deps = use_reduce(deps, uselist=use)
+					deps = paren_normalize(deps)
+					deps = paren_enclose(deps)
+				except portage.exception.InvalidDependString, e:
+					writemsg("%s: %s\n" % (k, str(e)),
+						noiselevel=-1)
+					del e
+					writemsg("!!! Invalid binary package: '%s'\n" % \
+						self.getname(cpv), noiselevel=-1)
+					self.dbapi.cpv_remove(cpv)
+					return
+				if deps:
+					d[k] = deps
+				else:
+					del d[k]
+			pkgindex.packages[cpv] = d
+			self._update_pkgindex_header(pkgindex.header)
+			from portage.util import atomic_ofstream
+			f = atomic_ofstream(os.path.join(self.pkgdir, "Packages"))
+			try:
+				pkgindex.write(f)
+			finally:
+				f.close()
+		finally:
+			if pkgindex_lock:
+				unlockfile(pkgindex_lock)
+
+	def _update_pkgindex_header(self, header):
+		portdir = normalize_path(os.path.realpath(self.settings["PORTDIR"]))
+		profiles_base = os.path.join(portdir, "profiles") + os.path.sep
+		profile_path = normalize_path(os.path.realpath(self.settings.profile_path))
+		if profile_path.startswith(profiles_base):
+			profile_path = profile_path[len(profiles_base):]
+		header["PROFILE"] = profile_path
+		header["VERSION"] = str(self._pkgindex_version)
+		base_uri = self.settings.get("PORTAGE_BINHOST_HEADER_URI")
+		if base_uri:
+			header["URI"] = base_uri
+		else:
+			header.pop("URI", None)
+		for k in self._pkgindex_header_keys:
+			v = self.settings.get(k, None)
+			if v:
+				header[k] = v
+			else:
+				header.pop(k, None)
+
+	def _pkgindex_version_supported(self, pkgindex):
+		version = pkgindex.header.get("VERSION")
+		if version:
+			try:
+				if int(version) <= self._pkgindex_version:
+					return True
+			except ValueError:
+				pass
+		return False
+
+	def exists_specific(self, cpv):
+		if not self.populated:
+			self.populate()
+		return self.dbapi.match(
+			dep_expand("="+cpv, mydb=self.dbapi, settings=self.settings))
+
+	def dep_bestmatch(self, mydep):
+		"compatibility method -- all matches, not just visible ones"
+		if not self.populated:
+			self.populate()
+		writemsg("\n\n", 1)
+		writemsg("mydep: %s\n" % mydep, 1)
+		mydep = dep_expand(mydep, mydb=self.dbapi, settings=self.settings)
+		writemsg("mydep: %s\n" % mydep, 1)
+		mykey = dep_getkey(mydep)
+		writemsg("mykey: %s\n" % mykey, 1)
+		mymatch = best(match_from_list(mydep,self.dbapi.cp_list(mykey)))
+		writemsg("mymatch: %s\n" % mymatch, 1)
+		if mymatch is None:
+			return ""
+		return mymatch
+
+	def getname(self, pkgname):
+		"""Returns a file location for this package.  The default location is
+		${PKGDIR}/All/${PF}.tbz2, but will be ${PKGDIR}/${CATEGORY}/${PF}.tbz2
+		in the rare event of a collision.  The prevent_collision() method can
+		be called to ensure that ${PKGDIR}/All/${PF}.tbz2 is available for a
+		specific cpv."""
+		if not self.populated:
+			self.populate()
+		mycpv = pkgname
+		mypath = self._pkg_paths.get(mycpv, None)
+		if mypath:
+			return os.path.join(self.pkgdir, mypath)
+		mycat, mypkg = catsplit(mycpv)
+		if self._all_directory:
+			mypath = os.path.join("All", mypkg + ".tbz2")
+			if mypath in self._pkg_paths.values():
+				mypath = os.path.join(mycat, mypkg + ".tbz2")
+		else:
+			mypath = os.path.join(mycat, mypkg + ".tbz2")
+		self._pkg_paths[mycpv] = mypath # cache for future lookups
+		return os.path.join(self.pkgdir, mypath)
+
+	def isremote(self, pkgname):
+		"Returns true if the package is kept remotely."
+		remote = pkgname in self._remotepkgs and \
+			not os.path.exists(self.getname(pkgname))
+		return remote
+
+	def get_use(self, pkgname):
+		writemsg("deprecated use of binarytree.get_use()," + \
+			" use dbapi.aux_get() instead", noiselevel=-1)
+		return self.dbapi.aux_get(pkgname, ["USE"])[0].split()
+
+	def gettbz2(self, pkgname):
+		"fetches the package from a remote site, if necessary."
+		print "Fetching '"+str(pkgname)+"'"
+		mysplit  = pkgname.split("/")
+		tbz2name = mysplit[1]+".tbz2"
+		if not self.isremote(pkgname):
+			if (tbz2name not in self.invalids):
+				return
+			else:
+				writemsg("Resuming download of this tbz2, but it is possible that it is corrupt.\n",
+					noiselevel=-1)
+		tbz2_path = self.getname(pkgname)
+		mydest = os.path.dirname(self.getname(pkgname))
+		try:
+			os.makedirs(mydest, 0775)
+		except (OSError, IOError):
+			pass
+		from urlparse import urljoin
+		base_url = self._remote_base_uri
+		fcmd = self.settings["RESUMECOMMAND"]
+		if self._remote_has_index:
+			rel_url = self._remotepkgs[pkgname].get("PATH")
+			if not rel_url:
+				rel_url = pkgname+".tbz2"
+			url = urljoin(base_url, rel_url)
+			success = portage.getbinpkg.file_get(url, mydest, fcmd=fcmd)
+		else:
+			url = urljoin(base_url, tbz2name)
+			success = portage.getbinpkg.file_get(url, mydest, fcmd=fcmd)
+		if success and "strict" in self.settings.features:
+			metadata = self._remotepkgs[pkgname]
+			digests = {}
+			from portage.checksum import hashfunc_map, verify_all
+			for k in hashfunc_map:
+				v = metadata.get(k)
+				if not v:
+					continue
+				digests[k] = v
+			if "SIZE" in metadata:
+				try:
+					digests["size"] = long(self._remotepkgs[pkgname]["SIZE"])
+				except ValueError:
+					writemsg("!!! Malformed SIZE attribute in remote " + \
+					"metadata for '%s'\n" % pkgname)
+			if digests:
+				ok, reason = verify_all(tbz2_path, digests)
+				if not ok:
+					raise portage.exception.DigestException(
+						tuple([tbz2_path]+list(reason)))
+		if not success:
+			try:
+				os.unlink(self.getname(pkgname))
+			except OSError:
+				pass
+			raise portage.exception.FileNotFound(mydest)
+		self.inject(pkgname)
+
+	def getslot(self, mycatpkg):
+		"Get a slot for a catpkg; assume it exists."
+		myslot = ""
+		try:
+			myslot = self.dbapi.aux_get(mycatpkg,["SLOT"])[0]
+		except SystemExit, e:
+			raise
+		except Exception, e:
+			pass
+		return myslot
Index: /vendor/prefix-portage/current/pym/portage/dbapi/porttree.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/dbapi/porttree.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/dbapi/porttree.py	(revision 3489)
@@ -0,0 +1,812 @@
+# Copyright 1998-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: porttree.py 6804 2007-06-11 14:26:02Z grobian $
+
+from portage.cache.cache_errors import CacheError
+from portage.const import REPO_NAME_LOC
+from portage.data import portage_gid, secpass
+from portage.dbapi import dbapi
+from portage.dep import use_reduce, paren_reduce, dep_getslot, dep_getkey, \
+	match_from_list, match_to_list
+from portage.exception import OperationNotPermitted, PortageException, \
+	UntrustedSignature, SecurityViolation, InvalidSignature, MissingSignature, \
+	FileNotFound, InvalidDependString
+from portage.manifest import Manifest
+from portage.output import red
+from portage.util import ensure_dirs, writemsg, apply_recursive_permissions
+from portage.versions import pkgsplit, catpkgsplit, best
+
+import portage.gpg, portage.checksum
+
+from portage import eclass_cache, auxdbkeys, auxdbkeylen, doebuild, flatten, \
+	listdir, dep_expand, eapi_is_supported, key_expand, dep_check, config
+
+import os, stat, sys
+
+
+class portdbapi(dbapi):
+	"""this tree will scan a portage directory located at root (passed to init)"""
+	portdbapi_instances = []
+
+	def __init__(self, porttree_root, mysettings=None):
+		portdbapi.portdbapi_instances.append(self)
+
+		if mysettings:
+			self.mysettings = mysettings
+		else:
+			from portage import settings
+			self.mysettings = config(clone=settings)
+		self._categories = set(self.mysettings.categories)
+		# This is strictly for use in aux_get() doebuild calls when metadata
+		# is generated by the depend phase.  It's safest to use a clone for
+		# this purpose because doebuild makes many changes to the config
+		# instance that is passed in.
+		self.doebuild_settings = config(clone=self.mysettings)
+
+		self.manifestVerifyLevel = None
+		self.manifestVerifier = None
+		self.manifestCache = {}    # {location: [stat, md5]}
+		self.manifestMissingCache = []
+
+		if "gpg" in self.mysettings.features:
+			self.manifestVerifyLevel = portage.gpg.EXISTS
+			if "strict" in self.mysettings.features:
+				self.manifestVerifyLevel = portage.gpg.MARGINAL
+				self.manifestVerifier = portage.gpg.FileChecker(self.mysettings["PORTAGE_GPG_DIR"], "gentoo.gpg", minimumTrust=self.manifestVerifyLevel)
+			elif "severe" in self.mysettings.features:
+				self.manifestVerifyLevel = portage.gpg.TRUSTED
+				self.manifestVerifier = portage.gpg.FileChecker(self.mysettings["PORTAGE_GPG_DIR"], "gentoo.gpg", requireSignedRing=True, minimumTrust=self.manifestVerifyLevel)
+			else:
+				self.manifestVerifier = portage.gpg.FileChecker(self.mysettings["PORTAGE_GPG_DIR"], "gentoo.gpg", minimumTrust=self.manifestVerifyLevel)
+
+		#self.root=settings["PORTDIR"]
+		self.porttree_root = os.path.realpath(porttree_root)
+
+		self.depcachedir = self.mysettings.depcachedir[:]
+
+		self.tmpfs = self.mysettings["PORTAGE_TMPFS"]
+		if self.tmpfs and not os.path.exists(self.tmpfs):
+			self.tmpfs = None
+		if self.tmpfs and not os.access(self.tmpfs, os.W_OK):
+			self.tmpfs = None
+		if self.tmpfs and not os.access(self.tmpfs, os.R_OK):
+			self.tmpfs = None
+
+		self.eclassdb = eclass_cache.cache(self.porttree_root,
+			overlays=self.mysettings["PORTDIR_OVERLAY"].split())
+
+		self.metadbmodule = self.mysettings.load_best_module("portdbapi.metadbmodule")
+
+		#if the portdbapi is "frozen", then we assume that we can cache everything (that no updates to it are happening)
+		self.xcache = {}
+		self.frozen = 0
+
+		self.porttrees = [self.porttree_root] + \
+			[os.path.realpath(t) for t in self.mysettings["PORTDIR_OVERLAY"].split()]
+		self.treemap = {}
+		for path in self.porttrees:
+			repo_name_path = os.path.join(path, REPO_NAME_LOC)
+			try:
+				repo_name = open(repo_name_path, 'r').readline().strip()
+				self.treemap[repo_name] = path
+			except (OSError,IOError):
+				pass
+		
+		self.auxdbmodule = self.mysettings.load_best_module("portdbapi.auxdbmodule")
+		self.auxdb = {}
+		self._init_cache_dirs()
+		# XXX: REMOVE THIS ONCE UNUSED_0 IS YANKED FROM auxdbkeys
+		# ~harring
+		filtered_auxdbkeys = filter(lambda x: not x.startswith("UNUSED_0"), auxdbkeys)
+		if secpass < 1:
+			from portage.cache import metadata_overlay, volatile
+			for x in self.porttrees:
+				db_ro = self.auxdbmodule(self.depcachedir, x,
+					filtered_auxdbkeys, gid=portage_gid, readonly=True)
+				self.auxdb[x] = metadata_overlay.database(
+					self.depcachedir, x, filtered_auxdbkeys,
+					gid=portage_gid, db_rw=volatile.database,
+					db_ro=db_ro)
+		else:
+			for x in self.porttrees:
+				# location, label, auxdbkeys
+				self.auxdb[x] = self.auxdbmodule(
+					self.depcachedir, x, filtered_auxdbkeys, gid=portage_gid)
+		# Selectively cache metadata in order to optimize dep matching.
+		self._aux_cache_keys = set(["EAPI", "KEYWORDS", "LICENSE", "SLOT"])
+		self._aux_cache = {}
+		self._broken_ebuilds = set()
+
+	def _init_cache_dirs(self):
+		"""Create /var/cache/edb/dep and adjust permissions for the portage
+		group."""
+
+		dirmode = 02070
+		filemode =   060
+		modemask =    02
+
+		try:
+			for mydir in (self.depcachedir,):
+				if ensure_dirs(mydir, gid=portage_gid, mode=dirmode, mask=modemask):
+					writemsg("Adjusting permissions recursively: '%s'\n" % mydir,
+						noiselevel=-1)
+					def onerror(e):
+						raise # bail out on the first error that occurs during recursion
+					if not apply_recursive_permissions(mydir,
+						gid=portage_gid, dirmode=dirmode, dirmask=modemask,
+						filemode=filemode, filemask=modemask, onerror=onerror):
+						raise OperationNotPermitted(
+							"Failed to apply recursive permissions for the portage group.")
+		except PortageException, e:
+			pass
+
+	def close_caches(self):
+		if not hasattr(self, "auxdb"):
+			# unhandled exception thrown from constructor
+			return
+		for x in self.auxdb.keys():
+			self.auxdb[x].sync()
+		self.auxdb.clear()
+
+	def flush_cache(self):
+		for x in self.auxdb.values():
+			x.sync()
+
+	def finddigest(self,mycpv):
+		try:
+			mydig = self.findname2(mycpv)[0]
+			if not mydig:
+				return ""
+			mydigs = mydig.split("/")[:-1]
+			mydig = "/".join(mydigs)
+			mysplit = mycpv.split("/")
+		except OSError:
+			return ""
+		return mydig+"/files/digest-"+mysplit[-1]
+
+	def findLicensePath(self, license_name):
+		mytrees = self.porttrees[:]
+		mytrees.reverse()
+		for x in mytrees:
+			license_path = os.path.join(x, "licenses", license_name)
+			if os.access(license_path, os.R_OK):
+				return license_path
+		return None
+
+	def findname(self,mycpv):
+		return self.findname2(mycpv)[0]
+
+	def getRepositoryPath(self, repository_id):
+		"""
+		This function is required for GLEP 42 compliance; given a valid repository ID
+		it must return a path to the repository
+		TreeMap = { id:path }
+		"""
+		if repository_id in self.treemap:
+			return self.treemap[repository_id]
+		return None
+
+	def getRepositories(self):
+		"""
+		This function is required for GLEP 42 compliance; it will return a list of
+		repository ID's
+		TreeMap = {id: path}
+		"""
+		return [k for k in self.treemap.keys() if k]
+
+	def findname2(self, mycpv, mytree=None):
+		""" 
+		Returns the location of the CPV, and what overlay it was in.
+		Searches overlays first, then PORTDIR; this allows us to return the first
+		matching file.  As opposed to starting in portdir and then doing overlays
+		second, we would have to exhaustively search the overlays until we found
+		the file we wanted.
+		"""
+		if not mycpv:
+			return "",0
+		mysplit = mycpv.split("/")
+		psplit = pkgsplit(mysplit[1])
+
+		if mytree:
+			mytrees = [mytree]
+		else:
+			mytrees = self.porttrees[:]
+			mytrees.reverse()
+		if psplit:
+			for x in mytrees:
+				file=x+"/"+mysplit[0]+"/"+psplit[0]+"/"+mysplit[1]+".ebuild"
+				if os.access(file, os.R_OK):
+					return[file, x]
+		return None, 0
+
+	def aux_get(self, mycpv, mylist, mytree=None):
+		"stub code for returning auxilliary db information, such as SLOT, DEPEND, etc."
+		'input: "sys-apps/foo-1.0",["SLOT","DEPEND","HOMEPAGE"]'
+		'return: ["0",">=sys-libs/bar-1.0","http://www.foo.com"] or raise KeyError if error'
+		cache_me = False
+		if not mytree and not set(mylist).difference(self._aux_cache_keys):
+			aux_cache = self._aux_cache.get(mycpv)
+			if aux_cache is not None:
+				return [aux_cache[x] for x in mylist]
+			cache_me = True
+		global auxdbkeys, auxdbkeylen
+		cat,pkg = mycpv.split("/", 1)
+
+		myebuild, mylocation = self.findname2(mycpv, mytree)
+
+		if not myebuild:
+			writemsg("!!! aux_get(): ebuild path for '%(cpv)s' not specified:\n" % {"cpv":mycpv},
+				noiselevel=1)
+			writemsg("!!!            %s\n" % myebuild, noiselevel=1)
+			raise KeyError(mycpv)
+
+		myManifestPath = "/".join(myebuild.split("/")[:-1])+"/Manifest"
+		if "gpg" in self.mysettings.features:
+			try:
+				mys = portage.gpg.fileStats(myManifestPath)
+				if (myManifestPath in self.manifestCache) and \
+				   (self.manifestCache[myManifestPath] == mys):
+					pass
+				elif self.manifestVerifier:
+					if not self.manifestVerifier.verify(myManifestPath):
+						# Verification failed the desired level.
+						raise UntrustedSignature, "Untrusted Manifest: %(manifest)s" % {"manifest":myManifestPath}
+
+				if ("severe" in self.mysettings.features) and \
+				   (mys != portage.gpg.fileStats(myManifestPath)):
+					raise SecurityViolation, "Manifest changed: %(manifest)s" % {"manifest":myManifestPath}
+
+			except InvalidSignature, e:
+				if ("strict" in self.mysettings.features) or \
+				   ("severe" in self.mysettings.features):
+					raise
+				writemsg("!!! INVALID MANIFEST SIGNATURE DETECTED: %(manifest)s\n" % {"manifest":myManifestPath})
+			except MissingSignature, e:
+				if ("severe" in self.mysettings.features):
+					raise
+				if ("strict" in self.mysettings.features):
+					if myManifestPath not in self.manifestMissingCache:
+						writemsg("!!! WARNING: Missing signature in: %(manifest)s\n" % {"manifest":myManifestPath})
+						self.manifestMissingCache.insert(0,myManifestPath)
+			except (OSError, FileNotFound), e:
+				if ("strict" in self.mysettings.features) or \
+				   ("severe" in self.mysettings.features):
+					raise SecurityViolation, "Error in verification of signatures: %(errormsg)s" % {"errormsg":str(e)}
+				writemsg("!!! Manifest is missing or inaccessable: %(manifest)s\n" % {"manifest":myManifestPath},
+					noiselevel=-1)
+
+
+		if os.access(myebuild, os.R_OK):
+			emtime = os.stat(myebuild)[stat.ST_MTIME]
+		else:
+			writemsg("!!! aux_get(): ebuild for '%(cpv)s' does not exist at:\n" % {"cpv":mycpv},
+				noiselevel=-1)
+			writemsg("!!!            %s\n" % myebuild,
+				noiselevel=-1)
+			raise KeyError
+
+		try:
+			mydata = self.auxdb[mylocation][mycpv]
+			if emtime != long(mydata.get("_mtime_", 0)):
+				doregen = True
+			elif len(mydata.get("_eclasses_", [])) > 0:
+				doregen = not self.eclassdb.is_eclass_data_valid(mydata["_eclasses_"])
+			else:
+				doregen = False
+				
+		except KeyError:
+			doregen = True
+		except CacheError:
+			doregen = True
+			try:
+				del self.auxdb[mylocation][mycpv]
+			except KeyError:
+				pass
+
+		writemsg("auxdb is valid: "+str(not doregen)+" "+str(pkg)+"\n", 2)
+
+		if doregen:
+			if myebuild in self._broken_ebuilds:
+				raise KeyError(mycpv)
+			writemsg("doregen: %s %s\n" % (doregen, mycpv), 2)
+			writemsg("Generating cache entry(0) for: "+str(myebuild)+"\n", 1)
+
+			self.doebuild_settings.reset()
+			mydata = {}
+			myret = doebuild(myebuild, "depend",
+				self.doebuild_settings["ROOT"], self.doebuild_settings,
+				dbkey=mydata, tree="porttree", mydbapi=self)
+			if myret != os.EX_OK:
+				self._broken_ebuilds.add(myebuild)
+				raise KeyError(mycpv)
+
+			if "EAPI" not in mydata or not mydata["EAPI"].strip():
+				mydata["EAPI"] = "0"
+
+			if not eapi_is_supported(mydata["EAPI"]):
+				# if newer version, wipe everything and negate eapi
+				eapi = mydata["EAPI"]
+				mydata = {}
+				map(lambda x: mydata.setdefault(x, ""), auxdbkeys)
+				mydata["EAPI"] = "-"+eapi
+
+			if mydata.get("INHERITED", False):
+				mydata["_eclasses_"] = self.eclassdb.get_eclass_data(mydata["INHERITED"].split())
+			else:
+				mydata["_eclasses_"] = {}
+			
+			del mydata["INHERITED"]
+
+			mydata["_mtime_"] = emtime
+
+			self.auxdb[mylocation][mycpv] = mydata
+
+		if not mydata.setdefault("EAPI", "0"):
+			mydata["EAPI"] = "0"
+
+		#finally, we look at our internal cache entry and return the requested data.
+		returnme = []
+		for x in mylist:
+			if x == "INHERITED":
+				returnme.append(' '.join(mydata.get("_eclasses_", {}).keys()))
+			else:
+				returnme.append(mydata.get(x,""))
+
+		if cache_me:
+			aux_cache = {}
+			for x in self._aux_cache_keys:
+				aux_cache[x] = mydata.get(x, "")
+			self._aux_cache[mycpv] = aux_cache
+
+		return returnme
+
+	def getfetchlist(self, mypkg, useflags=None, mysettings=None, all=0, mytree=None):
+		if mysettings is None:
+			mysettings = self.mysettings
+		try:
+			myuris = self.aux_get(mypkg, ["SRC_URI"], mytree=mytree)[0]
+		except KeyError:
+			# Convert this to an InvalidDependString exception since callers
+			# already handle it.
+			raise portage.exception.InvalidDependString(
+				"getfetchlist(): aux_get() error reading "+mypkg+"; aborting.")
+
+		if useflags is None:
+			useflags = mysettings["USE"].split()
+
+		myurilist = paren_reduce(myuris)
+		myurilist = use_reduce(myurilist, uselist=useflags, matchall=all)
+		newuris = flatten(myurilist)
+
+		myfiles = []
+		for x in newuris:
+			mya = os.path.basename(x)
+			if not mya:
+				raise portage.exception.InvalidDependString("URI has no basename: '%s'" % x)
+			if not mya in myfiles:
+				myfiles.append(mya)
+		return [newuris, myfiles]
+
+	def getfetchsizes(self, mypkg, useflags=None, debug=0):
+		# returns a filename:size dictionnary of remaining downloads
+		myebuild = self.findname(mypkg)
+		pkgdir = os.path.dirname(myebuild)
+		mf = Manifest(pkgdir, self.mysettings["DISTDIR"])
+		checksums = mf.getDigests()
+		if not checksums:
+			if debug: 
+				print "[empty/missing/bad digest]: "+mypkg
+			return None
+		filesdict={}
+		if useflags is None:
+			myuris, myfiles = self.getfetchlist(mypkg,all=1)
+		else:
+			myuris, myfiles = self.getfetchlist(mypkg,useflags=useflags)
+		#XXX: maybe this should be improved: take partial downloads
+		# into account? check checksums?
+		for myfile in myfiles:
+			if myfile not in checksums:
+				if debug:
+					writemsg("[bad digest]: missing %s for %s\n" % (myfile, mypkg))
+				continue
+			file_path = os.path.join(self.mysettings["DISTDIR"], myfile)
+			mystat = None
+			try:
+				mystat = os.stat(file_path)
+			except OSError, e:
+				pass
+			if mystat is None:
+				existing_size = 0
+			else:
+				existing_size = mystat.st_size
+			remaining_size = int(checksums[myfile]["size"]) - existing_size
+			if remaining_size > 0:
+				# Assume the download is resumable.
+				filesdict[myfile] = remaining_size
+			elif remaining_size < 0:
+				# The existing file is too large and therefore corrupt.
+				filesdict[myfile] = int(checksums[myfile]["size"])
+		return filesdict
+
+	def fetch_check(self, mypkg, useflags=None, mysettings=None, all=False):
+		if not useflags:
+			if mysettings:
+				useflags = mysettings["USE"].split()
+		myuri, myfiles = self.getfetchlist(mypkg, useflags=useflags, mysettings=mysettings, all=all)
+		myebuild = self.findname(mypkg)
+		pkgdir = os.path.dirname(myebuild)
+		mf = Manifest(pkgdir, self.mysettings["DISTDIR"])
+		mysums = mf.getDigests()
+
+		failures = {}
+		for x in myfiles:
+			if not mysums or x not in mysums:
+				ok     = False
+				reason = "digest missing"
+			else:
+				try:
+					ok, reason = portage.checksum.verify_all(
+						os.path.join(self.mysettings["DISTDIR"], x), mysums[x])
+				except FileNotFound, e:
+					ok = False
+					reason = "File Not Found: '%s'" % str(e)
+			if not ok:
+				failures[x] = reason
+		if failures:
+			return False
+		return True
+
+	def cpv_exists(self, mykey):
+		"Tells us whether an actual ebuild exists on disk (no masking)"
+		cps2 = mykey.split("/")
+		cps = catpkgsplit(mykey, silent=0)
+		if not cps:
+			#invalid cat/pkg-v
+			return 0
+		if self.findname(cps[0] + "/" + cps2[1]):
+			return 1
+		else:
+			return 0
+
+	def cp_all(self):
+		"returns a list of all keys in our tree"
+		d = {}
+		for x in self.mysettings.categories:
+			for oroot in self.porttrees:
+				for y in listdir(oroot+"/"+x, EmptyOnError=1, ignorecvs=1, dirsonly=1):
+					d[x+"/"+y] = None
+		l = d.keys()
+		l.sort()
+		return l
+
+	def p_list(self,mycp):
+		d={}
+		for oroot in self.porttrees:
+			for x in listdir(oroot+"/"+mycp,EmptyOnError=1,ignorecvs=1):
+				if x[-7:]==".ebuild":
+					d[x[:-7]] = None
+		return d.keys()
+
+	def cp_list(self, mycp, use_cache=1, mytree=None):
+		mysplit = mycp.split("/")
+		invalid_category = mysplit[0] not in self._categories
+		d={}
+		if mytree:
+			mytrees = [mytree]
+		else:
+			mytrees = self.porttrees
+		for oroot in mytrees:
+			for x in listdir(oroot+"/"+mycp, EmptyOnError=1, ignorecvs=1):
+				if x.endswith(".ebuild"):
+					pf = x[:-7]
+					ps = pkgsplit(pf)
+					if not ps:
+						writemsg("\nInvalid ebuild name: %s\n" % \
+							os.path.join(oroot, mycp, x), noiselevel=-1)
+						continue
+					d[mysplit[0]+"/"+pf] = None
+		if invalid_category and d:
+			writemsg(("\n!!! '%s' has a category that is not listed in " + \
+				"/etc/portage/categories\n") % mycp, noiselevel=-1)
+			return []
+		return d.keys()
+
+	def freeze(self):
+		for x in ["list-visible", "bestmatch-visible", "match-visible", "match-all"]:
+			self.xcache[x]={}
+		self.frozen=1
+
+	def melt(self):
+		self.xcache = {}
+		self.frozen = 0
+
+	def xmatch(self,level,origdep,mydep=None,mykey=None,mylist=None):
+		"caching match function; very trick stuff"
+		#if no updates are being made to the tree, we can consult our xcache...
+		if self.frozen:
+			try:
+				return self.xcache[level][origdep][:]
+			except KeyError:
+				pass
+
+		if not mydep:
+			#this stuff only runs on first call of xmatch()
+			#create mydep, mykey from origdep
+			mydep = dep_expand(origdep, mydb=self, settings=self.mysettings)
+			mykey = dep_getkey(mydep)
+
+		if level == "list-visible":
+			#a list of all visible packages, not called directly (just by xmatch())
+			#myval = self.visible(self.cp_list(mykey))
+
+			myval = self.gvisible(self.visible(self.cp_list(mykey)))
+		elif level == "bestmatch-visible":
+			#dep match -- best match of all visible packages
+			#get all visible matches (from xmatch()), then choose the best one
+
+			myval = best(self.xmatch("match-visible", None, mydep=mydep, mykey=mykey))
+		elif level == "bestmatch-list":
+			#dep match -- find best match but restrict search to sublist
+			#no point in calling xmatch again since we're not caching list deps
+
+			myval = best(match_from_list(mydep, mylist))
+		elif level == "match-list":
+			#dep match -- find all matches but restrict search to sublist (used in 2nd half of visible())
+
+			myval = match_from_list(mydep, mylist)
+		elif level == "match-visible":
+			#dep match -- find all visible matches
+			#get all visible packages, then get the matching ones
+
+			myval = match_from_list(mydep,
+				self.xmatch("list-visible", mykey, mydep=mykey, mykey=mykey))
+		elif level == "match-all":
+			#match *all* visible *and* masked packages
+			
+			myval = match_from_list(mydep, self.cp_list(mykey))
+		else:
+			print "ERROR: xmatch doesn't handle", level, "query!"
+			raise KeyError
+		myslot = dep_getslot(mydep)
+		if myslot is not None:
+			slotmatches = []
+			for cpv in myval:
+				try:
+					if self.aux_get(cpv, ["SLOT"])[0] == myslot:
+						slotmatches.append(cpv)
+				except KeyError:
+					pass # ebuild masked by corruption
+			myval = slotmatches
+		if self.frozen and (level not in ["match-list", "bestmatch-list"]):
+			self.xcache[level][mydep] = myval
+			if origdep and origdep != mydep:
+				self.xcache[level][origdep] = myval
+		return myval[:]
+
+	def match(self, mydep, use_cache=1):
+		return self.xmatch("match-visible", mydep)
+
+	def visible(self, mylist):
+		"""two functions in one.  Accepts a list of cpv values and uses the package.mask *and*
+		packages file to remove invisible entries, returning remaining items.  This function assumes
+		that all entries in mylist have the same category and package name."""
+		if (mylist is None) or (len(mylist) == 0):
+			return []
+		newlist = mylist[:]
+		#first, we mask out packages in the package.mask file
+		mykey = newlist[0]
+		cpv = catpkgsplit(mykey)
+		if not cpv:
+			#invalid cat/pkg-v
+			print "visible(): invalid cat/pkg-v:", mykey
+			return []
+		mycp = cpv[0] + "/" + cpv[1]
+		maskdict = self.mysettings.pmaskdict
+		unmaskdict = self.mysettings.punmaskdict
+		if maskdict.has_key(mycp):
+			for x in maskdict[mycp]:
+				mymatches = self.xmatch("match-all", x)
+				if mymatches is None:
+					#error in package.mask file; print warning and continue:
+					print "visible(): package.mask entry \"" + x + "\" is invalid, ignoring..."
+					continue
+				for y in mymatches:
+					unmask = 0
+					if unmaskdict.has_key(mycp):
+						for z in unmaskdict[mycp]:
+							mymatches_unmask = self.xmatch("match-all",z)
+							if y in mymatches_unmask:
+								unmask = 1
+								break
+					if unmask == 0:
+						try:
+							newlist.remove(y)
+						except ValueError:
+							pass
+
+		profile_atoms = self.mysettings.prevmaskdict.get(mycp)
+		if profile_atoms:
+			for x in profile_atoms:
+				#important: only match against the still-unmasked entries...
+				#notice how we pass "newlist" to the xmatch() call below....
+				#Without this, ~ deps in the packages files are broken.
+				mymatches=self.xmatch("match-list",x,mylist=newlist)
+				if mymatches is None:
+					#error in packages file; print warning and continue:
+					print "emerge: visible(): profile packages entry \""+x+"\" is invalid, ignoring..."
+					continue
+				newlist = [cpv for cpv in newlist if cpv in mymatches]
+
+		return newlist
+
+	def gvisible(self,mylist):
+		"strip out group-masked (not in current group) entries"
+
+		if mylist is None:
+			return []
+		newlist=[]
+
+		accept_keywords = self.mysettings["ACCEPT_KEYWORDS"].split()
+		pkgdict = self.mysettings.pkeywordsdict
+		aux_keys = ["KEYWORDS", "LICENSE", "EAPI", "SLOT"]
+		for mycpv in mylist:
+			try:
+				keys, licenses, eapi, slot = self.aux_get(mycpv, aux_keys)
+			except KeyError:
+				continue
+			except PortageException, e:
+				writemsg("!!! Error: aux_get('%s', %s)\n" % (mycpv, aux_keys),
+					mycpv, noiselevel=-1)
+				writemsg("!!! %s\n" % str(e), noiselevel=-1)
+				del e
+				continue
+			mygroups = keys.split()
+			# Repoman may modify this attribute as necessary.
+			pgroups = accept_keywords[:]
+			match=0
+			cp = dep_getkey(mycpv)
+			if pkgdict.has_key(cp):
+				cpv_slot = "%s:%s" % (mycpv, slot)
+				matches = match_to_list(cpv_slot, pkgdict[cp].keys())
+				for atom in matches:
+					pgroups.extend(pkgdict[cp][atom])
+				if matches:
+					# normalize pgroups with incrementals logic so it 
+					# matches ACCEPT_KEYWORDS behavior
+					inc_pgroups = []
+					for x in pgroups:
+						if x == "-*":
+							inc_pgroups = []
+						elif x[0] == "-":
+							try:
+								inc_pgroups.remove(x[1:])
+							except ValueError:
+								pass
+						elif x not in inc_pgroups:
+							inc_pgroups.append(x)
+					pgroups = inc_pgroups
+					del inc_pgroups
+			hasstable = False
+			hastesting = False
+			for gp in mygroups:
+				if gp == "*" or (gp == "-*" and len(mygroups) == 1):
+					writemsg("--- WARNING: Package '%s' uses '%s' keyword.\n" % (mycpv, gp),
+						noiselevel=-1)
+					if gp == "*":
+						match = 1
+						break
+				elif gp in pgroups:
+					match=1
+					break
+				elif gp[0] == "~":
+					hastesting = True
+				elif gp[0] != "-":
+					hasstable = True
+			if not match and ((hastesting and "~*" in pgroups) or (hasstable and "*" in pgroups) or "**" in pgroups):
+				match=1
+			uselist = []
+			if "?" in licenses:
+				self.doebuild_settings.setcpv(mycpv, mydb=self)
+				uselist = self.doebuild_settings.get("USE", "").split()
+			try:
+				if self.mysettings.getMissingLicenses(
+					licenses, mycpv, uselist):
+					match = 0
+			except InvalidDependString:
+				match = 0
+			if match and eapi_is_supported(eapi):
+				newlist.append(mycpv)
+		return newlist
+
+
+def close_portdbapi_caches():
+	for i in portdbapi.portdbapi_instances:
+		i.close_caches()
+
+
+class portagetree(object):
+	def __init__(self, root="/", virtual=None, clone=None, settings=None):
+		"""
+		Constructor for a PortageTree
+		
+		@param root: ${ROOT}, defaults to '/', see make.conf(5)
+		@type root: String/Path
+		@param virtual: UNUSED
+		@type virtual: No Idea
+		@param clone: Set this if you want a copy of Clone
+		@type clone: Existing portagetree Instance
+		@param settings: Portage Configuration object (portage.settings)
+		@type settings: Instance of portage.config
+		"""
+
+		if clone:
+			writemsg("portagetree.__init__(): deprecated " + \
+				"use of clone parameter\n", noiselevel=-1)
+			self.root = clone.root
+			self.portroot = clone.portroot
+			self.pkglines = clone.pkglines
+		else:
+			self.root = root
+			if settings is None:
+				from portage import settings
+			self.settings = settings
+			self.portroot = settings["PORTDIR"]
+			self.virtual = virtual
+			self.dbapi = portdbapi(
+				settings["PORTDIR"], mysettings=settings)
+
+	def dep_bestmatch(self,mydep):
+		"compatibility method"
+		mymatch = self.dbapi.xmatch("bestmatch-visible",mydep)
+		if mymatch is None:
+			return ""
+		return mymatch
+
+	def dep_match(self,mydep):
+		"compatibility method"
+		mymatch = self.dbapi.xmatch("match-visible",mydep)
+		if mymatch is None:
+			return []
+		return mymatch
+
+	def exists_specific(self,cpv):
+		return self.dbapi.cpv_exists(cpv)
+
+	def getallnodes(self):
+		"""new behavior: these are all *unmasked* nodes.  There may or may not be available
+		masked package for nodes in this nodes list."""
+		return self.dbapi.cp_all()
+
+	def getname(self, pkgname):
+		"returns file location for this particular package (DEPRECATED)"
+		if not pkgname:
+			return ""
+		mysplit = pkgname.split("/")
+		psplit = pkgsplit(mysplit[1])
+		return "/".join([self.portroot, mysplit[0], psplit[0], mysplit[1]])+".ebuild"
+
+	def resolve_specific(self, myspec):
+		cps = catpkgsplit(myspec)
+		if not cps:
+			return None
+		mykey = key_expand(cps[0]+"/"+cps[1], mydb=self.dbapi,
+			settings=self.settings)
+		mykey = mykey + "-" + cps[2]
+		if cps[3] != "r0":
+			mykey = mykey + "-" + cps[3]
+		return mykey
+
+	def depcheck(self, mycheck, use="yes", myusesplit=None):
+		return dep_check(mycheck, self.dbapi, use=use, myuse=myusesplit)
+
+	def getslot(self,mycatpkg):
+		"Get a slot for a catpkg; assume it exists."
+		myslot = ""
+		try:
+			myslot = self.dbapi.aux_get(mycatpkg, ["SLOT"])[0]
+		except SystemExit, e:
+			raise
+		except Exception, e:
+			pass
+		return myslot
+
Index: /vendor/prefix-portage/current/pym/portage/dbapi/vartree.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/dbapi/vartree.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/dbapi/vartree.py	(revision 3489)
@@ -0,0 +1,2134 @@
+# Copyright 1998-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: vartree.py 6804 2007-06-11 14:26:02Z grobian $
+
+from portage.checksum import perform_md5
+from portage.const import CACHE_PATH, CONFIG_MEMORY_FILE, PORTAGE_BIN_PATH, \
+	PRIVATE_PATH, VDB_PATH, EPREFIX
+from portage.data import portage_gid, portage_uid, secpass
+from portage.dbapi import dbapi
+from portage.dep import dep_getslot, use_reduce, paren_reduce, isvalidatom, \
+	isjustname, dep_getkey, match_from_list
+from portage.elog import elog_process
+from portage.exception import InvalidPackageName, InvalidAtom, \
+	UnsupportedAPIException, FileNotFound
+from portage.locks import lockdir, unlockdir
+from portage.output import bold, red, green
+from portage.update import fixdbentries
+from portage.util import apply_secpass_permissions, ConfigProtect, ensure_dirs, \
+	writemsg, writemsg_stdout, write_atomic, atomic_ofstream, writedict, \
+	grabfile, grabdict, normalize_path, new_protect_filename
+from portage.versions import pkgsplit, catpkgsplit, catsplit, best, pkgcmp
+
+from portage import listdir, dep_expand, config, flatten, key_expand, \
+	doebuild_environment, doebuild, env_update, dircache, \
+	abssymlink, movefile, bsd_chflags
+
+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 """
+	def __init__(self, filename, autocommit=True):
+		""" @param filename: absolute path for saving the preserved libs records
+		    @type filename: String
+			@param autocommit: determines if the file is written after every update
+			@type autocommit: Boolean
+		"""
+		self._filename = filename
+		self._autocommit = autocommit
+		self.load()
+	
+	def load(self):
+		""" Reload the registry data from file """
+		try:
+			self._data = cPickle.load(open(self._filename, "r"))
+		except IOError, e:
+			if e.errno == errno.ENOENT:
+				self._data = {}
+			else:
+				raise e
+		
+	def store(self):
+		""" Store the registry data to file. No need to call this if autocommit
+		    was enabled.
+		"""
+		cPickle.dump(self._data, open(self._filename, "w"))
+	
+	def register(self, cpv, slot, counter, paths):
+		""" Register new objects in the registry. If there is a record with the
+			same packagename (internally derived from cpv) and slot it is 
+			overwritten with the new data.
+			@param cpv: package instance that owns the objects
+			@type cpv: CPV (as String)
+			@param slot: the value of SLOT of the given package instance
+			@type slot: String
+			@param counter: vdb counter value for the package instace
+			@type counter: Integer
+			@param paths: absolute paths of objects that got preserved during an update
+			@type paths: List
+		"""
+		cp = "/".join(catpkgsplit(cpv)[:2])
+		cps = cp+":"+slot
+		if len(paths) == 0 and self._data.has_key(cps) \
+				and self._data[cps][0] == cpv and int(self._data[cps][1]) == int(counter):
+			del self._data[cps]
+		elif len(paths) > 0:
+			self._data[cps] = (cpv, counter, paths)
+		if self._autocommit:
+			self.store()
+	
+	def unregister(self, cpv, slot, counter):
+		""" Remove a previous registration of preserved objects for the given package.
+			@param cpv: package instance whose records should be removed
+			@type cpv: CPV (as String)
+			@param slot: the value of SLOT of the given package instance
+			@type slot: String
+		"""
+		self.register(cpv, slot, counter, [])
+	
+	def pruneNonExisting(self):
+		""" Remove all records for objects that no longer exist on the filesystem. """
+		for cps in self._data.keys():
+			cpv, counter, paths = self._data[cps]
+			paths = [f for f in paths if os.path.exists(f)]
+			if len(paths) > 0:
+				self._data[cps] = (cpv, counter, paths)
+			else:
+				del self._data[cps]
+		if self._autocommit:
+			self.store()
+	
+	def hasEntries(self):
+		""" Check if this registry contains any records. """
+		return (len(self._data.keys()) > 0)
+	
+	def getPreservedLibs(self):
+		""" Return a mapping of packages->preserved objects.
+			@returns mapping of package instances to preserved objects
+			@rtype Dict cpv->list-of-paths
+		"""
+		rValue = {}
+		for cps in self._data.keys():
+			rValue[self._data[cps][0]] = self._data[cps][2]
+		return rValue
+
+class LibraryPackageMap(object):
+	""" This class provides a library->consumer mapping generated from VDB data """
+	def __init__(self, filename, vardbapi):
+		self._filename = filename
+		self._dbapi = vardbapi
+
+	def get(self):
+		""" Read the global library->consumer map for the given vdb instance.
+		    @returns mapping of library objects (just basenames) to consumers (absolute paths)
+			@rtype filename->list-of-paths
+		"""
+		if not os.path.exists(self._filename):
+			self.update()
+		rValue = {}
+		for l in open(self._filename, "r").read().split("\n"):
+			mysplit = l.split()
+			if len(mysplit) > 1:
+				rValue[mysplit[0]] = mysplit[1].split(",")
+		return rValue
+
+	def update(self):
+		""" Update the global library->consumer map for the given vdb instance. """
+		obj_dict = {}
+		for cpv in self._dbapi.cpv_all():
+			needed_list = self._dbapi.aux_get(cpv, ["NEEDED"])[0]
+			for l in needed_list.split("\n"):
+				mysplit = l.split()
+				if len(mysplit) < 2:
+					continue
+				libs = mysplit[1].split(",")
+				for lib in libs:
+					if not obj_dict.has_key(lib):
+						obj_dict[lib] = [mysplit[0]]
+					else:
+						obj_dict[lib].append(mysplit[0])
+		mapfile = open(self._filename, "w")
+		for lib in obj_dict.keys():
+			mapfile.write(lib+" "+",".join(obj_dict[lib])+"\n")
+		mapfile.close()
+
+class vardbapi(dbapi):
+	def __init__(self, root, categories=None, settings=None, vartree=None):
+		self.root = root[:]
+
+		#cache for category directory mtimes
+		self.mtdircache = {}
+
+		#cache for dependency checks
+		self.matchcache = {}
+
+		#cache for cp_list results
+		self.cpcache = {}
+
+		self.blockers = None
+		if settings is None:
+			from portage import settings
+		self.settings = settings
+		if categories is None:
+			categories = settings.categories
+		self.categories = categories[:]
+		if vartree is None:
+			from portage import db
+			vartree = db[root]["vartree"]
+		self.vartree = vartree
+		self._aux_cache_keys = set(["SLOT", "COUNTER", "PROVIDE", "USE",
+			"IUSE", "DEPEND", "RDEPEND", "PDEPEND", "NEEDED"])
+		self._aux_cache = None
+		self._aux_cache_version = "1"
+		self._aux_cache_filename = os.path.join(self.root,
+			CACHE_PATH.lstrip(os.path.sep), "vdb_metadata.pickle")
+
+		self.libmap = LibraryPackageMap(os.path.join(self.root, CACHE_PATH, "library_consumers"), self)
+		self.plib_registry = PreservedLibsRegistry(os.path.join(self.root, CACHE_PATH, "preserved_libs_registry"))
+
+	def getpath(self, mykey, filename=None):
+		rValue = os.path.join(self.root, VDB_PATH, mykey)
+		if filename != None:
+			rValue = os.path.join(rValue, filename)
+		return rValue
+
+	def cpv_exists(self, mykey):
+		"Tells us whether an actual ebuild exists on disk (no masking)"
+		return os.path.exists(self.getpath(mykey))
+
+	def cpv_counter(self, mycpv):
+		"This method will grab the COUNTER. Returns a counter value."
+		try:
+			return long(self.aux_get(mycpv, ["COUNTER"])[0])
+		except (KeyError, ValueError):
+			pass
+		cdir = self.getpath(mycpv)
+		cpath = self.getpath(mycpv, filename="COUNTER")
+
+		# We write our new counter value to a new file that gets moved into
+		# place to avoid filesystem corruption on XFS (unexpected reboot.)
+		corrupted = 0
+		if os.path.exists(cpath):
+			cfile = open(cpath, "r")
+			try:
+				counter = long(cfile.readline())
+			except ValueError:
+				print "portage: COUNTER for", mycpv, "was corrupted; resetting to value of 0"
+				counter = long(0)
+				corrupted = 1
+			cfile.close()
+		elif os.path.exists(cdir):
+			mys = pkgsplit(mycpv)
+			myl = self.match(mys[0], use_cache=0)
+			print mys, myl
+			if len(myl) == 1:
+				try:
+					# Only one package... Counter doesn't matter.
+					write_atomic(cpath, "1")
+					counter = 1
+				except SystemExit, e:
+					raise
+				except Exception, e:
+					writemsg("!!! COUNTER file is missing for "+str(mycpv)+" in /var/db.\n",
+						noiselevel=-1)
+					writemsg("!!! Please run %s/fix-db.py or\n" % PORTAGE_BIN_PATH,
+						noiselevel=-1)
+					writemsg("!!! unmerge this exact version.\n", noiselevel=-1)
+					writemsg("!!! %s\n" % e, noiselevel=-1)
+					sys.exit(1)
+			else:
+				writemsg("!!! COUNTER file is missing for "+str(mycpv)+" in /var/db.\n",
+					noiselevel=-1)
+				writemsg("!!! Please run %s/fix-db.py or\n" % PORTAGE_BIN_PATH,
+					noiselevel=-1)
+				writemsg("!!! remerge the package.\n", noiselevel=-1)
+				sys.exit(1)
+		else:
+			counter = long(0)
+		if corrupted:
+			# update new global counter file
+			write_atomic(cpath, str(counter))
+		return counter
+
+	def cpv_inject(self, mycpv):
+		"injects a real package into our on-disk database; assumes mycpv is valid and doesn't already exist"
+		os.makedirs(self.getpath(mycpv))
+		counter = self.counter_tick(self.root, mycpv=mycpv)
+		# write local package counter so that emerge clean does the right thing
+		write_atomic(self.getpath(mycpv, filename="COUNTER"), str(counter))
+
+	def isInjected(self, mycpv):
+		if self.cpv_exists(mycpv):
+			if os.path.exists(self.getpath(mycpv, filename="INJECTED")):
+				return True
+			if not os.path.exists(self.getpath(mycpv, filename="CONTENTS")):
+				return True
+		return False
+
+	def move_ent(self, mylist):
+		origcp = mylist[1]
+		newcp = mylist[2]
+
+		# sanity check
+		for cp in [origcp, newcp]:
+			if not (isvalidatom(cp) and isjustname(cp)):
+				raise InvalidPackageName(cp)
+		origmatches = self.match(origcp, use_cache=0)
+		moves = 0
+		if not origmatches:
+			return moves
+		for mycpv in origmatches:
+			mycpsplit = catpkgsplit(mycpv)
+			mynewcpv = newcp + "-" + mycpsplit[2]
+			mynewcat = newcp.split("/")[0]
+			if mycpsplit[3] != "r0":
+				mynewcpv += "-" + mycpsplit[3]
+			mycpsplit_new = catpkgsplit(mynewcpv)
+			origpath = self.getpath(mycpv)
+			if not os.path.exists(origpath):
+				continue
+			moves += 1
+			if not os.path.exists(self.getpath(mynewcat)):
+				#create the directory
+				os.makedirs(self.getpath(mynewcat))
+			newpath = self.getpath(mynewcpv)
+			if os.path.exists(newpath):
+				#dest already exists; keep this puppy where it is.
+				continue
+			os.rename(origpath, newpath)
+
+			# We need to rename the ebuild now.
+			old_pf = catsplit(mycpv)[1]
+			new_pf = catsplit(mynewcpv)[1]
+			if new_pf != old_pf:
+				try:
+					os.rename(os.path.join(newpath, old_pf + ".ebuild"),
+						os.path.join(newpath, new_pf + ".ebuild"))
+				except OSError, e:
+					if e.errno != errno.ENOENT:
+						raise
+					del e
+				write_atomic(os.path.join(newpath, "PF"), new_pf+"\n")
+
+			write_atomic(os.path.join(newpath, "CATEGORY"), mynewcat+"\n")
+			fixdbentries([mylist], newpath)
+		return moves
+
+	def cp_list(self, mycp, use_cache=1):
+		mysplit=catsplit(mycp)
+		if mysplit[0] == '*':
+			mysplit[0] = mysplit[0][1:]
+		try:
+			mystat = os.stat(self.getpath(mysplit[0]))[stat.ST_MTIME]
+		except OSError:
+			mystat = 0
+		if use_cache and self.cpcache.has_key(mycp):
+			cpc = self.cpcache[mycp]
+			if cpc[0] == mystat:
+				return cpc[1]
+		list = listdir(self.getpath(mysplit[0]), EmptyOnError=1)
+
+		if (list is None):
+			return []
+		returnme = []
+		for x in list:
+			if x.startswith("."):
+				continue
+			if x[0] == '-':
+				#writemsg(red("INCOMPLETE MERGE:")+str(x[len("-MERGING-"):])+"\n")
+				continue
+			ps = pkgsplit(x)
+			if not ps:
+				self.invalidentry(os.path.join(self.getpath(mysplit[0]), x))
+				continue
+			if len(mysplit) > 1:
+				if ps[0] == mysplit[1]:
+					returnme.append(mysplit[0]+"/"+x)
+		if use_cache:
+			self.cpcache[mycp] = [mystat,returnme]
+		elif self.cpcache.has_key(mycp):
+			del self.cpcache[mycp]
+		return returnme
+
+	def cpv_all(self, use_cache=1):
+		returnme = []
+		basepath = os.path.join(self.root, VDB_PATH) + os.path.sep
+		for x in self.categories:
+			for y in listdir(basepath + x, EmptyOnError=1):
+				if y.startswith("."):
+					continue
+				subpath = x + "/" + y
+				# -MERGING- should never be a cpv, nor should files.
+				if os.path.isdir(basepath + subpath) and (pkgsplit(y) is not None):
+					returnme += [subpath]
+		return returnme
+
+	def cp_all(self, use_cache=1):
+		mylist = self.cpv_all(use_cache=use_cache)
+		d={}
+		for y in mylist:
+			if y[0] == '*':
+				y = y[1:]
+			mysplit = catpkgsplit(y)
+			if not mysplit:
+				self.invalidentry(self.getpath(y))
+				continue
+			d[mysplit[0]+"/"+mysplit[1]] = None
+		return d.keys()
+
+	def checkblockers(self, origdep):
+		pass
+
+	def match(self, origdep, use_cache=1):
+		"caching match function"
+		mydep = dep_expand(
+			origdep, mydb=self, use_cache=use_cache, settings=self.settings)
+		mykey = dep_getkey(mydep)
+		mycat = catsplit(mykey)[0]
+		if not use_cache:
+			if self.matchcache.has_key(mycat):
+				del self.mtdircache[mycat]
+				del self.matchcache[mycat]
+			mymatch = match_from_list(mydep,
+				self.cp_list(mykey, use_cache=use_cache))
+			myslot = dep_getslot(mydep)
+			if myslot is not None:
+				mymatch = [cpv for cpv in mymatch \
+					if self.aux_get(cpv, ["SLOT"])[0] == myslot]
+			return mymatch
+		try:
+			curmtime = os.stat(self.root+VDB_PATH+"/"+mycat)[stat.ST_MTIME]
+		except (IOError, OSError):
+			curmtime=0
+
+		if not self.matchcache.has_key(mycat) or not self.mtdircache[mycat]==curmtime:
+			# clear cache entry
+			self.mtdircache[mycat] = curmtime
+			self.matchcache[mycat] = {}
+		if not self.matchcache[mycat].has_key(mydep):
+			mymatch = match_from_list(mydep, self.cp_list(mykey, use_cache=use_cache))
+			myslot = dep_getslot(mydep)
+			if myslot is not None:
+				mymatch = [cpv for cpv in mymatch \
+					if self.aux_get(cpv, ["SLOT"])[0] == myslot]
+			self.matchcache[mycat][mydep] = mymatch
+		return self.matchcache[mycat][mydep][:]
+
+	def findname(self, mycpv):
+		return self.getpath(str(mycpv), filename=catsplit(mycpv)[1]+".ebuild")
+
+	def flush_cache(self):
+		"""If the current user has permission and the internal aux_get cache has
+		been updated, save it to disk and mark it unmodified.  This is called
+		by emerge after it has loaded the full vdb for use in dependency
+		calculations.  Currently, the cache is only written if the user has
+		superuser privileges (since that's required to obtain a lock), but all
+		users have read access and benefit from faster metadata lookups (as
+		long as at least part of the cache is still valid)."""
+		if self._aux_cache is not None and \
+			self._aux_cache["modified"] and \
+			secpass >= 2:
+			valid_nodes = set(self.cpv_all())
+			for cpv in self._aux_cache["packages"].keys():
+				if cpv not in valid_nodes:
+					del self._aux_cache["packages"][cpv]
+			del self._aux_cache["modified"]
+			try:
+				f = atomic_ofstream(self._aux_cache_filename)
+				cPickle.dump(self._aux_cache, f, -1)
+				f.close()
+				apply_secpass_permissions(
+					self._aux_cache_filename, gid=portage_gid, mode=0644)
+			except (IOError, OSError), e:
+				pass
+			self._aux_cache["modified"] = False
+
+	def aux_get(self, mycpv, wants):
+		"""This automatically caches selected keys that are frequently needed
+		by emerge for dependency calculations.  The cached metadata is
+		considered valid if the mtime of the package directory has not changed
+		since the data was cached.  The cache is stored in a pickled dict
+		object with the following format:
+
+		{version:"1", "packages":{cpv1:(mtime,{k1,v1, k2,v2, ...}), cpv2...}}
+
+		If an error occurs while loading the cache pickle or the version is
+		unrecognized, the cache will simple be recreated from scratch (it is
+		completely disposable).
+		"""
+		if not self._aux_cache_keys.intersection(wants):
+			return self._aux_get(mycpv, wants)
+		if self._aux_cache is None:
+			try:
+				f = open(self._aux_cache_filename)
+				mypickle = cPickle.Unpickler(f)
+				mypickle.find_global = None
+				self._aux_cache = mypickle.load()
+				f.close()
+				del f
+			except (IOError, OSError, EOFError, cPickle.UnpicklingError):
+				pass
+			if not self._aux_cache or \
+				not isinstance(self._aux_cache, dict) or \
+				self._aux_cache.get("version") != self._aux_cache_version or \
+				not self._aux_cache.get("packages"):
+				self._aux_cache = {"version": self._aux_cache_version}
+				self._aux_cache["packages"] = {}
+			self._aux_cache["modified"] = False
+		mydir = self.getpath(mycpv)
+		mydir_stat = None
+		try:
+			mydir_stat = os.stat(mydir)
+		except OSError, e:
+			if e.errno != errno.ENOENT:
+				raise
+			raise KeyError(mycpv)
+		mydir_mtime = long(mydir_stat.st_mtime)
+		pkg_data = self._aux_cache["packages"].get(mycpv)
+		mydata = {}
+		cache_valid = False
+		if pkg_data:
+			cache_mtime, metadata = pkg_data
+			cache_valid = cache_mtime == mydir_mtime
+		if cache_valid:
+			cache_incomplete = self._aux_cache_keys.difference(metadata)
+			if cache_incomplete:
+				# Allow self._aux_cache_keys to change without a cache version
+				# bump and efficiently recycle partial cache whenever possible.
+				cache_valid = False
+				pull_me = cache_incomplete.union(wants)
+			else:
+				pull_me = set(wants).difference(self._aux_cache_keys)
+			mydata.update(metadata)
+		else:
+			pull_me = self._aux_cache_keys.union(wants)
+		if pull_me:
+			# pull any needed data and cache it
+			aux_keys = list(pull_me)
+			for k, v in izip(aux_keys, self._aux_get(mycpv, aux_keys)):
+				mydata[k] = v
+			if not cache_valid:
+				cache_data = {}
+				for aux_key in self._aux_cache_keys:
+					cache_data[aux_key] = mydata[aux_key]
+				self._aux_cache["packages"][mycpv] = (mydir_mtime, cache_data)
+				self._aux_cache["modified"] = True
+		return [mydata[x] for x in wants]
+
+	def _aux_get(self, mycpv, wants):
+		mydir = self.getpath(mycpv)
+		try:
+			if not stat.S_ISDIR(os.stat(mydir).st_mode):
+				raise KeyError(mycpv)
+		except OSError, e:
+			if e.errno == errno.ENOENT:
+				raise KeyError(mycpv)
+			del e
+			raise
+		results = []
+		for x in wants:
+			try:
+				myf = open(os.path.join(mydir, x), "r")
+				try:
+					myd = myf.read()
+				finally:
+					myf.close()
+				myd = " ".join(myd.split())
+			except IOError:
+				myd = ""
+			if x == "EAPI" and not myd:
+				results.append("0")
+			else:
+				results.append(myd)
+		return results
+
+	def aux_update(self, cpv, values):
+		cat, pkg = catsplit(cpv)
+		mylink = dblink(cat, pkg, self.root, self.settings,
+		treetype="vartree", vartree=self.vartree)
+		if not mylink.exists():
+			raise KeyError(cpv)
+		for k, v in values.iteritems():
+			if v:
+				mylink.setfile(k, v)
+			else:
+				try:
+					os.unlink(os.path.join(self.getpath(cpv), k))
+				except EnvironmentError:
+					pass
+
+	def counter_tick(self, myroot, mycpv=None):
+		return self.counter_tick_core(myroot, incrementing=1, mycpv=mycpv)
+
+	def get_counter_tick_core(self, myroot, mycpv=None):
+		return self.counter_tick_core(myroot, incrementing=0, mycpv=mycpv) + 1
+
+	def counter_tick_core(self, myroot, incrementing=1, mycpv=None):
+		"This method will grab the next COUNTER value and record it back to the global file.  Returns new counter value."
+		cpath = os.path.join(myroot, CACHE_PATH.lstrip(os.sep), "counter")
+		changed = 0
+		min_counter = 0
+		if mycpv:
+			mysplit = pkgsplit(mycpv)
+			for x in self.match(mysplit[0], use_cache=0):
+				if x == mycpv:
+					continue
+				try:
+					old_counter = long(self.aux_get(x, ["COUNTER"])[0])
+					writemsg("COUNTER '%d' '%s'\n" % (old_counter, x), 1)
+				except (ValueError, KeyError): # valueError from long(), KeyError from aux_get
+					old_counter = 0
+					writemsg("!!! BAD COUNTER in '%s'\n" % (x), noiselevel=-1)
+				if old_counter > min_counter:
+					min_counter = old_counter
+
+		# We write our new counter value to a new file that gets moved into
+		# place to avoid filesystem corruption.
+		find_counter = ("find '%s' -type f -name COUNTER | " + \
+			"while read f; do echo $(<\"${f}\"); done | " + \
+			"sort -n | tail -n1") % os.path.join(self.root, VDB_PATH)
+		if os.path.exists(cpath):
+			cfile = open(cpath, "r")
+			try:
+				counter = long(cfile.readline())
+			except (ValueError,OverflowError):
+				try:
+					counter = long(commands.getoutput(find_counter).strip())
+					writemsg("!!! COUNTER was corrupted; resetting to value of %d\n" % counter,
+						noiselevel=-1)
+					changed=1
+				except (ValueError, OverflowError):
+					writemsg("!!! COUNTER data is corrupt in pkg db. The values need to be\n",
+						noiselevel=-1)
+					writemsg("!!! corrected/normalized so that portage can operate properly.\n",
+						noiselevel=-1)
+					writemsg("!!! A simple solution is not yet available so try #gentoo on IRC.\n")
+					sys.exit(2)
+			cfile.close()
+		else:
+			try:
+				counter = long(commands.getoutput(find_counter).strip())
+				writemsg("!!! Global counter missing. Regenerated from counter files to: %s\n" % counter,
+					noiselevel=-1)
+			except ValueError: # Value Error for long(), probably others for commands.getoutput
+				writemsg("!!! Initializing global counter.\n", noiselevel=-1)
+				counter = long(0)
+			changed = 1
+
+		if counter < min_counter:
+			counter = min_counter + 1000
+			changed = 1
+
+		if incrementing or changed:
+
+			#increment counter
+			counter += 1
+			# update new global counter file
+			write_atomic(cpath, str(counter))
+		return counter
+
+class vartree(object):
+	"this tree will scan a var/db/pkg database located at root (passed to init)"
+	def __init__(self, root="/", virtual=None, clone=None, categories=None,
+		settings=None):
+		if clone:
+			writemsg("vartree.__init__(): deprecated " + \
+				"use of clone parameter\n", noiselevel=-1)
+			self.root = clone.root[:]
+			self.dbapi = copy.deepcopy(clone.dbapi)
+			self.populated = 1
+			self.settings = config(clone=clone.settings)
+		else:
+			self.root = root[:]
+			if settings is None:
+				from portage import settings
+			self.settings = settings # for key_expand calls
+			if categories is None:
+				categories = settings.categories
+			self.dbapi = vardbapi(self.root, categories=categories,
+				settings=settings, vartree=self)
+			self.populated = 1
+
+	def getpath(self, mykey, filename=None):
+		rValue = self.getpath(mykey)
+		if filename != None:
+			rValue = os.path.join(rValue, filename)
+		return rValue
+
+	def zap(self, mycpv):
+		return
+
+	def inject(self, mycpv):
+		return
+
+	def get_provide(self, mycpv):
+		myprovides = []
+		mylines = None
+		try:
+			mylines, myuse = self.dbapi.aux_get(mycpv, ["PROVIDE", "USE"])
+			if mylines:
+				myuse = myuse.split()
+				mylines = flatten(use_reduce(paren_reduce(mylines), uselist=myuse))
+				for myprovide in mylines:
+					mys = catpkgsplit(myprovide)
+					if not mys:
+						mys = myprovide.split("/")
+					myprovides += [mys[0] + "/" + mys[1]]
+			return myprovides
+		except SystemExit, e:
+			raise
+		except Exception, e:
+			mydir = self.getpath(mycpv)
+			writemsg("\nParse Error reading PROVIDE and USE in '%s'\n" % mydir,
+				noiselevel=-1)
+			if mylines:
+				writemsg("Possibly Invalid: '%s'\n" % str(mylines),
+					noiselevel=-1)
+			writemsg("Exception: %s\n\n" % str(e), noiselevel=-1)
+			return []
+
+	def get_all_provides(self):
+		myprovides = {}
+		for node in self.getallcpv():
+			for mykey in self.get_provide(node):
+				if myprovides.has_key(mykey):
+					myprovides[mykey] += [node]
+				else:
+					myprovides[mykey] = [node]
+		return myprovides
+
+	def dep_bestmatch(self, mydep, use_cache=1):
+		"compatibility method -- all matches, not just visible ones"
+		#mymatch=best(match(dep_expand(mydep,self.dbapi),self.dbapi))
+		mymatch = best(self.dbapi.match(
+			dep_expand(mydep, mydb=self.dbapi, settings=self.settings),
+			use_cache=use_cache))
+		if mymatch is None:
+			return ""
+		else:
+			return mymatch
+
+	def dep_match(self, mydep, use_cache=1):
+		"compatibility method -- we want to see all matches, not just visible ones"
+		#mymatch = match(mydep,self.dbapi)
+		mymatch = self.dbapi.match(mydep, use_cache=use_cache)
+		if mymatch is None:
+			return []
+		else:
+			return mymatch
+
+	def exists_specific(self, cpv):
+		return self.dbapi.cpv_exists(cpv)
+
+	def getallcpv(self):
+		"""temporary function, probably to be renamed --- Gets a list of all
+		category/package-versions installed on the system."""
+		return self.dbapi.cpv_all()
+
+	def getallnodes(self):
+		"""new behavior: these are all *unmasked* nodes.  There may or may not be available
+		masked package for nodes in this nodes list."""
+		return self.dbapi.cp_all()
+
+	def exists_specific_cat(self, cpv, use_cache=1):
+		cpv = key_expand(cpv, mydb=self.dbapi, use_cache=use_cache,
+			settings=self.settings)
+		a = catpkgsplit(cpv)
+		if not a:
+			return 0
+		mylist = listdir(self.getpath(a[0]), EmptyOnError=1)
+		for x in mylist:
+			b = pkgsplit(x)
+			if not b:
+				self.dbapi.invalidentry(self.getpath(a[0], filename=x))
+				continue
+			if a[1] == b[0]:
+				return 1
+		return 0
+
+	def getebuildpath(self, fullpackage):
+		cat, package = catsplit(fullpackage)
+		return self.getpath(fullpackage, filename=package+".ebuild")
+
+	def getnode(self, mykey, use_cache=1):
+		mykey = key_expand(mykey, mydb=self.dbapi, use_cache=use_cache,
+			settings=self.settings)
+		if not mykey:
+			return []
+		mysplit = catsplit(mykey)
+		mydirlist = listdir(self.getpath(mysplit[0]),EmptyOnError=1)
+		returnme = []
+		for x in mydirlist:
+			mypsplit = pkgsplit(x)
+			if not mypsplit:
+				self.dbapi.invalidentry(self.getpath(mysplit[0], filename=x))
+				continue
+			if mypsplit[0] == mysplit[1]:
+				appendme = [mysplit[0]+"/"+x, [mysplit[0], mypsplit[0], mypsplit[1], mypsplit[2]]]
+				returnme.append(appendme)
+		return returnme
+
+
+	def getslot(self, mycatpkg):
+		"Get a slot for a catpkg; assume it exists."
+		try:
+			return self.dbapi.aux_get(mycatpkg, ["SLOT"])[0]
+		except KeyError:
+			return ""
+
+	def hasnode(self, mykey, use_cache):
+		"""Does the particular node (cat/pkg key) exist?"""
+		mykey = key_expand(mykey, mydb=self.dbapi, use_cache=use_cache,
+			settings=self.settings)
+		mysplit = catsplit(mykey)
+		mydirlist = listdir(self.getpath(mysplit[0]), EmptyOnError=1)
+		for x in mydirlist:
+			mypsplit = pkgsplit(x)
+			if not mypsplit:
+				self.dbapi.invalidentry(self.getpath(mysplit[0], filename=x))
+				continue
+			if mypsplit[0] == mysplit[1]:
+				return 1
+		return 0
+
+	def populate(self):
+		self.populated=1
+
+class dblink(object):
+	"""
+	This class provides an interface to the installed package database
+	At present this is implemented as a text backend in /var/db/pkg.
+	"""
+	def __init__(self, cat, pkg, myroot, mysettings, treetype=None,
+		vartree=None):
+		"""
+		Creates a DBlink object for a given CPV.
+		The given CPV may not be present in the database already.
+		
+		@param cat: Category
+		@type cat: String
+		@param pkg: Package (PV)
+		@type pkg: String
+		@param myroot: Typically ${ROOT}
+		@type myroot: String (Path)
+		@param mysettings: Typically portage.config
+		@type mysettings: An instance of portage.config
+		@param treetype: one of ['porttree','bintree','vartree']
+		@type treetype: String
+		@param vartree: an instance of vartree corresponding to myroot.
+		@type vartree: vartree
+		"""
+		
+		self.cat = cat
+		self.pkg = pkg
+		self.mycpv = self.cat + "/" + self.pkg
+		self.mysplit = pkgsplit(self.mycpv)
+		self.treetype = treetype
+		if vartree is None:
+			from portage import db
+			vartree = db[myroot]["vartree"]
+		self.vartree = vartree
+
+		self.dbroot = normalize_path(os.path.join(myroot, VDB_PATH))
+		self.dbcatdir = self.dbroot+"/"+cat
+		self.dbpkgdir = self.dbcatdir+"/"+pkg
+		self.dbtmpdir = self.dbcatdir+"/-MERGING-"+pkg
+		self.dbdir = self.dbpkgdir
+
+		self._lock_vdb = None
+
+		self.settings = mysettings
+		if self.settings == 1:
+			raise ValueError
+
+		self.myroot=myroot
+		protect_obj = ConfigProtect(myroot,
+			mysettings.get("CONFIG_PROTECT","").split(),
+			mysettings.get("CONFIG_PROTECT_MASK","").split())
+		self.updateprotect = protect_obj.updateprotect
+		self.isprotected = protect_obj.isprotected
+		self._installed_instance = None
+		self.contentscache = None
+		self._contents_inodes = None
+
+	def lockdb(self):
+		if self._lock_vdb:
+			raise AssertionError("Lock already held.")
+		# At least the parent needs to exist for the lock file.
+		ensure_dirs(self.dbroot)
+		self._lock_vdb = lockdir(self.dbroot)
+
+	def unlockdb(self):
+		if self._lock_vdb:
+			unlockdir(self._lock_vdb)
+			self._lock_vdb = None
+
+	def getpath(self):
+		"return path to location of db information (for >>> informational display)"
+		return self.dbdir
+
+	def exists(self):
+		"does the db entry exist?  boolean."
+		return os.path.exists(self.dbdir)
+
+	def delete(self):
+		"""
+		Remove this entry from the database
+		"""
+		if not os.path.exists(self.dbdir):
+			return
+		try:
+			for x in listdir(self.dbdir):
+				os.unlink(self.dbdir+"/"+x)
+			os.rmdir(self.dbdir)
+		except OSError, e:
+			print "!!! Unable to remove db entry for this package."
+			print "!!! It is possible that a directory is in this one. Portage will still"
+			print "!!! register this package as installed as long as this directory exists."
+			print "!!! You may delete this directory with 'rm -Rf "+self.dbdir+"'"
+			print "!!! "+str(e)
+			print
+			sys.exit(1)
+
+	def clearcontents(self):
+		"""
+		For a given db entry (self), erase the CONTENTS values.
+		"""
+		if os.path.exists(self.dbdir+"/CONTENTS"):
+			os.unlink(self.dbdir+"/CONTENTS")
+
+	def getcontents(self):
+		"""
+		Get the installed files of a given package (aka what that package installed)
+		"""
+		contents_file = os.path.join(self.dbdir, "CONTENTS")
+		if not os.path.exists(contents_file):
+			return None
+		if self.contentscache is not None:
+			return self.contentscache
+		pkgfiles = {}
+		myc = open(contents_file,"r")
+		mylines = myc.readlines()
+		myc.close()
+		null_byte = "\0"
+		pos = 0
+		for line in mylines:
+			pos += 1
+			if null_byte in line:
+				# Null bytes are a common indication of corruption.
+				writemsg("!!! Null byte found in contents " + \
+					"file, line %d: '%s'\n" % (pos, contents_file),
+					noiselevel=-1)
+				continue
+			mydat = line.split()
+			# we do this so we can remove from non-root filesystems
+			# (use the ROOT var to allow maintenance on other partitions)
+			try:
+				mydat[1] = normalize_path(os.path.join(
+					self.myroot, mydat[1].lstrip(os.path.sep)))
+				if mydat[0] == "obj":
+					#format: type, mtime, md5sum
+					pkgfiles[" ".join(mydat[1:-2])] = [mydat[0], mydat[-1], mydat[-2]]
+				elif mydat[0] == "dir":
+					#format: type
+					pkgfiles[" ".join(mydat[1:])] = [mydat[0] ]
+				elif mydat[0] == "sym":
+					#format: type, mtime, dest
+					x = len(mydat) - 1
+					if (x >= 13) and (mydat[-1][-1] == ')'): # Old/Broken symlink entry
+						mydat = mydat[:-10] + [mydat[-10:][stat.ST_MTIME][:-1]]
+						writemsg("FIXED SYMLINK LINE: %s\n" % mydat, 1)
+						x = len(mydat) - 1
+					splitter = -1
+					while (x >= 0):
+						if mydat[x] == "->":
+							splitter = x
+							break
+						x = x - 1
+					if splitter == -1:
+						return None
+					pkgfiles[" ".join(mydat[1:splitter])] = [mydat[0], mydat[-1], " ".join(mydat[(splitter+1):-1])]
+				elif mydat[0] == "dev":
+					#format: type
+					pkgfiles[" ".join(mydat[1:])] = [mydat[0] ]
+				elif mydat[0]=="fif":
+					#format: type
+					pkgfiles[" ".join(mydat[1:])] = [mydat[0]]
+				else:
+					return None
+			except (KeyError, IndexError):
+				print "portage: CONTENTS line", pos, "corrupt!"
+		self.contentscache = pkgfiles
+		return pkgfiles
+
+	def unmerge(self, pkgfiles=None, trimworld=1, cleanup=1,
+		ldpath_mtimes=None, new_contents=None):
+		"""
+		Calls prerm
+		Unmerges a given package (CPV)
+		calls postrm
+		calls cleanrm
+		calls env_update
+		
+		@param pkgfiles: files to unmerge (generally self.getcontents() )
+		@type pkgfiles: Dictionary
+		@param trimworld: Remove CPV from world file if True, not if False
+		@type trimworld: Boolean
+		@param cleanup: cleanup to pass to doebuild (see doebuild)
+		@type cleanup: Boolean
+		@param ldpath_mtimes: mtimes to pass to env_update (see env_update)
+		@type ldpath_mtimes: Dictionary
+		@param new_contents: contents from a new instance that will replace this one
+		@type new_contents: Dictionary
+		@rtype: Integer
+		@returns:
+		1. os.EX_OK if everything went well.
+		2. return code of the failed phase (for prerm, postrm, cleanrm)
+		
+		Notes:
+		The caller must ensure that lockdb() and unlockdb() are called
+		before and after this method.
+		"""
+
+		# When new_contents is supplied, the security check has already been
+		# done for this slot, so it shouldn't be repeated until the next
+		# replacement or unmerge operation.
+		if new_contents is None:
+			slot = self.vartree.dbapi.aux_get(self.mycpv, ["SLOT"])[0]
+			slot_matches = self.vartree.dbapi.match(
+				"%s:%s" % (dep_getkey(self.mycpv), slot))
+			retval = self._security_check(slot_matches)
+			if retval:
+				return retval
+
+		contents = self.getcontents()
+		# Now, don't assume that the name of the ebuild is the same as the
+		# name of the dir; the package may have been moved.
+		myebuildpath = None
+		mystuff = listdir(self.dbdir, EmptyOnError=1)
+		for x in mystuff:
+			if x.endswith(".ebuild"):
+				myebuildpath = os.path.join(self.dbdir, self.pkg + ".ebuild")
+				if x[:-7] != self.pkg:
+					# Clean up after vardbapi.move_ent() breakage in
+					# portage versions before 2.1.2
+					os.rename(os.path.join(self.dbdir, x), myebuildpath)
+					write_atomic(os.path.join(self.dbdir, "PF"), self.pkg+"\n")
+				break
+
+		self.settings.load_infodir(self.dbdir)
+		if myebuildpath:
+			try:
+				doebuild_environment(myebuildpath, "prerm", self.myroot,
+					self.settings, 0, 0, self.vartree.dbapi)
+			except UnsupportedAPIException, e:
+				# Sometimes this happens due to corruption of the EAPI file.
+				writemsg("!!! FAILED prerm: %s\n" % \
+					os.path.join(self.dbdir, "EAPI"), noiselevel=-1)
+				writemsg("%s\n" % str(e), noiselevel=-1)
+				return 1
+			catdir = os.path.dirname(self.settings["PORTAGE_BUILDDIR"])
+			ensure_dirs(os.path.dirname(catdir),
+				uid=portage_uid, gid=portage_gid, mode=070, mask=0)
+		builddir_lock = None
+		catdir_lock = None
+		try:
+			if myebuildpath:
+				catdir_lock = lockdir(catdir)
+				ensure_dirs(catdir,
+					uid=portage_uid, gid=portage_gid,
+					mode=070, mask=0)
+				builddir_lock = lockdir(
+					self.settings["PORTAGE_BUILDDIR"])
+				try:
+					unlockdir(catdir_lock)
+				finally:
+					catdir_lock = None
+				# Eventually, we'd like to pass in the saved ebuild env here...
+				retval = doebuild(myebuildpath, "prerm", self.myroot,
+					self.settings, cleanup=cleanup, use_cache=0,
+					mydbapi=self.vartree.dbapi, tree="vartree",
+					vartree=self.vartree)
+				# XXX: Decide how to handle failures here.
+				if retval != os.EX_OK:
+					writemsg("!!! FAILED prerm: %s\n" % retval, noiselevel=-1)
+					return retval
+
+			self._unmerge_pkgfiles(pkgfiles, new_contents=new_contents)
+			
+			# Remove the registration of preserved libs for this pkg instance
+			self.vartree.dbapi.plib_registry.unregister(self.mycpv, self.settings["SLOT"], self.settings["COUNTER"])
+
+			if myebuildpath:
+				retval = doebuild(myebuildpath, "postrm", self.myroot,
+					 self.settings, use_cache=0, tree="vartree",
+					 mydbapi=self.vartree.dbapi, vartree=self.vartree)
+
+				# process logs created during pre/postrm
+				elog_process(self.mycpv, self.settings)
+
+				# XXX: Decide how to handle failures here.
+				if retval != os.EX_OK:
+					writemsg("!!! FAILED postrm: %s\n" % retval, noiselevel=-1)
+					return retval
+				doebuild(myebuildpath, "cleanrm", self.myroot, self.settings,
+					tree="vartree", mydbapi=self.vartree.dbapi,
+					vartree=self.vartree)
+			
+			# regenerate reverse NEEDED map
+			self.vartree.dbapi.libmap.update()
+
+		finally:
+			if builddir_lock:
+				unlockdir(builddir_lock)
+			try:
+				if myebuildpath and not catdir_lock:
+					# Lock catdir for removal if empty.
+					catdir_lock = lockdir(catdir)
+			finally:
+				if catdir_lock:
+					try:
+						os.rmdir(catdir)
+					except OSError, e:
+						if e.errno not in (errno.ENOENT,
+							errno.ENOTEMPTY, errno.EEXIST):
+							raise
+						del e
+					unlockdir(catdir_lock)
+		env_update(target_root=self.myroot, prev_mtimes=ldpath_mtimes,
+			contents=contents, env=self.settings.environ())
+		return os.EX_OK
+
+	def _unmerge_pkgfiles(self, pkgfiles, new_contents=None):
+		"""
+		
+		Unmerges the contents of a package from the liveFS
+		Removes the VDB entry for self
+		
+		@param pkgfiles: typically self.getcontents()
+		@type pkgfiles: Dictionary { filename: [ 'type', '?', 'md5sum' ] }
+		@param new_contents: contents from a new instance that will replace this one
+		@type new_contents: Dictionary
+		@rtype: None
+		"""
+		global dircache
+		dircache={}
+
+		if not pkgfiles:
+			writemsg_stdout("No package files given... Grabbing a set.\n")
+			pkgfiles = self.getcontents()
+
+		if not new_contents:
+			counter = self.vartree.dbapi.cpv_counter(self.mycpv)
+			slot = self.vartree.dbapi.aux_get(self.mycpv, ["SLOT"])[0]
+			slot_matches = self.vartree.dbapi.match(
+				"%s:%s" % (dep_getkey(self.mycpv), slot))
+			new_cpv = None
+			if slot_matches:
+				max_counter = -1
+				for cur_cpv in slot_matches:
+					cur_counter = self.vartree.dbapi.cpv_counter(cur_cpv)
+					if cur_counter == counter and \
+						cur_cpv == self.mycpv:
+						continue
+					if cur_counter > max_counter:
+						max_counter = cur_counter
+						new_cpv = cur_cpv
+			if new_cpv:
+				# The current instance has been replaced by a newer instance.
+				new_cat, new_pkg = catsplit(new_cpv)
+				new_contents = dblink(new_cat, new_pkg, self.vartree.root,
+					self.settings, vartree=self.vartree).getcontents()
+
+		if pkgfiles:
+			mykeys = pkgfiles.keys()
+			mykeys.sort()
+			mykeys.reverse()
+
+			#process symlinks second-to-last, directories last.
+			mydirs = []
+			modprotect = "/lib/modules/"
+			for objkey in mykeys:
+				obj = normalize_path(objkey)
+				if new_contents and obj in new_contents:
+					# A new instance of this package claims the file, so don't
+					# unmerge it.
+					writemsg_stdout("--- !owned %s %s\n" % \
+						(pkgfiles[objkey][0], obj))
+					continue
+				statobj = None
+				try:
+					statobj = os.stat(obj)
+				except OSError:
+					pass
+				lstatobj = None
+				try:
+					lstatobj = os.lstat(obj)
+				except (OSError, AttributeError):
+					pass
+				islink = lstatobj is not None and stat.S_ISLNK(lstatobj.st_mode)
+				if statobj is None:
+					if not islink:
+						#we skip this if we're dealing with a symlink
+						#because os.stat() will operate on the
+						#link target rather than the link itself.
+						writemsg_stdout("--- !found " + str(pkgfiles[objkey][0]) + " %s\n" % obj)
+						continue
+				# next line includes a tweak to protect modules from being unmerged,
+				# but we don't protect modules from being overwritten if they are
+				# upgraded. We effectively only want one half of the config protection
+				# functionality for /lib/modules. For portage-ng both capabilities
+				# should be able to be independently specified.
+				if obj.startswith(modprotect):
+					writemsg_stdout("--- cfgpro %s %s\n" % (pkgfiles[objkey][0], obj))
+					continue
+
+				lmtime = str(lstatobj[stat.ST_MTIME])
+				if (pkgfiles[objkey][0] not in ("dir", "fif", "dev")) and (lmtime != pkgfiles[objkey][1]):
+					writemsg_stdout("--- !mtime %s %s\n" % (pkgfiles[objkey][0], obj))
+					continue
+
+				if pkgfiles[objkey][0] == "dir":
+					if statobj is None or not stat.S_ISDIR(statobj.st_mode):
+						writemsg_stdout("--- !dir   %s %s\n" % ("dir", obj))
+						continue
+					mydirs.append(obj)
+				elif pkgfiles[objkey][0] == "sym":
+					if not islink:
+						writemsg_stdout("--- !sym   %s %s\n" % ("sym", obj))
+						continue
+					try:
+						os.unlink(obj)
+						writemsg_stdout("<<<        %s %s\n" % ("sym", obj))
+					except (OSError, IOError),e:
+						writemsg_stdout("!!!        %s %s\n" % ("sym", obj))
+				elif pkgfiles[objkey][0] == "obj":
+					if statobj is None or not stat.S_ISREG(statobj.st_mode):
+						writemsg_stdout("--- !obj   %s %s\n" % ("obj", obj))
+						continue
+					mymd5 = None
+					try:
+						mymd5 = perform_md5(obj, calc_prelink=1)
+					except FileNotFound, e:
+						# the file has disappeared between now and our stat call
+						writemsg_stdout("--- !obj   %s %s\n" % ("obj", obj))
+						continue
+
+					# string.lower is needed because db entries used to be in upper-case.  The
+					# string.lower allows for backwards compatibility.
+					if mymd5 != pkgfiles[objkey][2].lower():
+						writemsg_stdout("--- !md5   %s %s\n" % ("obj", obj))
+						continue
+					try:
+						# Remove permissions to ensure that any hardlinks to
+						# suid/sgid files are rendered harmless.
+						os.chmod(obj, 0)
+						os.unlink(obj)
+					except (OSError, IOError), e:
+						pass
+					writemsg_stdout("<<<        %s %s\n" % ("obj", obj))
+				elif pkgfiles[objkey][0] == "fif":
+					if not stat.S_ISFIFO(lstatobj[stat.ST_MODE]):
+						writemsg_stdout("--- !fif   %s %s\n" % ("fif", obj))
+						continue
+					writemsg_stdout("---        %s %s\n" % ("fif", obj))
+				elif pkgfiles[objkey][0] == "dev":
+					writemsg_stdout("---        %s %s\n" % ("dev", obj))
+
+			mydirs.sort()
+			mydirs.reverse()
+
+			for obj in mydirs:
+				try:
+					os.rmdir(obj)
+					writemsg_stdout("<<<        %s %s\n" % ("dir", obj))
+				except (OSError, IOError):
+					writemsg_stdout("--- !empty dir %s\n" % obj)
+
+		#remove self from vartree database so that our own virtual gets zapped if we're the last node
+		self.vartree.zap(self.mycpv)
+
+	def isowner(self,filename, destroot):
+		""" 
+		Check if filename is a new file or belongs to this package
+		(for this or a previous version)
+		
+		@param filename:
+		@type filename:
+		@param destroot:
+		@type destroot:
+		@rtype: Boolean
+		@returns:
+		1. True if this package owns the file.
+		2. False if this package does not own the file.
+		"""
+		destfile = normalize_path(
+			os.path.join(destroot, filename.lstrip(os.path.sep)))
+		try:
+			mylstat = os.lstat(destfile)
+		except (OSError, IOError):
+			return True
+
+		pkgfiles = self.getcontents()
+		if pkgfiles and filename in pkgfiles:
+			return True
+		if pkgfiles:
+			if self._contents_inodes is None:
+				self._contents_inodes = set()
+				for x in pkgfiles:
+					try:
+						lstat = os.lstat(x)
+						self._contents_inodes.add((lstat.st_dev, lstat.st_ino))
+					except OSError:
+						pass
+			if (mylstat.st_dev, mylstat.st_ino) in self._contents_inodes:
+				 return True
+
+		return False
+
+	def _preserve_libs(self, srcroot, destroot, mycontents, counter):
+		# read global reverse NEEDED map
+		libmap = self.vartree.dbapi.libmap.get()
+
+		# get list of libraries from old package instance
+		old_contents = self._installed_instance.getcontents().keys()
+		old_libs = set([os.path.basename(x) for x in old_contents]).intersection(libmap.keys())
+
+		# get list of libraries from new package instance
+		mylibs = set([os.path.basename(x) for x in mycontents]).intersection(libmap.keys())
+
+		# check which libs are present in the old, but not the new package instance
+		preserve_libs = old_libs.difference(mylibs)
+
+		# ignore any libs that are only internally used by the package
+		def has_external_consumers(lib, contents, otherlibs):
+			consumers = set(libmap[lib])
+			contents_without_libs = [x for x in contents if not os.path.basename(x) in otherlibs]
+			
+			# just used by objects that will be autocleaned
+			if len(consumers.difference(contents_without_libs)) == 0:
+				return False
+			# used by objects that are referenced as well, need to check those 
+			# recursively to break any reference cycles
+			elif len(consumers.difference(contents)) == 0:
+				otherlibs = set(otherlibs)
+				for ol in otherlibs.intersection(consumers):
+					if has_external_consumers(ol, contents, otherlibs.difference([lib])):
+						return True
+				return False
+			# used by external objects directly
+			else:
+				return True
+
+		for lib in list(preserve_libs):
+			if not has_external_consumers(lib, old_contents, preserve_libs):
+				preserve_libs.remove(lib)						
+			
+		# get the real paths for the libs
+		preserve_paths = [x for x in old_contents if os.path.basename(x) in preserve_libs]
+		del old_contents, old_libs, mylibs, preserve_libs
+			
+		# inject files that should be preserved into our image dir
+		import shutil
+		for x in preserve_paths:
+			print "injecting %s into %s" % (x, srcroot)
+			mydir = os.path.join(srcroot, os.path.dirname(x))
+			if not os.path.exists(mydir):
+				os.makedirs(mydir)
+
+			# resolve symlinks and extend preserve list
+			# NOTE: we're extending the list in the loop to emulate recursion to
+			#       also get indirect symlinks
+			if os.path.islink(x):
+				linktarget = os.readlink(x)
+				os.symlink(linktarget, os.path.join(srcroot, x.lstrip(os.sep)))
+				if linktarget[0] != os.sep:
+					linktarget = os.path.join(os.path.dirname(x), linktarget)
+				preserve_paths.append(linktarget)
+			else:
+				shutil.copy2(os.path.join(destroot, x), os.path.join(srcroot, x.lstrip(os.sep)))
+
+		# keep track of the libs we preserved
+		self.vartree.dbapi.plib_registry.register(self.mycpv, self.settings["SLOT"], counter, preserve_paths)
+
+		del preserve_paths
+	
+	def _collision_protect(self, srcroot, destroot, otherversions, mycontents, mysymlinks):
+			collision_ignore = set([normalize_path(myignore) for myignore in \
+				self.settings.get("COLLISION_IGNORE", "").split()])
+
+			# the linkcheck only works if we are in srcroot
+			mycwd = os.getcwd()
+			os.chdir(srcroot)
+
+
+			mysymlinked_directories = [s + os.path.sep for s in mysymlinks]
+			del mysymlinks
+
+			stopmerge = False
+			i=0
+
+			otherpkg=[]
+			mypkglist=[]
+
+			if self.pkg in otherversions:
+				otherversions.remove(self.pkg)	# we already checked this package
+
+			myslot = self.settings["SLOT"]
+			for v in otherversions:
+				# only allow versions with same slot to overwrite files
+				if myslot == self.vartree.dbapi.aux_get("/".join((self.cat, v)), ["SLOT"])[0]:
+					mypkglist.append(
+						dblink(self.cat, v, destroot, self.settings,
+							vartree=self.vartree))
+
+			collisions = []
+
+			print green("*")+" checking "+str(len(mycontents))+" files for package collisions"
+			for f in mycontents:
+				nocheck = False
+				# listdir isn't intelligent enough to exclude symlinked dirs,
+				# so we have to do it ourself
+				for s in mysymlinked_directories:
+					if f.startswith(s):
+						nocheck = True
+						break
+				if nocheck:
+					continue
+				i = i + 1
+				if i % 1000 == 0:
+					print str(i)+" files checked ..."
+				if f[0] != "/":
+					f="/"+f
+				isowned = False
+				for ver in [self] + mypkglist:
+					if (ver.isowner(f, destroot) or ver.isprotected(f)):
+						isowned = True
+						break
+				if not isowned:
+					collisions.append(f)
+					print "existing file "+f+" is not owned by this package"
+					stopmerge = True
+					if collision_ignore:
+						if f in collision_ignore:
+							stopmerge = False
+						else:
+							for myignore in collision_ignore:
+								if f.startswith(myignore + os.path.sep):
+									stopmerge = False
+									break
+			if stopmerge:
+				print red("*")+" This package is blocked because it wants to overwrite"
+				print red("*")+" files belonging to other packages (see messages above)."
+				print red("*")+" If you have no clue what this is all about report it "
+				print red("*")+" as a bug for this package on http://bugs.gentoo.org"
+				print
+				print red("package "+self.cat+"/"+self.pkg+" NOT merged")
+				print
+				print
+				print "Searching all installed packages for file collisions..."
+				print "Press Ctrl-C to Stop"
+				print
+				""" Note: The isowner calls result in a stat call for *every*
+				single installed file, since the inode numbers are used to work
+				around the problem of ambiguous paths caused by symlinked files
+				and/or directories.  Though it is slow, it is as accurate as
+				possible."""
+				found_owner = False
+				for cpv in self.vartree.dbapi.cpv_all():
+					cat, pkg = catsplit(cpv)
+					mylink = dblink(cat, pkg, destroot, self.settings,
+						vartree=self.vartree)
+					mycollisions = []
+					for f in collisions:
+						if mylink.isowner(f, destroot):
+							mycollisions.append(f)
+					if mycollisions:
+						found_owner = True
+						print " * %s:" % cpv
+						print
+						for f in mycollisions:
+							print "     '%s'" % \
+								os.path.join(destroot, f.lstrip(os.path.sep))
+						print
+				if not found_owner:
+					print "None of the installed packages claim the above file(s)."
+					print
+				sys.exit(1)
+			try:
+				os.chdir(mycwd)
+			except OSError:
+				pass
+
+	def _security_check(self, slot_matches):
+		if not slot_matches:
+			return 0
+		file_paths = set()
+		for cpv in slot_matches:
+			file_paths.update(dblink(self.cat, catsplit(cpv)[1],
+				self.vartree.root, self.settings,
+				vartree=self.vartree).getcontents())
+		inode_map = {}
+		for path in file_paths:
+			try:
+				s = os.lstat(path)
+			except OSError, e:
+				if e.errno != errno.ENOENT:
+					raise
+				del e
+				continue
+			if stat.S_ISREG(s.st_mode) and \
+				s.st_nlink > 1 and \
+				s.st_mode & (stat.S_ISUID | stat.S_ISGID):
+				k = (s.st_dev, s.st_ino)
+				inode_map.setdefault(k, []).append((path, s))
+		suspicious_hardlinks = []
+		for path_list in inode_map.itervalues():
+			path, s = path_list[0]
+			if len(path_list) == s.st_nlink:
+				# All hardlinks seem to be owned by this package.
+				continue
+			suspicious_hardlinks.append(path_list)
+		if not suspicious_hardlinks:
+			return 0
+		from portage.output import colorize
+		prefix = colorize("SECURITY_WARN", "*") + " WARNING: "
+		writemsg(prefix + "suid/sgid file(s) " + \
+			"with suspicious hardlink(s):\n", noiselevel=-1)
+		for path_list in suspicious_hardlinks:
+			for path, s in path_list:
+				writemsg(prefix + "  '%s'\n" % path, noiselevel=-1)
+		writemsg(prefix + "See the Gentoo Security Handbook " + \
+			"guide for advice on how to proceed.\n", noiselevel=-1)
+		return 1
+
+	def treewalk(self, srcroot, destroot, inforoot, myebuild, cleanup=0,
+		mydbapi=None, prev_mtimes=None):
+		"""
+		
+		This function does the following:
+		
+		calls self._preserve_libs if FEATURES=preserve-libs
+		calls self._collision_protect if FEATURES=collision-protect
+		calls doebuild(mydo=pkg_preinst)
+		Merges the package to the livefs
+		unmerges old version (if required)
+		calls doebuild(mydo=pkg_postinst)
+		calls env_update
+		calls elog_process
+		
+		@param srcroot: Typically this is ${D}
+		@type srcroot: String (Path)
+		@param destroot: Path to merge to (usually ${ROOT})
+		@type destroot: String (Path)
+		@param inforoot: root of the vardb entry ?
+		@type inforoot: String (Path)
+		@param myebuild: path to the ebuild that we are processing
+		@type myebuild: String (Path)
+		@param mydbapi: dbapi which is handed to doebuild.
+		@type mydbapi: portdbapi instance
+		@param prev_mtimes: { Filename:mtime } mapping for env_update
+		@type prev_mtimes: Dictionary
+		@rtype: Boolean
+		@returns:
+		1. 0 on success
+		2. 1 on failure
+		
+		secondhand is a list of symlinks that have been skipped due to their target
+		not existing; we will merge these symlinks at a later time.
+		"""
+		if not os.path.isdir(srcroot):
+			writemsg("!!! Directory Not Found: D='%s'\n" % srcroot,
+				noiselevel=-1)
+			return 1
+
+		if not os.path.exists(self.dbcatdir):
+			os.makedirs(self.dbcatdir)
+
+		otherversions = []
+		for v in self.vartree.dbapi.cp_list(self.mysplit[0]):
+			otherversions.append(v.split("/")[1])
+
+		slot_matches = self.vartree.dbapi.match(
+			"%s:%s" % (self.mysplit[0], self.settings["SLOT"]))
+		retval = self._security_check(slot_matches)
+		if retval:
+			return retval
+
+		if slot_matches:
+			# Used by self.isprotected().
+			max_cpv = None
+			max_counter = -1
+			for cur_cpv in slot_matches:
+				cur_counter = self.vartree.dbapi.cpv_counter(cur_cpv)
+				if cur_counter > max_counter:
+					max_counter = cur_counter
+					max_cpv = cur_cpv
+			slot_matches = [max_cpv]
+			self._installed_instance = dblink(self.cat,
+				catsplit(slot_matches[0])[1], destroot, self.settings,
+				vartree=self.vartree)
+
+		# get current counter value (counter_tick also takes care of incrementing it)
+		# XXX Need to make this destroot, but it needs to be initialized first. XXX
+		# XXX bis: leads to some invalidentry() call through cp_all().
+		# Note: The counter is generated here but written later because preserve_libs
+		#       needs the counter value but has to be before dbtmpdir is made (which
+		#       has to be before the counter is written) - genone
+		counter = self.vartree.dbapi.counter_tick(self.myroot, mycpv=self.mycpv)
+
+		myfilelist = None
+		mylinklist = None
+
+		# Preserve old libs if they are still in use
+		if slot_matches and "preserve-libs" in self.settings.features:
+			myfilelist = listdir(srcroot, recursive=1, filesonly=1, followSymlinks=False)
+			mylinklist = filter(os.path.islink, [os.path.join(srcroot, x) for x in listdir(srcroot, recursive=1, filesonly=0, followSymlinks=False)])
+			mylinklist = [x[len(srcroot):] for x in mylinklist]
+			self._preserve_libs(srcroot, destroot, myfilelist+mylinklist, counter)
+
+		# check for package collisions
+		if "collision-protect" in self.settings.features:
+			if myfilelist == None:
+				myfilelist = listdir(srcroot, recursive=1, filesonly=1, followSymlinks=False)
+			if mylinklist == None:
+				mylinklist = filter(os.path.islink, [os.path.join(srcroot, x) for x in listdir(srcroot, recursive=1, filesonly=0, followSymlinks=False)])
+				mylinklist = [x[len(srcroot):] for x in mylinklist]
+			self._collision_protect(srcroot, destroot, otherversions, myfilelist+mylinklist, mylinklist)
+
+		if os.stat(srcroot).st_dev == os.stat(destroot).st_dev:
+			""" The merge process may move files out of the image directory,
+			which causes invalidation of the .installed flag."""
+			try:
+				os.unlink(os.path.join(
+					os.path.dirname(normalize_path(srcroot)), ".installed"))
+			except OSError, e:
+				if e.errno != errno.ENOENT:
+					raise
+				del e
+
+		self.dbdir = self.dbtmpdir
+		self.delete()
+		if not os.path.exists(self.dbtmpdir):
+			os.makedirs(self.dbtmpdir)
+
+		writemsg_stdout(">>> Merging %s %s %s\n" % (self.mycpv,"to",destroot))
+
+		# run preinst script
+		if myebuild is None:
+			myebuild = os.path.join(inforoot, self.pkg + ".ebuild")
+		a = doebuild(myebuild, "preinst", destroot, self.settings, cleanup=cleanup,
+			use_cache=0, tree=self.treetype, mydbapi=mydbapi,
+			vartree=self.vartree)
+
+		# XXX: Decide how to handle failures here.
+		if a != os.EX_OK:
+			writemsg("!!! FAILED preinst: "+str(a)+"\n", noiselevel=-1)
+			return a
+
+		# copy "info" files (like SLOT, CFLAGS, etc.) into the database
+		for x in listdir(inforoot):
+			self.copyfile(inforoot+"/"+x)
+
+		# write local package counter for recording
+		lcfile = open(os.path.join(self.dbtmpdir, "COUNTER"),"w")
+		lcfile.write(str(counter))
+		lcfile.close()
+
+		# open CONTENTS file (possibly overwriting old one) for recording
+		outfile = open(os.path.join(self.dbtmpdir, "CONTENTS"),"w")
+
+		self.updateprotect()
+
+		#if we have a file containing previously-merged config file md5sums, grab it.
+		conf_mem_file = os.path.join(destroot, CONFIG_MEMORY_FILE)
+		cfgfiledict = grabdict(conf_mem_file)
+		if self.settings.has_key("NOCONFMEM"):
+			cfgfiledict["IGNORE"]=1
+		else:
+			cfgfiledict["IGNORE"]=0
+
+		# Don't bump mtimes on merge since some application require
+		# preservation of timestamps.  This means that the unmerge phase must
+		# check to see if file belongs to an installed instance in the same
+		# slot.
+		mymtime = None
+
+		# set umask to 0 for merging; back up umask, save old one in prevmask (since this is a global change)
+		prevmask = os.umask(0)
+		secondhand = []
+
+		# we do a first merge; this will recurse through all files in our srcroot but also build up a
+		# "second hand" of symlinks to merge later
+		if self.mergeme(srcroot, destroot, outfile, secondhand, EPREFIX.lstrip(os.path.sep), cfgfiledict, mymtime):
+			return 1
+
+		# now, it's time for dealing our second hand; we'll loop until we can't merge anymore.	The rest are
+		# broken symlinks.  We'll merge them too.
+		lastlen = 0
+		while len(secondhand) and len(secondhand)!=lastlen:
+			# clear the thirdhand.	Anything from our second hand that
+			# couldn't get merged will be added to thirdhand.
+
+			thirdhand = []
+			self.mergeme(srcroot, destroot, outfile, thirdhand, secondhand, cfgfiledict, mymtime)
+
+			#swap hands
+			lastlen = len(secondhand)
+
+			# our thirdhand now becomes our secondhand.  It's ok to throw
+			# away secondhand since thirdhand contains all the stuff that
+			# couldn't be merged.
+			secondhand = thirdhand
+
+		if len(secondhand):
+			# force merge of remaining symlinks (broken or circular; oh well)
+			self.mergeme(srcroot, destroot, outfile, None, secondhand, cfgfiledict, mymtime)
+
+		#restore umask
+		os.umask(prevmask)
+
+		#if we opened it, close it
+		outfile.flush()
+		outfile.close()
+		self.contentscache = None
+		new_contents = self.getcontents()
+
+		if os.path.exists(self.dbpkgdir):
+			writemsg_stdout(">>> Safely unmerging already-installed instance...\n")
+			dblink(self.cat, self.pkg, destroot, self.settings,
+				vartree=self.vartree).unmerge(trimworld=0,
+					ldpath_mtimes=prev_mtimes, new_contents=new_contents)
+			writemsg_stdout(">>> Original instance of package unmerged safely.\n")
+
+		# We hold both directory locks.
+		self.dbdir = self.dbpkgdir
+		self.delete()
+		movefile(self.dbtmpdir, self.dbpkgdir, mysettings=self.settings)
+		contents = self.getcontents()
+
+		#write out our collection of md5sums
+		if cfgfiledict.has_key("IGNORE"):
+			del cfgfiledict["IGNORE"]
+
+		my_private_path = os.path.join(destroot, PRIVATE_PATH)
+		if not os.path.exists(my_private_path):
+			os.makedirs(my_private_path)
+			os.chown(my_private_path, os.getuid(), portage_gid)
+			os.chmod(my_private_path, 02770)
+
+		writedict(cfgfiledict, conf_mem_file)
+		del conf_mem_file
+
+		# regenerate reverse NEEDED map
+		self.vartree.dbapi.libmap.update()
+
+		#do postinst script
+		a = doebuild(myebuild, "postinst", destroot, self.settings, use_cache=0,
+			tree=self.treetype, mydbapi=mydbapi, vartree=self.vartree)
+
+		# XXX: Decide how to handle failures here.
+		if a != os.EX_OK:
+			writemsg("!!! FAILED postinst: "+str(a)+"\n", noiselevel=-1)
+			return a
+
+		downgrade = False
+		for v in otherversions:
+			if pkgcmp(catpkgsplit(self.pkg)[1:], catpkgsplit(v)[1:]) < 0:
+				downgrade = True
+
+		#update environment settings, library paths. DO NOT change symlinks.
+		env_update(makelinks=(not downgrade),
+			target_root=self.settings["ROOT"], prev_mtimes=prev_mtimes,
+			contents=contents, env=self.settings.environ())
+		#dircache may break autoclean because it remembers the -MERGING-pkg file
+		global dircache
+		if dircache.has_key(self.dbcatdir):
+			del dircache[self.dbcatdir]
+		writemsg_stdout(">>> %s %s\n" % (self.mycpv,"merged."))
+
+		# Process ebuild logfiles
+		elog_process(self.mycpv, self.settings)
+		if "noclean" not in self.settings.features:
+			doebuild(myebuild, "clean", destroot, self.settings,
+				tree=self.treetype, mydbapi=mydbapi, vartree=self.vartree)
+		return os.EX_OK
+
+	def mergeme(self, srcroot, destroot, outfile, secondhand, stufftomerge, cfgfiledict, thismtime):
+		"""
+		
+		This function handles actual merging of the package contents to the livefs.
+		It also handles config protection.
+		
+		@param srcroot: Where are we copying files from (usually ${D})
+		@type srcroot: String (Path)
+		@param destroot: Typically ${ROOT}
+		@type destroot: String (Path)
+		@param outfile: File to log operations to
+		@type outfile: File Object
+		@param secondhand: A set of items to merge in pass two (usually
+		or symlinks that point to non-existing files that may get merged later)
+		@type secondhand: List
+		@param stufftomerge: Either a diretory to merge, or a list of items.
+		@type stufftomerge: String or List
+		@param cfgfiledict: { File:mtime } mapping for config_protected files
+		@type cfgfiledict: Dictionary
+		@param thismtime: The current time (typically long(time.time())
+		@type thismtime: Long
+		@rtype: None or Boolean
+		@returns:
+		1. True on failure
+		2. None otherwise
+		
+		"""
+		from os.path import sep, join
+		srcroot = normalize_path(srcroot).rstrip(sep) + sep
+		destroot = normalize_path(destroot).rstrip(sep) + sep
+		
+		# this is supposed to merge a list of files.  There will be 2 forms of argument passing.
+		if isinstance(stufftomerge, basestring):
+			#A directory is specified.  Figure out protection paths, listdir() it and process it.
+			mergelist = listdir(join(srcroot, stufftomerge))
+			offset = stufftomerge
+		else:
+			mergelist = stufftomerge
+			offset = ""
+		for x in mergelist:
+			mysrc = join(srcroot, offset, x)
+			mydest = join(destroot, offset, x)
+			# myrealdest is mydest without the $ROOT prefix (makes a difference if ROOT!="/")
+			myrealdest = join(sep, offset, x)
+			# stat file once, test using S_* macros many times (faster that way)
+			try:
+				mystat = os.lstat(mysrc)
+			except OSError, e:
+				writemsg("\n")
+				writemsg(red("!!! ERROR: There appears to be ")+bold("FILE SYSTEM CORRUPTION.")+red(" A file that is listed\n"))
+				writemsg(red("!!!        as existing is not capable of being stat'd. If you are using an\n"))
+				writemsg(red("!!!        experimental kernel, please boot into a stable one, force an fsck,\n"))
+				writemsg(red("!!!        and ensure your filesystem is in a sane state. ")+bold("'shutdown -Fr now'\n"))
+				writemsg(red("!!!        File:  ")+str(mysrc)+"\n", noiselevel=-1)
+				writemsg(red("!!!        Error: ")+str(e)+"\n", noiselevel=-1)
+				sys.exit(1)
+			except Exception, e:
+				writemsg("\n")
+				writemsg(red("!!! ERROR: An unknown error has occurred during the merge process.\n"))
+				writemsg(red("!!!        A stat call returned the following error for the following file:"))
+				writemsg(    "!!!        Please ensure that your filesystem is intact, otherwise report\n")
+				writemsg(    "!!!        this as a portage bug at bugs.gentoo.org. Append 'emerge info'.\n")
+				writemsg(    "!!!        File:  "+str(mysrc)+"\n", noiselevel=-1)
+				writemsg(    "!!!        Error: "+str(e)+"\n", noiselevel=-1)
+				sys.exit(1)
+
+
+			mymode = mystat[stat.ST_MODE]
+			# handy variables; mydest is the target object on the live filesystems;
+			# mysrc is the source object in the temporary install dir
+			try:
+				mydstat = os.lstat(mydest)
+				mydmode = mydstat.st_mode
+			except OSError, e:
+				if e.errno != errno.ENOENT:
+					raise
+				del e
+				#dest file doesn't exist
+				mydstat = None
+				mydmode = None
+
+			if stat.S_ISLNK(mymode):
+				# we are merging a symbolic link
+				myabsto = abssymlink(mysrc)
+				if myabsto.startswith(srcroot):
+					myabsto = myabsto[len(srcroot):]
+				myabsto = myabsto.lstrip(sep)
+				myto = os.readlink(mysrc)
+				if self.settings and self.settings["D"]:
+					if myto.startswith(self.settings["D"]):
+						myto = myto[len(self.settings["D"]):]
+				# myrealto contains the path of the real file to which this symlink points.
+				# we can simply test for existence of this file to see if the target has been merged yet
+				myrealto = normalize_path(os.path.join(destroot, myabsto))
+				if mydmode!=None:
+					#destination exists
+					if not stat.S_ISLNK(mydmode):
+						if stat.S_ISDIR(mydmode):
+							# directory in the way: we can't merge a symlink over a directory
+							# we won't merge this, continue with next file...
+							continue
+
+						if os.path.exists(mysrc) and stat.S_ISDIR(os.stat(mysrc)[stat.ST_MODE]):
+							# Kill file blocking installation of symlink to dir #71787
+							pass
+						elif self.isprotected(mydest):
+							# Use md5 of the target in ${D} if it exists...
+							try:
+								newmd5 = perform_md5(join(srcroot, myabsto))
+							except FileNotFound:
+								# Maybe the target is merged already.
+								try:
+									newmd5 = perform_md5(myrealto)
+								except FileNotFound:
+									newmd5 = None
+							mydest = new_protect_filename(mydest, newmd5=newmd5)
+
+				# if secondhand is None it means we're operating in "force" mode and should not create a second hand.
+				if (secondhand != None) and (not os.path.exists(myrealto)):
+					# either the target directory doesn't exist yet or the target file doesn't exist -- or
+					# the target is a broken symlink.  We will add this file to our "second hand" and merge
+					# it later.
+					secondhand.append(mysrc[len(srcroot):])
+					continue
+				# unlinking no longer necessary; "movefile" will overwrite symlinks atomically and correctly
+				mymtime = movefile(mysrc, mydest, newmtime=thismtime, sstat=mystat, mysettings=self.settings)
+				if mymtime != None:
+					writemsg_stdout(">>> %s -> %s\n" % (mydest, myto))
+					outfile.write("sym "+myrealdest+" -> "+myto+" "+str(mymtime)+"\n")
+				else:
+					print "!!! Failed to move file."
+					print "!!!", mydest, "->", myto
+					sys.exit(1)
+			elif stat.S_ISDIR(mymode):
+				# we are merging a directory
+				if mydmode != None:
+					# destination exists
+
+					if bsd_chflags:
+						# Save then clear flags on dest.
+						dflags = os.lstat(mydest).st_flags
+						if dflags != 0:
+							bsd_chflags.lchflags(mydest, 0)
+
+					if not os.access(mydest, os.W_OK):
+						pkgstuff = pkgsplit(self.pkg)
+						writemsg("\n!!! Cannot write to '"+mydest+"'.\n", noiselevel=-1)
+						writemsg("!!! Please check permissions and directories for broken symlinks.\n")
+						writemsg("!!! You may start the merge process again by using ebuild:\n")
+						writemsg("!!! ebuild "+self.settings["PORTDIR"]+"/"+self.cat+"/"+pkgstuff[0]+"/"+self.pkg+".ebuild merge\n")
+						writemsg("!!! And finish by running this: env-update\n\n")
+						return 1
+
+					if stat.S_ISLNK(mydmode) or stat.S_ISDIR(mydmode):
+						# a symlink to an existing directory will work for us; keep it:
+						writemsg_stdout("--- %s/\n" % mydest)
+						if bsd_chflags:
+							bsd_chflags.lchflags(mydest, dflags)
+					else:
+						# a non-directory and non-symlink-to-directory.  Won't work for us.  Move out of the way.
+						if movefile(mydest, mydest+".backup", mysettings=self.settings) is None:
+							sys.exit(1)
+						print "bak", mydest, mydest+".backup"
+						#now create our directory
+						if self.settings.selinux_enabled():
+							import selinux
+							sid = selinux.get_sid(mysrc)
+							selinux.secure_mkdir(mydest,sid)
+						else:
+							os.mkdir(mydest)
+						if bsd_chflags:
+							bsd_chflags.lchflags(mydest, dflags)
+						os.chmod(mydest, mystat[0])
+						os.chown(mydest, mystat[4], mystat[5])
+						writemsg_stdout(">>> %s/\n" % mydest)
+				else:
+					#destination doesn't exist
+					if self.settings.selinux_enabled():
+						import selinux
+						sid = selinux.get_sid(mysrc)
+						selinux.secure_mkdir(mydest, sid)
+					else:
+						os.mkdir(mydest)
+					os.chmod(mydest, mystat[0])
+					os.chown(mydest, mystat[4], mystat[5])
+					writemsg_stdout(">>> %s/\n" % mydest)
+				outfile.write("dir "+myrealdest+"\n")
+				# recurse and merge this directory
+				if self.mergeme(srcroot, destroot, outfile, secondhand,
+					join(offset, x), cfgfiledict, thismtime):
+					return 1
+			elif stat.S_ISREG(mymode):
+				# we are merging a regular file
+				mymd5 = perform_md5(mysrc, calc_prelink=1)
+				# calculate config file protection stuff
+				mydestdir = os.path.dirname(mydest)
+				moveme = 1
+				zing = "!!!"
+				mymtime = None
+				if mydmode != None:
+					# destination file exists
+					if stat.S_ISDIR(mydmode):
+						# install of destination is blocked by an existing directory with the same name
+						moveme = 0
+						writemsg_stdout("!!! %s\n" % mydest)
+					elif stat.S_ISREG(mydmode) or (stat.S_ISLNK(mydmode) and os.path.exists(mydest) and stat.S_ISREG(os.stat(mydest)[stat.ST_MODE])):
+						cfgprot = 0
+						# install of destination is blocked by an existing regular file,
+						# or by a symlink to an existing regular file;
+						# now, config file management may come into play.
+						# we only need to tweak mydest if cfg file management is in play.
+						if self.isprotected(mydest):
+							# we have a protection path; enable config file management.
+							destmd5 = perform_md5(mydest, calc_prelink=1)
+							if mymd5 == destmd5:
+								#file already in place; simply update mtimes of destination
+								moveme = 1
+							else:
+								if mymd5 == cfgfiledict.get(myrealdest, [None])[0]:
+									""" An identical update has previously been
+									merged.  Skip it unless the user has chosen
+									--noconfmem."""
+									moveme = cfgfiledict["IGNORE"]
+									cfgprot = cfgfiledict["IGNORE"]
+									if not moveme:
+										zing = "-o-"
+										mymtime = long(mystat.st_mtime)
+								else:
+									moveme = 1
+									cfgprot = 1
+							if moveme:
+								# Merging a new file, so update confmem.
+								cfgfiledict[myrealdest] = [mymd5]
+							elif destmd5 == cfgfiledict.get(myrealdest, [None])[0]:
+								"""A previously remembered update has been
+								accepted, so it is removed from confmem."""
+								del cfgfiledict[myrealdest]
+						if cfgprot:
+							mydest = new_protect_filename(mydest, newmd5=mymd5)
+
+				# whether config protection or not, we merge the new file the
+				# same way.  Unless moveme=0 (blocking directory)
+				if moveme:
+					mymtime = movefile(mysrc, mydest, newmtime=thismtime, sstat=mystat, mysettings=self.settings)
+					if mymtime is None:
+						sys.exit(1)
+					zing = ">>>"
+
+				if mymtime != None:
+					zing = ">>>"
+					outfile.write("obj "+myrealdest+" "+mymd5+" "+str(mymtime)+"\n")
+				writemsg_stdout("%s %s\n" % (zing,mydest))
+			else:
+				# we are merging a fifo or device node
+				zing = "!!!"
+				if mydmode is None:
+					# destination doesn't exist
+					if movefile(mysrc, mydest, newmtime=thismtime, sstat=mystat, mysettings=self.settings) != None:
+						zing = ">>>"
+					else:
+						sys.exit(1)
+				if stat.S_ISFIFO(mymode):
+					outfile.write("fif %s\n" % myrealdest)
+				else:
+					outfile.write("dev %s\n" % myrealdest)
+				writemsg_stdout(zing + " " + mydest + "\n")
+
+	def merge(self, mergeroot, inforoot, myroot, myebuild=None, cleanup=0,
+		mydbapi=None, prev_mtimes=None):
+		try:
+			self.lockdb()
+			return self.treewalk(mergeroot, myroot, inforoot, myebuild,
+				cleanup=cleanup, mydbapi=mydbapi, prev_mtimes=prev_mtimes)
+		finally:
+			self.unlockdb()
+
+	def getstring(self,name):
+		"returns contents of a file with whitespace converted to spaces"
+		if not os.path.exists(self.dbdir+"/"+name):
+			return ""
+		myfile = open(self.dbdir+"/"+name,"r")
+		mydata = myfile.read().split()
+		myfile.close()
+		return " ".join(mydata)
+
+	def copyfile(self,fname):
+		import shutil
+		shutil.copyfile(fname,self.dbdir+"/"+os.path.basename(fname))
+
+	def getfile(self,fname):
+		if not os.path.exists(self.dbdir+"/"+fname):
+			return ""
+		myfile = open(self.dbdir+"/"+fname,"r")
+		mydata = myfile.read()
+		myfile.close()
+		return mydata
+
+	def setfile(self,fname,data):
+		write_atomic(os.path.join(self.dbdir, fname), data)
+
+	def getelements(self,ename):
+		if not os.path.exists(self.dbdir+"/"+ename):
+			return []
+		myelement = open(self.dbdir+"/"+ename,"r")
+		mylines = myelement.readlines()
+		myreturn = []
+		for x in mylines:
+			for y in x[:-1].split():
+				myreturn.append(y)
+		myelement.close()
+		return myreturn
+
+	def setelements(self,mylist,ename):
+		myelement = open(self.dbdir+"/"+ename,"w")
+		for x in mylist:
+			myelement.write(x+"\n")
+		myelement.close()
+
+	def isregular(self):
+		"Is this a regular package (does it have a CATEGORY file?  A dblink can be virtual *and* regular)"
+		return os.path.exists(os.path.join(self.dbdir, "CATEGORY"))
+
+def tar_contents(contents, root, tar, onProgress=None):
+	from portage import normalize_path
+	root = normalize_path(root).rstrip(os.path.sep) + os.path.sep
+	id_strings = {}
+	maxval = len(contents)
+	curval = 0
+	if onProgress:
+		onProgress(maxval, 0)
+	paths = contents.keys()
+	paths.sort()
+	for path in paths:
+		curval += 1
+		try:
+			lst = os.lstat(path)
+		except OSError, e:
+			if e.errno != errno.ENOENT:
+				raise
+			del e
+			if onProgress:
+				onProgress(maxval, curval)
+			continue
+		contents_type = contents[path][0]
+		if path.startswith(root):
+			arcname = path[len(root):]
+		else:
+			raise ValueError("invalid root argument: '%s'" % root)
+		live_path = path
+		if 'dir' == contents_type and \
+			not stat.S_ISDIR(lst.st_mode) and \
+			os.path.isdir(live_path):
+			# Even though this was a directory in the original ${D}, it exists
+			# as a symlink to a directory in the live filesystem.  It must be
+			# recorded as a real directory in the tar file to ensure that tar
+			# can properly extract it's children.
+			live_path = os.path.realpath(live_path)
+		tarinfo = tar.gettarinfo(live_path, arcname)
+		# store numbers instead of real names like tar's --numeric-owner
+		tarinfo.uname = id_strings.setdefault(tarinfo.uid, str(tarinfo.uid))
+		tarinfo.gname = id_strings.setdefault(tarinfo.gid, str(tarinfo.gid))
+
+		if stat.S_ISREG(lst.st_mode):
+			f = file(path)
+			try:
+				tar.addfile(tarinfo, f)
+			finally:
+				f.close()
+		else:
+			tar.addfile(tarinfo)
+		if onProgress:
+			onProgress(maxval, curval)
Index: /vendor/prefix-portage/current/pym/portage/dbapi/virtual.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/dbapi/virtual.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/dbapi/virtual.py	(revision 3489)
@@ -0,0 +1,95 @@
+# Copyright 1998-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: virtual.py 6734 2007-06-05 16:37:29Z grobian $
+
+
+from portage.dbapi import dbapi
+
+from portage import cpv_getkey
+
+class fakedbapi(dbapi):
+	"This is a dbapi to use for the emptytree function.  It's empty, but things can be added to it."
+	def __init__(self, settings=None):
+		self.cpvdict = {}
+		self.cpdict = {}
+		if settings is None:
+			from portage import settings
+		self.settings = settings
+		self._match_cache = {}
+
+	def _clear_cache(self):
+		if self._match_cache:
+			self._match_cache = {}
+
+	def match(self, origdep, use_cache=1):
+		result = self._match_cache.get(origdep, None)
+		if result is not None:
+			return result[:]
+		result = dbapi.match(self, origdep, use_cache=use_cache)
+		self._match_cache[origdep] = result
+		return result[:]
+
+	def cpv_exists(self, mycpv):
+		return self.cpvdict.has_key(mycpv)
+
+	def cp_list(self, mycp, use_cache=1):
+		if not self.cpdict.has_key(mycp):
+			return []
+		else:
+			return self.cpdict[mycp]
+
+	def cp_all(self):
+		returnme=[]
+		for x in self.cpdict.keys():
+			returnme.extend(self.cpdict[x])
+		return returnme
+
+	def cpv_all(self):
+		return self.cpvdict.keys()
+
+	def cpv_inject(self, mycpv, metadata=None):
+		"""Adds a cpv from the list of available packages."""
+		self._clear_cache()
+		mycp = cpv_getkey(mycpv)
+		self.cpvdict[mycpv] = metadata
+		myslot = None
+		if metadata:
+			myslot = metadata.get("SLOT", None)
+		if myslot and mycp in self.cpdict:
+			# If necessary, remove another package in the same SLOT.
+			for cpv in self.cpdict[mycp]:
+				if mycpv != cpv:
+					other_metadata = self.cpvdict[cpv]
+					if other_metadata:
+						if myslot == other_metadata.get("SLOT", None):
+							self.cpv_remove(cpv)
+							break
+		if mycp not in self.cpdict:
+			self.cpdict[mycp] = []
+		if not mycpv in self.cpdict[mycp]:
+			self.cpdict[mycp].append(mycpv)
+
+	def cpv_remove(self,mycpv):
+		"""Removes a cpv from the list of available packages."""
+		self._clear_cache()
+		mycp = cpv_getkey(mycpv)
+		if self.cpvdict.has_key(mycpv):
+			del	self.cpvdict[mycpv]
+		if not self.cpdict.has_key(mycp):
+			return
+		while mycpv in self.cpdict[mycp]:
+			del self.cpdict[mycp][self.cpdict[mycp].index(mycpv)]
+		if not len(self.cpdict[mycp]):
+			del self.cpdict[mycp]
+
+	def aux_get(self, mycpv, wants):
+		if not self.cpv_exists(mycpv):
+			raise KeyError(mycpv)
+		metadata = self.cpvdict[mycpv]
+		if not metadata:
+			return ["" for x in wants]
+		return [metadata.get(x, "") for x in wants]
+
+	def aux_update(self, cpv, values):
+		self._clear_cache()
+		self.cpvdict[cpv].update(values)
Index: /vendor/prefix-portage/current/pym/portage/debug.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/debug.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/debug.py	(revision 3489)
@@ -0,0 +1,115 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+import os, sys, threading
+
+import portage.const
+from portage.util import writemsg
+
+def set_trace(on=True):
+	if on:
+		t = trace_handler()
+		threading.settrace(t.event_handler)
+		sys.settrace(t.event_handler)
+	else:
+		sys.settrace(None)
+		threading.settrace(None)
+
+class trace_handler(object):
+
+	def __init__(self):
+		python_system_paths = []
+		for x in sys.path:
+			if os.path.basename(x).startswith("python2."):
+				python_system_paths.append(x)
+
+		self.ignore_prefixes = []
+		for x in python_system_paths:
+			self.ignore_prefixes.append(x + os.sep)
+
+		self.trim_filename = prefix_trimmer(os.path.join(portage.const.PORTAGE_BASE_PATH, "pym") + os.sep).trim
+		self.show_local_lines = False
+		self.max_repr_length = 200
+
+	def event_handler(self, *args):
+		frame, event, arg = args
+		if "line" == event:
+			if self.show_local_lines:
+				self.trace_line(*args)
+		else:
+			if not self.ignore_filename(frame.f_code.co_filename):
+				self.trace_event(*args)
+				return self.event_handler
+
+	def trace_event(self, frame, event, arg):
+		writemsg("%s line=%d name=%s event=%s %slocals=%s\n" % \
+		(self.trim_filename(frame.f_code.co_filename),
+		frame.f_lineno,
+		frame.f_code.co_name,
+		event,
+		self.arg_repr(frame, event, arg),
+		self.locals_repr(frame, event, arg)))
+
+	def arg_repr(self, frame, event, arg):
+		my_repr = None
+		if "return" == event:
+			my_repr = repr(arg)
+			if len(my_repr) > self.max_repr_length:
+				my_repr = "'omitted'"
+			return "value=%s " % my_repr
+		elif "exception" == event:
+			my_repr = repr(arg[1])
+			if len(my_repr) > self.max_repr_length:
+				my_repr = "'omitted'"
+			return "type=%s value=%s " % (arg[0], my_repr)
+
+		return ""
+
+	def trace_line(self, frame, event, arg):
+		writemsg("%s line=%d\n" % (self.trim_filename(frame.f_code.co_filename), frame.f_lineno))
+
+	def ignore_filename(self, filename):
+		if filename:
+			for x in self.ignore_prefixes:
+				if filename.startswith(x):
+					return True
+		return False
+
+	def locals_repr(self, frame, event, arg):
+		"""Create a representation of the locals dict that is suitable for
+		tracing output."""
+
+		my_locals = frame.f_locals.copy()
+
+		# prevent unsafe  __repr__ call on self when __init__ is called
+		# (method calls aren't safe until after __init__  has completed).
+		if frame.f_code.co_name == "__init__" and "self" in my_locals:
+			my_locals["self"] = "omitted"
+
+		# We omit items that will lead to unreasonable bloat of the trace
+		# output (and resulting log file).
+		for k, v in my_locals.iteritems():
+			my_repr = repr(v)
+			if len(my_repr) > self.max_repr_length:
+				my_locals[k] = "omitted"
+		return my_locals
+
+class prefix_trimmer(object):
+	def __init__(self, prefix):
+		self.prefix = prefix
+		self.cut_index = len(prefix)
+		self.previous = None
+		self.previous_trimmed = None
+
+	def trim(self, s):
+		"""Remove a prefix from the string and return the result.
+		The previous result is automatically cached."""
+		if s == self.previous:
+			return self.previous_trimmed
+		else:
+			if s.startswith(self.prefix):
+				self.previous_trimmed = s[self.cut_index:]
+			else:
+				self.previous_trimmed = s
+			return self.previous_trimmed
Index: /vendor/prefix-portage/current/pym/portage/dep.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/dep.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/dep.py	(revision 3489)
@@ -0,0 +1,756 @@
+# deps.py -- Portage dependency resolution functions
+# Copyright 2003-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_dep.py 4598 2006-10-05 11:52:50Z zmedico $
+
+
+# DEPEND SYNTAX:
+#
+# 'use?' only affects the immediately following word!
+# Nesting is the only legal way to form multiple '[!]use?' requirements.
+#
+# Where: 'a' and 'b' are use flags, and 'z' is a depend atom.
+#
+# "a? z"           -- If 'a' in [use], then b is valid.
+# "a? ( z )"       -- Syntax with parenthesis.
+# "a? b? z"        -- Deprecated.
+# "a? ( b? z )"    -- Valid
+# "a? ( b? ( z ) ) -- Valid
+#
+
+import re, sys, types
+import portage.exception
+from portage.exception import InvalidData, InvalidAtom
+from portage.versions import catpkgsplit, catsplit, pkgcmp, pkgsplit, ververify
+
+def cpvequal(cpv1, cpv2):
+	"""
+	
+	@param cpv1: CategoryPackageVersion (no operators) Example: "sys-apps/portage-2.1"
+	@type cpv1: String
+	@param cpv2: CategoryPackageVersion (no operators) Example: "sys-apps/portage-2.1"
+	@type cpv2: String
+	@rtype: Boolean
+	@returns:
+	1.  True if cpv1 = cpv2
+	2.  False Otherwise
+	3.  Throws PortageException if cpv1 or cpv2 is not a CPV
+
+	Example Usage:
+	>>> from portage.dep import cpvequal
+	>>> cpvequal("sys-apps/portage-2.1","sys-apps/portage-2.1")
+	>>> True
+
+	"""
+
+	split1 = catpkgsplit(cpv1)
+	split2 = catpkgsplit(cpv2)
+	
+	if not split1 or not split2:
+		raise portage.exception.PortageException("Invalid data '%s, %s', parameter was not a CPV" % (cpv1, cpv2))
+	
+	if split1[0] != split2[0]:
+		return False
+	
+	return (pkgcmp(split1[1:], split2[1:]) == 0)
+
+def strip_empty(myarr):
+	"""
+	Strip all empty elements from an array
+
+	@param myarr: The list of elements
+	@type myarr: List
+	@rtype: Array
+	@return: The array with empty elements removed
+	"""
+
+	for x in range(len(myarr)-1, -1, -1):
+		if not myarr[x]:
+			del myarr[x]
+	return myarr
+
+def paren_reduce(mystr,tokenize=1):
+	"""
+	Take a string and convert all paren enclosed entities into sublists, optionally
+	futher splitting the list elements by spaces.
+
+	Example usage:
+		>>> paren_reduce('foobar foo ( bar baz )',1)
+		['foobar', 'foo', ['bar', 'baz']]
+		>>> paren_reduce('foobar foo ( bar baz )',0)
+		['foobar foo ', [' bar baz ']]
+
+	@param mystr: The string to reduce
+	@type mystr: String
+	@param tokenize: Split on spaces to produces further list breakdown
+	@type tokenize: Integer
+	@rtype: Array
+	@return: The reduced string in an array
+	"""
+	mylist = []
+	while mystr:
+		left_paren = mystr.find("(")
+		has_left_paren = left_paren != -1
+		right_paren = mystr.find(")")
+		has_right_paren = right_paren != -1
+		if not has_left_paren and not has_right_paren:
+			freesec = mystr
+			subsec = None
+			tail = ""
+		elif mystr[0] == ")":
+			return [mylist,mystr[1:]]
+		elif has_left_paren and not has_right_paren:
+			raise portage.exception.InvalidDependString(
+				"missing right parenthesis: '%s'" % mystr)
+		elif has_left_paren and left_paren < right_paren:
+			freesec,subsec = mystr.split("(",1)
+			subsec,tail = paren_reduce(subsec,tokenize)
+		else:
+			subsec,tail = mystr.split(")",1)
+			if tokenize:
+				subsec = strip_empty(subsec.split(" "))
+				return [mylist+subsec,tail]
+			return mylist+[subsec],tail
+		mystr = tail
+		if freesec:
+			if tokenize:
+				mylist = mylist + strip_empty(freesec.split(" "))
+			else:
+				mylist = mylist + [freesec]
+		if subsec is not None:
+			mylist = mylist + [subsec]
+	return mylist
+
+class paren_normalize(list):
+	"""Take a dependency structure as returned by paren_reduce or use_reduce
+	and generate an equivalent structure that has no redundant lists."""
+	def __init__(self, src):
+		list.__init__(self)
+		self._zap_parens(src, self)
+
+	def _zap_parens(self, src, dest, disjunction=False):
+		if not src:
+			return dest
+		i = iter(src)
+		for x in i:
+			if isinstance(x, basestring):
+				if x == '||':
+					x = self._zap_parens(i.next(), [], disjunction=True)
+					if len(x) == 1:
+						dest.append(x[0])
+					else:
+						dest.append("||")
+						dest.append(x)
+				elif x.endswith("?"):
+					dest.append(x)
+					dest.append(self._zap_parens(i.next(), []))
+				else:
+					dest.append(x)
+			else:
+				if disjunction:
+					x = self._zap_parens(x, [])
+					if len(x) == 1:
+						dest.append(x[0])
+					else:
+						dest.append(x)
+				else:
+					self._zap_parens(x, dest)
+		return dest
+
+def paren_enclose(mylist):
+	"""
+	Convert a list to a string with sublists enclosed with parens.
+
+	Example usage:
+		>>> test = ['foobar','foo',['bar','baz']]
+		>>> paren_enclose(test)
+		'foobar foo ( bar baz )'
+
+	@param mylist: The list
+	@type mylist: List
+	@rtype: String
+	@return: The paren enclosed string
+	"""
+	mystrparts = []
+	for x in mylist:
+		if isinstance(x, list):
+			mystrparts.append("( "+paren_enclose(x)+" )")
+		else:
+			mystrparts.append(x)
+	return " ".join(mystrparts)
+
+# This is just for use by emerge so that it can enable a backward compatibility
+# mode in order to gracefully deal with installed packages that have invalid
+# atoms or dep syntax.  For backward compatibility with api consumers, strict
+# behavior will be explicitly enabled as necessary.
+_dep_check_strict = False
+
+def use_reduce(deparray, uselist=[], masklist=[], matchall=0, excludeall=[]):
+	"""
+	Takes a paren_reduce'd array and reduces the use? conditionals out
+	leaving an array with subarrays
+
+	@param deparray: paren_reduce'd list of deps
+	@type deparray: List
+	@param uselist: List of use flags
+	@type uselist: List
+	@param masklist: List of masked flags
+	@type masklist: List
+	@param matchall: Resolve all conditional deps unconditionally.  Used by repoman
+	@type matchall: Integer
+	@rtype: List
+	@return: The use reduced depend array
+	"""
+	# Quick validity checks
+	for x in range(len(deparray)):
+		if deparray[x] in ["||","&&"]:
+			if len(deparray) - 1 == x or not isinstance(deparray[x+1], list):
+				raise portage.exception.InvalidDependString(deparray[x]+" missing atom list in \""+paren_enclose(deparray)+"\"")
+	if deparray and deparray[-1] and deparray[-1][-1] == "?":
+		raise portage.exception.InvalidDependString("Conditional without target in \""+paren_enclose(deparray)+"\"")
+
+	global _dep_check_strict
+
+	mydeparray = deparray[:]
+	rlist = []
+	while mydeparray:
+		head = mydeparray.pop(0)
+
+		if type(head) == types.ListType:
+			additions = use_reduce(head, uselist, masklist, matchall, excludeall)
+			if additions:
+				rlist.append(additions)
+			elif rlist and rlist[-1] == "||":
+			#XXX: Currently some DEPEND strings have || lists without default atoms.
+			#	raise portage.exception.InvalidDependString("No default atom(s) in \""+paren_enclose(deparray)+"\"")
+				rlist.append([])
+
+		else:
+			if head[-1] == "?": # Use reduce next group on fail.
+				# Pull any other use conditions and the following atom or list into a separate array
+				newdeparray = [head]
+				while isinstance(newdeparray[-1], str) and newdeparray[-1][-1] == "?":
+					if mydeparray:
+						newdeparray.append(mydeparray.pop(0))
+					else:
+						raise ValueError, "Conditional with no target."
+
+				# Deprecation checks
+				warned = 0
+				if len(newdeparray[-1]) == 0:
+					sys.stderr.write("Note: Empty target in string. (Deprecated)\n")
+					warned = 1
+				if len(newdeparray) != 2:
+					sys.stderr.write("Note: Nested use flags without parenthesis (Deprecated)\n")
+					warned = 1
+				if warned:
+					sys.stderr.write("  --> "+" ".join(map(str,[head]+newdeparray))+"\n")
+
+				# Check that each flag matches
+				ismatch = True
+				missing_flag = False
+				for head in newdeparray[:-1]:
+					head = head[:-1]
+					if not head:
+						missing_flag = True
+						break
+					if head.startswith("!"):
+						head_key = head[1:]
+						if not head_key:
+							missing_flag = True
+							break
+						if not matchall and head_key in uselist or \
+							head_key in excludeall:
+							ismatch = False
+							break
+					elif head not in masklist:
+						if not matchall and head not in uselist:
+							ismatch = False
+							break
+					else:
+						ismatch = False
+				if missing_flag:
+					raise portage.exception.InvalidDependString(
+						"Conditional without flag: \"" + \
+						paren_enclose([head+"?", newdeparray[-1]])+"\"")
+
+				# If they all match, process the target
+				if ismatch:
+					target = newdeparray[-1]
+					if isinstance(target, list):
+						additions = use_reduce(target, uselist, masklist, matchall, excludeall)
+						if additions:
+							rlist.append(additions)
+					elif not _dep_check_strict:
+						# The old deprecated behavior.
+						rlist.append(target)
+					else:
+						raise portage.exception.InvalidDependString(
+							"Conditional without parenthesis: '%s?'" % head)
+
+			else:
+				rlist += [head]
+
+	return rlist
+
+
+def dep_opconvert(deplist):
+	"""
+	Iterate recursively through a list of deps, if the
+	dep is a '||' or '&&' operator, combine it with the
+	list of deps that follows..
+
+	Example usage:
+		>>> test = ["blah", "||", ["foo", "bar", "baz"]]
+		>>> dep_opconvert(test)
+		['blah', ['||', 'foo', 'bar', 'baz']]
+
+	@param deplist: A list of deps to format
+	@type mydep: List
+	@rtype: List
+	@return:
+		The new list with the new ordering
+	"""
+
+	retlist = []
+	x = 0
+	while x != len(deplist):
+		if isinstance(deplist[x], list):
+			retlist.append(dep_opconvert(deplist[x]))
+		elif deplist[x] == "||" or deplist[x] == "&&":
+			retlist.append([deplist[x]] + dep_opconvert(deplist[x+1]))
+			x += 1
+		else:
+			retlist.append(deplist[x])
+		x += 1
+	return retlist
+
+def get_operator(mydep):
+	"""
+	Return the operator used in a depstring.
+
+	Example usage:
+		>>> from portage.dep import *
+		>>> get_operator(">=test-1.0")
+		'>='
+
+	@param mydep: The dep string to check
+	@type mydep: String
+	@rtype: String
+	@return: The operator. One of:
+		'~', '=', '>', '<', '=*', '>=', or '<='
+	"""
+	if mydep:
+		mydep = remove_slot(mydep)
+	if not mydep:
+		return None
+	if mydep[0] == "~":
+		operator = "~"
+	elif mydep[0] == "=":
+		if mydep[-1] == "*":
+			operator = "=*"
+		else:
+			operator = "="
+	elif mydep[0] in "><":
+		if len(mydep) > 1 and mydep[1] == "=":
+			operator = mydep[0:2]
+		else:
+			operator = mydep[0]
+	else:
+		operator = None
+
+	return operator
+
+_dep_getcpv_cache = {}
+
+def dep_getcpv(mydep):
+	"""
+	Return the category-package-version with any operators/slot specifications stripped off
+
+	Example usage:
+		>>> dep_getcpv('>=media-libs/test-3.0')
+		'media-libs/test-3.0'
+
+	@param mydep: The depstring
+	@type mydep: String
+	@rtype: String
+	@return: The depstring with the operator removed
+	"""
+	global _dep_getcpv_cache
+	retval = _dep_getcpv_cache.get(mydep, None)
+	if retval is not None:
+		return retval
+	mydep_orig = mydep
+	if mydep:
+		mydep = remove_slot(mydep)
+	if mydep and mydep[0] == "*":
+		mydep = mydep[1:]
+	if mydep and mydep[-1] == "*":
+		mydep = mydep[:-1]
+	if mydep and mydep[0] == "!":
+		mydep = mydep[1:]
+	if mydep[:2] in [">=", "<="]:
+		mydep = mydep[2:]
+	elif mydep[:1] in "=<>~":
+		mydep = mydep[1:]
+	_dep_getcpv_cache[mydep_orig] = mydep
+	return mydep
+
+def dep_getslot(mydep):
+	"""
+	Retrieve the slot on a depend.
+
+	Example usage:
+		>>> dep_getslot('app-misc/test:3')
+		'3'
+
+	@param mydep: The depstring to retrieve the slot of
+	@type mydep: String
+	@rtype: String
+	@return: The slot
+	"""
+	colon = mydep.rfind(":")
+	if colon != -1:
+		return mydep[colon+1:]
+	return None
+
+def remove_slot(mydep):
+	colon = mydep.rfind(":")
+	if colon != -1:
+		mydep = mydep[:colon]
+	return mydep
+
+def dep_getusedeps( depend ):
+	"""
+	Pull a listing of USE Dependencies out of a dep atom.
+	
+	Example usage:
+		>>> dep_getusedeps('app-misc/test:3[foo][-bar]')
+		['foo','-bar']
+	
+	@param depend: The depstring to process
+	@type depend: String
+	@rtype: List
+	@return: List of use flags ( or [] if no flags exist )
+	"""
+	use_list = []
+	open_bracket = depend.find('[')
+	# -1 = failure (think c++ string::npos)
+	while( open_bracket != -1 ):
+		close_bracket = depend.find(']', open_bracket )
+		if close_bracket == -1:
+			raise InvalidAtom("USE Dependency with no closing bracket: %s" % depend )
+		use = depend[open_bracket + 1: close_bracket]
+		# foo[1:1] may return '' instead of None, we don't want '' in the result
+		if len(use):
+			use_list.append(use)
+		else:
+			raise InvalidAtom("USE Dependency with no use flag ([]): %s" % depend )
+		# Find next use flag
+		open_bracket = depend.find( '[', open_bracket+1 )
+	return use_list
+
+_invalid_atom_chars_regexp = re.compile("[()|?]")
+
+def isvalidatom(atom, allow_blockers=False):
+	"""
+	Check to see if a depend atom is valid
+
+	Example usage:
+		>>> isvalidatom('media-libs/test-3.0')
+		0
+		>>> isvalidatom('>=media-libs/test-3.0')
+		1
+
+	@param atom: The depend atom to check against
+	@type atom: String
+	@rtype: Integer
+	@return: One of the following:
+		1) 0 if the atom is invalid
+		2) 1 if the atom is valid
+	"""
+	global _invalid_atom_chars_regexp
+	if _invalid_atom_chars_regexp.search(atom):
+		return 0
+	if allow_blockers and atom.startswith("!"):
+		atom = atom[1:]
+	try:
+		mycpv_cps = catpkgsplit(dep_getcpv(atom))
+	except InvalidData:
+		return 0
+	operator = get_operator(atom)
+	if operator:
+		if operator[0] in "<>" and atom[-1] == "*":
+			return 0
+		if mycpv_cps and mycpv_cps[0] != "null":
+			# >=cat/pkg-1.0
+			return 1
+		else:
+			# >=cat/pkg or >=pkg-1.0 (no category)
+			return 0
+	if mycpv_cps:
+		# cat/pkg-1.0
+		return 0
+
+	if (len(atom.split('/')) == 2):
+		# cat/pkg
+		return 1
+	else:
+		return 0
+
+def isjustname(mypkg):
+	"""
+	Checks to see if the depstring is only the package name (no version parts)
+
+	Example usage:
+		>>> isjustname('media-libs/test-3.0')
+		0
+		>>> isjustname('test')
+		1
+		>>> isjustname('media-libs/test')
+		1
+
+	@param mypkg: The package atom to check
+	@param mypkg: String
+	@rtype: Integer
+	@return: One of the following:
+		1) 0 if the package string is not just the package name
+		2) 1 if it is
+	"""
+	myparts = mypkg.split('-')
+	for x in myparts:
+		if ververify(x):
+			return 0
+	return 1
+
+iscache = {}
+
+def isspecific(mypkg):
+	"""
+	Checks to see if a package is in category/package-version or package-version format,
+	possibly returning a cached result.
+
+	Example usage:
+		>>> isspecific('media-libs/test')
+		0
+		>>> isspecific('media-libs/test-3.0')
+		1
+
+	@param mypkg: The package depstring to check against
+	@type mypkg: String
+	@rtype: Integer
+	@return: One of the following:
+		1) 0 if the package string is not specific
+		2) 1 if it is
+	"""
+	try:
+		return iscache[mypkg]
+	except KeyError:
+		pass
+	mysplit = mypkg.split("/")
+	if not isjustname(mysplit[-1]):
+			iscache[mypkg] = 1
+			return 1
+	iscache[mypkg] = 0
+	return 0
+
+def dep_getkey(mydep):
+	"""
+	Return the category/package-name of a depstring.
+
+	Example usage:
+		>>> dep_getkey('media-libs/test-3.0')
+		'media-libs/test'
+
+	@param mydep: The depstring to retrieve the category/package-name of
+	@type mydep: String
+	@rtype: String
+	@return: The package category/package-version
+	"""
+	mydep = dep_getcpv(mydep)
+	if mydep and isspecific(mydep):
+		mysplit = catpkgsplit(mydep)
+		if not mysplit:
+			return mydep
+		return mysplit[0] + "/" + mysplit[1]
+	else:
+		return mydep
+
+def match_to_list(mypkg, mylist):
+	"""
+	Searches list for entries that matches the package.
+
+	@param mypkg: The package atom to match
+	@type mypkg: String
+	@param mylist: The list of package atoms to compare against
+	@param mylist: List
+	@rtype: List
+	@return: A unique list of package atoms that match the given package atom
+	"""
+	matches = []
+	for x in mylist:
+		if match_from_list(x, [mypkg]):
+			if x not in matches:
+				matches.append(x)
+	return matches
+
+def best_match_to_list(mypkg, mylist):
+	"""
+	Returns the most specific entry that matches the package given.
+
+	@param mypkg: The package atom to check
+	@type mypkg: String
+	@param mylist: The list of package atoms to check against
+	@type mylist: List
+	@rtype: String
+	@return: The package atom which best matches given the following ordering:
+		- =cpv      6
+		- ~cpv      5
+		- =cpv*     4
+		- cp:slot   3
+		- >cpv      2
+		- <cpv      2
+		- >=cpv     2
+		- <=cpv     2
+		- cp        1
+	"""
+	operator_values = {'=':6, '~':5, '=*':4,
+		'>':2, '<':2, '>=':2, '<=':2, None:1}
+	maxvalue = 0
+	bestm  = None
+	for x in match_to_list(mypkg, mylist):
+		if dep_getslot(x) is not None:
+			if maxvalue < 3:
+				maxvalue = 3
+				bestm = x
+		op_val = operator_values[get_operator(x)]
+		if op_val > maxvalue:
+			maxvalue = op_val
+			bestm  = x
+	return bestm
+
+_match_from_list_cache = {}
+
+def match_from_list(mydep, candidate_list):
+	"""
+	Searches list for entries that matches the package.
+
+	@param mydep: The package atom to match
+	@type mydep: String
+	@param candidate_list: The list of package atoms to compare against
+	@param candidate_list: List
+	@rtype: List
+	@return: A list of package atoms that match the given package atom
+	"""
+
+	global _match_from_list_cache
+	cache_key = (mydep, tuple(candidate_list))
+	mylist = _match_from_list_cache.get(cache_key, None)
+	if mylist is not None:
+		return mylist[:]
+
+	from portage.util import writemsg
+	if mydep[0] == "!":
+		mydep = mydep[1:]
+
+	mycpv     = dep_getcpv(mydep)
+	mycpv_cps = catpkgsplit(mycpv) # Can be None if not specific
+	slot      = dep_getslot(mydep)
+
+	if not mycpv_cps:
+		cat, pkg = catsplit(mycpv)
+		ver      = None
+		rev      = None
+	else:
+		cat, pkg, ver, rev = mycpv_cps
+		if mydep == mycpv:
+			raise KeyError("Specific key requires an operator" + \
+				" (%s) (try adding an '=')" % (mydep))
+
+	if ver and rev:
+		operator = get_operator(mydep)
+		if not operator:
+			writemsg("!!! Invalid atom: %s\n" % mydep, noiselevel=-1)
+			return []
+	else:
+		operator = None
+
+	mylist = []
+
+	if operator is None:
+		for x in candidate_list:
+			if dep_getkey(x) != mycpv:
+				continue
+			mylist.append(x)
+
+	elif operator == "=": # Exact match
+		mylist = [cpv for cpv in candidate_list if \
+			cpvequal(remove_slot(cpv), mycpv)]
+
+	elif operator == "=*": # glob match
+		# XXX: Nasty special casing for leading zeros
+		# Required as =* is a literal prefix match, so can't 
+		# use vercmp
+		mysplit = catpkgsplit(mycpv)
+		myver = mysplit[2].lstrip("0")
+		if not myver or not myver[0].isdigit():
+			myver = "0"+myver
+		mycpv = mysplit[0]+"/"+mysplit[1]+"-"+myver
+		for x in candidate_list:
+			xs = catpkgsplit(remove_slot(x))
+			myver = xs[2].lstrip("0")
+			if not myver or not myver[0].isdigit():
+				myver = "0"+myver
+			xcpv = xs[0]+"/"+xs[1]+"-"+myver
+			if xcpv.startswith(mycpv):
+				mylist.append(x)
+
+	elif operator == "~": # version, any revision, match
+		for x in candidate_list:
+			xs = catpkgsplit(remove_slot(x))
+			if xs is None:
+				raise InvalidData(x)
+			if not cpvequal(xs[0]+"/"+xs[1]+"-"+xs[2], mycpv_cps[0]+"/"+mycpv_cps[1]+"-"+mycpv_cps[2]):
+				continue
+			if xs[2] != ver:
+				continue
+			mylist.append(x)
+
+	elif operator in [">", ">=", "<", "<="]:
+		mysplit = ["%s/%s" % (cat, pkg), ver, rev]
+		for x in candidate_list:
+			try:
+				result = pkgcmp(pkgsplit(remove_slot(x)), mysplit)
+			except ValueError: # pkgcmp may return ValueError during int() conversion
+				writemsg("\nInvalid package name: %s\n" % x, noiselevel=-1)
+				raise
+			if result is None:
+				continue
+			elif operator == ">":
+				if result > 0:
+					mylist.append(x)
+			elif operator == ">=":
+				if result >= 0:
+					mylist.append(x)
+			elif operator == "<":
+				if result < 0:
+					mylist.append(x)
+			elif operator == "<=":
+				if result <= 0:
+					mylist.append(x)
+			else:
+				raise KeyError("Unknown operator: %s" % mydep)
+	else:
+		raise KeyError("Unknown operator: %s" % mydep)
+
+	if slot is not None:
+		candidate_list = mylist
+		mylist = []
+		for x in candidate_list:
+			xslot = dep_getslot(x)
+			if xslot is not None and xslot != slot:
+				continue
+			mylist.append(x)
+
+	_match_from_list_cache[cache_key] = mylist
+	return mylist[:]
Index: /vendor/prefix-portage/current/pym/portage/dispatch_conf.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/dispatch_conf.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/dispatch_conf.py	(revision 3489)
@@ -0,0 +1,161 @@
+# archive_conf.py -- functionality common to archive-conf and dispatch-conf
+# Copyright 2003-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/pym/dispatch_conf.py,v 1.3.2.3 2005/04/29 03:37:30 jstubbs Exp $
+
+
+# Library by Wayne Davison <gentoo@blorf.net>, derived from code
+# written by Jeremy Wohl (http://igmus.org)
+
+from stat import *
+import os, sys, commands, shutil
+
+import portage, portage.const
+
+RCS_BRANCH = '1.1.1'
+RCS_LOCK = 'rcs -ko -M -l'
+RCS_PUT = 'ci -t-"Archived config file." -m"dispatch-conf update."'
+RCS_GET = 'co'
+RCS_MERGE = 'rcsmerge -p -r' + RCS_BRANCH + ' %s >%s'
+
+DIFF3_MERGE = 'diff3 -mE %s %s %s >%s'
+
+def read_config(mandatory_opts):
+    try:
+        opts = portage.getconfig(portage.const.EPREFIX+'/etc/dispatch-conf.conf')
+    except:
+        opts = None
+
+    if not opts:
+        print >> sys.stderr, 'dispatch-conf: Error reading '+portage.const.EPREFIX+'/etc/dispatch-conf.conf; fatal'
+        sys.exit(1)
+
+    for key in mandatory_opts:
+        if not opts.has_key(key):
+            if key == "merge":
+                opts["merge"] = "sdiff --suppress-common-lines --output=%s %s %s"
+            else:
+                print >> sys.stderr, 'dispatch-conf: Missing option "%s" in /etc/dispatch-conf.conf; fatal' % (key,)
+
+    if not os.path.exists(opts['archive-dir']):
+        os.mkdir(opts['archive-dir'])
+    elif not os.path.isdir(opts['archive-dir']):
+        print >> sys.stderr, 'dispatch-conf: Config archive dir [%s] must exist; fatal' % (opts['archive-dir'],)
+        sys.exit(1)
+
+    return opts
+
+
+def rcs_archive(archive, curconf, newconf, mrgconf):
+    """Archive existing config in rcs (on trunk). Then, if mrgconf is
+    specified and an old branch version exists, merge the user's changes
+    and the distributed changes and put the result into mrgconf.  Lastly,
+    if newconf was specified, leave it in the archive dir with a .dist.new
+    suffix along with the last 1.1.1 branch version with a .dist suffix."""
+
+    try:
+        os.makedirs(os.path.dirname(archive))
+    except:
+        pass
+
+    try:
+        shutil.copy2(curconf, archive)
+    except(IOError, os.error), why:
+        print >> sys.stderr, 'dispatch-conf: Error copying %s to %s: %s; fatal' % \
+              (curconf, archive, str(why))
+    if os.path.exists(archive + ',v'):
+        os.system(RCS_LOCK + ' ' + archive)
+    os.system(RCS_PUT + ' ' + archive)
+
+    ret = 0
+    if newconf != '':
+        os.system(RCS_GET + ' -r' + RCS_BRANCH + ' ' + archive)
+        has_branch = os.path.exists(archive)
+        if has_branch:
+            os.rename(archive, archive + '.dist')
+
+        try:
+            shutil.copy2(newconf, archive)
+        except(IOError, os.error), why:
+            print >> sys.stderr, 'dispatch-conf: Error copying %s to %s: %s; fatal' % \
+                  (newconf, archive, str(why))
+
+        if has_branch:
+            if mrgconf != '':
+                # This puts the results of the merge into mrgconf.
+                ret = os.system(RCS_MERGE % (archive, mrgconf))
+                mystat = os.lstat(newconf)
+                os.chmod(mrgconf, mystat[ST_MODE])
+                os.chown(mrgconf, mystat[ST_UID], mystat[ST_GID])
+        os.rename(archive, archive + '.dist.new')
+    return ret
+
+
+def file_archive(archive, curconf, newconf, mrgconf):
+    """Archive existing config to the archive-dir, bumping old versions
+    out of the way into .# versions (log-rotate style). Then, if mrgconf
+    was specified and there is a .dist version, merge the user's changes
+    and the distributed changes and put the result into mrgconf.  Lastly,
+    if newconf was specified, archive it as a .dist.new version (which
+    gets moved to the .dist version at the end of the processing)."""
+
+    try:
+        os.makedirs(os.path.dirname(archive))
+    except:
+        pass
+
+    # Archive the current config file if it isn't already saved
+    if os.path.exists(archive) \
+     and len(commands.getoutput('diff -aq %s %s' % (curconf,archive))) != 0:
+        suf = 1
+        while suf < 9 and os.path.exists(archive + '.' + str(suf)):
+            suf += 1
+
+        while suf > 1:
+            os.rename(archive + '.' + str(suf-1), archive + '.' + str(suf))
+            suf -= 1
+
+        os.rename(archive, archive + '.1')
+
+    try:
+        shutil.copy2(curconf, archive)
+    except(IOError, os.error), why:
+        print >> sys.stderr, 'dispatch-conf: Error copying %s to %s: %s; fatal' % \
+              (curconf, archive, str(why))
+
+    if newconf != '':
+        # Save off new config file in the archive dir with .dist.new suffix
+        try:
+            shutil.copy2(newconf, archive + '.dist.new')
+        except(IOError, os.error), why:
+            print >> sys.stderr, 'dispatch-conf: Error copying %s to %s: %s; fatal' % \
+                  (newconf, archive + '.dist.new', str(why))
+
+        ret = 0
+        if mrgconf != '' and os.path.exists(archive + '.dist'):
+            # This puts the results of the merge into mrgconf.
+            ret = os.system(DIFF3_MERGE % (curconf, archive + '.dist', newconf, mrgconf))
+            mystat = os.lstat(newconf)
+            os.chmod(mrgconf, mystat[ST_MODE])
+            os.chown(mrgconf, mystat[ST_UID], mystat[ST_GID])
+
+        return ret
+
+
+def rcs_archive_post_process(archive):
+    """Check in the archive file with the .dist.new suffix on the branch
+    and remove the one with the .dist suffix."""
+    os.rename(archive + '.dist.new', archive)
+    if os.path.exists(archive + '.dist'):
+        # Commit the last-distributed version onto the branch.
+        os.system(RCS_LOCK + RCS_BRANCH + ' ' + archive)
+        os.system(RCS_PUT + ' -r' + RCS_BRANCH + ' ' + archive)
+        os.unlink(archive + '.dist')
+    else:
+        # Forcefully commit the last-distributed version onto the branch.
+        os.system(RCS_PUT + ' -f -r' + RCS_BRANCH + ' ' + archive)
+
+
+def file_archive_post_process(archive):
+    """Rename the archive file with the .dist.new suffix to a .dist suffix"""
+    os.rename(archive + '.dist.new', archive + '.dist')
Index: /vendor/prefix-portage/current/pym/portage/eclass_cache.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/eclass_cache.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/eclass_cache.py	(revision 3489)
@@ -0,0 +1,83 @@
+# Copyright: 2005 Gentoo Foundation
+# Author(s): Nicholas Carpaski (carpaski@gentoo.org), Brian Harring (ferringb@gentoo.org)
+# License: GPL2
+# $Id$
+
+from portage.util import normalize_path, writemsg
+import os, sys
+from portage.data import portage_gid
+
+class cache:
+	"""
+	Maintains the cache information about eclasses used in ebuild.
+	"""
+	def __init__(self, porttree_root, overlays=[]):
+		self.porttree_root = porttree_root
+
+		self.eclasses = {} # {"Name": ("location","_mtime_")}
+		self._eclass_locations = {}
+
+		# screw with the porttree ordering, w/out having bash inherit match it, and I'll hurt you.
+		# ~harring
+		self.porttrees = [self.porttree_root]+overlays
+		self.porttrees = tuple(map(normalize_path, self.porttrees))
+		self._master_eclass_root = os.path.join(self.porttrees[0],"eclass")
+		self.update_eclasses()
+
+	def close_caches(self):
+		import traceback
+		traceback.print_stack()
+		print "%s close_cache is deprecated" % self.__class__
+		self.eclasses.clear()
+
+	def flush_cache(self):
+		import traceback
+		traceback.print_stack()
+		print "%s flush_cache is deprecated" % self.__class__
+
+		self.update_eclasses()
+
+	def update_eclasses(self):
+		self.eclasses = {}
+		self._eclass_locations = {}
+		eclass_len = len(".eclass")
+		for x in [normalize_path(os.path.join(y,"eclass")) for y in self.porttrees]:
+			if not os.path.isdir(x):
+				continue
+			for y in [y for y in os.listdir(x) if y.endswith(".eclass")]:
+				try:
+					mtime = long(os.stat(os.path.join(x, y)).st_mtime)
+				except OSError:
+					continue
+				ys=y[:-eclass_len]
+				self.eclasses[ys] = (x, long(mtime))
+				self._eclass_locations[ys] = x
+	
+	def is_eclass_data_valid(self, ec_dict):
+		if not isinstance(ec_dict, dict):
+			return False
+		for eclass, tup in ec_dict.iteritems():
+			cached_data = self.eclasses.get(eclass, None)
+			""" Only use the mtime for validation since the probability of a
+			collision is small and, depending on the cache implementation, the
+			path may not be specified (cache from rsync mirrors, for example).
+			"""
+			if cached_data is None or tup[1] != cached_data[1]:
+				return False
+
+		return True
+
+	def get_eclass_data(self, inherits, from_master_only=False):
+		ec_dict = {}
+		for x in inherits:
+			try:
+				ec_dict[x] = self.eclasses[x]
+			except KeyError:
+				print "ec=",ec_dict
+				print "inherits=",inherits
+				raise
+			if from_master_only and \
+				self._eclass_locations[x] != self._master_eclass_root:
+				return None
+
+		return ec_dict
Index: /vendor/prefix-portage/current/pym/portage/elog/__init__.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/elog/__init__.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/elog/__init__.py	(revision 3489)
@@ -0,0 +1,106 @@
+# elog/__init__.py - elog core functions
+# Copyright 2006-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: __init__.py 6593 2007-05-23 16:27:03Z grobian $
+
+from portage.const import EBUILD_PHASES
+from portage.exception import PortageException
+from portage.process import atexit_register
+from portage.util import writemsg
+
+from portage.elog.messages import collect_ebuild_messages, collect_messages
+from portage.elog.filtering import filter_loglevels
+
+import os
+
+def _merge_logentries(a, b):
+	rValue = {}
+	phases = set(a.keys()+b.keys())
+	for p in phases:
+		rValue[p] = []
+		if a.has_key(p):
+			for x in a[p]:
+				rValue[p].append(x)
+		if b.has_key(p):
+			for x in b[p]:
+				rValue[p].append(x)
+	return rValue
+
+def _combine_logentries(logentries):
+	# generate a single string with all log messages
+	rValue = ""
+	for phase in EBUILD_PHASES:
+		if not phase in logentries:
+			continue
+		for msgtype, msgcontent in logentries[phase]:
+			rValue += "%s: %s\n" % (msgtype, phase)
+			for line in msgcontent:
+				rValue += line
+			rValue += "\n"
+	return rValue
+
+_elog_atexit_handlers = []
+def elog_process(cpv, mysettings):
+	ebuild_logentries = collect_ebuild_messages(os.path.join(mysettings["T"], "logging"))
+	all_logentries = collect_messages()
+	if all_logentries.has_key(cpv):
+		all_logentries[cpv] = _merge_logentries(ebuild_logentries, all_logentries[cpv])
+	else:
+		all_logentries[cpv] = ebuild_logentries
+
+	my_elog_classes = set(mysettings.get("PORTAGE_ELOG_CLASSES", "").split())
+
+
+	for key in all_logentries.keys():
+		default_logentries = filter_loglevels(all_logentries[key], my_elog_classes)
+
+		# in case the filters matched all messages and no module overrides exist
+		if len(default_logentries) == 0 and (not ":" in mysettings.get("PORTAGE_ELOG_SYSTEM", "")):
+			return
+
+		default_fulllog = _combine_logentries(default_logentries)
+
+		# pass the processing to the individual modules
+		logsystems = mysettings["PORTAGE_ELOG_SYSTEM"].split()
+		for s in logsystems:
+			# allow per module overrides of PORTAGE_ELOG_CLASSES
+			if ":" in s:
+				s, levels = s.split(":", 1)
+				levels = levels.split(",")
+				mod_logentries = filter_loglevels(all_logentries[key], levels)
+				mod_fulllog = combine_logentries(mod_logentries)
+			else:
+				mod_logentries = default_logentries
+				mod_fulllog = default_fulllog
+			if len(mod_logentries) == 0:
+				continue
+			# - is nicer than _ for module names, so allow people to use it.
+			s = s.replace("-", "_")
+			try:
+				# FIXME: ugly ad.hoc import code
+				# TODO:  implement a common portage module loader
+				name = "portage.elog.mod_" + s
+				m = __import__(name)
+				for comp in name.split(".")[1:]:
+					m = getattr(m, comp)
+				def timeout_handler(signum, frame):
+					raise PortageException("Timeout in elog_process for system '%s'" % s)
+				import signal
+				signal.signal(signal.SIGALRM, timeout_handler)
+				# Timeout after one minute (in case something like the mail
+				# module gets hung).
+				signal.alarm(60)
+				try:
+					m.process(mysettings, str(key), mod_logentries, mod_fulllog)
+				finally:
+					signal.alarm(0)
+				if hasattr(m, "finalize") and not m.finalize in _elog_atexit_handlers:
+					_elog_atexit_handlers.append(m.finalize)
+					atexit_register(m.finalize, mysettings)
+			except (ImportError, AttributeError), e:
+				writemsg("!!! Error while importing logging modules " + \
+					"while loading \"mod_%s\":\n" % str(s))
+				writemsg("%s\n" % str(e), noiselevel=-1)
+			except PortageException, e:
+				writemsg("%s\n" % str(e), noiselevel=-1)
+
Index: /vendor/prefix-portage/current/pym/portage/elog/filtering.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/elog/filtering.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/elog/filtering.py	(revision 3489)
@@ -0,0 +1,17 @@
+# elog/messages.py - elog core functions
+# Copyright 2006-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: __init__.py 6458 2007-04-30 02:31:30Z genone $
+
+def filter_loglevels(logentries, loglevels):
+	# remove unwanted entries from all logentries
+	rValue = {}
+	loglevels = map(str.upper, loglevels)
+	for phase in logentries.keys():
+		for msgtype, msgcontent in logentries[phase]:
+			if msgtype.upper() in loglevels or "*" in loglevels:
+				if not rValue.has_key(phase):
+					rValue[phase] = []
+				rValue[phase].append((msgtype, msgcontent))
+	return rValue
+	
Index: /vendor/prefix-portage/current/pym/portage/elog/messages.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/elog/messages.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/elog/messages.py	(revision 3489)
@@ -0,0 +1,89 @@
+# elog/messages.py - elog core functions
+# Copyright 2006-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: __init__.py 6458 2007-04-30 02:31:30Z genone $
+
+from portage.output import colorize
+from portage.const import EBUILD_PHASES
+from portage.util import writemsg
+
+from portage import listdir
+
+import os
+
+def collect_ebuild_messages(path):
+	""" Collect elog messages generated by the bash logging function stored 
+		at 'path'.
+	"""
+	mylogfiles = listdir(path)
+	# shortcut for packages without any messages
+	if len(mylogfiles) == 0:
+		return {}
+	# exploit listdir() file order so we process log entries in chronological order
+	mylogfiles.reverse()
+	logentries = {}
+	for f in mylogfiles:
+		msgfunction, msgtype = f.split(".")
+		if msgfunction not in EBUILD_PHASES:
+			writemsg("!!! can't process invalid log file: %s\n" % f,
+				noiselevel=-1)
+			continue
+		if not msgfunction in logentries:
+			logentries[msgfunction] = []
+		msgcontent = open(os.path.join(path, f), "r").readlines()
+		logentries[msgfunction].append((msgtype, msgcontent))
+	# clean logfiles to avoid repetitions
+	for f in mylogfiles:
+		try:
+			os.unlink(os.path.join(path, f))
+		except OSError:
+			pass
+	return logentries
+
+_msgbuffer = {}
+def _elog_base(level, msg, phase="other", key=None, color=None):
+	""" Backend for the other messaging functions, should not be called 
+	    directly.
+	"""
+	if color == None:
+		color = "GOOD"
+	print colorize(color, " * ")+msg
+	if not _msgbuffer.has_key(key):
+		_msgbuffer[key] = {}
+	if not _msgbuffer[key].has_key(phase):
+		_msgbuffer[key][phase] = []
+	_msgbuffer[key][phase].append((level, msg))
+
+	#raise NotImplementedError()
+
+def collect_messages():
+	rValue = _msgbuffer
+	_reset_buffer()
+	return rValue
+
+def _reset_buffer():
+	""" Reset the internal message buffer when it has been processed, 
+	    should not be called directly.
+	"""
+	_msgbuffer = {}
+
+# creating and exporting the actual messaging functions
+_functions = { "einfo": ("INFO", "GOOD"),
+		"elog": ("LOG", "GOOD"),
+		"ewarn": ("WARN", "WARN"),
+		"eqawarn": ("QA", "WARN"),
+		"eerror": ("ERROR", "ERROR"),
+}
+
+def _make_msgfunction(level, color):
+	def _elog(msg, phase="other", key=None):
+		""" Display and log a message assigned to the given key/cpv 
+		    (or unassigned if no key is given).
+		""" 
+		_elog_base(level, msg,  phase=phase, key=key, color=color)
+	return _elog
+
+import sys
+for f in _functions.keys():
+	setattr(sys.modules[__name__], f, _make_msgfunction(_functions[f][0], _functions[f][1]))
+del f, _functions
Index: /vendor/prefix-portage/current/pym/portage/elog/mod_custom.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/elog/mod_custom.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/elog/mod_custom.py	(revision 3489)
@@ -0,0 +1,21 @@
+# elog/mod_custom.py - elog dispatch module
+# Copyright 2006-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: mod_custom.py 6593 2007-05-23 16:27:03Z grobian $
+
+import portage.elog_modules.mod_save, portage.process, portage.exception
+
+def process(mysettings, key, logentries, fulltext):
+	elogfilename = portage.elog_modules.mod_save.process(mysettings, key, logentries, fulltext)
+	
+	if (not "PORTAGE_ELOG_COMMAND" in mysettings.keys()) \
+			or len(mysettings["PORTAGE_ELOG_COMMAND"]) == 0:
+		raise portage.exception.MissingParameter("!!! Custom logging requested but PORTAGE_ELOG_COMMAND is not defined")
+	else:
+		mylogcmd = mysettings["PORTAGE_ELOG_COMMAND"]
+		mylogcmd = mylogcmd.replace("${LOGFILE}", elogfilename)
+		mylogcmd = mylogcmd.replace("${PACKAGE}", key)
+		retval = portage.process.spawn_bash(mylogcmd)
+		if retval != 0:
+			raise portage.exception.PortageException("!!! PORTAGE_ELOG_COMMAND failed with exitcode %d" % retval)
+	return
Index: /vendor/prefix-portage/current/pym/portage/elog/mod_echo.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/elog/mod_echo.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/elog/mod_echo.py	(revision 3489)
@@ -0,0 +1,30 @@
+# elog/mod_echo.py - elog dispatch module
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: mod_echo.py 6593 2007-05-23 16:27:03Z grobian $
+
+from portage.output import EOutput
+from portage.const import EBUILD_PHASES
+
+_items = {}
+def process(mysettings, key, logentries, fulltext):
+	_items[key] = logentries
+
+def finalize(mysettings):
+	printer = EOutput()
+	for key in _items.keys():
+		print
+		printer.einfo("Messages for package %s:" % key)
+		print
+		for phase in EBUILD_PHASES:
+			if not phase in _items[key]:
+				continue
+			for msgtype, msgcontent in _items[key][phase]:
+				fmap = {"INFO": printer.einfo,
+						"WARN": printer.ewarn,
+						"ERROR": printer.eerror,
+						"LOG": printer.einfo,
+						"QA": printer.ewarn}
+				for line in msgcontent:
+					fmap[msgtype](line.strip("\n"))
+	return
Index: /vendor/prefix-portage/current/pym/portage/elog/mod_mail.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/elog/mod_mail.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/elog/mod_mail.py	(revision 3489)
@@ -0,0 +1,22 @@
+# elog/mod_mail.py - elog dispatch module
+# Copyright 2006-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: mod_mail.py 6593 2007-05-23 16:27:03Z grobian $
+
+import portage.mail, socket
+
+def process(mysettings, key, logentries, fulltext):
+	if mysettings.has_key("PORTAGE_ELOG_MAILURI"):
+		myrecipient = mysettings["PORTAGE_ELOG_MAILURI"].split()[0]
+	else:
+		myrecipient = "root@localhost"
+	
+	myfrom = mysettings["PORTAGE_ELOG_MAILFROM"]
+	mysubject = mysettings["PORTAGE_ELOG_MAILSUBJECT"]
+	mysubject = mysubject.replace("${PACKAGE}", key)
+	mysubject = mysubject.replace("${HOST}", socket.getfqdn())
+
+	mymessage = portage.mail.create_message(myfrom, myrecipient, mysubject, fulltext)
+	portage.mail.send_mail(mysettings, mymessage)
+
+	return
Index: /vendor/prefix-portage/current/pym/portage/elog/mod_mail_summary.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/elog/mod_mail_summary.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/elog/mod_mail_summary.py	(revision 3489)
@@ -0,0 +1,40 @@
+# elog/mod_mail_summary.py - elog dispatch module
+# Copyright 2006-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: mod_mail_summary.py 6593 2007-05-23 16:27:03Z grobian $
+
+import portage.mail, socket, os, time
+from email.MIMEText import MIMEText as TextMessage
+
+_items = {}
+def process(mysettings, key, logentries, fulltext):
+	header = ">>> Messages generated for package %s by process %d on %s:\n\n" % \
+		(key, os.getpid(), time.strftime("%Y%m%d-%H%M%S", time.gmtime(time.time())))
+	_items[key] = header + fulltext
+
+def finalize(mysettings):
+	if len(_items) == 0:
+		return
+	elif len(_items) == 1:
+		count = "one package"
+	else:
+		count = "multiple packages"
+	if mysettings.has_key("PORTAGE_ELOG_MAILURI"):
+		myrecipient = mysettings["PORTAGE_ELOG_MAILURI"].split()[0]
+	else:
+		myrecipient = "root@localhost"
+	
+	myfrom = mysettings["PORTAGE_ELOG_MAILFROM"]
+	mysubject = mysettings["PORTAGE_ELOG_MAILSUBJECT"]
+	mysubject = mysubject.replace("${PACKAGE}", count)
+	mysubject = mysubject.replace("${HOST}", socket.getfqdn())
+
+	mybody = "elog messages for the following packages generated by " + \
+		"process %d on host %s:\n" % (os.getpid(), socket.getfqdn())
+	for key in _items.keys():
+		 mybody += "- %s\n" % key
+
+	mymessage = portage.mail.create_message(myfrom, myrecipient, mysubject, mybody, attachments=_items.values())
+	portage.mail.send_mail(mysettings, mymessage)
+
+	return
Index: /vendor/prefix-portage/current/pym/portage/elog/mod_save.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/elog/mod_save.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/elog/mod_save.py	(revision 3489)
@@ -0,0 +1,26 @@
+# elog/mod_save.py - elog dispatch module
+# Copyright 2006-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: mod_save.py 6593 2007-05-23 16:27:03Z grobian $
+
+import os, time
+from portage.data import portage_uid, portage_gid
+
+def process(mysettings, key, logentries, fulltext):
+	path = key.replace("/", ":")
+
+	if mysettings["PORT_LOGDIR"] != "":
+		elogdir = os.path.join(mysettings["PORT_LOGDIR"], "elog")
+	else:
+		elogdir = os.path.join(os.sep, "var", "log", "portage", "elog")
+	if not os.path.exists(elogdir):
+		os.makedirs(elogdir)
+	os.chown(elogdir, portage_uid, portage_gid)
+	os.chmod(elogdir, 02770)
+
+	elogfilename = elogdir+"/"+path+":"+time.strftime("%Y%m%d-%H%M%S", time.gmtime(time.time()))+".log"
+	elogfile = open(elogfilename, "w")
+	elogfile.write(fulltext)
+	elogfile.close()
+
+	return elogfilename
Index: /vendor/prefix-portage/current/pym/portage/elog/mod_save_summary.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/elog/mod_save_summary.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/elog/mod_save_summary.py	(revision 3489)
@@ -0,0 +1,29 @@
+# elog/mod_save_summary.py - elog dispatch module
+# Copyright 2006-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: mod_save_summary.py 6593 2007-05-23 16:27:03Z grobian $
+
+import os, time
+from portage.data import portage_uid, portage_gid
+from portage.const import EPREFIX
+
+def process(mysettings, key, logentries, fulltext):
+	if mysettings["PORT_LOGDIR"] != "":
+		elogdir = os.path.join(mysettings["PORT_LOGDIR"], "elog")
+	else:
+		elogdir = os.path.join(EPREFIX, "var", "log", "portage", "elog")
+	if not os.path.exists(elogdir):
+		os.makedirs(elogdir)
+	os.chown(elogdir, portage_uid, portage_gid)
+	os.chmod(elogdir, 02770)
+
+	# TODO: Locking
+	elogfilename = elogdir+"/summary.log"
+	elogfile = open(elogfilename, "a")
+	elogfile.write(">>> Messages generated by process %d on %s for package %s:\n\n" % \
+			(os.getpid(), time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(time.time())), key))
+	elogfile.write(fulltext)
+	elogfile.write("\n")
+	elogfile.close()
+
+	return elogfilename
Index: /vendor/prefix-portage/current/pym/portage/elog/mod_syslog.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/elog/mod_syslog.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/elog/mod_syslog.py	(revision 3489)
@@ -0,0 +1,22 @@
+# elog/mod_syslog.py - elog dispatch module
+# Copyright 2006-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: mod_syslog.py 6593 2007-05-23 16:27:03Z grobian $
+
+import syslog
+from portage.const import EBUILD_PHASES
+
+def process(mysettings, key, logentries, fulltext):
+	syslog.openlog("portage", syslog.LOG_ERR | syslog.LOG_WARNING | syslog.LOG_INFO | syslog.LOG_NOTICE, syslog.LOG_LOCAL5)
+	for phase in EBUILD_PHASES:
+		if not phase in logentries:
+			continue
+		for msgtype,msgcontent in logentries[phase]:
+			pri = {"INFO": syslog.LOG_INFO, 
+				"WARN": syslog.LOG_WARNING, 
+				"ERROR": syslog.LOG_ERR, 
+				"LOG": syslog.LOG_NOTICE,
+				"QA": syslog.LOG_WARNING}
+			msgtext = "".join(msgcontent)
+			syslog.syslog(pri[msgtype], "%s: %s: %s" % (key, phase, msgtext))
+	syslog.closelog()
Index: /vendor/prefix-portage/current/pym/portage/env/__init__.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/env/__init__.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/env/__init__.py	(revision 3489)
@@ -0,0 +1,4 @@
+# Copyright: 2007 Gentoo Foundation
+# License: GPL2
+# $Id: __init__.py 6200 2007-03-09 11:23:18Z grobian $
+
Index: /vendor/prefix-portage/current/pym/portage/env/config.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/env/config.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/env/config.py	(revision 3489)
@@ -0,0 +1,81 @@
+# config.py -- Portage Config
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+from UserDict import UserDict
+from portage.env.loaders import KeyListFileLoader, KeyValuePairFileLoader, ItemFileLoader
+
+class UserConfigKlass(UserDict,object):
+	"""
+	A base class stub for things to inherit from.
+	Users may want a non-file backend.
+	"""
+	
+	data = {}
+	
+	def __init__(self, loader):
+		"""
+		@param loader: A class that has a load() that returns two dicts
+			the first being a data dict, the second being a dict of errors.
+		"""
+		self._loader = loader
+
+	def load(self):
+		"""
+		Load the data from the loader.
+
+		@throws LoaderError:
+		"""
+
+		self.data, self.errors = self._loader.load()
+
+class PackageKeywordsFile(UserConfigKlass):
+	"""
+	Inherits from UserConfigKlass; implements a file-based backend.
+	"""
+
+	default_loader = KeyListFileLoader
+
+	def __init__(self, filename):
+		super(PackageKeywordsFile, self).__init__(
+			self.default_loader(filename, validator=None))
+	
+class PackageUseFile(UserConfigKlass):
+	"""
+	Inherits from PackageUse; implements a file-based backend.  Doesn't handle recursion yet.
+	"""
+
+	default_loader = KeyListFileLoader
+	def __init__(self, filename):
+		super(PackageUseFile, self).__init__(
+			self.default_loader(filename, validator=None))
+	
+class PackageMaskFile(UserConfigKlass):
+	"""
+	A class that implements a file-based package.mask
+	
+	Entires in package.mask are of the form:
+	atom1
+	atom2
+	or optionally
+	-atom3
+	to revert a previous mask; this only works when masking files are stacked
+	"""
+	
+	default_loader = ItemFileLoader
+
+	def __init__(self, filename):
+		super(PackageMaskFile, self).__init__(
+			self.default_loader(filename, validator=None))
+
+class PortageModulesFile(UserConfigKlass):
+	"""
+	File Class for /etc/portage/modules
+	"""
+	
+	default_loader = KeyValuePairFileLoader
+	
+	def __init__(self, filename):
+		super(PortageModulesFile, self).__init__(
+			 self.default_loader(filename, validator=None))
Index: /vendor/prefix-portage/current/pym/portage/env/loaders.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/env/loaders.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/env/loaders.py	(revision 3489)
@@ -0,0 +1,206 @@
+# config.py -- Portage Config
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+import os
+
+class LoaderError(Exception):
+	
+	def __init__(self, resource, error_msg):
+		"""
+		@param resource: Resource that failed to load (file/sql/etc)
+		@type resource: String
+		@param error_msg: Error from underlying Loader system
+		@type error_msg: String
+		"""
+
+		self.resource
+	
+	def __str__(self):
+		return "Failed while loading resource: %s, error was: %s" % (
+			resource, error_msg)
+
+def RecursiveFileLoader(filename):
+	"""
+	If filename is of type file, return [filename]
+	else if filename is of type directory, return an array
+	full of files in that directory to process.
+	
+	Ignore files beginning with . or ending in ~.
+	Prune CVS directories.
+
+	@param filename: name of a file/directory to traverse
+	@rtype: list
+	@returns: List of files to process
+	"""
+
+	if os.path.isdir(filename):
+		for root, dirs, files in os.walk(self.fname):
+			if 'CVS' in dirs:
+				dirs.remove('CVS')
+			files = filter(files,startswith('.'))
+			files = filter(files,endswith('~'))
+			for file in files:
+				yield file
+	else:
+		yield filename
+
+class DataLoader(object):
+
+	def __init__(self, validator=None):
+		f = validator
+		if f is None:
+			# if they pass in no validator, just make a fake one
+			# that always returns true
+			class AlwaysTrue(object):
+				def validate(self, key):
+					return True
+			f = AlwaysTrue()
+		self._validator = f
+
+	def load(self):
+		"""
+		Function to do the actual work of a Loader
+		"""
+		pass
+
+class ItemFileLoader(DataLoader):
+	"""
+	Class to load data from a file full of items one per line
+	
+	>>> item1
+	>>> item2
+	>>> item3
+	>>> item1
+	
+	becomes { 'item1':None, 'item2':None, 'item3':None }
+	Note that due to the data store being a dict, duplicates
+	are removed.
+	"""
+	
+	_recursive = False
+
+	def __init__(self, filename, validator):
+		DataLoader.__init__(self, validator)
+		self.fname = filename
+	
+	def load(self):
+		data = {}
+		errors = {}
+		for file in RecursiveFileLoader(self.fname):
+			f = open(file, 'rb')
+			for line_num, line in enumerate(f):
+				if line.startswith('#'):
+					continue
+				split = line.strip().split()
+				if not len(split):
+					errors.setdefault(self.fname,[]).append(
+					"Malformed data at line: %s, data: %s"
+					% (line_num + 1, split))
+				key = split[0]
+				if not self._validator.validate(key):
+					errors.setdefault(self.fname,[]).append(
+					"Validation failed at line: %s, data %s"
+					% (line_num + 1, split))
+					continue
+				data[key] = None
+		return (data, errors)
+
+class KeyListFileLoader(DataLoader):
+	"""
+	Class to load data from a file full of key [list] tuples
+	
+	>>>>key foo1 foo2 foo3
+	becomes
+	{'key':['foo1','foo2','foo3']}
+	"""
+
+	_recursive = False
+
+	def __init__(self, filename, validator):
+		DataLoader.__init__(self, validator)
+		self.fname = filename
+
+	def load(self):
+		data = {}
+		errors = {}
+		for file in RecursiveFileLoader(self.fname):
+			f = open(file, 'rb')
+			for line_num, line in enumerate(f):
+				if line.startswith('#'):
+					continue
+				split = line.strip().split()
+				if len(split) < 2:
+					errors.setdefault(self.fname,[]).append(
+					"Malformed data at line: %s, data: %s"
+					% (line_num + 1, split))
+					continue
+				key = split[0]
+				value = split[1:]
+				if not self._validator.validate(key):
+					errors.setdefault(self.fname,[]).append(
+					"Validation failed at line: %s, data %s"
+					% (line_num + 1, split))
+					continue
+				if key in data:
+					data[key].append(value)
+				else:
+					data[key] = value
+		return (data, errors)
+
+class KeyValuePairFileLoader(DataLoader):
+	"""
+	Class to load data from a file full of key=value pairs
+	
+	>>>>key=value
+	>>>>foo=bar
+	becomes:
+	{'key':'value',
+	 'foo':'bar'}
+	"""
+
+	_recursive = False
+
+	def __init__(self, filename, validator):
+		DataLoader.__init__(self, validator)
+		self.fname = filename
+
+	def load(self):
+		"""
+		Return the {source: {key: value}} pairs from a file
+		Return the {source: [list of errors] from a load
+
+		@param recursive: If set and self.fname is a directory; 
+			load all files in self.fname
+		@type: Boolean
+		@rtype: tuple
+		@returns:
+		Returns (data,errors), both may be empty dicts or populated.
+		"""
+
+		DataLoader.load(self)
+		data = {}
+		errors = {}
+		for file in RecursiveFileLoader(self.fname):
+			f = open(file, 'rb')
+			for line_num, line in enumerate(f):
+				if line.startswith('#'):
+					continue
+				split = line.strip().split('=')
+				if len(split) < 2:
+					errors.setdefault(self.fname,[]).append(
+					"Malformed data at line: %s, data %s"
+					% (line_num + 1, split))
+				key = split[0]
+				value = split[1:]
+				if not self._validator.validate(key):
+					errors.setdefault(self.fname,[]).append(
+					"Validation failed at line: %s, data %s"
+					% (line_num + 1, split))
+					continue
+				if key in data:
+					data[key].append(value)
+				else:
+					data[key] = value
+		return (data, errors)
Index: /vendor/prefix-portage/current/pym/portage/exception.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/exception.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/exception.py	(revision 3489)
@@ -0,0 +1,100 @@
+# Copyright 1998-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_exception.py 3483 2006-06-10 21:40:40Z genone $
+
+
+class PortageException(Exception):
+	"""General superclass for portage exceptions"""
+	def __init__(self,value):
+		self.value = value[:]
+	def __str__(self):
+		if isinstance(self.value, basestring):
+			return self.value
+		else:
+			return repr(self.value)
+
+class CorruptionError(PortageException):
+	"""Corruption indication"""
+
+class InvalidDependString(PortageException):
+	"""An invalid depend string has been encountered"""
+
+class InvalidVersionString(PortageException):
+	"""An invalid version string has been encountered"""
+
+class SecurityViolation(PortageException):
+	"""An incorrect formatting was passed instead of the expected one"""
+
+class IncorrectParameter(PortageException):
+	"""A parameter of the wrong type was passed"""
+
+class MissingParameter(PortageException):
+	"""A parameter is required for the action requested but was not passed"""
+
+class ParseError(PortageException):
+	"""An error was generated while attempting to parse the request"""
+
+class InvalidData(PortageException):
+	"""An incorrect formatting was passed instead of the expected one"""
+
+class InvalidDataType(PortageException):
+	"""An incorrect type was passed instead of the expected one"""
+
+class InvalidLocation(PortageException):
+	"""Data was not found when it was expected to exist or was specified incorrectly"""
+
+class FileNotFound(InvalidLocation):
+	"""A file was not found when it was expected to exist"""
+
+class DirectoryNotFound(InvalidLocation):
+	"""A directory was not found when it was expected to exist"""
+
+class OperationNotPermitted(PortageException):
+	"""An operation was not permitted operating system"""
+
+class PermissionDenied(PortageException):
+	"""Permission denied"""
+
+class ReadOnlyFileSystem(PortageException):
+	"""Read-only file system"""
+
+class CommandNotFound(PortageException):
+	"""A required binary was not available or executable"""
+
+
+class PortagePackageException(PortageException):
+	"""Malformed or missing package data"""
+
+class PackageNotFound(PortagePackageException):
+	"""Missing Ebuild or Binary"""
+
+class InvalidPackageName(PortagePackageException):
+	"""Malformed package name"""
+
+class InvalidAtom(PortagePackageException):
+	"""Malformed atom spec"""
+
+class UnsupportedAPIException(PortagePackageException):
+	"""Unsupported API"""
+	def __init__(self, cpv, eapi):
+		self.cpv, self.eapi = cpv, eapi
+	def __str__(self):
+		return "Unable to do any operations on '%s', due to the fact it's EAPI is higher then this portage versions.  Please upgrade to a portage version that supports EAPI %s" % (self.cpv, self.eapi)
+
+
+
+class SignatureException(PortageException):
+	"""Signature was not present in the checked file"""
+
+class DigestException(SignatureException):
+	"""A problem exists in the digest"""
+
+class MissingSignature(SignatureException):
+	"""Signature was not present in the checked file"""
+
+class InvalidSignature(SignatureException):
+	"""Signature was checked and was not a valid, current, nor trusted signature"""
+
+class UntrustedSignature(SignatureException):
+	"""Signature was not certified to the desired security level"""
+
Index: /vendor/prefix-portage/current/pym/portage/getbinpkg.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/getbinpkg.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/getbinpkg.py	(revision 3489)
@@ -0,0 +1,638 @@
+# getbinpkg.py -- Portage binary-package helper functions
+# Copyright 2003-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: getbinpkg.py 3483 2006-06-10 21:40:40Z genone $
+
+if not hasattr(__builtins__, "set"):
+	from sets import Set as set
+
+from portage.output import red, yellow, green
+import htmllib,HTMLParser,formatter,sys,os,portage.xpak,time,tempfile,base64,urllib2
+from portage.const import CACHE_PATH
+
+try:
+	import cPickle
+except ImportError:
+	import pickle as cPickle
+
+try:
+	import ftplib
+except SystemExit, e:
+	raise
+except Exception, e:
+	sys.stderr.write(red("!!! CANNOT IMPORT FTPLIB: ")+str(e)+"\n")
+
+try:
+	import httplib
+except SystemExit, e:
+	raise
+except Exception, e:
+	sys.stderr.write(red("!!! CANNOT IMPORT HTTPLIB: ")+str(e)+"\n")
+
+def make_metadata_dict(data):
+	myid,myglob = data
+	
+	mydict = {}
+	for x in portage.xpak.getindex_mem(myid):
+		mydict[x] = portage.xpak.getitem(data,x)
+
+	return mydict
+
+class ParseLinks(HTMLParser.HTMLParser):
+	"""Parser class that overrides HTMLParser to grab all anchors from an html
+	page and provide suffix and prefix limitors"""
+	def __init__(self):
+		self.PL_anchors = []
+		HTMLParser.HTMLParser.__init__(self)
+
+	def get_anchors(self):
+		return self.PL_anchors
+		
+	def get_anchors_by_prefix(self,prefix):
+		newlist = []
+		for x in self.PL_anchors:
+			if x.startswith(prefix):
+				if x not in newlist:
+					newlist.append(x[:])
+		return newlist
+		
+	def get_anchors_by_suffix(self,suffix):
+		newlist = []
+		for x in self.PL_anchors:
+			if x.endswith(suffix):
+				if x not in newlist:
+					newlist.append(x[:])
+		return newlist
+		
+	def	handle_endtag(self,tag):
+		pass
+
+	def	handle_starttag(self,tag,attrs):
+		if tag == "a":
+			for x in attrs:
+				if x[0] == 'href':
+					if x[1] not in self.PL_anchors:
+						self.PL_anchors.append(urllib2.unquote(x[1]))
+
+
+def create_conn(baseurl,conn=None):
+	"""(baseurl,conn) --- Takes a protocol://site:port/address url, and an
+	optional connection. If connection is already active, it is passed on.
+	baseurl is reduced to address and is returned in tuple (conn,address)"""
+	parts = baseurl.split("://",1)
+	if len(parts) != 2:
+		raise ValueError, "Provided URL does not contain protocol identifier. '%s'" % baseurl
+	protocol,url_parts = parts
+	del parts
+	host,address = url_parts.split("/",1)
+	del url_parts
+	address = "/"+address
+
+	userpass_host = host.split("@",1)
+	if len(userpass_host) == 1:
+		host = userpass_host[0]
+		userpass = ["anonymous"]
+	else:
+		host = userpass_host[1]
+		userpass = userpass_host[0].split(":")
+	del userpass_host
+
+	if len(userpass) > 2:
+		raise ValueError, "Unable to interpret username/password provided."
+	elif len(userpass) == 2:
+		username = userpass[0]
+		password = userpass[1]
+	elif len(userpass) == 1:
+		username = userpass[0]
+		password = None
+	del userpass
+
+	http_headers = {}
+	http_params = {}
+	if username and password:
+		http_headers = {
+			"Authorization": "Basic %s" %
+			  base64.encodestring("%s:%s" % (username, password)).replace(
+			    "\012",
+			    ""
+			  ),
+		}
+
+	if not conn:
+		if protocol == "https":
+			conn = httplib.HTTPSConnection(host)
+		elif protocol == "http":
+			conn = httplib.HTTPConnection(host)
+		elif protocol == "ftp":
+			passive = 1
+			if(host[-1] == "*"):
+				passive = 0
+				host = host[:-1]
+			conn = ftplib.FTP(host)
+			if password:
+				conn.login(username,password)
+			else:
+				sys.stderr.write(yellow(" * No password provided for username")+" '"+str(username)+"'\n\n")
+				conn.login(username)
+			conn.set_pasv(passive)
+			conn.set_debuglevel(0)
+		else:
+			raise NotImplementedError, "%s is not a supported protocol." % protocol
+
+	return (conn,protocol,address, http_params, http_headers)
+
+def make_ftp_request(conn, address, rest=None, dest=None):
+	"""(conn,address,rest) --- uses the conn object to request the data
+	from address and issuing a rest if it is passed."""
+	try:
+	
+		if dest:
+			fstart_pos = dest.tell()
+	
+		conn.voidcmd("TYPE I")
+		fsize = conn.size(address)
+
+		if (rest != None) and (rest < 0):
+			rest = fsize+int(rest)
+		if rest < 0:
+			rest = 0
+
+		if rest != None:
+			mysocket = conn.transfercmd("RETR "+str(address), rest)
+		else:
+			mysocket = conn.transfercmd("RETR "+str(address))
+
+		mydata = ""
+		while 1:
+			somedata = mysocket.recv(8192)
+			if somedata:
+				if dest:
+					dest.write(somedata)
+				else:
+					mydata = mydata + somedata
+			else:
+				break
+
+		if dest:
+			data_size = fstart_pos - dest.tell()
+		else:
+			data_size = len(mydata)
+
+		mysocket.close()
+		conn.voidresp()
+		conn.voidcmd("TYPE A")
+
+		return mydata,not (fsize==data_size),""
+
+	except ValueError, e:
+		return None,int(str(e)[:4]),str(e)
+	
+
+def make_http_request(conn, address, params={}, headers={}, dest=None):
+	"""(conn,address,params,headers) --- uses the conn object to request
+	the data from address, performing Location forwarding and using the
+	optional params and headers."""
+
+	rc = 0
+	response = None
+	while (rc == 0) or (rc == 301) or (rc == 302):
+		try:
+			if (rc != 0):
+				conn,ignore,ignore,ignore,ignore = create_conn(address)
+			conn.request("GET", address, params, headers)
+		except SystemExit, e:
+			raise
+		except Exception, e:
+			return None,None,"Server request failed: "+str(e)
+		response = conn.getresponse()
+		rc = response.status
+
+		# 301 means that the page address is wrong.
+		if ((rc == 301) or (rc == 302)):
+			ignored_data = response.read()
+			del ignored_data
+			for x in str(response.msg).split("\n"):
+				parts = x.split(": ",1)
+				if parts[0] == "Location":
+					if (rc == 301):
+						sys.stderr.write(red("Location has moved: ")+str(parts[1])+"\n")
+					if (rc == 302):
+						sys.stderr.write(red("Location has temporarily moved: ")+str(parts[1])+"\n")
+					address = parts[1]
+					break
+	
+	if (rc != 200) and (rc != 206):
+		sys.stderr.write(str(response.msg)+"\n")
+		sys.stderr.write(response.read()+"\n")
+		sys.stderr.write("address: "+address+"\n")
+		return None,rc,"Server did not respond successfully ("+str(response.status)+": "+str(response.reason)+")"
+
+	if dest:
+		dest.write(response.read())
+		return "",0,""
+
+	return response.read(),0,""
+
+
+def match_in_array(array, prefix="", suffix="", match_both=1, allow_overlap=0):
+	myarray = []
+	
+	if not (prefix and suffix):
+		match_both = 0
+		
+	for x in array:
+		add_p = 0
+		if prefix and (len(x) >= len(prefix)) and (x[:len(prefix)] == prefix):
+			add_p = 1
+
+		if match_both:
+			if prefix and not add_p: # Require both, but don't have first one.
+				continue
+		else:
+			if add_p:     # Only need one, and we have it.
+				myarray.append(x[:])
+				continue
+
+		if not allow_overlap: # Not allow to overlap prefix and suffix
+			if len(x) >= (len(prefix)+len(suffix)):
+				y = x[len(prefix):]
+			else:
+				continue          # Too short to match.
+		else:
+			y = x               # Do whatever... We're overlapping.
+		
+		if suffix and (len(x) >= len(suffix)) and (x[-len(suffix):] == suffix):
+			myarray.append(x)   # It matches
+		else:
+			continue            # Doesn't match.
+
+	return myarray
+			
+
+
+def dir_get_list(baseurl,conn=None):
+	"""(baseurl[,connection]) -- Takes a base url to connect to and read from.
+	URL should be in the for <proto>://<site>[:port]<path>
+	Connection is used for persistent connection instances."""
+
+	if not conn:
+		keepconnection = 0
+	else:
+		keepconnection = 1
+
+	conn,protocol,address,params,headers = create_conn(baseurl, conn)
+
+	listing = None
+	if protocol in ["http","https"]:
+		page,rc,msg = make_http_request(conn,address,params,headers)
+		
+		if page:
+			parser = ParseLinks()
+			parser.feed(page)
+			del page
+			listing = parser.get_anchors()
+		else:
+			raise Exception, "Unable to get listing: %s %s" % (rc,msg)
+	elif protocol in ["ftp"]:
+		if address[-1] == '/':
+			olddir = conn.pwd()
+			conn.cwd(address)
+			listing = conn.nlst()
+			conn.cwd(olddir)
+			del olddir
+		else:
+			listing = conn.nlst(address)
+	else:
+		raise TypeError, "Unknown protocol. '%s'" % protocol
+
+	if not keepconnection:
+		conn.close()
+
+	return listing
+
+def file_get_metadata(baseurl,conn=None, chunk_size=3000):
+	"""(baseurl[,connection]) -- Takes a base url to connect to and read from.
+	URL should be in the for <proto>://<site>[:port]<path>
+	Connection is used for persistent connection instances."""
+
+	if not conn:
+		keepconnection = 0
+	else:
+		keepconnection = 1
+
+	conn,protocol,address,params,headers = create_conn(baseurl, conn)
+
+	if protocol in ["http","https"]:
+		headers["Range"] = "bytes=-"+str(chunk_size)
+		data,rc,msg = make_http_request(conn, address, params, headers)
+	elif protocol in ["ftp"]:
+		data,rc,msg = make_ftp_request(conn, address, -chunk_size)
+	else:
+		raise TypeError, "Unknown protocol. '%s'" % protocol
+	
+	if data:
+		xpaksize = portage.xpak.decodeint(data[-8:-4])
+		if (xpaksize+8) > chunk_size:
+			myid = file_get_metadata(baseurl, conn, (xpaksize+8))
+			if not keepconnection:
+				conn.close()
+			return myid
+		else:
+			xpak_data = data[len(data)-(xpaksize+8):-8]
+		del data
+
+		myid = portage.xpak.xsplit_mem(xpak_data)
+		if not myid:
+			myid = None,None
+		del xpak_data
+	else:
+		myid = None,None
+
+	if not keepconnection:
+		conn.close()
+
+	return myid
+
+
+def file_get(baseurl,dest,conn=None,fcmd=None):
+	"""(baseurl,dest,fcmd=) -- Takes a base url to connect to and read from.
+	URL should be in the for <proto>://[user[:pass]@]<site>[:port]<path>"""
+
+	if not fcmd:
+		return file_get_lib(baseurl,dest,conn)
+
+	fcmd = fcmd.replace("${DISTDIR}",dest)
+	fcmd = fcmd.replace("${URI}", baseurl)
+	fcmd = fcmd.replace("${FILE}", os.path.basename(baseurl))
+	mysplit = fcmd.split()
+	mycmd   = mysplit[0]
+	myargs  = [os.path.basename(mycmd)]+mysplit[1:]
+	mypid=os.fork()
+	if mypid == 0:
+		try:
+			os.execv(mycmd,myargs)
+		except OSError:
+			pass
+		sys.stderr.write("!!! Failed to spawn fetcher.\n")
+		sys.stderr.flush()
+		os._exit(1)
+	retval=os.waitpid(mypid,0)[1]
+	if (retval & 0xff) == 0:
+		retval = retval >> 8
+	else:
+		sys.stderr.write("Spawned processes caught a signal.\n")
+		sys.exit(1)
+	if retval != 0:
+		sys.stderr.write("Fetcher exited with a failure condition.\n")
+		return 0
+	return 1
+
+def file_get_lib(baseurl,dest,conn=None):
+	"""(baseurl[,connection]) -- Takes a base url to connect to and read from.
+	URL should be in the for <proto>://<site>[:port]<path>
+	Connection is used for persistent connection instances."""
+
+	if not conn:
+		keepconnection = 0
+	else:
+		keepconnection = 1
+
+	conn,protocol,address,params,headers = create_conn(baseurl, conn)
+
+	sys.stderr.write("Fetching '"+str(os.path.basename(address)+"'\n"))
+	if protocol in ["http","https"]:
+		data,rc,msg = make_http_request(conn, address, params, headers, dest=dest)
+	elif protocol in ["ftp"]:
+		data,rc,msg = make_ftp_request(conn, address, dest=dest)
+	else:
+		raise TypeError, "Unknown protocol. '%s'" % protocol
+	
+	if not keepconnection:
+		conn.close()
+
+	return rc
+
+
+def dir_get_metadata(baseurl, conn=None, chunk_size=3000, verbose=1, usingcache=1, makepickle=None):
+	"""(baseurl,conn,chunk_size,verbose) -- 
+	"""
+	if not conn:
+		keepconnection = 0
+	else:
+		keepconnection = 1
+
+	if makepickle is None:
+		makepickle = CACHE_PATH+"/metadata.idx.most_recent"
+
+	conn,protocol,address,params,headers = create_conn(baseurl, conn)
+
+	filedict = {}
+
+	try:
+		metadatafile = open(CACHE_PATH+"/remote_metadata.pickle")
+		metadata = cPickle.load(metadatafile)
+		sys.stderr.write("Loaded metadata pickle.\n")
+		metadatafile.close()
+	except (cPickle.UnpicklingError, OSError, IOError, EOFError):
+		metadata = {}
+	if not metadata.has_key(baseurl):
+		metadata[baseurl]={}
+	if not metadata[baseurl].has_key("indexname"):
+		metadata[baseurl]["indexname"]=""
+	if not metadata[baseurl].has_key("timestamp"):
+		metadata[baseurl]["timestamp"]=0
+	if not metadata[baseurl].has_key("unmodified"):
+		metadata[baseurl]["unmodified"]=0
+	if not metadata[baseurl].has_key("data"):
+		metadata[baseurl]["data"]={}
+
+	filelist = dir_get_list(baseurl, conn)
+	tbz2list = match_in_array(filelist, suffix=".tbz2")
+	metalist = match_in_array(filelist, prefix="metadata.idx")
+	del filelist
+	
+	# Determine if our metadata file is current.
+	metalist.sort()
+	metalist.reverse() # makes the order new-to-old.
+	havecache=0
+	for mfile in metalist:
+		if usingcache and \
+		   ((metadata[baseurl]["indexname"] != mfile) or \
+			  (metadata[baseurl]["timestamp"] < int(time.time()-(60*60*24)))):
+			# Try to download new cache until we succeed on one.
+			data=""
+			for trynum in [1,2,3]:
+				mytempfile = tempfile.TemporaryFile()
+				try:
+					file_get(baseurl+"/"+mfile, mytempfile, conn)
+					if mytempfile.tell() > len(data):
+						mytempfile.seek(0)
+						data = mytempfile.read()
+				except ValueError, e:
+					sys.stderr.write("--- "+str(e)+"\n")
+					if trynum < 3:
+						sys.stderr.write("Retrying...\n")
+					mytempfile.close()
+					continue
+				if match_in_array([mfile],suffix=".gz"):
+					sys.stderr.write("gzip'd\n")
+					try:
+						import gzip
+						mytempfile.seek(0)
+						gzindex = gzip.GzipFile(mfile[:-3],'rb',9,mytempfile)
+						data = gzindex.read()
+					except SystemExit, e:
+						raise
+					except Exception, e:
+						mytempfile.close()
+						sys.stderr.write("!!! Failed to use gzip: "+str(e)+"\n")
+					mytempfile.close()
+				try:
+					metadata[baseurl]["data"] = cPickle.loads(data)
+					del data
+					metadata[baseurl]["indexname"] = mfile
+					metadata[baseurl]["timestamp"] = int(time.time())
+					metadata[baseurl]["modified"]  = 0 # It's not, right after download.
+					sys.stderr.write("Pickle loaded.\n")
+					break
+				except SystemExit, e:
+					raise
+				except Exception, e:
+					sys.stderr.write("!!! Failed to read data from index: "+str(mfile)+"\n")
+					sys.stderr.write("!!! "+str(e)+"\n")
+			try:
+				metadatafile = open(CACHE_PATH+"/remote_metadata.pickle", "w+")
+				cPickle.dump(metadata,metadatafile)
+				metadatafile.close()
+			except SystemExit, e:
+				raise
+			except Exception, e:
+				sys.stderr.write("!!! Failed to write binary metadata to disk!\n")
+				sys.stderr.write("!!! "+str(e)+"\n")
+			break
+	# We may have metadata... now we run through the tbz2 list and check.
+	sys.stderr.write(yellow("cache miss: 'x'")+" --- "+green("cache hit: 'o'")+"\n")
+	binpkg_filenames = set()
+	for x in tbz2list:
+		x = os.path.basename(x)
+		binpkg_filenames.add(x)
+		if ((not metadata[baseurl]["data"].has_key(x)) or \
+		    (x not in metadata[baseurl]["data"].keys())):
+			sys.stderr.write(yellow("x"))
+			metadata[baseurl]["modified"] = 1
+			myid = None
+			for retry in xrange(3):
+				try:
+					myid = file_get_metadata(
+						"/".join((baseurl.rstrip("/"), x.lstrip("/"))),
+						conn, chunk_size)
+					break
+				except httplib.BadStatusLine:
+					# Sometimes this error is thrown from conn.getresponse() in
+					# make_http_request().  The docstring for this error in
+					# httplib.py says "Presumably, the server closed the
+					# connection before sending a valid response".
+					conn, protocol, address, params, headers = create_conn(
+						baseurl)
+
+			if myid and myid[0]:
+				metadata[baseurl]["data"][x] = make_metadata_dict(myid)
+			elif verbose:
+				sys.stderr.write(red("!!! Failed to retrieve metadata on: ")+str(x)+"\n")
+		else:
+			sys.stderr.write(green("o"))
+	# Cleanse stale cache for files that don't exist on the server anymore.
+	stale_cache = set(metadata[baseurl]["data"]).difference(binpkg_filenames)
+	if stale_cache:
+		for x in stale_cache:
+			del metadata[baseurl]["data"][x]
+		metadata[baseurl]["modified"] = 1
+	del stale_cache
+	del binpkg_filenames
+	sys.stderr.write("\n")
+	
+	try:
+		if metadata[baseurl].has_key("modified") and metadata[baseurl]["modified"]:
+			metadata[baseurl]["timestamp"] = int(time.time())
+			metadatafile = open(CACHE_PATH+"/remote_metadata.pickle", "w+")
+			cPickle.dump(metadata,metadatafile)
+			metadatafile.close()
+		if makepickle:
+			metadatafile = open(makepickle, "w")
+			cPickle.dump(metadata[baseurl]["data"],metadatafile)
+			metadatafile.close()
+	except SystemExit, e:
+		raise
+	except Exception, e:
+		sys.stderr.write("!!! Failed to write binary metadata to disk!\n")
+		sys.stderr.write("!!! "+str(e)+"\n")
+
+	if not keepconnection:
+		conn.close()
+	
+	return metadata[baseurl]["data"]
+
+def readpkgindex(pkgfile):
+	d = {}
+	for line in pkgfile:
+		line = line.rstrip("\n")
+		if not line:
+			break
+		line = line.split(":", 1)
+		if not len(line) == 2:
+			continue
+		k, v = line
+		if v:
+			v = v[1:]
+		d[k] = v
+	return d
+
+def writepkgindex(pkgfile, items):
+	for k, v in items:
+		pkgfile.write("%s: %s\n" % (k, v))
+	pkgfile.write("\n")
+
+class PackageIndex(object):
+
+	def __init__(self):
+		self.header = {}
+		self.packages = {}
+		self.modified = True
+
+	def read(self, pkgfile):
+		self.readHeader(pkgfile)
+		self.readBody(pkgfile)
+
+	def readHeader(self, pkgfile):
+		self.header.update(readpkgindex(pkgfile))
+
+	def readBody(self, pkgfile):
+		while True:
+			d = readpkgindex(pkgfile)
+			if not d:
+				break
+			mycpv = d.get("CPV")
+			if not mycpv:
+				continue
+			d.setdefault("SLOT", "0")
+			self.packages[mycpv] = d
+
+	def write(self, pkgfile):
+		cpv_all = self.packages.keys()
+		cpv_all.sort()
+		if self.modified:
+			import time
+			self.header["TIMESTAMP"] = str(long(time.time()))
+			self.header["PACKAGES"] = str(len(cpv_all))
+		keys = self.header.keys()
+		keys.sort()
+		writepkgindex(pkgfile, [(k, self.header[k]) for k in keys])
+		for cpv in cpv_all:
+			metadata = self.packages[cpv].copy()
+			if metadata.get("SLOT") == "0":
+				del metadata["SLOT"]
+			if metadata.get("USE") == "":
+				del metadata["USE"]
+			keys = metadata.keys()
+			keys.sort()
+			writepkgindex(pkgfile, [(k, metadata[k]) for k in keys])
Index: /vendor/prefix-portage/current/pym/portage/gpg.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/gpg.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/gpg.py	(revision 3489)
@@ -0,0 +1,149 @@
+# gpg.py -- core Portage functionality
+# Copyright 2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_gpg.py 3483 2006-06-10 21:40:40Z genone $
+
+
+import os
+import copy
+import types
+import commands
+import portage.exception
+import portage.checksum
+
+GPG_BINARY       = "/usr/bin/gpg"
+GPG_OPTIONS      = " --lock-never --no-random-seed-file --no-greeting --no-sig-cache "
+GPG_VERIFY_FLAGS = " --verify "
+GPG_KEYDIR       = " --homedir '%s' "
+GPG_KEYRING      = " --keyring '%s' "
+
+UNTRUSTED = 0
+EXISTS    = UNTRUSTED + 1
+MARGINAL  = EXISTS    + 1
+TRUSTED   = MARGINAL  + 1
+
+def fileStats(filepath):
+	mya = []
+	for x in os.stat(filepath):
+		mya.append(x)
+	mya.append(portage.checksum.perform_checksum(filepath))
+	return mya
+
+
+class FileChecker:
+	def __init__(self,keydir=None,keyring=None,requireSignedRing=False,minimumTrust=EXISTS):
+		self.minimumTrust     = TRUSTED  # Default we require trust. For rings.
+		self.keydir           = None
+		self.keyring          = None
+		self.keyringPath      = None
+		self.keyringStats     = None
+		self.keyringIsTrusted = False
+	
+		if (keydir != None):
+			# Verify that the keydir is valid.
+			if type(keydir) != types.StringType:
+				raise portage.exception.InvalidDataType, "keydir argument: %s" % keydir
+			if not os.path.isdir(keydir):
+				raise portage.exception.DirectoryNotFound, "keydir: %s" % keydir
+			self.keydir = copy.deepcopy(keydir)
+
+		if (keyring != None):
+			# Verify that the keyring is a valid filename and exists.
+			if type(keyring) != types.StringType:
+				raise portage.exception.InvalidDataType, "keyring argument: %s" % keyring
+			if keyring.find("/") != -1:
+				raise portage.exception.InvalidData, "keyring: %s" % keyring
+			pathname = ""
+			if keydir:
+				pathname = keydir + "/" + keyring
+			if not os.path.isfile(pathname):
+				raise portage.exception.FileNotFound, "keyring missing: %s (dev.gentoo.org/~carpaski/gpg/)" % pathname
+
+		keyringPath = keydir+"/"+keyring
+
+		if not keyring or not keyringPath and requireSignedRing:
+			raise portage.exception.MissingParameter
+
+		self.keyringStats = fileStats(keyringPath)
+		self.minimumTrust = TRUSTED
+		if not self.verify(keyringPath, keyringPath+".asc"):
+			self.keyringIsTrusted = False
+			if requireSignedRing:
+				raise portage.exception.InvalidSignature, "Required keyring verification: "+keyringPath
+		else:
+			self.keyringIsTrusted = True
+		
+		self.keyring      = copy.deepcopy(keyring)
+		self.keyringPath  = self.keydir+"/"+self.keyring
+		self.minimumTrust = minimumTrust
+
+	def _verifyKeyring(self):
+		if self.keyringStats and self.keyringPath:
+			new_stats = fileStats(self.keyringPath)
+			if new_stats != self.keyringStats:
+				raise portage.exception.SecurityViolation, "GPG keyring changed!"
+
+	def verify(self, filename, sigfile=None):
+		"""Uses minimumTrust to determine if it is Valid/True or Invalid/False"""
+		self._verifyKeyring()
+
+		if not os.path.isfile(filename):
+			raise portage.exception.FileNotFound, filename
+		
+		if sigfile and not os.path.isfile(sigfile):
+			raise portage.exception.FileNotFound, sigfile
+		
+		if self.keydir and not os.path.isdir(self.keydir):
+			raise portage.exception.DirectoryNotFound, filename
+		
+		if self.keyringPath:
+			if not os.path.isfile(self.keyringPath):
+				raise portage.exception.FileNotFound, self.keyringPath
+
+		if not os.path.isfile(filename):
+			raise portage.exception.CommandNotFound, filename
+
+		command = GPG_BINARY + GPG_VERIFY_FLAGS + GPG_OPTIONS
+		if self.keydir:
+			command += GPG_KEYDIR % (self.keydir)
+		if self.keyring:
+			command += GPG_KEYRING % (self.keyring)
+		
+		if sigfile:
+			command += " '"+sigfile+"'"
+		command += " '"+filename+"'"
+	
+		result,output = commands.getstatusoutput(command)
+		
+		signal = result & 0xff
+		result = (result >> 8)
+	
+		if signal:
+			raise SignalCaught, "Signal: %d" % (signal)
+	
+		trustLevel     = UNTRUSTED
+		if result == 0:
+			trustLevel   = TRUSTED
+			#if portage.output.find("WARNING") != -1:
+			#	trustLevel = MARGINAL
+			if portage.output.find("BAD") != -1:
+				raise portage.exception.InvalidSignature, filename
+		elif result == 1:
+			trustLevel   = EXISTS
+			if portage.output.find("BAD") != -1:
+				raise portage.exception.InvalidSignature, filename
+		elif result == 2:
+			trustLevel   = UNTRUSTED
+			if portage.output.find("could not be verified") != -1:
+				raise portage.exception.MissingSignature, filename
+			if portage.output.find("public key not found") != -1:
+				if self.keyringIsTrusted: # We trust the ring, but not the key specifically.
+					trustLevel = MARGINAL
+				else:
+					raise portage.exception.InvalidSignature, filename+" (Unknown Signature)"
+		else:
+			raise portage.exception.UnknownCondition, "GPG returned unknown result: %d" % (result)
+	
+		if trustLevel >= self.minimumTrust:
+			return True
+		return False
Index: /vendor/prefix-portage/current/pym/portage/localization.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/localization.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/localization.py	(revision 3489)
@@ -0,0 +1,21 @@
+# localization.py -- Code to manage/help portage localization.
+# Copyright 2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_localization.py 3483 2006-06-10 21:40:40Z genone $
+
+
+# We define this to make the transition easier for us.
+def _(mystr):
+	return mystr
+
+
+def localization_example():
+	# Dict references allow translators to rearrange word order.
+	print _("You can use this string for translating.")
+	print _("Strings can be formatted with %(mystr)s like this.") % {"mystr": "VALUES"}
+
+	a_value = "value.of.a"
+	b_value = 123
+	c_value = [1,2,3,4]
+	print _("A: %(a)s -- B: %(b)s -- C: %(c)s") % {"a":a_value,"b":b_value,"c":c_value}
+
Index: /vendor/prefix-portage/current/pym/portage/locks.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/locks.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/locks.py	(revision 3489)
@@ -0,0 +1,320 @@
+# portage: Lock management code
+# Copyright 2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_locks.py 4449 2006-09-14 07:52:39Z zmedico $
+
+
+import errno, os, stat, time, types
+from portage.exception import InvalidData, DirectoryNotFound, FileNotFound
+from portage.data import portage_gid
+from portage.util import writemsg
+from portage.localization import _
+import portage.const
+
+HARDLINK_FD = -2
+
+def lockdir(mydir):
+	return lockfile(mydir,wantnewlockfile=1)
+def unlockdir(mylock):
+	return unlockfile(mylock)
+
+def lockfile(mypath, wantnewlockfile=0, unlinkfile=0, waiting_msg=None):
+	"""Creates all dirs upto, the given dir. Creates a lockfile
+	for the given directory as the file: directoryname+'.portage.lockfile'."""
+	import fcntl
+
+	if not mypath:
+		raise InvalidData, "Empty path given"
+
+	if type(mypath) == types.StringType and mypath[-1] == '/':
+		mypath = mypath[:-1]
+
+	if type(mypath) == types.FileType:
+		mypath = mypath.fileno()
+	if type(mypath) == types.IntType:
+		lockfilename    = mypath
+		wantnewlockfile = 0
+		unlinkfile      = 0
+	elif wantnewlockfile:
+		base, tail = os.path.split(mypath)
+		lockfilename = os.path.join(base, "." + tail + ".portage.lockfile")
+		del base, tail
+		unlinkfile   = 1
+	else:
+		lockfilename = mypath
+	
+	if type(mypath) == types.StringType:
+		if not os.path.exists(os.path.dirname(mypath)):
+			raise DirectoryNotFound, os.path.dirname(mypath)
+		if not os.path.exists(lockfilename):
+			old_mask=os.umask(000)
+			myfd = os.open(lockfilename, os.O_CREAT|os.O_RDWR,0660)
+			try:
+				if os.stat(lockfilename).st_gid != portage_gid:
+					os.chown(lockfilename,os.getuid(),portage_gid)
+			except OSError, e:
+				if e[0] == 2: # No such file or directory
+					return lockfile(mypath, wantnewlockfile=wantnewlockfile,
+						unlinkfile=unlinkfile, waiting_msg=waiting_msg)
+				else:
+					writemsg("Cannot chown a lockfile. This could cause inconvenience later.\n");
+			os.umask(old_mask)
+		else:
+			myfd = os.open(lockfilename, os.O_CREAT|os.O_RDWR,0660)
+
+	elif type(mypath) == types.IntType:
+		myfd = mypath
+
+	else:
+		raise ValueError, "Unknown type passed in '%s': '%s'" % (type(mypath),mypath)
+
+	# try for a non-blocking lock, if it's held, throw a message
+	# we're waiting on lockfile and use a blocking attempt.
+	locking_method = fcntl.lockf
+	try:
+		fcntl.lockf(myfd,fcntl.LOCK_EX|fcntl.LOCK_NB)
+	except IOError, e:
+		if "errno" not in dir(e):
+			raise
+		if e.errno == errno.EAGAIN:
+			# resource temp unavailable; eg, someone beat us to the lock.
+			if waiting_msg is None:
+				if isinstance(mypath, int):
+					print "waiting for lock on fd %i" % myfd
+				else:
+					print "waiting for lock on %s" % lockfilename
+			elif waiting_msg:
+				print waiting_msg
+			# try for the exclusive lock now.
+			fcntl.lockf(myfd,fcntl.LOCK_EX)
+		elif e.errno == errno.ENOLCK:
+			# We're not allowed to lock on this FS.
+			os.close(myfd)
+			link_success = False
+			if lockfilename == str(lockfilename):
+				if wantnewlockfile:
+					try:
+						if os.stat(lockfilename)[stat.ST_NLINK] == 1:
+							os.unlink(lockfilename)
+					except OSError:
+						pass
+					link_success = hardlink_lockfile(lockfilename)
+			if not link_success:
+				raise
+			locking_method = None
+			myfd = HARDLINK_FD
+		else:
+			raise
+
+		
+	if type(lockfilename) == types.StringType and \
+		myfd != HARDLINK_FD and os.fstat(myfd).st_nlink == 0:
+		# The file was deleted on us... Keep trying to make one...
+		os.close(myfd)
+		writemsg("lockfile recurse\n",1)
+		lockfilename, myfd, unlinkfile, locking_method = lockfile(
+			mypath, wantnewlockfile=wantnewlockfile, unlinkfile=unlinkfile,
+			waiting_msg=waiting_msg)
+
+	writemsg(str((lockfilename,myfd,unlinkfile))+"\n",1)
+	return (lockfilename,myfd,unlinkfile,locking_method)
+
+def unlockfile(mytuple):
+	import fcntl
+
+	#XXX: Compatability hack.
+	if len(mytuple) == 3:
+		lockfilename,myfd,unlinkfile = mytuple
+		locking_method = fcntl.flock
+	elif len(mytuple) == 4:
+		lockfilename,myfd,unlinkfile,locking_method = mytuple
+	else:
+		raise InvalidData
+
+	if(myfd == HARDLINK_FD):
+		unhardlink_lockfile(lockfilename)
+		return True
+	
+	# myfd may be None here due to myfd = mypath in lockfile()
+	if type(lockfilename) == types.StringType and not os.path.exists(lockfilename):
+		writemsg("lockfile does not exist '%s'\n" % lockfilename,1)
+		if myfd is not None:
+			os.close(myfd)
+		return False
+
+	try:
+		if myfd is None:
+			myfd = os.open(lockfilename, os.O_WRONLY,0660)
+			unlinkfile = 1
+		locking_method(myfd,fcntl.LOCK_UN)
+	except OSError:
+		if type(lockfilename) == types.StringType:
+			os.close(myfd)
+		raise IOError, "Failed to unlock file '%s'\n" % lockfilename
+
+	try:
+		# This sleep call was added to allow other processes that are
+		# waiting for a lock to be able to grab it before it is deleted.
+		# lockfile() already accounts for this situation, however, and
+		# the sleep here adds more time than is saved overall, so am
+		# commenting until it is proved necessary.
+		#time.sleep(0.0001)
+		if unlinkfile:
+			locking_method(myfd,fcntl.LOCK_EX|fcntl.LOCK_NB)
+			# We won the lock, so there isn't competition for it.
+			# We can safely delete the file.
+			writemsg("Got the lockfile...\n",1)
+			if os.fstat(myfd).st_nlink == 1:
+				os.unlink(lockfilename)
+				writemsg("Unlinked lockfile...\n",1)
+				locking_method(myfd,fcntl.LOCK_UN)
+			else:
+				writemsg("lockfile does not exist '%s'\n" % lockfilename,1)
+				os.close(myfd)
+				return False
+	except Exception, e:
+		writemsg("Failed to get lock... someone took it.\n",1)
+		writemsg(str(e)+"\n",1)
+
+	# why test lockfilename?  because we may have been handed an
+	# fd originally, and the caller might not like having their
+	# open fd closed automatically on them.
+	if type(lockfilename) == types.StringType:
+		os.close(myfd)
+
+	return True
+
+
+
+
+def hardlock_name(path):
+	return path+".hardlock-"+os.uname()[1]+"-"+str(os.getpid())
+
+def hardlink_is_mine(link,lock):
+	try:
+		return os.stat(link).st_nlink == 2
+	except OSError:
+		return False
+
+def hardlink_lockfile(lockfilename, max_wait=14400):
+	"""Does the NFS, hardlink shuffle to ensure locking on the disk.
+	We create a PRIVATE lockfile, that is just a placeholder on the disk.
+	Then we HARDLINK the real lockfile to that private file.
+	If our file can 2 references, then we have the lock. :)
+	Otherwise we lather, rise, and repeat.
+	We default to a 4 hour timeout.
+	"""
+
+	start_time = time.time()
+	myhardlock = hardlock_name(lockfilename)
+	reported_waiting = False
+	
+	while(time.time() < (start_time + max_wait)):
+		# We only need it to exist.
+		myfd = os.open(myhardlock, os.O_CREAT|os.O_RDWR,0660)
+		os.close(myfd)
+	
+		if not os.path.exists(myhardlock):
+			raise FileNotFound, _("Created lockfile is missing: %(filename)s") % {"filename":myhardlock}
+
+		try:
+			res = os.link(myhardlock, lockfilename)
+		except OSError:
+			pass
+
+		if hardlink_is_mine(myhardlock, lockfilename):
+			# We have the lock.
+			if reported_waiting:
+				print
+			return True
+
+		if reported_waiting:
+			writemsg(".")
+		else:
+			reported_waiting = True
+			from portage.const import PORTAGE_BIN_PATH
+			print
+			print "Waiting on (hardlink) lockfile: (one '.' per 3 seconds)"
+			print "This is a feature to prevent distfiles corruption."
+			print "%s/clean_locks can fix stuck locks." % PORTAGE_BIN_PATH
+			print "Lockfile: " + lockfilename
+		time.sleep(3)
+	
+	os.unlink(myhardlock)
+	return False
+
+def unhardlink_lockfile(lockfilename):
+	myhardlock = hardlock_name(lockfilename)
+	if hardlink_is_mine(myhardlock, lockfilename):
+		# Make sure not to touch lockfilename unless we really have a lock.
+		try:
+			os.unlink(lockfilename)
+		except OSError:
+			pass
+	try:
+		os.unlink(myhardlock)
+	except OSError:
+		pass
+
+def hardlock_cleanup(path, remove_all_locks=False):
+	mypid  = str(os.getpid())
+	myhost = os.uname()[1]
+	mydl = os.listdir(path)
+
+	results = []
+	mycount = 0
+
+	mylist = {}
+	for x in mydl:
+		if os.path.isfile(path+"/"+x):
+			parts = x.split(".hardlock-")
+			if len(parts) == 2:
+				filename = parts[0]
+				hostpid  = parts[1].split("-")
+				host  = "-".join(hostpid[:-1])
+				pid   = hostpid[-1]
+				
+				if not mylist.has_key(filename):
+					mylist[filename] = {}
+				if not mylist[filename].has_key(host):
+					mylist[filename][host] = []
+				mylist[filename][host].append(pid)
+
+				mycount += 1
+
+
+	results.append("Found %(count)s locks" % {"count":mycount})
+	
+	for x in mylist.keys():
+		if mylist[x].has_key(myhost) or remove_all_locks:
+			mylockname = hardlock_name(path+"/"+x)
+			if hardlink_is_mine(mylockname, path+"/"+x) or \
+			   not os.path.exists(path+"/"+x) or \
+				 remove_all_locks:
+				for y in mylist[x].keys():
+					for z in mylist[x][y]:
+						filename = path+"/"+x+".hardlock-"+y+"-"+z
+						if filename == mylockname:
+							continue
+						try:
+							# We're sweeping through, unlinking everyone's locks.
+							os.unlink(filename)
+							results.append(_("Unlinked: ") + filename)
+						except OSError:
+							pass
+				try:
+					os.unlink(path+"/"+x)
+					results.append(_("Unlinked: ") + path+"/"+x)
+					os.unlink(mylockname)
+					results.append(_("Unlinked: ") + mylockname)
+				except OSError:
+					pass
+			else:
+				try:
+					os.unlink(mylockname)
+					results.append(_("Unlinked: ") + mylockname)
+				except OSError:
+					pass
+
+	return results
+
Index: /vendor/prefix-portage/current/pym/portage/mail.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/mail.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/mail.py	(revision 3489)
@@ -0,0 +1,89 @@
+# portage.py -- core Portage functionality
+# Copyright 1998-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage.py 3483 2006-06-10 21:40:40Z genone $
+
+import portage.exception, socket, smtplib, os, sys, time
+from email.MIMEText import MIMEText as TextMessage
+from email.MIMEMultipart import MIMEMultipart as MultipartMessage
+from email.MIMEBase import MIMEBase as BaseMessage
+
+def create_message(sender, recipient, subject, body, attachments=None):
+	if attachments == None:
+		mymessage = TextMessage(body)
+	else:
+		mymessage = MultipartMessage()
+		mymessage.attach(TextMessage(body))
+		for x in attachments:
+			if isinstance(x, BaseMessage):
+				mymessage.attach(x)
+			elif isinstance(x, str):
+				mymessage.attach(TextMessage(x))
+			else:
+				raise portage.exception.PortageException("Can't handle type of attachment: %s" % type(x))
+
+	mymessage.set_unixfrom(sender)
+	mymessage["To"] = recipient
+	mymessage["From"] = sender
+	mymessage["Subject"] = subject
+	mymessage["Date"] = time.strftime("%a, %d %b %Y %H:%M:%S %z")
+	
+	return mymessage
+
+def send_mail(mysettings, message):
+	mymailhost = "localhost"
+	mymailport = 25
+	mymailuser = ""
+	mymailpasswd = ""
+	myrecipient = "root@localhost"
+	
+	# Syntax for PORTAGE_ELOG_MAILURI (if defined):
+	# adress [[user:passwd@]mailserver[:port]]
+	# where adress:     recipient adress
+	#       user:       username for smtp auth (defaults to none)
+	#       passwd:     password for smtp auth (defaults to none)
+	#       mailserver: smtp server that should be used to deliver the mail (defaults to localhost)
+	#					alternatively this can also be the absolute path to a sendmail binary if you don't want to use smtp
+	#       port:       port to use on the given smtp server (defaults to 25, values > 100000 indicate that starttls should be used on (port-100000))
+	if " " in mysettings["PORTAGE_ELOG_MAILURI"]:
+		myrecipient, mymailuri = mysettings["PORTAGE_ELOG_MAILURI"].split()
+		if "@" in mymailuri:
+			myauthdata, myconndata = mymailuri.rsplit("@", 1)
+			try:
+				mymailuser,mymailpasswd = myauthdata.split(":")
+			except ValueError:
+				print "!!! invalid SMTP AUTH configuration, trying unauthenticated ..."
+		else:
+			myconndata = mymailuri
+		if ":" in myconndata:
+			mymailhost,mymailport = myconndata.split(":")
+		else:
+			mymailhost = myconndata
+	else:
+		myrecipient = mysettings["PORTAGE_ELOG_MAILURI"]
+	
+	myfrom = message.get("From")
+		
+	# user wants to use a sendmail binary instead of smtp
+	if mymailhost[0] == os.sep and os.path.exists(mymailhost):
+		fd = os.popen(mymailhost+" -f "+myfrom+" "+myrecipient, "w")
+		fd.write(message.as_string())
+		if fd.close() != None:
+			sys.stderr.write("!!! %s returned with a non-zero exit code. This generally indicates an error.\n" % mymailhost)
+	else:
+		try:
+			if int(mymailport) > 100000:
+				myconn = smtplib.SMTP(mymailhost, int(mymailport) - 100000)
+				myconn.starttls()
+			else:
+				myconn = smtplib.SMTP(mymailhost, mymailport)
+			if mymailuser != "" and mymailpasswd != "":
+				myconn.login(mymailuser, mymailpasswd)
+			myconn.sendmail(myfrom, myrecipient, message.as_string())
+			myconn.quit()
+		except smtplib.SMTPException, e:
+			raise portage.exception.PortageException("!!! An error occured while trying to send logmail:\n"+str(e))
+		except socket.error, e:
+			raise portage.exception.PortageException("!!! A network error occured while trying to send logmail:\n"+str(e)+"\nSure you configured PORTAGE_ELOG_MAILURI correctly?")
+	return
+	
Index: /vendor/prefix-portage/current/pym/portage/manifest.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/manifest.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/manifest.py	(revision 3489)
@@ -0,0 +1,633 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+import errno, os, sets
+if not hasattr(__builtins__, "set"):
+	from sets import Set as set
+
+import portage.versions, portage.const
+from portage.checksum import *
+from portage.exception import *
+from portage.util import write_atomic
+
+class FileNotInManifestException(PortageException):
+	pass
+
+def manifest2AuxfileFilter(filename):
+	filename = filename.strip(os.sep)
+	mysplit = filename.split(os.path.sep)
+	if "CVS" in mysplit:
+		return False
+	for x in mysplit:
+		if x.startswith("."):
+			return False
+	return not filename.startswith("digest-")
+
+def manifest2MiscfileFilter(filename):
+	filename = filename.strip(os.sep)
+	return not (filename in ["CVS", ".svn", "files", "Manifest"] or filename.endswith(".ebuild"))
+
+def guessManifestFileType(filename):
+	""" Perform a best effort guess of which type the given filename is, avoid using this if possible """
+	if filename.startswith("files" + os.sep + "digest-"):
+		return None
+	if filename.startswith("files" + os.sep):
+		return "AUX"
+	elif filename.endswith(".ebuild"):
+		return "EBUILD"
+	elif filename in ["ChangeLog", "metadata.xml"]:
+		return "MISC"
+	else:
+		return "DIST"
+
+def parseManifest2(mysplit):
+	myentry = None
+	if len(mysplit) > 4 and mysplit[0] in portage.const.MANIFEST2_IDENTIFIERS:
+		mytype = mysplit[0]
+		myname = mysplit[1]
+		mysize = int(mysplit[2])
+		myhashes = dict(zip(mysplit[3::2], mysplit[4::2]))
+		myhashes["size"] = mysize
+		myentry = Manifest2Entry(type=mytype, name=myname, hashes=myhashes)
+	return myentry
+
+def parseManifest1(mysplit):
+	myentry = None
+	if len(mysplit) == 4 and mysplit[0] in ["size"] + portage.const.MANIFEST1_HASH_FUNCTIONS:
+		myname = mysplit[2]
+		mytype = None
+		mytype = guessManifestFileType(myname)
+		if mytype == "AUX":
+			if myname.startswith("files" + os.path.sep):
+				myname = myname[6:]
+		mysize = int(mysplit[3])
+		myhashes = {mysplit[0]: mysplit[1]}
+		myhashes["size"] = mysize
+		myentry = Manifest1Entry(type=mytype, name=myname, hashes=myhashes)
+	return myentry
+
+class ManifestEntry(object):
+	__slots__ = ("type", "name", "hashes")
+	def __init__(self, **kwargs):
+		for k, v in kwargs.iteritems():
+			setattr(self, k, v)
+	def __cmp__(self, other):
+		if str(self) == str(other):
+			return 0
+		return 1
+
+class Manifest1Entry(ManifestEntry):
+	def __str__(self):
+		myhashkeys = self.hashes.keys()
+		for hashkey in myhashkeys:
+			if hashkey != "size":
+				break
+		hashvalue = self.hashes[hashkey]
+		myname = self.name
+		if self.type == "AUX" and not myname.startswith("files" + os.sep):
+			myname = os.path.join("files", myname)
+		return " ".join([hashkey, str(hashvalue), myname, str(self.hashes["size"])])
+
+class Manifest2Entry(ManifestEntry):
+	def __str__(self):
+		myline = " ".join([self.type, self.name, str(self.hashes["size"])])
+		myhashkeys = self.hashes.keys()
+		myhashkeys.remove("size")
+		myhashkeys.sort()
+		for h in myhashkeys:
+			myline += " " + h + " " + str(self.hashes[h])
+		return myline
+
+class Manifest(object):
+	parsers = (parseManifest2, parseManifest1)
+	def __init__(self, pkgdir, distdir, fetchlist_dict=None,
+		manifest1_compat=True, from_scratch=False):
+		""" create new Manifest instance for package in pkgdir
+		    and add compability entries for old portage versions if manifest1_compat == True.
+		    Do not parse Manifest file if from_scratch == True (only for internal use)
+			The fetchlist_dict parameter is required only for generation of
+			a Manifest (not needed for parsing and checking sums)."""
+		self.pkgdir = pkgdir.rstrip(os.sep) + os.sep
+		self.fhashdict = {}
+		self.hashes = portage.const.MANIFEST2_HASH_FUNCTIONS[:]
+		self.hashes.append("size")
+		if manifest1_compat:
+			self.hashes.extend(portage.const.MANIFEST1_HASH_FUNCTIONS)
+		self.hashes = sets.Set(self.hashes)
+		for t in portage.const.MANIFEST2_IDENTIFIERS:
+			self.fhashdict[t] = {}
+		self.compat = manifest1_compat
+		if not from_scratch:
+			self._read()
+		if fetchlist_dict != None:
+			self.fetchlist_dict = fetchlist_dict
+		else:
+			self.fetchlist_dict = {}
+		self.distdir = distdir
+		self.guessType = guessManifestFileType
+
+	def getFullname(self):
+		""" Returns the absolute path to the Manifest file for this instance """
+		return os.path.join(self.pkgdir, "Manifest")
+	
+	def getDigests(self):
+		""" Compability function for old digest/manifest code, returns dict of filename:{hashfunction:hashvalue} """
+		rval = {}
+		for t in portage.const.MANIFEST2_IDENTIFIERS:
+			rval.update(self.fhashdict[t])
+		return rval
+	
+	def getTypeDigests(self, ftype):
+		""" Similar to getDigests(), but restricted to files of the given type. """
+		return self.fhashdict[ftype]
+
+	def _readDigests(self, myhashdict=None):
+		""" Parse old style digest files for this Manifest instance """
+		if myhashdict is None:
+			myhashdict = {}
+		try:
+			for d in os.listdir(os.path.join(self.pkgdir, "files")):
+				if d.startswith("digest-"):
+					self._readManifest(os.path.join(self.pkgdir, "files", d), mytype="DIST",
+						myhashdict=myhashdict)
+		except (IOError, OSError), e:
+			if e.errno == errno.ENOENT:
+				pass
+			else:
+				raise
+		return myhashdict
+
+	def _readManifest(self, file_path, myhashdict=None, **kwargs):
+		"""Parse a manifest or an old style digest.  If myhashdict is given
+		then data will be added too it.  Otherwise, a new dict will be created
+		and returned."""
+		try:
+			fd = open(file_path, "r")
+			if myhashdict is None:
+				myhashdict = {}
+			self._parseDigests(fd, myhashdict=myhashdict, **kwargs)
+			fd.close()
+			return myhashdict
+		except (OSError, IOError), e:
+			if e.errno == errno.ENOENT:
+				raise FileNotFound(file_path)
+			else:
+				raise
+
+	def _read(self):
+		""" Parse Manifest file for this instance """
+		try:
+			self._readManifest(self.getFullname(), myhashdict=self.fhashdict)
+		except FileNotFound:
+			pass
+		if self.compat:
+			self._readDigests(myhashdict=self.fhashdict)
+
+	def _parseManifestLines(self, mylines):
+		"""Parse manifest lines and return a list of manifest entries."""
+		for myline in mylines:
+			myentry = None
+			mysplit = myline.split()
+			for parser in self.parsers:
+				myentry = parser(mysplit)
+				if myentry is not None:
+					yield myentry
+					break # go to the next line
+
+	def _parseDigests(self, mylines, myhashdict=None, mytype=None):
+		"""Parse manifest entries and store the data in myhashdict.  If mytype
+		is specified, it will override the type for all parsed entries."""
+		if myhashdict is None:
+			myhashdict = {}
+		for myentry in self._parseManifestLines(mylines):
+			if mytype is None:
+				myentry_type = myentry.type
+			else:
+				myentry_type = mytype
+			myhashdict.setdefault(myentry_type, {})
+			myhashdict[myentry_type].setdefault(myentry.name, {})
+			myhashdict[myentry_type][myentry.name].update(myentry.hashes)
+		return myhashdict
+
+	def _writeDigests(self, force=False):
+		""" Create old style digest files for this Manifest instance """
+		cpvlist = [os.path.join(self._pkgdir_category(), x[:-7]) for x in os.listdir(self.pkgdir) if x.endswith(".ebuild")]
+		rval = []
+		try:
+			os.makedirs(os.path.join(self.pkgdir, "files"))
+		except OSError, oe:
+			if oe.errno == errno.EEXIST:
+				pass
+			else:
+				raise
+		for cpv in cpvlist:
+			dname = os.path.join(self.pkgdir, "files", "digest-%s" % self._catsplit(cpv)[1])
+			distlist = self._getCpvDistfiles(cpv)
+			missing_digests = set()
+			for f in distlist:
+				if f not in self.fhashdict["DIST"] or len(self.fhashdict["DIST"][f]) == 0:
+					missing_digests.add(f)
+			if missing_digests:
+				# This allows us to force remove of stale digests for the
+				# ebuild --force digest option.
+				distlist = [f for f in distlist if f not in missing_digests]
+			update_digest = True
+			if not force:
+				try:
+					f = open(dname, "r")
+					old_data = self._parseDigests(f)
+					f.close()
+					new_data = self._getDigestData(distlist)
+					if not old_data and not new_data:
+						# SRC_URI is empty
+						update_digest = False
+					elif len(old_data) == 1 and "DIST" in old_data:
+						if "DIST" in new_data:
+							for myfile in new_data["DIST"]:
+								for hashname in \
+									new_data["DIST"][myfile].keys():
+									if hashname != "size" and hashname not in \
+										portage.const.MANIFEST1_HASH_FUNCTIONS:
+										del new_data["DIST"][myfile][hashname]
+							if new_data["DIST"] == old_data["DIST"]:
+								update_digest = False
+				except (IOError, OSError), e:
+					if errno.ENOENT == e.errno:
+						pass
+					else:
+						raise
+			if update_digest:
+				mylines = self._createDigestLines1(distlist, self.fhashdict)
+				if mylines:
+					mylines = "\n".join(mylines) + "\n"
+				else:
+					mylines = ""
+				write_atomic(dname, mylines)
+			rval.append(dname)
+		return rval
+
+	def _getDigestData(self, distlist):
+		"""create a hash dict for a specific list of files"""
+		myhashdict = {}
+		for myname in distlist:
+			for mytype in self.fhashdict:
+				if myname in self.fhashdict[mytype]:
+					myhashdict.setdefault(mytype, {})
+					myhashdict[mytype].setdefault(myname, {})
+					myhashdict[mytype][myname].update(self.fhashdict[mytype][myname])
+		return myhashdict
+
+	def _createDigestLines1(self, distlist, myhashdict):
+		""" Create an old style digest file."""
+		mylines = []
+		myfiles = myhashdict["DIST"].keys()
+		myfiles.sort()
+		for f in myfiles:
+			if f in distlist:
+				myhashkeys = myhashdict["DIST"][f].keys()
+				myhashkeys.sort()
+				for h in myhashkeys:
+					if h not in portage.const.MANIFEST1_HASH_FUNCTIONS:
+						continue
+					myline = " ".join([h, str(myhashdict["DIST"][f][h]), f, str(myhashdict["DIST"][f]["size"])])
+					mylines.append(myline)
+		return mylines
+	
+	def _addDigestsToManifest(self, digests, fd):
+		""" Add entries for old style digest files to Manifest file """
+		mylines = []
+		for dname in digests:
+			myhashes = perform_multiple_checksums(dname, portage.const.MANIFEST1_HASH_FUNCTIONS+["size"])
+			for h in myhashes:
+				mylines.append((" ".join([h, str(myhashes[h]), os.path.join("files", os.path.basename(dname)), str(myhashes["size"])])))
+		fd.write("\n".join(mylines))
+		fd.write("\n")
+
+	def _createManifestEntries(self):
+		mytypes = self.fhashdict.keys()
+		mytypes.sort()
+		for t in mytypes:
+			myfiles = self.fhashdict[t].keys()
+			myfiles.sort()
+			for f in myfiles:
+				myentry = Manifest2Entry(
+					type=t, name=f, hashes=self.fhashdict[t][f].copy())
+				myhashkeys = myentry.hashes.keys()
+				for h in myhashkeys:
+					if h not in ["size"] + portage.const.MANIFEST2_HASH_FUNCTIONS:
+						del myentry.hashes[h]
+				yield myentry
+				if self.compat and t != "DIST":
+					mysize = self.fhashdict[t][f]["size"]
+					myhashes = self.fhashdict[t][f]
+					for h in myhashkeys:
+						if h not in portage.const.MANIFEST1_HASH_FUNCTIONS:
+							continue
+						yield Manifest1Entry(
+							type=t, name=f, hashes={"size":mysize, h:myhashes[h]})
+
+		if self.compat:
+			cvp_list = self.fetchlist_dict.keys()
+			cvp_list.sort()
+			for cpv in cvp_list:
+				digest_path = os.path.join("files", "digest-%s" % self._catsplit(cpv)[1])
+				dname = os.path.join(self.pkgdir, digest_path)
+				try:
+					myhashes = perform_multiple_checksums(dname, portage.const.MANIFEST1_HASH_FUNCTIONS+["size"])
+					myhashkeys = myhashes.keys()
+					myhashkeys.sort()
+					for h in myhashkeys:
+						if h in portage.const.MANIFEST1_HASH_FUNCTIONS:
+							yield Manifest1Entry(type="AUX", name=digest_path,
+								hashes={"size":myhashes["size"], h:myhashes[h]})
+				except FileNotFound:
+					pass
+
+	def checkIntegrity(self):
+		for t in self.fhashdict.keys():
+			for f in self.fhashdict[t]:
+				if not portage.const.MANIFEST2_REQUIRED_HASH in self.fhashdict[t][f].keys():
+					raise MissingParameter("Missing %s checksum: %s %s" % (portage.const.MANIFEST2_REQUIRED_HASH, t, f))
+
+	def write(self, sign=False, force=False):
+		""" Write Manifest instance to disk, optionally signing it """
+		self.checkIntegrity()
+		try:
+			if self.compat:
+				self._writeDigests()
+			myentries = list(self._createManifestEntries())
+			update_manifest = True
+			if not force:
+				try:
+					f = open(self.getFullname(), "r")
+					oldentries = list(self._parseManifestLines(f))
+					f.close()
+					if len(oldentries) == len(myentries):
+						update_manifest = False
+						for i in xrange(len(oldentries)):
+							if oldentries[i] != myentries[i]:
+								update_manifest = True
+								break
+				except (IOError, OSError), e:
+					if e.errno == errno.ENOENT:
+						pass
+					else:
+						raise
+			if update_manifest:
+				fd = open(self.getFullname(), "w")
+				for myentry in myentries:
+					fd.write("%s\n" % str(myentry))
+				fd.close()
+			if sign:
+				self.sign()
+		except (IOError, OSError), e:
+			if e.errno == errno.EACCES:
+				raise PermissionDenied(str(e))
+			raise
+
+	def sign(self):
+		""" Sign the Manifest """
+		raise NotImplementedError()
+	
+	def validateSignature(self):
+		""" Validate signature on Manifest """
+		raise NotImplementedError()
+	
+	def addFile(self, ftype, fname, hashdict=None, ignoreMissing=False):
+		""" Add entry to Manifest optionally using hashdict to avoid recalculation of hashes """
+		if ftype == "AUX" and not fname.startswith("files/"):
+			fname = os.path.join("files", fname)
+		if not os.path.exists(self.pkgdir+fname) and not ignoreMissing:
+			raise FileNotFound(fname)
+		if not ftype in portage.const.MANIFEST2_IDENTIFIERS:
+			raise InvalidDataType(ftype)
+		if ftype == "AUX" and fname.startswith("files"):
+			fname = fname[6:]
+		self.fhashdict[ftype][fname] = {}
+		if hashdict != None:
+			self.fhashdict[ftype][fname].update(hashdict)
+		if not portage.const.MANIFEST2_REQUIRED_HASH in self.fhashdict[ftype][fname]:
+			self.updateFileHashes(ftype, fname, checkExisting=False, ignoreMissing=ignoreMissing)
+	
+	def removeFile(self, ftype, fname):
+		""" Remove given entry from Manifest """
+		del self.fhashdict[ftype][fname]
+	
+	def hasFile(self, ftype, fname):
+		""" Return wether the Manifest contains an entry for the given type,filename pair """
+		return (fname in self.fhashdict[ftype])
+	
+	def findFile(self, fname):
+		""" Return entrytype of the given file if present in Manifest or None if not present """
+		for t in portage.const.MANIFEST2_IDENTIFIERS:
+			if fname in self.fhashdict[t]:
+				return t
+		return None
+	
+	def create(self, checkExisting=False, assumeDistHashesSometimes=False,
+		assumeDistHashesAlways=False, requiredDistfiles=[]):
+		""" Recreate this Manifest from scratch.  This will not use any
+		existing checksums unless assumeDistHashesSometimes or
+		assumeDistHashesAlways is true (assumeDistHashesSometimes will only
+		cause DIST checksums to be reused if the file doesn't exist in
+		DISTDIR).  The requiredDistfiles parameter specifies a list of
+		distfiles to raise a FileNotFound exception for (if no file or existing
+		checksums are available), and defaults to all distfiles when not
+		specified."""
+		if checkExisting:
+			self.checkAllHashes()
+		if assumeDistHashesSometimes or assumeDistHashesAlways:
+			distfilehashes = self.fhashdict["DIST"]
+		else:
+			distfilehashes = {}
+		self.__init__(self.pkgdir, self.distdir,
+			fetchlist_dict=self.fetchlist_dict, from_scratch=True,
+			manifest1_compat=self.compat)
+		for pkgdir, pkgdir_dirs, pkgdir_files in os.walk(self.pkgdir):
+			break
+		for f in pkgdir_files:
+			if f.endswith(".ebuild"):
+				mytype = "EBUILD"
+			elif manifest2MiscfileFilter(f):
+				mytype = "MISC"
+			else:
+				continue
+			self.fhashdict[mytype][f] = perform_multiple_checksums(self.pkgdir+f, self.hashes)
+		recursive_files = []
+		cut_len = len(os.path.join(self.pkgdir, "files") + os.sep)
+		for parentdir, dirs, files in os.walk(os.path.join(self.pkgdir, "files")):
+			for f in files:
+				full_path = os.path.join(parentdir, f)
+				recursive_files.append(full_path[cut_len:])
+		for f in recursive_files:
+			if not manifest2AuxfileFilter(f):
+				continue
+			self.fhashdict["AUX"][f] = perform_multiple_checksums(
+				os.path.join(self.pkgdir, "files", f.lstrip(os.sep)), self.hashes)
+		cpvlist = [os.path.join(self._pkgdir_category(), x[:-7]) for x in os.listdir(self.pkgdir) if x.endswith(".ebuild")]
+		distlist = set()
+		for cpv in cpvlist:
+			distlist.update(self._getCpvDistfiles(cpv))
+		if requiredDistfiles is None:
+			# This allows us to force removal of stale digests for the
+			# ebuild --force digest option (no distfiles are required).
+			requiredDistfiles = set()
+		elif len(requiredDistfiles) == 0:
+			# repoman passes in an empty list, which implies that all distfiles
+			# are required.
+			requiredDistfiles = distlist.copy()
+		required_hash_types = set()
+		required_hash_types.add("size")
+		required_hash_types.add(portage.const.MANIFEST2_REQUIRED_HASH)
+		for f in distlist:
+			fname = os.path.join(self.distdir, f)
+			mystat = None
+			try:
+				mystat = os.stat(fname)
+			except OSError:
+				pass
+			if f in distfilehashes and \
+				((assumeDistHashesSometimes and mystat is None) or \
+				(assumeDistHashesAlways and mystat is None) or \
+				(assumeDistHashesAlways and mystat is not None and \
+				len(distfilehashes[f]) == len(self.hashes) and \
+				distfilehashes[f]["size"] == mystat.st_size)) and \
+				not required_hash_types.difference(distfilehashes[f]):
+				self.fhashdict["DIST"][f] = distfilehashes[f]
+			else:
+				try:
+					self.fhashdict["DIST"][f] = perform_multiple_checksums(fname, self.hashes)
+				except FileNotFound:
+					if f in requiredDistfiles:
+						raise
+
+	def _pkgdir_category(self):
+		return self.pkgdir.rstrip(os.sep).split(os.sep)[-2]
+
+	def _getAbsname(self, ftype, fname):
+		if ftype == "DIST":
+			absname = os.path.join(self.distdir, fname)
+		elif ftype == "AUX":
+			absname = os.path.join(self.pkgdir, "files", fname)
+		else:
+			absname = os.path.join(self.pkgdir, fname)
+		return absname	
+	
+	def checkAllHashes(self, ignoreMissingFiles=False):
+		for t in portage.const.MANIFEST2_IDENTIFIERS:
+			self.checkTypeHashes(t, ignoreMissingFiles=ignoreMissingFiles)
+	
+	def checkTypeHashes(self, idtype, ignoreMissingFiles=False):
+		for f in self.fhashdict[idtype]:
+			self.checkFileHashes(idtype, f, ignoreMissing=ignoreMissingFiles)
+	
+	def checkFileHashes(self, ftype, fname, ignoreMissing=False):
+		myhashes = self.fhashdict[ftype][fname]
+		try:
+			ok,reason = verify_all(self._getAbsname(ftype, fname), self.fhashdict[ftype][fname])
+			if not ok:
+				raise DigestException(tuple([self._getAbsname(ftype, fname)]+list(reason)))
+			return ok, reason
+		except FileNotFound, e:
+			if not ignoreMissing:
+				raise
+			return False, "File Not Found: '%s'" % str(e)
+
+	def checkCpvHashes(self, cpv, checkDistfiles=True, onlyDistfiles=False, checkMiscfiles=False):
+		""" check the hashes for all files associated to the given cpv, include all
+		AUX files and optionally all MISC files. """
+		if not onlyDistfiles:
+			self.checkTypeHashes("AUX", ignoreMissingFiles=False)
+			if checkMiscfiles:
+				self.checkTypeHashes("MISC", ignoreMissingFiles=False)
+			ebuildname = "%s.ebuild" % self._catsplit(cpv)[1]
+			self.checkFileHashes("EBUILD", ebuildname, ignoreMissing=False)
+		if checkDistfiles or onlyDistfiles:
+			for f in self._getCpvDistfiles(cpv):
+				self.checkFileHashes("DIST", f, ignoreMissing=False)
+	
+	def _getCpvDistfiles(self, cpv):
+		""" Get a list of all DIST files associated to the given cpv """
+		return self.fetchlist_dict[cpv]
+
+	def getDistfilesSize(self, fetchlist):
+		total_bytes = 0
+		for f in fetchlist:
+			total_bytes += int(self.fhashdict["DIST"][f]["size"])
+		return total_bytes
+
+	def updateFileHashes(self, ftype, fname, checkExisting=True, ignoreMissing=True, reuseExisting=False):
+		""" Regenerate hashes for the given file """
+		if checkExisting:
+			self.checkFileHashes(ftype, fname, ignoreMissing=ignoreMissing)
+		if not ignoreMissing and not self.fhashdict[ftype].has_key(fname):
+			raise FileNotInManifestException(fname)
+		if not self.fhashdict[ftype].has_key(fname):
+			self.fhashdict[ftype][fname] = {}
+		myhashkeys = list(self.hashes)
+		if reuseExisting:
+			for k in [h for h in self.fhashdict[ftype][fname] if h in myhashkeys]:
+				myhashkeys.remove(k)
+		myhashes = perform_multiple_checksums(self._getAbsname(ftype, fname), myhashkeys)
+		self.fhashdict[ftype][fname].update(myhashes)
+	
+	def updateTypeHashes(self, idtype, checkExisting=False, ignoreMissingFiles=True):
+		""" Regenerate all hashes for all files of the given type """
+		for fname in self.fhashdict[idtype]:
+			self.updateFileHashes(idtype, fname, checkExisting)
+	
+	def updateAllHashes(self, checkExisting=False, ignoreMissingFiles=True):
+		""" Regenerate all hashes for all files in this Manifest. """
+		for ftype in portage.const.MANIFEST2_IDENTIFIERS:
+			self.updateTypeHashes(idtype, fname, checkExisting)
+
+	def updateCpvHashes(self, cpv, ignoreMissingFiles=True):
+		""" Regenerate all hashes associated to the given cpv (includes all AUX and MISC
+		files)."""
+		self.updateTypeHashes("AUX", ignoreMissingFiles=ignoreMissingFiles)
+		self.updateTypeHashes("MISC", ignoreMissingFiles=ignoreMissingFiles)
+		ebuildname = "%s.ebuild" % self._catsplit(cpv)[1]
+		self.updateFileHashes("EBUILD", ebuildname, ignoreMissingFiles=ignoreMissingFiles)
+		for f in self._getCpvDistfiles(cpv):
+			self.updateFileHashes("DIST", f, ignoreMissingFiles=ignoreMissingFiles)
+
+	def updateHashesGuessType(self, fname, *args, **kwargs):
+		""" Regenerate hashes for the given file (guesses the type and then
+		calls updateFileHashes)."""
+		mytype = self.guessType(fname)
+		if mytype == "AUX":
+			fname = fname[len("files" + os.sep):]
+		elif mytype is None:
+			return
+		myrealtype = self.findFile(fname)
+		if myrealtype is not None:
+			mytype = myrealtype
+		return self.updateFileHashes(mytype, fname, *args, **kwargs)
+
+	def getFileData(self, ftype, fname, key):
+		""" Return the value of a specific (type,filename,key) triple, mainly useful
+		to get the size for distfiles."""
+		return self.fhashdict[ftype][fname][key]
+
+	def getVersions(self):
+		""" Returns a list of manifest versions present in the manifest file. """
+		rVal = []
+		mfname = self.getFullname()
+		if not os.path.exists(mfname):
+			return rVal
+		myfile = open(mfname, "r")
+		lines = myfile.readlines()
+		myfile.close()
+		for l in lines:
+			mysplit = l.split()
+			if len(mysplit) == 4 and mysplit[0] in portage.const.MANIFEST1_HASH_FUNCTIONS and not 1 in rVal:
+				rVal.append(1)
+			elif len(mysplit) > 4 and mysplit[0] in portage.const.MANIFEST2_IDENTIFIERS and ((len(mysplit) - 3) % 2) == 0 and not 2 in rVal:
+				rVal.append(2)
+		return rVal
+
+	def _catsplit(self, pkg_key):
+		"""Split a category and package, returning a list of [cat, pkg].
+		This is compatible with portage.catsplit()"""
+		return pkg_key.split("/", 1)
Index: /vendor/prefix-portage/current/pym/portage/news.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/news.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/news.py	(revision 3489)
@@ -0,0 +1,263 @@
+# portage: news management code
+# Copyright 2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+from portage.const import INCREMENTALS, PROFILE_PATH, NEWS_LIB_PATH
+from portage import config, vartree, vardbapi, portdbapi
+from portage.util import ensure_dirs, apply_permissions
+from portage.data import portage_gid
+from portage.locks import lockfile, unlockfile, lockdir, unlockdir
+from portage.exception import FileNotFound
+import os, re
+
+class NewsManager(object):
+	"""
+	This object manages GLEP 42 style news items.  It will cache news items
+	that have previously shown up and notify users when there are relevant news
+	items that apply to their packages that the user has not previously read.
+	
+	Creating a news manager requires:
+	root - typically ${ROOT} see man make.conf and man emerge for details
+	NEWS_PATH - path to news items; usually $REPODIR/metadata/news
+	UNREAD_PATH - path to the news.repoid.unread file; this helps us track news items
+	
+	"""
+
+	TIMESTAMP_FILE = "news-timestamp"
+
+	def __init__(self, root, NEWS_PATH, UNREAD_PATH, LANGUAGE_ID='en'):
+		self.NEWS_PATH = NEWS_PATH
+		self.UNREAD_PATH = UNREAD_PATH
+		self.TIMESTAMP_PATH = os.path.join(root, NEWS_LIB_PATH, NewsManager.TIMESTAMP_FILE)
+		self.target_root = root
+		self.LANGUAGE_ID = LANGUAGE_ID
+		self.config = config(config_root = os.environ.get("PORTAGE_CONFIGROOT", "/"),
+				target_root = root, config_incrementals = INCREMENTALS)
+		self.vdb = vardbapi(settings = self.config, root = root,
+			vartree = vartree(root = root, settings = self.config))
+		self.portdb = portdbapi(porttree_root = self.config["PORTDIR"], mysettings = self.config)
+
+		# Ensure that the unread path exists and is writable.
+		dirmode  = 02070
+		modemask =    02
+		ensure_dirs(self.UNREAD_PATH, mode=dirmode, mask=modemask, gid=portage_gid)
+
+	def updateItems(self, repoid):
+		"""
+		Figure out which news items from NEWS_PATH are both unread and relevant to
+		the user (according to the GLEP 42 standards of relevancy).  Then add these
+		items into the news.repoid.unread file.
+		"""
+
+		repos = self.portdb.getRepositories()
+		if repoid not in repos:
+			raise ValueError("Invalid repoID: %s" % repoid)
+
+		timestamp_file = self.TIMESTAMP_PATH + repoid
+		if os.path.exists(timestamp_file):
+			# Make sure the timestamp has correct permissions.
+			apply_permissions(filename=timestamp_file, 
+				uid=int(self.config["PORTAGE_INST_UID"]), gid=portage_gid, mode=0664)
+			timestamp = os.stat(timestamp_file).st_mtime
+		else:
+			timestamp = 0
+
+		path = os.path.join(self.portdb.getRepositoryPath(repoid), self.NEWS_PATH)
+
+		repo_path = self.portdb.getRepositoryPath(repoid)
+		# Skip reading news for repoid if the news dir does not exist.  Requested by
+		# NightMorph :)
+		if not os.path.exists(path):
+			return None
+		news = os.listdir(path)
+		updates = []
+		for itemid in news:
+			try:
+				filename = os.path.join(path, itemid, itemid + "." + self.LANGUAGE_ID + ".txt")
+				item = NewsItem(filename, itemid, timestamp)
+			except (TypeError, ValueError), e:
+				continue
+			if item.isRelevant(profile=os.readlink(PROFILE_PATH), config=config, vardb=self.vdb):
+				updates.append(item)
+		del path
+		
+		path = os.path.join(self.UNREAD_PATH, "news-"+repoid+".unread")
+		try:
+			unread_lock = lockfile(path)
+			if not os.path.exists(path):
+				#create the file if it does not exist
+				open(path, "w")
+			# Ensure correct perms on the unread file.
+			apply_permissions( filename=path,
+				uid=int(self.config["PORTAGE_INST_UID"]), gid=portage_gid, mode=0664)
+			# Make sure we have the correct permissions when created
+			unread_file = open(path, "a")
+
+			for item in updates:
+				unread_file.write(item.name + "\n")
+			unread_file.close()
+		finally:
+			unlockfile(unread_lock)
+		
+		# Touch the timestamp file
+		f = open(timestamp_file, "w")
+		f.close()
+
+	def getUnreadItems(self, repoid, update=False):
+		"""
+		Determine if there are unread relevant items in news.repoid.unread.
+		If there are unread items return their number.
+		If update is specified, updateNewsItems( repoid ) will be called to
+		check for new items.
+		"""
+		
+		if update:
+			self.updateItems(repoid)
+		
+		unreadfile = os.path.join(self.UNREAD_PATH, "news-"+repoid+".unread")
+		try:
+			try:
+				unread_lock = lockfile(unreadfile)
+				# Set correct permissions on the news-repoid.unread file
+				apply_permissions(filename=unreadfile,
+					uid=int(self.config["PORTAGE_INST_UID"]), gid=portage_gid, mode=0664)
+					
+				if os.path.exists(unreadfile):
+					unread = open(unreadfile).readlines()
+					if len(unread):
+						return len(unread)
+			except FileNotFound:
+				pass # unread file may not exist
+		finally:
+			if unread_lock:
+				unlockfile(unread_lock)
+
+_installedRE = re.compile("Display-If-Installed:(.*)\n")
+_profileRE = re.compile("Display-If-Profile:(.*)\n")
+_keywordRE = re.compile("Display-If-Keyword:(.*)\n")
+
+class NewsItem(object):
+	"""
+	This class encapsulates a GLEP 42 style news item.
+	It's purpose is to wrap parsing of these news items such that portage can determine
+	whether a particular item is 'relevant' or not.  This requires parsing the item
+	and determining 'relevancy restrictions'; these include "Display if Installed" or
+	"display if arch: x86" and so forth.
+
+	Creation of a news item involves passing in the path to the particular news item.
+
+	"""
+	
+	def __init__(self, path, name, cache_mtime = 0):
+		""" 
+		For a given news item we only want if it path is a file and it's 
+		mtime is newer than the cache'd timestamp.
+		"""
+		if not os.path.isfile(path):
+			raise TypeError("%s is no regular file" % path)
+		if not os.stat(path).st_mtime > cache_mtime:
+			raise ValueError("%s / %s timestamp mismatch" % (str(os.stat(path).st_mtime), str(cache_mtime)))
+		self.path = path
+		self.name = name
+		self._parsed = False
+
+	def isRelevant(self, vardb, config, profile):
+		"""
+		This function takes a dict of keyword arguments; one should pass in any
+		objects need to do to lookups (like what keywords we are on, what profile,
+		and a vardb so we can look at installed packages).
+		Each restriction will pluck out the items that are required for it to match
+		or raise a ValueError exception if the required object is not present.
+		"""
+
+		if not len(self.restrictions):
+			return True # no restrictions to match means everyone should see it
+		
+		kwargs = { 'vardb' : vardb,
+			   'config' : config,
+			   'profile' : profile }
+
+		for restriction in self.restrictions:
+			if restriction.checkRestriction(**kwargs):
+				return True
+			
+		return False # No restrictions were met; thus we aren't relevant :(
+
+	def parse(self):
+		lines = open(self.path).readlines()
+		self.restrictions = []
+		for line in lines:
+			#Optimization to ignore regex matchines on lines that
+			#will never match
+			if not line.startswith("D"):
+				continue
+			restricts = {  _installedRE : DisplayInstalledRestriction,
+					_profileRE : DisplayProfileRestriction,
+					_keywordRE : DisplayKeywordRestriction }
+			for regex, restriction in restricts.iteritems():
+				match = regex.match(line)
+				if match:
+					self.restrictions.append(restriction(match.groups()[0].strip()))
+					continue
+		self._parsed = True
+
+	def __getattr__(self, attr):
+		if not self._parsed:
+			self.parse()
+		return self.__dict__[attr]
+
+class DisplayRestriction(object):
+	"""
+	A base restriction object representing a restriction of display.
+	news items may have 'relevancy restrictions' preventing them from
+	being important.  In this case we need a manner of figuring out if
+	a particular item is relevant or not.  If any of it's restrictions
+	are met, then it is displayed
+	"""
+
+	def checkRestriction(self, **kwargs):
+		raise NotImplementedError("Derived class should over-ride this method")
+
+class DisplayProfileRestriction(DisplayRestriction):
+	"""
+	A profile restriction where a particular item shall only be displayed
+	if the user is running a specific profile.
+	"""
+
+	def __init__(self, profile):
+		self.profile = profile
+
+	def checkRestriction(self, **kwargs):
+		if self.profile == kwargs['profile']:
+			return True
+		return False
+
+class DisplayKeywordRestriction(DisplayRestriction):
+	"""
+	A keyword restriction where a particular item shall only be displayed
+	if the user is running a specific keyword.
+	"""
+
+	def __init__(self, keyword):
+		self.keyword = keyword
+
+	def checkRestriction(self, **kwargs):
+		if kwargs['config']["ARCH"] == self.keyword:
+			return True
+		return False
+
+class DisplayInstalledRestriction(DisplayRestriction):
+	"""
+	An Installation restriction where a particular item shall only be displayed
+	if the user has that item installed.
+	"""
+	
+	def __init__(self, cpv):
+		self.cpv = cpv
+
+	def checkRestriction(self, **kwargs):
+		vdb = kwargs['vardb']
+		if vdb.match(self.cpv):
+			return True
+		return False
Index: /vendor/prefix-portage/current/pym/portage/output.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/output.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/output.py	(revision 3489)
@@ -0,0 +1,559 @@
+# Copyright 1998-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: output.py 4554 2006-09-29 02:10:29Z zmedico $
+
+__docformat__ = "epytext"
+
+import commands, errno, os, re, shlex, sys, time
+from portage.const import COLOR_MAP_FILE
+from portage.util import writemsg
+from portage.exception import PortageException, ParseError, PermissionDenied, FileNotFound
+
+havecolor=1
+dotitles=1
+
+esc_seq = "\x1b["
+
+g_attr = {}
+g_attr["normal"]       =  0
+
+g_attr["bold"]         =  1
+g_attr["faint"]        =  2
+g_attr["standout"]     =  3
+g_attr["underline"]    =  4
+g_attr["blink"]        =  5
+g_attr["overline"]     =  6  # Why is overline actually useful?
+g_attr["reverse"]      =  7
+g_attr["invisible"]    =  8
+
+g_attr["no-attr"]      = 22
+g_attr["no-standout"]  = 23
+g_attr["no-underline"] = 24
+g_attr["no-blink"]     = 25
+g_attr["no-overline"]  = 26
+g_attr["no-reverse"]   = 27
+# 28 isn't defined?
+# 29 isn't defined?
+g_attr["black"]        = 30
+g_attr["red"]          = 31
+g_attr["green"]        = 32
+g_attr["yellow"]       = 33
+g_attr["blue"]         = 34
+g_attr["magenta"]      = 35
+g_attr["cyan"]         = 36
+g_attr["white"]        = 37
+# 38 isn't defined?
+g_attr["default"]      = 39
+g_attr["bg_black"]     = 40
+g_attr["bg_red"]       = 41
+g_attr["bg_green"]     = 42
+g_attr["bg_yellow"]    = 43
+g_attr["bg_blue"]      = 44
+g_attr["bg_magenta"]   = 45
+g_attr["bg_cyan"]      = 46
+g_attr["bg_white"]     = 47
+g_attr["bg_default"]   = 49
+
+
+# make_seq("blue", "black", "normal")
+def color(fg, bg="default", attr=["normal"]):
+	mystr = esc_seq[:] + "%02d" % g_attr[fg]
+	for x in [bg]+attr:
+		mystr += ";%02d" % g_attr[x]
+	return mystr+"m"
+
+
+
+codes={}
+codes["reset"]     = esc_seq + "39;49;00m"
+
+codes["bold"]      = esc_seq + "01m"
+codes["faint"]     = esc_seq + "02m"
+codes["standout"]  = esc_seq + "03m"
+codes["underline"] = esc_seq + "04m"
+codes["blink"]     = esc_seq + "05m"
+codes["overline"]  = esc_seq + "06m"  # Who made this up? Seriously.
+
+ansi_color_codes = []
+for x in xrange(30, 38):
+	ansi_color_codes.append("%im" % x)
+	ansi_color_codes.append("%i;01m" % x)
+
+rgb_ansi_colors = ['0x000000', '0x555555', '0xAA0000', '0xFF5555', '0x00AA00',
+	'0x55FF55', '0xAA5500', '0xFFFF55', '0x0000AA', '0x5555FF', '0xAA00AA',
+	'0xFF55FF', '0x00AAAA', '0x55FFFF', '0xAAAAAA', '0xFFFFFF']
+
+for x in xrange(len(rgb_ansi_colors)):
+	codes[rgb_ansi_colors[x]] = esc_seq + ansi_color_codes[x]
+
+del x
+
+codes["black"]     = codes["0x000000"]
+codes["darkgray"]  = codes["0x555555"]
+
+codes["red"]       = codes["0xFF5555"]
+codes["darkred"]   = codes["0xAA0000"]
+
+codes["green"]     = codes["0x55FF55"]
+codes["darkgreen"] = codes["0x00AA00"]
+
+codes["yellow"]    = codes["0xFFFF55"]
+codes["brown"]     = codes["0xAA5500"]
+
+codes["blue"]      = codes["0x5555FF"]
+codes["darkblue"]  = codes["0x0000AA"]
+
+codes["fuchsia"]   = codes["0xFF55FF"]
+codes["purple"]    = codes["0xAA00AA"]
+
+codes["turquoise"] = codes["0x55FFFF"]
+codes["teal"]      = codes["0x00AAAA"]
+
+codes["white"]     = codes["0xFFFFFF"]
+codes["lightgray"] = codes["0xAAAAAA"]
+
+codes["darkteal"]   = codes["turquoise"]
+codes["darkyellow"] = codes["brown"]
+codes["fuscia"]     = codes["fuchsia"]
+codes["white"]      = codes["bold"]
+
+# Colors from /sbin/functions.sh
+codes["GOOD"]       = codes["green"]
+codes["WARN"]       = codes["yellow"]
+codes["BAD"]        = codes["red"]
+codes["HILITE"]     = codes["teal"]
+codes["BRACKET"]    = codes["blue"]
+
+# Portage functions
+codes["INFORM"] = codes["darkgreen"]
+codes["UNMERGE_WARN"] = codes["red"]
+codes["SECURITY_WARN"] = codes["red"]
+codes["MERGE_LIST_PROGRESS"] = codes["yellow"]
+
+def parse_color_map():
+	myfile = COLOR_MAP_FILE
+	ansi_code_pattern = re.compile("^[0-9;]*m$")
+	def strip_quotes(token, quotes):
+		if token[0] in quotes and token[0] == token[-1]:
+			token = token[1:-1]
+		return token
+	try:
+		s = shlex.shlex(open(myfile))
+		s.wordchars = s.wordchars + ";" # for ansi codes
+		d = {}
+		while True:
+			k, o, v = s.get_token(), s.get_token(), s.get_token()
+			if k is s.eof:
+				break
+			if o != "=":
+				raise ParseError("%s%s'%s'" % (s.error_leader(myfile, s.lineno), "expected '=' operator: ", o))
+			k = strip_quotes(k, s.quotes)
+			v = strip_quotes(v, s.quotes)
+			if ansi_code_pattern.match(v):
+				codes[k] = esc_seq + v
+			else:
+				if v in codes:
+					codes[k] = codes[v]
+				else:
+					raise ParseError("%s%s'%s'" % (s.error_leader(myfile, s.lineno), "Undefined: ", v))
+	except (IOError, OSError), e:
+		if e.errno == errno.ENOENT:
+			raise FileNotFound(myfile)
+		elif e.errno == errno.EACCES:
+			raise PermissionDenied(myfile)
+		raise
+
+try:
+	parse_color_map()
+except FileNotFound, e:
+	pass
+except PortageException, e:
+	writemsg("%s\n" % str(e))
+
+def nc_len(mystr):
+	tmp = re.sub(esc_seq + "^m]+m", "", mystr);
+	return len(tmp)
+
+def xtermTitle(mystr, raw=False):
+	if dotitles and "TERM" in os.environ and sys.stderr.isatty():
+		myt=os.environ["TERM"]
+		legal_terms = ["xterm","Eterm","aterm","rxvt","screen","kterm","rxvt-unicode","gnome"]
+		for term in legal_terms:
+			if myt.startswith(term):
+				if not raw:
+					mystr = "\x1b]0;%s\x07" % mystr
+				sys.stderr.write(mystr)
+				sys.stderr.flush()
+				break
+
+default_xterm_title = None
+
+def xtermTitleReset():
+	global default_xterm_title
+	if default_xterm_title is None:
+		prompt_command = os.getenv('PROMPT_COMMAND')
+		if prompt_command == "":
+			default_xterm_title = ""
+		elif prompt_command is not None:
+			if dotitles and "TERM" in os.environ and sys.stderr.isatty():
+				from portage.process import find_binary, spawn
+				shell = os.environ.get("SHELL")
+				if not shell or not os.access(shell, os.EX_OK):
+					shell = find_binary("sh")
+				if shell:
+					spawn([shell, "-c", prompt_command], env=os.environ,
+						fdpipes={0:sys.stdin.fileno(),1:sys.stderr.fileno(),
+						2:sys.stderr.fileno()})
+				else:
+					os.system(prompt_command)
+			return
+		else:
+			pwd = os.getenv('PWD','')
+			home = os.getenv('HOME', '')
+			if home != '' and pwd.startswith(home):
+				pwd = '~' + pwd[len(home):]
+			default_xterm_title = '\x1b]0;%s@%s:%s\x07' % (
+				os.getenv('LOGNAME', ''), os.getenv('HOSTNAME', '').split('.', 1)[0], pwd)
+	xtermTitle(default_xterm_title, raw=True)
+
+def notitles():
+	"turn off title setting"
+	dotitles=0
+
+def nocolor():
+	"turn off colorization"
+	global havecolor
+	havecolor=0
+
+def resetColor():
+	return codes["reset"]
+
+def colorize(color_key, text):
+	global havecolor
+	if havecolor:
+		return codes[color_key] + text + codes["reset"]
+	else:
+		return text
+
+compat_functions_colors = ["bold","white","teal","turquoise","darkteal",
+	"fuscia","fuchsia","purple","blue","darkblue","green","darkgreen","yellow",
+	"brown","darkyellow","red","darkred"]
+
+def create_color_func(color_key):
+	def derived_func(*args):
+		newargs = list(args)
+		newargs.insert(0, color_key)
+		return colorize(*newargs)
+	return derived_func
+
+for c in compat_functions_colors:
+	globals()[c] = create_color_func(c)
+
+def get_term_size():
+	"""
+	Get the number of lines and columns of the tty that is connected to
+	stdout.  Returns a tuple of (lines, columns) or (-1, -1) if an error
+	occurs. The curses module is used if available, otherwise the output of
+	`stty size` is parsed.
+	"""
+	try:
+		import curses
+		curses.setupterm()
+		return curses.tigetnum('lines'), curses.tigetnum('cols')
+	except ImportError:
+		pass
+	st, out = commands.getstatusoutput('stty size')
+	if st == os.EX_OK:
+		out = out.split()
+		if len(out) == 2:
+			try:
+				return int(out[0]), int(out[1])
+			except ValueError:
+				pass
+	return -1, -1
+
+def set_term_size(lines, columns, fd):
+	"""
+	Set the number of lines and columns for the tty that is connected to fd.
+	For portability, this simply calls `stty rows $lines columns $columns`.
+	"""
+	from portage.process import spawn
+	cmd = ["stty", "rows", str(lines), "columns", str(columns)]
+	spawn(cmd, env=os.environ, fd_pipes={0:fd})
+
+class EOutput:
+	"""
+	Performs fancy terminal formatting for status and informational messages.
+
+	The provided methods produce identical terminal output to the eponymous
+	functions in the shell script C{/sbin/functions.sh} and also accept
+	identical parameters.
+
+	This is not currently a drop-in replacement however, as the output-related
+	functions in C{/sbin/functions.sh} are oriented for use mainly by system
+	init scripts and ebuilds and their output can be customized via certain
+	C{RC_*} environment variables (see C{/etc/conf.d/rc}). B{EOutput} is not
+	customizable in this manner since it's intended for more general uses.
+	Likewise, no logging is provided.
+
+	@ivar quiet: Specifies if output should be silenced.
+	@type quiet: BooleanType
+	@ivar term_columns: Width of terminal in characters. Defaults to the value
+		specified by the shell's C{COLUMNS} variable, else to the queried tty
+		size, else to C{80}.
+	@type term_columns: IntType
+	"""
+
+	def __init__(self):
+		self.__last_e_cmd = ""
+		self.__last_e_len = 0
+		self.quiet = False
+		lines, columns = get_term_size()
+		if columns <= 0:
+			columns = 80
+		# Adjust columns so that eend works properly on a standard BSD console.
+		if os.environ.get("TERM") == "cons25":
+			columns = columns - 1
+		self.term_columns = columns
+
+	def __eend(self, caller, errno, msg):
+		if errno == 0:
+			status_brackets = colorize("BRACKET", "[ ") + colorize("GOOD", "ok") + colorize("BRACKET", " ]")
+		else:
+			status_brackets = colorize("BRACKET", "[ ") + colorize("BAD", "!!") + colorize("BRACKET", " ]")
+			if msg:
+				if caller == "eend":
+					self.eerror(msg[0])
+				elif caller == "ewend":
+					self.ewarn(msg[0])
+		if self.__last_e_cmd != "ebegin":
+			self.__last_e_len = 0
+		print "%*s%s" % ((self.term_columns - self.__last_e_len - 6), "", status_brackets)
+		sys.stdout.flush()
+
+	def ebegin(self, msg):
+		"""
+		Shows a message indicating the start of a process.
+
+		@param msg: A very brief (shorter than one line) description of the
+			starting process.
+		@type msg: StringType
+		"""
+		msg += " ..."
+		if not self.quiet:
+			self.einfon(msg)
+		self.__last_e_len = len(msg) + 4
+		self.__last_e_cmd = "ebegin"
+
+	def eend(self, errno, *msg):
+		"""
+		Indicates the completion of a process, optionally displaying a message
+		via L{eerror} if the process's exit status isn't C{0}.
+
+		@param errno: A standard UNIX C{errno} code returned by processes upon
+			exit.
+		@type errno: IntType
+		@param msg: I{(optional)} An error message, typically a standard UNIX
+			error string corresponding to C{errno}.
+		@type msg: StringType
+		"""
+		if not self.quiet:
+			self.__eend("eend", errno, msg)
+		self.__last_e_cmd = "eend"
+
+	def eerror(self, msg):
+		"""
+		Shows an error message.
+
+		@param msg: A very brief (shorter than one line) error message.
+		@type msg: StringType
+		"""
+		if not self.quiet:
+			if self.__last_e_cmd == "ebegin": print
+			print colorize("BAD", " * ") + msg
+			sys.stdout.flush()
+		self.__last_e_cmd = "eerror"
+
+	def einfo(self, msg):
+		"""
+		Shows an informative message terminated with a newline.
+
+		@param msg: A very brief (shorter than one line) informative message.
+		@type msg: StringType
+		"""
+		if not self.quiet:
+			if self.__last_e_cmd == "ebegin": print
+			print colorize("GOOD", " * ") + msg
+			sys.stdout.flush()
+		self.__last_e_cmd = "einfo"
+
+	def einfon(self, msg):
+		"""
+		Shows an informative message terminated without a newline.
+
+		@param msg: A very brief (shorter than one line) informative message.
+		@type msg: StringType
+		"""
+		if not self.quiet:
+			if self.__last_e_cmd == "ebegin": print
+			print colorize("GOOD", " * ") + msg ,
+			sys.stdout.flush()
+		self.__last_e_cmd = "einfon"
+
+	def ewarn(self, msg):
+		"""
+		Shows a warning message.
+
+		@param msg: A very brief (shorter than one line) warning message.
+		@type msg: StringType
+		"""
+		if not self.quiet:
+			if self.__last_e_cmd == "ebegin": print
+			print colorize("WARN", " * ") + msg
+			sys.stdout.flush()
+		self.__last_e_cmd = "ewarn"
+
+	def ewend(self, errno, *msg):
+		"""
+		Indicates the completion of a process, optionally displaying a message
+		via L{ewarn} if the process's exit status isn't C{0}.
+
+		@param errno: A standard UNIX C{errno} code returned by processes upon
+			exit.
+		@type errno: IntType
+		@param msg: I{(optional)} A warning message, typically a standard UNIX
+			error string corresponding to C{errno}.
+		@type msg: StringType
+		"""
+		if not self.quiet:
+			self.__eend("ewend", errno, msg)
+		self.__last_e_cmd = "ewend"
+
+class ProgressBar(object):
+	"""The interface is copied from the ProgressBar class from the EasyDialogs
+	module (which is Mac only)."""
+	def __init__(self, title=None, maxval=0, label=None):
+		self._title = title
+		self._maxval = maxval
+		self._label = maxval
+		self._curval = 0
+
+	@property
+	def curval(self):
+		"""
+		The current value (of type integer or long integer) of the progress
+		bar. The normal access methods coerce curval between 0 and maxval. This
+		attribute should not be altered directly.
+		"""
+		return self._curval
+
+	@property
+	def maxval(self):
+		"""
+		The maximum value (of type integer or long integer) of the progress
+		bar; the progress bar (thermometer style) is full when curval equals
+		maxval. If maxval is 0, the bar will be indeterminate (barber-pole).
+		This attribute should not be altered directly.
+		"""
+		return self._maxval
+
+	def title(self, newstr):
+		"""Sets the text in the title bar of the progress dialog to newstr."""
+		self._title = newstr
+
+	def label(self, newstr):
+		"""Sets the text in the progress box of the progress dialog to newstr."""
+		self._label = newstr
+
+	def set(self, value, maxval=None):
+		"""
+		Sets the progress bar's curval to value, and also maxval to max if the
+		latter is provided. value is first coerced between 0 and maxval. The
+		thermometer bar is updated to reflect the changes, including a change
+		from indeterminate to determinate or vice versa.
+		"""
+		if maxval is not None:
+			self._maxval = maxval
+		if value < 0:
+			value = 0
+		elif value > self._maxval:
+			value = self._maxval
+		self._curval = value
+
+	def inc(self, n=1):
+		"""Increments the progress bar's curval by n, or by 1 if n is not
+		provided. (Note that n may be negative, in which case the effect is a
+		decrement.) The progress bar is updated to reflect the change. If the
+		bar is indeterminate, this causes one ``spin'' of the barber pole. The
+		resulting curval is coerced between 0 and maxval if incrementing causes
+		it to fall outside this range.
+		"""
+		self.set(self._curval+n)
+
+class TermProgressBar(ProgressBar):
+	"""A tty progress bar similar to wget's."""
+	def __init__(self, **kwargs):
+		ProgressBar.__init__(self, **kwargs)
+		lines, self.term_columns = get_term_size()
+		self.file = sys.stdout
+		self._min_columns = 11
+		self._max_columns = 80
+		# for indeterminate mode, ranges from 0.0 to 1.0
+		self._position = 0.0
+
+	def set(self, value, maxval=None):
+		ProgressBar.set(self, value, maxval=maxval)
+		self._display_image(self._create_image())
+
+	def _display_image(self, image):
+		self.file.write('\r')
+		self.file.write(image)
+		self.file.flush()
+
+	def _create_image(self):
+		cols = self.term_columns
+		if cols > self._max_columns:
+			cols = self._max_columns
+		min_columns = self._min_columns
+		curval = self._curval
+		maxval = self._maxval
+		position = self._position
+		if cols < 3:
+			return ""
+		bar_space = cols - 6
+		if maxval == 0:
+			max_bar_width = bar_space-3
+			image = "    "
+			if cols < min_columns:
+				return image
+			if position <= 0.5:
+				offset = 2 * position
+			else:
+				offset = 2 * (1 - position)
+			delta = 0.5 / max_bar_width
+			position += delta
+			if position >= 1.0:
+				position = 0.0
+			# make sure it touches the ends
+			if 1.0 - position < delta:
+				position = 1.0
+			if position < 0.5 and 0.5 - position < delta:
+				position = 0.5
+			self._position = position
+			bar_width = int(offset * max_bar_width)
+			image = image + "[" + (bar_width * " ") + \
+				"<=>" + ((max_bar_width - bar_width) * " ") + "]"
+			return image
+		else:
+			max_bar_width = bar_space-1
+			percentage = int(100 * float(curval) / maxval)
+			if percentage == 100:
+				percentage = 99
+			image = ("%d%% " % percentage).rjust(4)
+			if cols < min_columns:
+				return image
+			offset = float(curval) / maxval
+			bar_width = int(offset * max_bar_width)
+			image = image + "[" + (bar_width * "=") + \
+				">" + ((max_bar_width - bar_width) * " ") + "]"
+			return image
Index: /vendor/prefix-portage/current/pym/portage/process.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/process.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/process.py	(revision 3489)
@@ -0,0 +1,353 @@
+# portage.py -- core Portage functionality
+# Copyright 1998-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: process.py 6752 2007-06-08 07:10:30Z grobian $
+
+
+import os, atexit, signal, sys
+import portage.data
+
+from portage.util import dump_traceback
+from portage.const import BASH_BINARY, SANDBOX_BINARY
+from portage.exception import CommandNotFound
+
+try:
+	import resource
+	max_fd_limit = resource.getrlimit(resource.RLIMIT_NOFILE)[0]
+except ImportError:
+	max_fd_limit = 256
+
+if os.path.isdir("/proc/%i/fd" % os.getpid()):
+	def get_open_fds():
+		return map(int, [fd for fd in os.listdir("/proc/%i/fd" % os.getpid()) if fd.isdigit()])
+else:
+	def get_open_fds():
+		return xrange(max_fd_limit)
+
+sandbox_capable = (os.path.isfile(SANDBOX_BINARY) and
+                   os.access(SANDBOX_BINARY, os.X_OK))
+
+def spawn_bash(mycommand, debug=False, opt_name=None, **keywords):
+	"""
+	Spawns a bash shell running a specific commands
+	
+	@param mycommand: The command for bash to run
+	@type mycommand: String
+	@param debug: Turn bash debugging on (set -x)
+	@type debug: Boolean
+	@param opt_name: Name of the spawned process (detaults to binary name)
+	@type opt_name: String
+	@param keywords: Extra Dictionary arguments to pass to spawn
+	@type keywords: Dictionary
+	"""
+
+	args = [BASH_BINARY]
+	if not opt_name:
+		opt_name = os.path.basename(mycommand.split()[0])
+	if debug:
+		# Print commands and their arguments as they are executed.
+		args.append("-x")
+	args.append("-c")
+	args.append(mycommand)
+	return spawn(args, opt_name=opt_name, **keywords)
+
+def spawn_sandbox(mycommand, opt_name=None, **keywords):
+	if not sandbox_capable:
+		return spawn_bash(mycommand, opt_name=opt_name, **keywords)
+	args=[SANDBOX_BINARY]
+	if not opt_name:
+		opt_name = os.path.basename(mycommand.split()[0])
+	args.append(mycommand)
+	return spawn(args, opt_name=opt_name, **keywords)
+
+_exithandlers = []
+def atexit_register(func, *args, **kargs):
+	"""Wrapper around atexit.register that is needed in order to track
+	what is registered.  For example, when portage restarts itself via
+	os.execv, the atexit module does not work so we have to do it
+	manually by calling the run_exitfuncs() function in this module."""
+	_exithandlers.append((func, args, kargs))
+
+def run_exitfuncs():
+	"""This should behave identically to the routine performed by
+	the atexit module at exit time.  It's only necessary to call this
+	function when atexit will not work (because of os.execv, for
+	example)."""
+
+	# This function is a copy of the private atexit._run_exitfuncs()
+	# from the python 2.4.2 sources.  The only difference from the
+	# original function is in the output to stderr.
+	exc_info = None
+	while _exithandlers:
+		func, targs, kargs = _exithandlers.pop()
+		try:
+			func(*targs, **kargs)
+		except SystemExit:
+			exc_info = sys.exc_info()
+		except: # No idea what they called, so we need this broad except here.
+			dump_traceback("Error in portage.process.run_exitfuncs", noiselevel=0)
+			exc_info = sys.exc_info()
+
+	if exc_info is not None:
+		raise exc_info[0], exc_info[1], exc_info[2]
+
+atexit.register(run_exitfuncs)
+
+# We need to make sure that any processes spawned are killed off when
+# we exit. spawn() takes care of adding and removing pids to this list
+# as it creates and cleans up processes.
+spawned_pids = []
+def cleanup():
+	while spawned_pids:
+		pid = spawned_pids.pop()
+		try:
+			if os.waitpid(pid, os.WNOHANG) == (0, 0):
+				os.kill(pid, signal.SIGTERM)
+				os.waitpid(pid, 0)
+		except OSError:
+			# This pid has been cleaned up outside
+			# of spawn().
+			pass
+
+atexit_register(cleanup)
+
+# Make sure the original terminal attributes are reverted at exit.
+if hasattr(sys.stdin, "isatty") and sys.stdin.isatty():
+	import termios
+	_stdin_termios = termios.tcgetattr(sys.stdin.fileno())
+	def _reset_stdin_termios(stdin_termios):
+		import termios
+		termios.tcsetattr(sys.stdin.fileno(), termios.TCSAFLUSH, stdin_termios)
+	atexit_register(_reset_stdin_termios, _stdin_termios)
+	del termios, _stdin_termios, _reset_stdin_termios
+
+def spawn(mycommand, env={}, opt_name=None, fd_pipes=None, returnpid=False,
+          uid=None, gid=None, groups=None, umask=None, logfile=None,
+          path_lookup=True, pre_exec=None):
+	"""
+	Spawns a given command.
+	
+	@param mycommand: the command to execute
+	@type mycommand: String or List (Popen style list)
+	@param env: A dict of Key=Value pairs for env variables
+	@type env: Dictionary
+	@param opt_name: an optional name for the spawn'd process (defaults to the binary name)
+	@type opt_name: String
+	@param fd_pipes: A dict of mapping for pipes, { '0': stdin, '1': stdout } for example
+	@type fd_pipes: Dictionary
+	@param returnpid: Return the Process IDs for a successful spawn.
+	NOTE: This requires the caller clean up all the PIDs, otherwise spawn will clean them.
+	@type returnpid: Boolean
+	@param uid: User ID to spawn as; useful for dropping privilages
+	@type uid: Integer
+	@param gid: Group ID to spawn as; useful for dropping privilages
+	@type gid: Integer
+	@param groups: Group ID's to spawn in: useful for having the process run in multiple group contexts.
+	@type groups: List
+	@param umask: An integer representing the umask for the process (see man chmod for umask details)
+	@type umask: Integer
+	@param logfile: name of a file to use for logging purposes
+	@type logfile: String
+	@param path_lookup: If the binary is not fully specified then look for it in PATH
+	@type path_lookup: Boolean
+	@param pre_exec: A function to be called with no arguments just prior to the exec call.
+	@type pre_exec: callable
+	
+	logfile requires stdout and stderr to be assigned to this process (ie not pointed
+	   somewhere else.)
+	
+	"""
+
+	# mycommand is either a str or a list
+	if isinstance(mycommand, str):
+		mycommand = mycommand.split()
+
+	# If an absolute path to an executable file isn't given
+	# search for it unless we've been told not to.
+	binary = mycommand[0]
+	if (not os.path.isabs(binary) or not os.path.isfile(binary)
+	    or not os.access(binary, os.X_OK)):
+		binary = path_lookup and find_binary(binary) or None
+		if not binary:
+			raise CommandNotFound(mycommand[0])
+
+	# If we haven't been told what file descriptors to use
+	# default to propogating our stdin, stdout and stderr.
+	if fd_pipes is None:
+		fd_pipes = {0:0, 1:1, 2:2}
+
+	# mypids will hold the pids of all processes created.
+	mypids = []
+
+	if logfile:
+		# Using a log file requires that stdout and stderr
+		# are assigned to the process we're running.
+		if 1 not in fd_pipes or 2 not in fd_pipes:
+			raise ValueError(fd_pipes)
+
+		# Create a pipe
+		(pr, pw) = os.pipe()
+
+		# Create a tee process, giving it our stdout and stderr
+		# as well as the read end of the pipe.
+		mypids.extend(spawn(('tee', '-i', '-a', logfile),
+		              returnpid=True, fd_pipes={0:pr,
+		              1:fd_pipes[1], 2:fd_pipes[2]}))
+
+		# We don't need the read end of the pipe, so close it.
+		os.close(pr)
+
+		# Assign the write end of the pipe to our stdout and stderr.
+		fd_pipes[1] = pw
+		fd_pipes[2] = pw
+
+	pid = os.fork()
+
+	if not pid:
+		try:
+			_exec(binary, mycommand, opt_name, fd_pipes,
+			      env, gid, groups, uid, umask, pre_exec)
+		except Exception, e:
+			# We need to catch _any_ exception so that it doesn't
+			# propogate out of this function and cause exiting
+			# with anything other than os._exit()
+			sys.stderr.write("%s:\n   %s\n" % (e, " ".join(mycommand)))
+			sys.stderr.flush()
+			os._exit(1)
+
+	# Add the pid to our local and the global pid lists.
+	mypids.append(pid)
+	spawned_pids.append(pid)
+
+	# If we started a tee process the write side of the pipe is no
+	# longer needed, so close it.
+	if logfile:
+		os.close(pw)
+
+	# If the caller wants to handle cleaning up the processes, we tell
+	# it about all processes that were created.
+	if returnpid:
+		return mypids
+
+	# Otherwise we clean them up.
+	while mypids:
+
+		# Pull the last reader in the pipe chain. If all processes
+		# in the pipe are well behaved, it will die when the process
+		# it is reading from dies.
+		pid = mypids.pop(0)
+
+		# and wait for it.
+		retval = os.waitpid(pid, 0)[1]
+
+		# When it's done, we can remove it from the
+		# global pid list as well.
+		spawned_pids.remove(pid)
+
+		if retval:
+			# If it failed, kill off anything else that
+			# isn't dead yet.
+			for pid in mypids:
+				if os.waitpid(pid, os.WNOHANG) == (0,0):
+					os.kill(pid, signal.SIGTERM)
+					os.waitpid(pid, 0)
+				spawned_pids.remove(pid)
+
+			# If it got a signal, return the signal that was sent.
+			if (retval & 0xff):
+				return ((retval & 0xff) << 8)
+
+			# Otherwise, return its exit code.
+			return (retval >> 8)
+
+	# Everything succeeded
+	return 0
+
+def _exec(binary, mycommand, opt_name, fd_pipes, env, gid, groups, uid, umask,
+	pre_exec):
+
+	"""
+	Execute a given binary with options
+	
+	@param binary: Name of program to execute
+	@type binary: String
+	@param mycommand: Options for program
+	@type mycommand: String
+	@param opt_name: Name of process (defaults to binary)
+	@type opt_name: String
+	@param fd_pipes: Mapping pipes to destination; { 0:0, 1:1, 2:2 }
+	@type fd_pipes: Dictionary
+	@param env: Key,Value mapping for Environmental Variables
+	@type env: Dictionary
+	@param gid: Group ID to run the process under
+	@type gid: Integer
+	@param groups: Groups the Process should be in.
+	@type groups: Integer
+	@param uid: User ID to run the process under
+	@type uid: Integer
+	@param umask: an int representing a unix umask (see man chmod for umask details)
+	@type umask: Integer
+	@param pre_exec: A function to be called with no arguments just prior to the exec call.
+	@type pre_exec: callable
+	@rtype: None
+	@returns: Never returns (calls os.execve)
+	"""
+	
+	# If the process we're creating hasn't been given a name
+	# assign it the name of the executable.
+	if not opt_name:
+		opt_name = os.path.basename(binary)
+
+	# Set up the command's argument list.
+	myargs = [opt_name]
+	myargs.extend(mycommand[1:])
+
+	# Set up the command's pipes.
+	my_fds = {}
+	# To protect from cases where direct assignment could
+	# clobber needed fds ({1:2, 2:1}) we first dupe the fds
+	# into unused fds.
+	for fd in fd_pipes:
+		my_fds[fd] = os.dup(fd_pipes[fd])
+	# Then assign them to what they should be.
+	for fd in my_fds:
+		os.dup2(my_fds[fd], fd)
+	# Then close _all_ fds that haven't been explictly
+	# requested to be kept open.
+	for fd in get_open_fds():
+		if fd not in my_fds:
+			try:
+				os.close(fd)
+			except OSError:
+				pass
+
+	# Set requested process permissions.
+	if gid:
+		os.setgid(gid)
+	if groups:
+		os.setgroups(groups)
+	if uid:
+		os.setuid(uid)
+	if umask:
+		os.umask(umask)
+	if pre_exec:
+		pre_exec()
+
+	# And switch to the new process.
+	os.execve(binary, myargs, env)
+
+def find_binary(binary):
+	"""
+	Given a binary name, find the binary in PATH
+	
+	@param binary: Name of the binary to find
+	@type string
+	@rtype: None or string
+	@returns: full path to binary or None if the binary could not be located.
+	"""
+	
+	for path in os.getenv("PATH", "").split(":"):
+		filename = "%s/%s" % (path, binary)
+		if os.access(filename, os.X_OK) and os.path.isfile(filename):
+			return filename
+	return None
Index: /vendor/prefix-portage/current/pym/portage/selinux.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/selinux.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/selinux.py	(revision 3489)
@@ -0,0 +1,8 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+import selinux
+from selinux import is_selinux_enabled
+from selinux_aux import setexec, secure_symlink, secure_rename, \
+	secure_copy, secure_mkdir, getcontext, get_sid, get_lsid
Index: /vendor/prefix-portage/current/pym/portage/tests/__init__.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/__init__.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/__init__.py	(revision 3489)
@@ -0,0 +1,167 @@
+# tests/__init__.py -- Portage Unit Test functionality
+# Copyright 2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: __init__.py 6312 2007-03-28 19:20:08Z grobian $
+
+import os, sys, time, unittest
+import portage.tests
+
+def main():
+	testDirs = ["bin", "util","versions", "dep", "xpak", "env/config"]
+	suite = unittest.TestSuite()
+	basedir = os.path.dirname(__file__)
+	for mydir in testDirs:
+		suite.addTests(getTests(os.path.join(basedir, mydir), basedir) )
+	return portage.tests.TextTestRunner(verbosity=2).run(suite)
+
+def my_import(name):
+	mod = __import__(name)
+	components = name.split('.')
+	for comp in components[1:]:
+		mod = getattr(mod, comp)
+	return mod
+
+def getTests( path, base_path ):
+	"""
+
+	path is the path to a given subdir ( 'portage/' for example)
+	This does a simple filter on files in that dir to give us modules
+	to import
+
+	"""
+	import os
+	files = os.listdir( path )
+	files = [ f[:-3] for f in files if f.startswith("test_") and f.endswith(".py") ]
+	parent_path = path[len(base_path)+1:]
+	parent_module = ".".join(("portage","tests", parent_path))
+	parent_module = parent_module.replace('/','.')
+	result = []
+	for mymodule in files:
+		# Make the trailing / a . for module importing
+		modname = ".".join((parent_module, mymodule))
+		mod = my_import(modname)
+		result.append( unittest.TestLoader().loadTestsFromModule(mod) )
+	return result
+
+class TextTestResult(unittest._TextTestResult):
+	"""
+	We need a subclass of unittest._TextTestResult to handle tests with TODO
+
+	This just adds an addTodo method that can be used to add tests
+	that are marked TODO; these can be displayed later
+	by the test runner.
+	"""
+	
+	def __init__( self, stream, descriptions, verbosity ):
+		unittest._TextTestResult.__init__( self, stream, descriptions, verbosity )
+		self.todoed = []
+
+	def addTodo( self, test, info ):
+		self.todoed.append((test,info))
+		if self.showAll:
+			self.stream.writeln("TODO")
+		elif self.dots:
+			self.stream.write(".")
+	
+	def printErrors( self ):
+		if self.dots or self.showAll:
+			self.stream.writeln()
+			self.printErrorList('ERROR', self.errors)
+			self.printErrorList('FAIL', self.failures)
+			self.printErrorList('TODO', self.todoed)
+	
+class TestCase(unittest.TestCase):
+	"""
+	We need a way to mark a unit test as "ok to fail"
+	This way someone can add a broken test and mark it as failed
+	and then fix the code later.  This may not be a great approach
+	(broken code!!??!11oneone) but it does happen at times.
+	"""
+	
+	def __init__(self, methodName='runTest'):
+		# This method exists because unittest.py in python 2.4 stores
+		# the methodName as __testMethodName while 2.5 uses
+		# _testMethodName.
+		self._testMethodName = methodName
+		unittest.TestCase.__init__(self, methodName)
+		self.todo = False
+		
+	def defaultTestResult(self):
+		return TextTestResult()
+
+	def run( self, result=None ):
+		if result is None: result = self.defaultTestResult()
+		result.startTest(self)
+		testMethod = getattr(self, self._testMethodName)
+		try:
+			try:
+				self.setUp()
+			except KeyboardInterrupt:
+				raise
+			except:
+				result.addError(self, sys.exc_info())
+				return
+			ok = False
+			try:
+				testMethod()
+				ok = True
+			except self.failureException:
+				if self.todo:
+					result.addTodo(self,"%s: TODO" % testMethod)
+				else:
+					result.addFailure(self, sys.exc_info())
+			except (KeyboardInterrupt, SystemExit):
+				raise
+			except:
+				result.addError(self, sys.exc_info())
+			try:
+				self.tearDown()
+			except KeyboardInterrupt:
+				raise
+			except:
+				result.addError(self, sys.exc_info())
+				ok = False
+			if ok: result.addSuccess(self)
+		finally:
+			result.stopTest(self)
+			
+class TextTestRunner(unittest.TextTestRunner):
+	"""
+	We subclass unittest.TextTestRunner to output SKIP for tests that fail but are skippable
+	"""
+	
+	def _makeResult(self):
+	        return TextTestResult(self.stream, self.descriptions, self.verbosity)
+
+	def run( self, test ):
+		"""
+		Run the given test case or test suite.
+		"""
+		result = self._makeResult()
+		startTime = time.time()
+		test(result)
+		stopTime = time.time()
+		timeTaken = stopTime - startTime
+		result.printErrors()
+		self.stream.writeln(result.separator2)
+		run = result.testsRun
+		self.stream.writeln("Ran %d test%s in %.3fs" %
+							(run, run != 1 and "s" or "", timeTaken))
+		self.stream.writeln()
+		if not result.wasSuccessful():
+			self.stream.write("FAILED (")
+			failed, errored = map(len, (result.failures, result.errors))
+			if failed:
+				self.stream.write("failures=%d" % failed)
+			if errored:
+				if failed: self.stream.write(", ")
+				self.stream.write("errors=%d" % errored)
+			self.stream.writeln(")")
+		else:
+			self.stream.writeln("OK")
+		return result
+	
+test_cps = ['sys-apps/portage','virtual/portage']
+test_versions = ['1.0', '1.0-r1','2.3_p4','1.0_alpha57']
+test_slots = [ None, '1','gentoo-sources-2.6.17','spankywashere']
+test_usedeps = ['foo','-bar', ['foo','bar'],['foo','-bar'] ]
Index: /vendor/prefix-portage/current/pym/portage/tests/bin/setup_env.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/bin/setup_env.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/bin/setup_env.py	(revision 3489)
@@ -0,0 +1,69 @@
+# setup_env.py -- Make sure bin subdir has sane env for testing
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: test_dep_getcpv.py 6182 2007-03-06 07:35:22Z antarus $
+
+import os, shutil, sys
+from os.path import dirname, abspath, join
+from portage.tests import TestCase
+from portage.process import spawn
+
+bindir = join(dirname(dirname(abspath(__file__))), "..", "..", "..", "bin")
+basedir = join(dirname(dirname(abspath(__file__))), "bin", "root")
+os.environ["D"] = os.path.join(basedir, "image")
+os.environ["T"] = os.path.join(basedir, "temp")
+os.environ["S"] = os.path.join(basedir, "workdir")
+os.environ["PF"] = "portage-tests-0.09-r1"
+os.environ["PATH"] = bindir + ":" + os.environ["PATH"]
+
+def binTestsCleanup():
+	if os.access(basedir, os.W_OK):
+		shutil.rmtree(basedir)
+def binTestsInit():
+	binTestsCleanup()
+	os.mkdir(basedir)
+	os.mkdir(os.environ["D"])
+	os.mkdir(os.environ["T"])
+	os.mkdir(os.environ["S"])
+	os.chdir(os.environ["S"])
+
+class BinTestCase(TestCase):
+	def __init__(self, methodName):
+		TestCase.__init__(self, methodName)
+		binTestsInit()
+	def __del__(self):
+		binTestsCleanup()
+		if hasattr(TestCase, "__del__"):
+			TestCase.__del__(self)
+
+def _exists_in_D(path):
+	# Note: do not use os.path.join() here, we assume D to end in /
+	return os.access(os.environ["D"] + path, os.W_OK)
+def exists_in_D(path):
+	if not _exists_in_D(path):
+		raise TestCase.failureException
+def xexists_in_D(path):
+	if _exists_in_D(path):
+		raise TestCase.failureException
+
+def portage_func(func, args, exit_status=0):
+	# we don't care about the output of the programs,
+	# just their exit value and the state of $D
+	f = open('/dev/null', 'w')
+	fd_pipes = {0:0,1:f.fileno(),2:f.fileno()}
+	spawn(func+" "+args, env=os.environ, fd_pipes=fd_pipes)
+	f.close()
+
+def create_portage_wrapper(bin):
+	def derived_func(*args):
+		newargs = list(args)
+		newargs.insert(0, bin)
+		return portage_func(*newargs)
+	return derived_func
+
+for bin in os.listdir(bindir):
+	if bin.startswith("do") or \
+	   bin.startswith("new") or \
+	   bin.startswith("prep") or \
+	   bin in ["ecompress","ecompressdir","fowners","fperms"]:
+		globals()[bin] = create_portage_wrapper(bin)
Index: /vendor/prefix-portage/current/pym/portage/tests/bin/test_dobin.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/bin/test_dobin.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/bin/test_dobin.py	(revision 3489)
@@ -0,0 +1,13 @@
+# test_dobin.py -- Portage Unit Testing Functionality
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: test_dep_getcpv.py 6182 2007-03-06 07:35:22Z antarus $
+
+from setup_env import *
+
+class DoBin(BinTestCase):
+	def testDoBin(self):
+		dobin("does-not-exist", 1)
+		xexists_in_D("does-not-exist")
+		xexists_in_D("/bin/does-not-exist")
+		xexists_in_D("/usr/bin/does-not-exist")
Index: /vendor/prefix-portage/current/pym/portage/tests/bin/test_dodir.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/bin/test_dodir.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/bin/test_dodir.py	(revision 3489)
@@ -0,0 +1,13 @@
+# test_dodir.py -- Portage Unit Testing Functionality
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: test_dodir.py 6182 2007-03-06 07:35:22Z antarus $
+
+from setup_env import *
+
+class DoDir(BinTestCase):
+	def testDoDir(self):
+		dodir("usr /usr")
+		exists_in_D("/usr")
+		dodir("/var/lib/moocow")
+		exists_in_D("/var/lib/moocow")
Index: /vendor/prefix-portage/current/pym/portage/tests/dep/__init__.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/dep/__init__.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/dep/__init__.py	(revision 3489)
@@ -0,0 +1,4 @@
+# tests/portage.dep/__init__.py -- Portage Unit Test functionality
+# Copyright 2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: __init__.py 6312 2007-03-28 19:20:08Z grobian $
Index: /vendor/prefix-portage/current/pym/portage/tests/dep/test_dep_getcpv.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/dep/test_dep_getcpv.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/dep/test_dep_getcpv.py	(revision 3489)
@@ -0,0 +1,41 @@
+# test_dep_getcpv.py -- Portage Unit Testing Functionality
+# Copyright 2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: test_dep_getcpv.py 6312 2007-03-28 19:20:08Z grobian $
+
+from portage.tests import TestCase
+from portage.dep import dep_getcpv
+
+class DepGetCPV(TestCase):
+	""" A simple testcase for isvalidatom
+	"""
+
+	def testDepGetCPV(self):
+		
+		prefix_ops = ["<", ">", "=", "~", "!", "<=", 
+			      ">=", "!=", "!<", "!>", "!~",""]
+
+		bad_prefix_ops = [ ">~", "<~", "~>", "~<" ]
+		postfix_ops = [ "*", "" ]
+
+		cpvs = ["sys-apps/portage", "sys-apps/portage-2.1", "sys-apps/portage-2.1",
+				"sys-apps/portage-2.1"]
+		slots = [None,":",":2"]
+		for cpv in cpvs:
+			for slot in slots:
+				for prefix in prefix_ops:
+					for postfix in postfix_ops:
+						if slot:
+							self.assertEqual( dep_getcpv( 
+								prefix + cpv + slot + postfix ), cpv )
+						else:
+							self.assertEqual( dep_getcpv( 
+								prefix + cpv + postfix ), cpv )
+				for prefix in bad_prefix_ops:
+					for postfix in postfix_ops:
+						if slot:
+							self.assertNotEqual( dep_getcpv(
+								prefix + cpv + slot + postfix ), cpv )
+						else:
+							self.assertNotEqual( dep_getcpv(
+								prefix + cpv + postfix ), cpv )
Index: /vendor/prefix-portage/current/pym/portage/tests/dep/test_dep_getslot.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/dep/test_dep_getslot.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/dep/test_dep_getslot.py	(revision 3489)
@@ -0,0 +1,31 @@
+# test_dep_getslot.py -- Portage Unit Testing Functionality
+# Copyright 2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: test_dep_getslot.py 6312 2007-03-28 19:20:08Z grobian $
+
+from portage.tests import TestCase
+from portage.dep import dep_getslot
+
+class DepGetSlot(TestCase):
+	""" A simple testcase for isvalidatom
+	"""
+
+	def testDepGetSlot(self):
+
+		slot_char = ":"
+		slots = ( "a", "1.2", "1", "IloveVapier", None )
+		cpvs = ["sys-apps/portage"]
+		versions = ["2.1.1","2.1-r1"]
+		for cpv in cpvs:
+			for version in versions:
+				for slot in slots:
+					mycpv = cpv[:]
+					if version:
+						cpv += version
+					if slot:
+						self.assertEqual( dep_getslot( 
+							cpv + slot_char + slot ), slot )
+					else:
+						self.assertEqual( dep_getslot( cpv ), slot )
+
+		self.assertEqual( dep_getslot( "sys-apps/portage:"), "" )
Index: /vendor/prefix-portage/current/pym/portage/tests/dep/test_dep_getusedeps.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/dep/test_dep_getusedeps.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/dep/test_dep_getusedeps.py	(revision 3489)
@@ -0,0 +1,38 @@
+# test_dep_getusedeps.py -- Portage Unit Testing Functionality
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: test_dep_getslot.py 5794 2007-01-27 18:16:08Z antarus $
+
+from portage.tests import TestCase
+from portage.dep import dep_getusedeps
+
+import sys
+from portage.tests import test_cps, test_slots, test_versions, test_usedeps
+
+class DepGetUseDeps(TestCase):
+	""" A simple testcase for dep_getusedeps
+	"""
+
+	def testDepGetUseDeps(self):
+
+		for mycpv in test_cps:
+			for version in test_versions:
+				for slot in test_slots:
+					for use in test_usedeps:
+						cpv = mycpv[:]
+						if version:
+							cpv += version
+						if slot:
+							cpv += ":" + slot
+						if isinstance( use, list ):
+							for u in use:
+								cpv = cpv + "[" + u + "]"
+							self.assertEqual( dep_getusedeps(
+								cpv ), use )
+						else:
+							if len(use):
+								self.assertEqual( dep_getusedeps(
+									cpv + "[" + use + "]" ), [use] )
+							else:
+								self.assertEqual( dep_getusedeps(
+									cpv + "[" + use + "]" ), [] )
Index: /vendor/prefix-portage/current/pym/portage/tests/dep/test_get_operator.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/dep/test_get_operator.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/dep/test_get_operator.py	(revision 3489)
@@ -0,0 +1,31 @@
+# test_get_operator.py -- Portage Unit Testing Functionality
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: test_get_operator.py 6312 2007-03-28 19:20:08Z grobian $
+
+from portage.tests import TestCase
+from portage.dep import get_operator
+
+class GetOperator(TestCase):
+
+	def testGetOperator(self):
+
+		# get_operator does not validate operators
+		tests = [ ( "~", "~" ), ( "=", "=" ), ( ">", ">" ),
+			  ( ">=", ">=" ), ( "<=", "<=" ) , ( "", None ),
+			  ( ">~", ">" ), ("~<", "~"), ( "=~", "=" ),
+			  ( "=>", "=" ), ("=<", "=") ]
+
+		test_cpvs = ["sys-apps/portage","sys-apps/portage-2.1"]
+		slots = [ None,"1","linux-2.5.6" ]
+		for cpv in test_cpvs:
+			for test in tests:
+				for slot in slots:
+					atom = cpv[:]
+					if slot:
+						atom += ":" + slot
+					result = get_operator( test[0] + atom )
+					self.assertEqual( result, test[1] )
+
+		result = get_operator( "=sys-apps/portage*" )
+		self.assertEqual( result , "=*" )
Index: /vendor/prefix-portage/current/pym/portage/tests/dep/test_isjustname.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/dep/test_isjustname.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/dep/test_isjustname.py	(revision 3489)
@@ -0,0 +1,25 @@
+# test_isjustname.py -- Portage Unit Testing Functionality
+# Copyright 2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: test_isjustname.py 6312 2007-03-28 19:20:08Z grobian $
+
+from portage.tests import TestCase
+from portage.dep import isjustname
+
+class IsJustName(TestCase):
+
+	def testIsJustName(self):
+
+		cats = ( "", "sys-apps/", "foo/", "virtual/" )
+		pkgs = ( "portage", "paludis", "pkgcore", "notARealPkg" )
+		vers = ( "", "-2.0-r3", "-1.0_pre2", "-3.1b" )
+
+		for pkg in pkgs:
+			for cat in cats:
+				for ver in vers:
+					if len(ver):
+						self.assertFalse( isjustname( cat + pkg + ver ),
+						msg="isjustname(%s) is True!" % (cat + pkg + ver) )
+					else:
+						self.assertTrue( isjustname( cat + pkg + ver ),
+						msg="isjustname(%s) is False!" % (cat + pkg + ver) )
Index: /vendor/prefix-portage/current/pym/portage/tests/dep/test_isvalidatom.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/dep/test_isvalidatom.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/dep/test_isvalidatom.py	(revision 3489)
@@ -0,0 +1,42 @@
+# test_isvalidatom.py -- Portage Unit Testing Functionality
+# Copyright 2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: test_isvalidatom.py 6312 2007-03-28 19:20:08Z grobian $
+
+from portage.tests import TestCase
+from portage.dep import isvalidatom
+import portage.dep
+portage.dep._dep_check_strict = True
+
+class IsValidAtom(TestCase):
+	""" A simple testcase for isvalidatom
+	"""
+
+	def testIsValidAtom(self):
+	
+		self.todo = True	
+		tests = [ ( "sys-apps/portage", True ),
+			  ( "=sys-apps/portage-2.1", True ),
+		 	  ( "=sys-apps/portage-2.1*", True ),
+			  ( ">=sys-apps/portage-2.1", True ),
+			  ( "<=sys-apps/portage-2.1", True ),
+			  ( ">sys-apps/portage-2.1", True ),
+			  ( "<sys-apps/portage-2.1", True ),
+			  ( "~sys-apps/portage-2.1", True ),
+			  ( "sys-apps/portage:foo", True ),
+			  ( "sys-apps/portage-2.1:foo", False ),
+			  ( "sys-apps/portage-2.1:", False ),
+			  ( ">~cate-gory/foo-1.0", False ),
+			  ( ">~category/foo-1.0", True ),
+			  ( "<~category/foo-1.0", True ),
+			  ( "###cat/foo-1.0", False ),
+			  ( "~sys-apps/portage", False ),
+			  ( "portage", False ) ]
+
+		for test in tests:
+			if test[1]:
+				atom_type = "valid"
+			else:
+				atom_type = "invalid"
+			self.assertEqual( bool(isvalidatom( test[0] )), test[1],
+				msg="isvalidatom(%s) != %s" % ( test[0], test[1] ) )
Index: /vendor/prefix-portage/current/pym/portage/tests/dep/test_match_from_list.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/dep/test_match_from_list.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/dep/test_match_from_list.py	(revision 3489)
@@ -0,0 +1,31 @@
+# test_match_from_list.py -- Portage Unit Testing Functionality
+# Copyright 2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: test_match_from_list.py 6312 2007-03-28 19:20:08Z grobian $
+
+from portage.tests import TestCase
+from portage.dep import match_from_list
+
+class AtomCmpEqualGlob(TestCase):
+        """ A simple testcase for =* glob matching
+        """
+
+        def testEqualGlobPass(self):
+                tests = [ ("=sys-apps/portage-45*", "sys-apps/portage-045" ),
+                          ("=sys-fs/udev-1*", "sys-fs/udev-123"),
+                          ("=sys-fs/udev-4*", "sys-fs/udev-456" ) ]
+
+# I need to look up the cvs syntax
+#                         ("=sys-fs/udev_cvs*","sys-fs/udev_cvs_pre4" ) ]
+
+                for test in tests:
+                        self.assertEqual( len(match_from_list( test[0], [test[1]] )), 1 )
+
+        def testEqualGlobFail(self):
+                tests = [ ("=sys-apps/portage-2*", "sys-apps/portage-2.1" ),
+                          ("=sys-apps/portage-2.1*", "sys-apps/portage-2.1.2" ) ]
+                for test in tests:
+                        try:
+                                self.assertEqual( len( match_from_list( test[0], [test[1]] ) ), 1 )
+                        except TypeError: # failure is ok here
+                                pass
Index: /vendor/prefix-portage/current/pym/portage/tests/env/__init__.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/env/__init__.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/env/__init__.py	(revision 3489)
@@ -0,0 +1,5 @@
+# tests/portage/env/__init__.py -- Portage Unit Test functionality
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: __init__.py 6312 2007-03-28 19:20:08Z grobian $
+
Index: /vendor/prefix-portage/current/pym/portage/tests/env/config/__init__.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/env/config/__init__.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/env/config/__init__.py	(revision 3489)
@@ -0,0 +1,5 @@
+# tests/portage/env/config/__init__.py -- Portage Unit Test functionality
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: __init__.py 6312 2007-03-28 19:20:08Z grobian $
+
Index: /vendor/prefix-portage/current/pym/portage/tests/env/config/test_PackageKeywordsFile.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/env/config/test_PackageKeywordsFile.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/env/config/test_PackageKeywordsFile.py	(revision 3489)
@@ -0,0 +1,42 @@
+# test_PackageKeywordsFile.py -- Portage Unit Testing Functionality
+# Copyright 2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: test_PackageKeywordsFile.py 6182 2007-03-06 07:35:22Z antarus $
+
+from portage.tests import TestCase
+from portage.env.config import PackageKeywordsFile
+from tempfile import mkstemp
+import os
+
+class PackageKeywordsFileTestCase(TestCase):
+
+	cpv = ['sys-apps/portage']
+	keywords = ['~x86', 'amd64', '-mips']
+	
+	def testPackageKeywordsFile(self):
+		"""
+		A simple test to ensure the load works properly
+		"""
+
+		self.BuildFile()
+		try:
+			f = PackageKeywordsFile(self.fname)
+			f.load()
+			i = 0
+			for cpv, keyword in f.iteritems():
+				self.assertEqual( cpv, self.cpv[i] )
+				[k for k in keyword if self.assertTrue(k in self.keywords)]
+				i = i + 1
+		finally:
+			self.NukeFile()
+	
+	def BuildFile(self):
+		fd, self.fname = mkstemp()
+		f = os.fdopen(fd, 'w')
+		for c in self.cpv:
+			f.write("%s %s\n" % (c,' '.join(self.keywords)))
+		f.close()
+
+	def NukeFile(self):
+		import os
+		os.unlink(self.fname)
Index: /vendor/prefix-portage/current/pym/portage/tests/env/config/test_PackageMaskFile.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/env/config/test_PackageMaskFile.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/env/config/test_PackageMaskFile.py	(revision 3489)
@@ -0,0 +1,32 @@
+# test_PackageMaskFile.py -- Portage Unit Testing Functionality
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: test_PackageMaskFile.py 6182 2007-03-06 07:35:22Z antarus $
+
+import os
+
+from portage.env.config import PackageMaskFile
+from portage.tests import TestCase
+from tempfile import mkstemp
+
+class PackageMaskFileTestCase(TestCase):
+
+	atoms = ['sys-apps/portage','dev-util/diffball','not@va1id@t0m']
+	
+	def testPackageMaskFile(self):
+		self.BuildFile()
+		try:
+			f = PackageMaskFile(self.fname)
+			f.load()
+			[atom for atom in f.keys() if self.assertTrue(atom in self.atoms)]
+		finally:
+			self.NukeFile()
+	
+	def BuildFile(self):
+		fd, self.fname = mkstemp()
+		f = os.fdopen(fd, 'w')
+		f.write("\n".join(self.atoms))
+		f.close()
+	
+	def NukeFile(self):
+		os.unlink(self.fname)
Index: /vendor/prefix-portage/current/pym/portage/tests/env/config/test_PackageUseFile.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/env/config/test_PackageUseFile.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/env/config/test_PackageUseFile.py	(revision 3489)
@@ -0,0 +1,39 @@
+# test_PackageUseFile.py -- Portage Unit Testing Functionality
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: test_PackageUseFile.py 6182 2007-03-06 07:35:22Z antarus $
+
+import os
+from portage.tests import TestCase
+from portage.env.config import PackageUseFile
+from tempfile import mkstemp
+
+
+class PackageUseFileTestCase(TestCase):
+
+	cpv = 'sys-apps/portage'
+	useflags = ['cdrom', 'far', 'boo', 'flag', 'blat']
+	
+	def testPackageUseFile(self):
+		"""
+		A simple test to ensure the load works properly
+		"""
+		self.BuildFile()
+		try:
+			f = PackageUseFile(self.fname)
+			f.load()
+			for cpv, use in f.iteritems():
+				self.assertEqual( cpv, self.cpv )
+				[flag for flag in use if self.assertTrue(flag in self.useflags)]
+		finally:
+			self.NukeFile()
+
+	def BuildFile(self):
+		fd, self.fname = mkstemp()
+		f = os.fdopen(fd, 'wb')
+		f.write("%s %s" % (self.cpv, ' '.join(self.useflags)))
+		f.close()
+	
+	def NukeFile(self):
+		import os
+		os.unlink(self.fname)
Index: /vendor/prefix-portage/current/pym/portage/tests/env/config/test_PortageModulesFile.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/env/config/test_PortageModulesFile.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/env/config/test_PortageModulesFile.py	(revision 3489)
@@ -0,0 +1,34 @@
+import os
+
+from portage.tests import TestCase
+from portage.env.config import PortageModulesFile
+from tempfile import mkstemp
+from itertools import izip
+
+class PortageModulesFileTestCase(TestCase):
+
+	keys = ['foo.bar','baz','bob','extra_key']
+	modules = ['spanky','zmedico','antarus','ricer']
+
+	def setUp(self):
+		self.items = {}
+		for k,v in izip(self.keys, self.modules):
+			self.items[k] = v
+
+	def testPortageModulesFile(self):
+		self.BuildFile()
+		f = PortageModulesFile(self.fname)
+		for k in f.keys():
+			self.assertEqual( f[k], self.items[k] )
+		self.NukeFile()
+
+	def BuildFile(self):
+		fd, self.fname = mkstemp()
+		f = os.fdopen(fd, 'wb')
+		for k,v in self.items.iteritems():
+			f.write('%s=%s\n' % (k,v))
+		f.close()
+
+	def NukeFile(self):
+		import os
+		os.unlink(self.fname)
Index: /vendor/prefix-portage/current/pym/portage/tests/news/__init__.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/news/__init__.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/news/__init__.py	(revision 3489)
@@ -0,0 +1,4 @@
+# tests/portage.news/__init__.py -- Portage Unit Test functionality
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: __init__.py 6312 2007-03-28 19:20:08Z grobian $
Index: /vendor/prefix-portage/current/pym/portage/tests/news/test_NewsItem.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/news/test_NewsItem.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/news/test_NewsItem.py	(revision 3489)
@@ -0,0 +1,83 @@
+# test_NewsItem.py -- Portage Unit Testing Functionality
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: test_varExpand.py 5596 2007-01-12 08:08:53Z antarus $
+
+from portage.tests import TestCase, TestLoader
+from portage.news import NewsItem
+from portage.const import PROFILE_PATH
+
+class NewsItemTestCase(TestCase):
+	
+	self.fakeItem = """
+Title: YourSQL Upgrades from 4.0 to 4.1
+Author: Ciaran McCreesh <ciaranm@gentoo.org>
+Content-Type: text/plain
+Posted: 01-Nov-2005
+Revision: 1
+#Display-If-Installed:
+#Display-If-Profile:
+#Display-If-Arch:
+
+YourSQL databases created using YourSQL version 4.0 are incompatible
+with YourSQL version 4.1 or later. There is no reliable way to
+automate the database format conversion, so action from the system
+administrator is required before an upgrade can take place.
+
+Please see the Gentoo YourSQL Upgrade Guide for instructions:
+
+    http://www.gentoo.org/doc/en/yoursql-upgrading.xml
+
+Also see the official YourSQL documentation:
+
+    http://dev.yoursql.com/doc/refman/4.1/en/upgrading-from-4-0.html
+
+After upgrading, you should also recompile any packages which link
+against YourSQL:
+
+    revdep-rebuild --library=libyoursqlclient.so.12
+
+The revdep-rebuild tool is provided by app-portage/gentoolkit.
+"""
+
+	from portage import settings
+	import time
+
+	def testDisplayIfProfile():
+		from portage.const import PROFILE_PATH
+		tmpItem = self.fakeItem.replace("#Display-If-Profile:", "Display-If-Profile: %s" %
+			os.readlink( PROFILE_PATH ) )
+
+		item = _processItem(tmpItem)
+		self.assertTrue( item.isRelevant( os.readlink( PROFILE_PATH ) ),
+			msg="Expected %s to be relevant, but it was not!" % tmpItem )
+
+	def testDisplayIfInstalled():
+		tmpItem = self.fakeItem.replace("#Display-If-Installed:", "Display-If-Profile: %s" %
+			"sys-apps/portage" )
+
+		item = _processItem(tmpItem)
+		self.assertTrue( item.isRelevant( portage.settings ),
+			msg="Expected %s to be relevant, but it was not!" % tmpItem )
+
+
+	def testDisplayIfKeyword():
+		from portage import settings
+		tmpItem = self.fakeItem.replace("#Display-If-Keyword:", "Display-If-Keyword: %s" %
+			settings["ACCEPT_KEYWORDS"].split()[0] )
+
+		item = _processItem(tmpItem)
+		self.assertTrue( item.isRelevant( os.readlink( PROFILE_PATH ) ),
+			msg="Expected %s to be relevant, but it was not!" % tmpItem )
+		
+
+	def _processItem( self, item ):
+
+		path = os.path.join( settings["PORTAGE_TMPDIR"], str(time.time())
+		f = open( os.path.join( path )
+		f.write(item)
+		f.close
+		try:
+			return NewsItem( path, 0 )
+		except TypeError:
+			self.fail("Error while processing news item %s" % path )
Index: /vendor/prefix-portage/current/pym/portage/tests/runTests
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/runTests	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/runTests	(revision 3489)
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+# runTests.py -- Portage Unit Test Functionality
+# Copyright 2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: runTests 5885 2007-02-03 21:52:00Z grobian $
+
+
+import os, sys
+import os.path as osp
+
+# Insert our parent dir so we can do shiny import "tests"
+# This line courtesy of Marienz and Pkgcore ;)
+sys.path.insert(0, osp.dirname(osp.dirname(osp.dirname(osp.abspath(__file__)))))
+
+import portage.tests as tests
+
+if __name__ == "__main__":
+	result = tests.main()
+	if result.failures:
+		sys.exit(1)
Index: /vendor/prefix-portage/current/pym/portage/tests/util/__init__.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/util/__init__.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/util/__init__.py	(revision 3489)
@@ -0,0 +1,5 @@
+# tests/portage.util/__init__.py -- Portage Unit Test functionality
+# Copyright 2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: __init__.py 6312 2007-03-28 19:20:08Z grobian $
+
Index: /vendor/prefix-portage/current/pym/portage/tests/util/test_grabdict.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/util/test_grabdict.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/util/test_grabdict.py	(revision 3489)
@@ -0,0 +1,12 @@
+# test_grabDict.py -- Portage Unit Testing Functionality
+# Copyright 2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: test_grabdict.py 6312 2007-03-28 19:20:08Z grobian $
+
+from portage.tests import TestCase
+from portage.util import grabdict
+
+class GrabDictTestCase(TestCase):
+	
+	def testGrabDictPass(self):
+		pass
Index: /vendor/prefix-portage/current/pym/portage/tests/util/test_normalizedPath.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/util/test_normalizedPath.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/util/test_normalizedPath.py	(revision 3489)
@@ -0,0 +1,15 @@
+# test_normalizePath.py -- Portage Unit Testing Functionality
+# Copyright 2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: test_normalizedPath.py 6312 2007-03-28 19:20:08Z grobian $
+
+from portage.tests import TestCase
+
+class NormalizePathTestCase(TestCase):
+	
+	def testNormalizePath(self):
+		
+		from portage.util import normalize_path
+		path = "///foo/bar/baz"
+		good = "/foo/bar/baz"
+		self.assertEqual(normalize_path(path), good)
Index: /vendor/prefix-portage/current/pym/portage/tests/util/test_stackDictList.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/util/test_stackDictList.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/util/test_stackDictList.py	(revision 3489)
@@ -0,0 +1,18 @@
+# test_stackDictList.py -- Portage Unit Testing Functionality
+# Copyright 2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: test_stackDictList.py 6312 2007-03-28 19:20:08Z grobian $
+
+from portage.tests import TestCase
+
+class StackDictListTestCase(TestCase):
+
+	def testStackDictList(self):
+		from portage.util import stack_dictlist
+		
+		tests = [ ({'a':'b'},{'x':'y'},False,{'a':['b'],'x':['y']}) ]
+		tests.append(( {'KEYWORDS':['alpha','x86']},{'KEYWORDS':['-*']},True,{} ))
+		tests.append(( {'KEYWORDS':['alpha','x86']},{'KEYWORDS':['-x86']},True,{'KEYWORDS':['alpha']} ))
+		for test in tests:
+			self.assertEqual(
+			stack_dictlist([test[0],test[1]],incremental=test[2]), test[3] )
Index: /vendor/prefix-portage/current/pym/portage/tests/util/test_stackDicts.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/util/test_stackDicts.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/util/test_stackDicts.py	(revision 3489)
@@ -0,0 +1,37 @@
+# test_stackDicts.py -- Portage Unit Testing Functionality
+# Copyright 2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: test_stackDicts.py 6312 2007-03-28 19:20:08Z grobian $
+
+from portage.tests import TestCase
+from portage.util import stack_dicts
+
+
+class StackDictsTestCase(TestCase):
+	
+	def testStackDictsPass(self):
+		
+		tests = [ ( [ { "a":"b" }, { "b":"c" } ], { "a":"b", "b":"c" },
+			  False, [], False ),
+			  ( [ { "a":"b" }, { "a":"c" } ], { "a":"b c" },
+			  True, [], False ),
+			  ( [ { "a":"b" }, { "a":"c" } ], { "a":"b c" },
+			  False, ["a"], False ),
+			  ( [ { "a":"b" }, None ], { "a":"b" },
+			  False, [], True ),
+			  ( [ None ], None, False, [], False ),
+			  ( [ None, {}], {}, False, [], True ) ]
+
+
+		for test in tests:
+			result = stack_dicts( test[0], test[2], test[3], test[4] )
+			self.assertEqual( result, test[1] )
+	
+	def testStackDictsFail(self):
+		
+		tests = [ ( [ None, {} ], None, False, [], True ),
+			  ( [ { "a":"b"}, {"a":"c" } ], { "a":"b c" },
+				False, [], False ) ]
+		for test in tests:
+			result = stack_dicts( test[0], test[2], test[3], test[4] )
+			self.assertNotEqual( result , test[1] )
Index: /vendor/prefix-portage/current/pym/portage/tests/util/test_stackLists.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/util/test_stackLists.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/util/test_stackLists.py	(revision 3489)
@@ -0,0 +1,20 @@
+# test_stackLists.py -- Portage Unit Testing Functionality
+# Copyright 2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: test_stackLists.py 6312 2007-03-28 19:20:08Z grobian $
+
+from portage.tests import TestCase
+from portage.util import stack_lists
+
+class StackListsTestCase(TestCase):
+	
+	def testStackLists(self):
+		
+		tests = [ ( [ ['a','b','c'], ['d','e','f'] ], ['a','c','b','e','d','f'], False ),
+			  ( [ ['a','x'], ['b','x'] ], ['a','x','b'], False ),
+			  ( [ ['a','b','c'], ['-*'] ], [], True ),
+			  ( [ ['a'], ['-a'] ], [], True ) ]
+
+		for test in tests:
+			result = stack_lists( test[0], test[2] )
+			self.assertEqual( result , test[1] )
Index: /vendor/prefix-portage/current/pym/portage/tests/util/test_uniqueArray.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/util/test_uniqueArray.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/util/test_uniqueArray.py	(revision 3489)
@@ -0,0 +1,26 @@
+# test_uniqueArray.py -- Portage Unit Testing Functionality
+# Copyright 2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: test_uniqueArray.py 6312 2007-03-28 19:20:08Z grobian $
+
+from portage.tests import TestCase
+from portage.util import unique_array
+
+class UniqueArrayTestCase(TestCase):
+	
+	def testUniqueArrayPass(self):
+		"""
+		test portage.util.uniqueArray()
+		"""
+
+		import os
+
+		tests = [ ( ["a","a","a",os,os,[],[],[]], ['a',os,[]] ), 
+			  ( [1,1,1,2,3,4,4] , [1,2,3,4]) ]
+
+		for test in tests:
+			result = unique_array( test[0] )
+			for item in test[1]:
+				number = result.count(item)
+				self.failIf( number is not 1, msg="%s contains %s of %s, \
+					should be only 1" % (result, number, item) )
Index: /vendor/prefix-portage/current/pym/portage/tests/util/test_varExpand.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/util/test_varExpand.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/util/test_varExpand.py	(revision 3489)
@@ -0,0 +1,60 @@
+# test_varExpand.py -- Portage Unit Testing Functionality
+# Copyright 2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: test_varExpand.py 6532 2007-05-13 20:52:10Z grobian $
+
+from portage.tests import TestCase
+from portage.util import varexpand
+
+class VarExpandTestCase(TestCase):
+	
+	def testVarExpandPass(self):
+
+		varDict = { "a":"5", "b":"7", "c":"-5" }
+		for key in varDict.keys():
+			result = varexpand( "$%s" % key, varDict )
+			
+			self.failIf( result != varDict[key],
+				msg="Got %s != %s, from varexpand( %s, %s )" % \
+					( result, varDict[key], "$%s" % key, varDict ) )
+			result = varexpand( "${%s}" % key, varDict )
+			self.failIf( result != varDict[key],
+				msg="Got %s != %s, from varexpand( %s, %s )" % \
+					( result, varDict[key], "${%s}" % key, varDict ) )
+
+	def testVarExpandDoubleQuotes(self):
+		
+		varDict = { "a":"5" }
+		tests = [ ("\"${a}\"", "\"5\"") ]
+		for test in tests:
+			result = varexpand( test[0], varDict )
+			self.failIf( result != test[1],
+				msg="Got %s != %s from varexpand( %s, %s )" \
+				% ( result, test[1], test[0], varDict ) )
+
+	def testVarExpandSingleQuotes(self):
+		
+		varDict = { "a":"5" }
+		tests = [ ("\'${a}\'", "\'${a}\'") ]
+		for test in tests:
+			result = varexpand( test[0], varDict )
+			self.failIf( result != test[1],
+				msg="Got %s != %s from varexpand( %s, %s )" \
+				% ( result, test[1], test[0], varDict ) )
+
+	def testVarExpandFail(self):
+
+		varDict = { "a":"5", "b":"7", "c":"15" }
+
+		testVars = [ "fail" ]
+
+		for var in testVars:
+			result = varexpand( "$%s" % var, varDict )
+			self.failIf( len(result),
+				msg="Got %s == %s, from varexpand( %s, %s )" \
+					% ( result, var, "$%s" % var, varDict ) )
+
+			result = varexpand( "${%s}" % var, varDict )
+			self.failIf( len(result),
+				msg="Got %s == %s, from varexpand( %s, %s )" \
+					% ( result, var, "${%s}" % var, varDict ) )
Index: /vendor/prefix-portage/current/pym/portage/tests/versions/__init__.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/versions/__init__.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/versions/__init__.py	(revision 3489)
@@ -0,0 +1,4 @@
+# tests/portage.versions/__init__.py -- Portage Unit Test functionality
+# Copyright 2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: __init__.py 6312 2007-03-28 19:20:08Z grobian $
Index: /vendor/prefix-portage/current/pym/portage/tests/versions/test_vercmp.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/versions/test_vercmp.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/versions/test_vercmp.py	(revision 3489)
@@ -0,0 +1,40 @@
+# test_vercmp.py -- Portage Unit Testing Functionality
+# Copyright 2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: test_vercmp.py 6312 2007-03-28 19:20:08Z grobian $
+
+from portage.tests import TestCase
+from portage.versions import vercmp
+
+class VerCmpTestCase(TestCase):
+	""" A simple testCase for portage.versions.vercmp()
+	"""
+	
+	def testVerCmpGreater(self):
+		
+		tests = [ ( "6.0", "5.0"), ("5.0","5")]
+		for test in tests:
+			self.failIf( vercmp( test[0], test[1] ) <= 0, msg="%s < %s? Wrong!" % (test[0],test[1]) )
+
+	def testVerCmpLess(self):
+		"""
+		pre < alpha < beta < rc < p -> test each of these, they are inductive (or should be..)
+		"""
+		tests = [ ( "4.0", "5.0"), ("5", "5.0"), ("1.0_pre2","1.0_p2"),
+			("1.0_alpha2", "1.0_p2"),("1.0_alpha1", "1.0_beta1"),("1.0_beta3","1.0_rc3")]
+		for test in tests:
+			self.failIf( vercmp( test[0], test[1]) >= 0, msg="%s > %s? Wrong!" % (test[0],test[1]))
+	
+	
+	def testVerCmpEqual(self):
+		
+		tests = [ ("4.0", "4.0") ]
+		for test in tests:
+			self.failIf( vercmp( test[0], test[1]) != 0, msg="%s != %s? Wrong!" % (test[0],test[1]))
+			
+	def testVerNotEqual(self):
+		
+		tests = [ ("1","2"),("1.0_alpha","1.0_pre"),("1.0_beta","1.0_alpha"),
+			("0", "0.0")]
+		for test in tests:
+			self.failIf( vercmp( test[0], test[1]) == 0, msg="%s == %s? Wrong!" % (test[0],test[1]))
Index: /vendor/prefix-portage/current/pym/portage/tests/xpak/__init__.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/xpak/__init__.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/xpak/__init__.py	(revision 3489)
@@ -0,0 +1,4 @@
+# tests/portage.dep/__init__.py -- Portage Unit Test functionality
+# Copyright 2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: __init__.py 6312 2007-03-28 19:20:08Z grobian $
Index: /vendor/prefix-portage/current/pym/portage/tests/xpak/test_decodeint.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/tests/xpak/test_decodeint.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/tests/xpak/test_decodeint.py	(revision 3489)
@@ -0,0 +1,14 @@
+# xpak/test_decodeint.py
+# Copright Gentoo Foundation 2006
+# Portage Unit Testing Functionality
+# $Id$
+
+from portage.tests import TestCase
+from portage.xpak import decodeint, encodeint
+
+class testDecodeIntTestCase(TestCase):
+
+	def testDecodeInt(self):
+		
+		for n in xrange(1000):
+			self.assertEqual(decodeint(encodeint(n)), n)
Index: /vendor/prefix-portage/current/pym/portage/update.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/update.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/update.py	(revision 3489)
@@ -0,0 +1,229 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+import errno, os, re, sys
+
+from portage.util import ConfigProtect, grabfile, new_protect_filename, \
+	normalize_path, write_atomic, writemsg
+from portage.exception import DirectoryNotFound, PortageException
+from portage.versions import ververify
+from portage.dep import dep_getkey, get_operator, isvalidatom, isjustname
+from portage.const import USER_CONFIG_PATH, WORLD_FILE, EPREFIX
+
+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 old_value in mycontent:
+			old_value = re.escape(old_value);
+			mycontent = re.sub(old_value+"(:|$|\\s)", new_value+"\\1", mycontent)
+			def myreplace(matchobj):
+				if ververify(matchobj.group(2)):
+					return "%s-%s" % (new_value, matchobj.group(2))
+				else:
+					return "".join(matchobj.groups())
+			mycontent = re.sub("(%s-)(\\S*)" % old_value, myreplace, 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 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)
+	return mycontent
+
+def update_dbentries(update_iter, mydata):
+	"""Performs update commands and returns a
+	dict containing only the updated items."""
+	updated_items = {}
+	for k, mycontent in mydata.iteritems():
+		if k not in ignored_dbentries:
+			orig_content = mycontent
+			for update_cmd in update_iter:
+				mycontent = update_dbentry(update_cmd, mycontent)
+			if mycontent != orig_content:
+				updated_items[k] = mycontent
+	return updated_items
+
+def fixdbentries(update_iter, dbdir):
+	"""Performs update commands which result in search and replace operations
+	for each of the files in dbdir (excluding CONTENTS and environment.bz2).
+	Returns True when actual modifications are necessary and False otherwise."""
+	mydata = {}
+	for myfile in [f for f in os.listdir(dbdir) if f not in ignored_dbentries]:
+		file_path = os.path.join(dbdir, myfile)
+		f = open(file_path, "r")
+		mydata[myfile] = f.read()
+		f.close()
+	updated_items = update_dbentries(update_iter, mydata)
+	for myfile, mycontent in updated_items.iteritems():
+		file_path = os.path.join(dbdir, myfile)
+		write_atomic(file_path, mycontent)
+	return len(updated_items) > 0
+
+def grab_updates(updpath, prev_mtimes=None):
+	"""Returns all the updates from the given directory as a sorted list of
+	tuples, each containing (file_path, statobj, content).  If prev_mtimes is
+	given then only updates with differing mtimes are considered."""
+	try:
+		mylist = os.listdir(updpath)
+	except OSError, oe:
+		if oe.errno == errno.ENOENT:
+			raise DirectoryNotFound(updpath)
+		raise
+	if prev_mtimes is None:
+		prev_mtimes = {}
+	# validate the file name (filter out CVS directory, etc...)
+	mylist = [myfile for myfile in mylist if len(myfile) == 7 and myfile[1:3] == "Q-"]
+	if len(mylist) == 0:
+		return []
+	
+	# update names are mangled to make them sort properly
+	mylist = [myfile[3:]+"-"+myfile[:2] for myfile in mylist]
+	mylist.sort()
+	mylist = [myfile[5:]+"-"+myfile[:4] for myfile in mylist]
+
+	update_data = []
+	for myfile in mylist:
+		file_path = os.path.join(updpath, myfile)
+		mystat = os.stat(file_path)
+		if file_path not in prev_mtimes or \
+		long(prev_mtimes[file_path]) != long(mystat.st_mtime):
+			f = open(file_path)
+			content = f.read()
+			f.close()
+			update_data.append((file_path, mystat, content))
+	return update_data
+
+def parse_updates(mycontent):
+	"""Valid updates are returned as a list of split update commands."""
+	myupd = []
+	errors = []
+	mylines = mycontent.splitlines()
+	for myline in mylines:
+		mysplit = myline.split()
+		if len(mysplit) == 0:
+			continue
+		if mysplit[0] not in ("move", "slotmove"):
+			errors.append("ERROR: Update type not recognized '%s'" % myline)
+			continue
+		if mysplit[0] == "move":
+			if len(mysplit) != 3:
+				errors.append("ERROR: Update command invalid '%s'" % myline)
+				continue
+			orig_value, new_value = mysplit[1], mysplit[2]
+			for cp in (orig_value, new_value):
+				if not (isvalidatom(cp) and isjustname(cp)):
+					errors.append(
+						"ERROR: Malformed update entry '%s'" % myline)
+					continue
+		if mysplit[0] == "slotmove":
+			if len(mysplit)!=4:
+				errors.append("ERROR: Update command invalid '%s'" % myline)
+				continue
+			pkg, origslot, newslot = mysplit[1], mysplit[2], mysplit[3]
+			if not isvalidatom(pkg):
+				errors.append("ERROR: Malformed update entry '%s'" % myline)
+				continue
+		
+		# The list of valid updates is filtered by continue statements above.
+		myupd.append(mysplit)
+	return myupd, errors
+
+def update_config_files(config_root, protect, protect_mask, update_iter):
+	"""Perform global updates on /etc/portage/package.* and the world file.
+	config_root - location of files to update
+	protect - list of paths from CONFIG_PROTECT
+	protect_mask - list of paths from CONFIG_PROTECT_MASK
+	update_iter - list of update commands as returned from parse_updates()"""
+	config_root = normalize_path(config_root)
+	update_files = {}
+	file_contents = {}
+	myxfiles = ["package.mask", "package.unmask", \
+		"package.keywords", "package.use"]
+	myxfiles += [os.path.join("profile", x) for x in myxfiles]
+	# if the user gives a path, respect it, otherwise use our prefix
+	if USER_CONFIG_PATH != "":
+		abs_user_config = os.path.join(config_root,
+			USER_CONFIG_PATH.lstrip(os.path.sep))
+	else:
+		abs_user_config = os.path.join(config_root,
+			EPREFIX.lstrip(os.path.sep))
+	recursivefiles = []
+	for x in myxfiles:
+		config_file = os.path.join(abs_user_config, x)
+		if os.path.isdir(config_file):
+			for parent, dirs, files in os.walk(config_file):
+				for y in dirs:
+					if y.startswith("."):
+						dirs.remove(y)
+				for y in files:
+					if y.startswith("."):
+						continue
+					recursivefiles.append(
+						os.path.join(parent, y)[len(abs_user_config) + 1:])
+		else:
+			recursivefiles.append(x)
+	myxfiles = recursivefiles
+	for x in myxfiles:
+		try:
+			myfile = open(os.path.join(abs_user_config, x),"r")
+			file_contents[x] = myfile.readlines()
+			myfile.close()
+		except IOError:
+			if file_contents.has_key(x):
+				del file_contents[x]
+			continue
+	worldlist = grabfile(os.path.join(config_root, WORLD_FILE))
+
+	for update_cmd in update_iter:
+		if update_cmd[0] == "move":
+			old_value, new_value = update_cmd[1], update_cmd[2]
+			#update world entries:
+			for x in range(0,len(worldlist)):
+				#update world entries, if any.
+				worldlist[x] = \
+					dep_transform(worldlist[x], old_value, new_value)
+
+			#update /etc/portage/packages.*
+			for x in file_contents:
+				for mypos in range(0,len(file_contents[x])):
+					line = file_contents[x][mypos]
+					if line[0] == "#" or not line.strip():
+						continue
+					myatom = line.split()[0]
+					if myatom.startswith("-"):
+						# package.mask supports incrementals
+						myatom = myatom[1:]
+					if not isvalidatom(myatom):
+						continue
+					key = dep_getkey(myatom)
+					if key == old_value:
+						file_contents[x][mypos] = \
+							line.replace(old_value, new_value)
+						update_files[x] = 1
+						sys.stdout.write("p")
+						sys.stdout.flush()
+
+	write_atomic(os.path.join(config_root, WORLD_FILE), "\n".join(worldlist))
+
+	protect_obj = ConfigProtect(
+		config_root, protect, protect_mask)
+	for x in update_files:
+		updating_file = os.path.join(abs_user_config, x)
+		if protect_obj.isprotected(updating_file):
+			updating_file = new_protect_filename(updating_file)
+		try:
+			write_atomic(updating_file, "".join(file_contents[x]))
+		except PortageException, e:
+			writemsg("\n!!! %s\n" % str(e), noiselevel=-1)
+			writemsg("!!! An error occured while updating a config file:" + \
+				" '%s'\n" % updating_file, noiselevel=-1)
+			continue
+
+def dep_transform(mydep, oldkey, newkey):
+	if dep_getkey(mydep) == oldkey:
+		return mydep.replace(oldkey, newkey, 1)
+	return mydep
Index: /vendor/prefix-portage/current/pym/portage/util.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/util.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/util.py	(revision 3489)
@@ -0,0 +1,1040 @@
+# Copyright 2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_util.py 4603 2006-10-06 03:28:25Z zmedico $
+
+from portage.exception import PortageException, FileNotFound, \
+       OperationNotPermitted, PermissionDenied, ReadOnlyFileSystem
+import portage.exception
+from portage.dep import isvalidatom
+from portage.const import EPREFIX
+
+import os, errno, shlex, stat, string, sys
+try:
+	import cPickle
+except ImportError:
+	import pickle as cPickle
+
+if not hasattr(__builtins__, "set"):
+	from sets import Set as set
+
+noiselimit = 0
+
+def writemsg(mystr,noiselevel=0,fd=None):
+	"""Prints out warning and debug messages based on the noiselimit setting"""
+	global noiselimit
+	if fd is None:
+		fd = sys.stderr
+	if noiselevel <= noiselimit:
+		fd.write(mystr)
+		fd.flush()
+
+def writemsg_stdout(mystr,noiselevel=0):
+	"""Prints messages stdout based on the noiselimit setting"""
+	writemsg(mystr, noiselevel=noiselevel, fd=sys.stdout)
+
+def normalize_path(mypath):
+	""" 
+	os.path.normpath("//foo") returns "//foo" instead of "/foo"
+	We dislike this behavior so we create our own normpath func
+	to fix it.
+	"""
+	if mypath.startswith(os.path.sep):
+		# posixpath.normpath collapses 3 or more leading slashes to just 1.
+		return os.path.normpath(2*os.path.sep + mypath)
+	else:
+		return os.path.normpath(mypath)
+
+def grabfile(myfilename, compat_level=0, recursive=0):
+	"""This function grabs the lines in a file, normalizes whitespace and returns lines in a list; if a line
+	begins with a #, it is ignored, as are empty lines"""
+
+	mylines=grablines(myfilename, recursive)
+	newlines=[]
+	for x in mylines:
+		#the split/join thing removes leading and trailing whitespace, and converts any whitespace in the line
+		#into single spaces.
+		myline=" ".join(x.split())
+		if not len(myline):
+			continue
+		if myline[0]=="#":
+			# Check if we have a compat-level string. BC-integration data.
+			# '##COMPAT==>N<==' 'some string attached to it'
+			mylinetest = myline.split("<==",1)
+			if len(mylinetest) == 2:
+				myline_potential = mylinetest[1]
+				mylinetest = mylinetest[0].split("##COMPAT==>")
+				if len(mylinetest) == 2:
+					if compat_level >= int(mylinetest[1]):
+						# It's a compat line, and the key matches.
+						newlines.append(myline_potential)
+				continue
+			else:
+				continue
+		newlines.append(myline)
+	return newlines
+
+def map_dictlist_vals(func,myDict):
+	"""Performs a function on each value of each key in a dictlist.
+	Returns a new dictlist."""
+	new_dl = {}
+	for key in myDict.keys():
+		new_dl[key] = []
+		new_dl[key] = map(func,myDict[key])
+	return new_dl
+
+def stack_dictlist(original_dicts, incremental=0, incrementals=[], ignore_none=0):
+	"""
+	Stacks an array of dict-types into one array. Optionally merging or
+	overwriting matching key/value pairs for the dict[key]->list.
+	Returns a single dict. Higher index in lists is preferenced.
+	
+	Example usage:
+	   >>> from portage.util import stack_dictlist
+		>>> print stack_dictlist( [{'a':'b'},{'x':'y'}])
+		>>> {'a':'b','x':'y'}
+		>>> print stack_dictlist( [{'a':'b'},{'a':'c'}], incremental = True )
+		>>> {'a':['b','c'] }
+		>>> a = {'KEYWORDS':['x86','alpha']}
+		>>> b = {'KEYWORDS':['-x86']}
+		>>> print stack_dictlist( [a,b] )
+		>>> { 'KEYWORDS':['x86','alpha','-x86']}
+		>>> print stack_dictlist( [a,b], incremental=True)
+		>>> { 'KEYWORDS':['alpha'] }
+		>>> print stack_dictlist( [a,b], incrementals=['KEYWORDS'])
+		>>> { 'KEYWORDS':['alpha'] }
+	
+	@param original_dicts a list of (dictionary objects or None)
+	@type list
+	@param incremental True or false depending on whether new keys should overwrite
+	   keys which already exist.
+	@type boolean
+	@param incrementals A list of items that should be incremental (-foo removes foo from
+	   the returned dict).
+	@type list
+	@param ignore_none Appears to be ignored, but probably was used long long ago.
+	@type boolean
+	
+	"""
+	final_dict = {}
+	for mydict in original_dicts:
+		if mydict is None:
+			continue
+		for y in mydict.keys():
+			if not y in final_dict:
+				final_dict[y] = []
+			
+			for thing in mydict[y]:
+				if thing:
+					if incremental or y in incrementals:
+						if thing == "-*":
+							final_dict[y] = []
+							continue
+						elif thing.startswith("-"):
+							try:
+								final_dict[y].remove(thing[1:])
+							except ValueError:
+								pass
+							continue
+					if thing not in final_dict[y]:
+						final_dict[y].append(thing)
+			if y in final_dict and not final_dict[y]:
+				del final_dict[y]
+	return final_dict
+
+def stack_dicts(dicts, incremental=0, incrementals=[], ignore_none=0):
+	"""Stacks an array of dict-types into one array. Optionally merging or
+	overwriting matching key/value pairs for the dict[key]->string.
+	Returns a single dict."""
+	final_dict = None
+	for mydict in dicts:
+		if mydict is None:
+			if ignore_none:
+				continue
+			else:
+				return None
+		if final_dict is None:
+			final_dict = {}
+		for y in mydict.keys():
+			if mydict[y]:
+				if final_dict.has_key(y) and (incremental or (y in incrementals)):
+					final_dict[y] += " "+mydict[y][:]
+				else:
+					final_dict[y]  = mydict[y][:]
+			mydict[y] = " ".join(mydict[y].split()) # Remove extra spaces.
+	return final_dict
+
+def stack_lists(lists, incremental=1):
+	"""Stacks an array of list-types into one array. Optionally removing
+	distinct values using '-value' notation. Higher index is preferenced.
+
+	all elements must be hashable."""
+
+	new_list = {}
+	for x in lists:
+		for y in filter(None, x):
+			if incremental:
+				if y == "-*":
+					new_list.clear()
+				elif y.startswith("-"):
+					new_list.pop(y[1:], None)
+				else:
+					new_list[y] = True
+			else:
+				new_list[y] = True
+	return new_list.keys()
+
+def grabdict(myfilename, juststrings=0, empty=0, recursive=0, incremental=1):
+	"""
+	This function grabs the lines in a file, normalizes whitespace and returns lines in a dictionary
+	
+	@param myfilename: file to process
+	@type myfilename: string (path)
+	@param juststrings: only return strings
+	@type juststrings: Boolean (integer)
+	@param empty: Ignore certain lines
+	@type empty: Boolean (integer)
+	@param recursive: Recursively grab ( support for /etc/portage/package.keywords/* and friends )
+	@type recursive: Boolean (integer)
+	@param incremental: Append to the return list, don't overwrite
+	@type incremental: Boolean (integer)
+	@rtype: Dictionary
+	@returns:
+	1.  Returns the lines in a file in a dictionary, for example:
+		'sys-apps/portage x86 amd64 ppc'
+		would return
+		{ "sys-apps/portage" : [ 'x86', 'amd64', 'ppc' ]
+		the line syntax is key : [list of values]
+	"""
+	newdict={}
+	for x in grablines(myfilename, recursive):
+		#the split/join thing removes leading and trailing whitespace, and converts any whitespace in the line
+		#into single spaces.
+		if x[0] == "#":
+			continue
+		myline=x.split()
+		if len(myline) < 2 and empty == 0:
+			continue
+		if len(myline) < 1 and empty == 1:
+			continue
+		if incremental:
+			newdict.setdefault(myline[0], []).extend(myline[1:])
+		else:
+			newdict[myline[0]] = myline[1:]
+	if juststrings:
+		for k, v in newdict.iteritems():
+			newdict[k] = " ".join(v)
+	return newdict
+
+def grabdict_package(myfilename, juststrings=0, recursive=0):
+	pkgs=grabdict(myfilename, juststrings, empty=1, recursive=recursive)
+	# We need to call keys() here in order to avoid the possibility of
+	# "RuntimeError: dictionary changed size during iteration"
+	# when an invalid atom is deleted.
+	for x in pkgs.keys():
+		if not isvalidatom(x):
+			del(pkgs[x])
+			writemsg("--- Invalid atom in %s: %s\n" % (myfilename, x),
+				noiselevel=-1)
+	return pkgs
+
+def grabfile_package(myfilename, compatlevel=0, recursive=0):
+	pkgs=grabfile(myfilename, compatlevel, recursive=recursive)
+	for x in range(len(pkgs)-1, -1, -1):
+		pkg = pkgs[x]
+		if pkg[0] == "-":
+			pkg = pkg[1:]
+		if pkg[0] == "*": # Kill this so we can deal the "packages" file too
+			pkg = pkg[1:]
+		if not isvalidatom(pkg):
+			writemsg("--- Invalid atom in %s: %s\n" % (myfilename, pkgs[x]),
+				noiselevel=-1)
+			del(pkgs[x])
+	return pkgs
+
+def grablines(myfilename,recursive=0):
+	mylines=[]
+	if recursive and os.path.isdir(myfilename):
+		if myfilename in ["RCS", "CVS", "SCCS"]:
+			return mylines
+		dirlist = os.listdir(myfilename)
+		dirlist.sort()
+		for f in dirlist:
+			if not f.startswith(".") and not f.endswith("~"):
+				mylines.extend(grablines(
+					os.path.join(myfilename, f), recursive))
+	else:
+		try:
+			myfile = open(myfilename, "r")
+			mylines = myfile.readlines()
+			myfile.close()
+		except IOError:
+			pass
+	return mylines
+
+def writedict(mydict,myfilename,writekey=True):
+	"""Writes out a dict to a file; writekey=0 mode doesn't write out
+	the key and assumes all values are strings, not lists."""
+	myfile = None
+	try:
+		myfile = atomic_ofstream(myfilename)
+		if not writekey:
+			for x in mydict.values():
+				myfile.write(x+"\n")
+		else:
+			for x in mydict.keys():
+				myfile.write("%s %s\n" % (x, " ".join(mydict[x])))
+		myfile.close()
+	except IOError:
+		if myfile is not None:
+			myfile.abort()
+		return 0
+	return 1
+
+def getconfig(mycfg, tolerant=0, allow_sourcing=False, expand=True):
+	mykeys={}
+	try:
+		f=open(mycfg,'r')
+	except IOError, e:
+		if e.errno != errno.ENOENT:
+			raise
+		return None
+	try:
+		lex = shlex.shlex(f, posix=True)
+		lex.wordchars=string.digits+string.letters+"~!@#$%*_\:;?,./-+{}"     
+		lex.quotes="\"'"
+		if allow_sourcing:
+			lex.source="source"
+		while 1:
+			key=lex.get_token()
+			if key == "export":
+				key = lex.get_token()
+			if key is None:
+				#normal end of file
+				break;
+			equ=lex.get_token()
+			if (equ==''):
+				#unexpected end of file
+				#lex.error_leader(self.filename,lex.lineno)
+				if not tolerant:
+					writemsg("!!! Unexpected end of config file: variable "+str(key)+"\n",
+						noiselevel=-1)
+					raise Exception("ParseError: Unexpected EOF: "+str(mycfg)+": on/before line "+str(lex.lineno))
+				else:
+					return mykeys
+			elif (equ!='='):
+				#invalid token
+				#lex.error_leader(self.filename,lex.lineno)
+				if not tolerant:
+					writemsg("!!! Invalid token (not \"=\") "+str(equ)+"\n",
+						noiselevel=-1)
+					raise Exception("ParseError: Invalid token (not '='): "+str(mycfg)+": line "+str(lex.lineno))
+				else:
+					return mykeys
+			val=lex.get_token()
+			if val is None:
+				#unexpected end of file
+				#lex.error_leader(self.filename,lex.lineno)
+				if not tolerant:
+					writemsg("!!! Unexpected end of config file: variable "+str(key)+"\n",
+						noiselevel=-1)
+					raise portage.exception.CorruptionError("ParseError: Unexpected EOF: "+str(mycfg)+": line "+str(lex.lineno))
+				else:
+					return mykeys
+			if expand:
+				mykeys[key] = varexpand(val, mykeys)
+			else:
+				mykeys[key] = val
+	except SystemExit, e:
+		raise
+	except Exception, e:
+		raise portage.exception.ParseError(str(e)+" in "+mycfg)
+	return mykeys
+	
+#cache expansions of constant strings
+cexpand={}
+def varexpand(mystring, mydict={}):
+	newstring = cexpand.get(" "+mystring, None)
+	if newstring is not None:
+		return newstring
+
+	"""
+	new variable expansion code.  Preserves quotes, handles \n, etc.
+	This code is used by the configfile code, as well as others (parser)
+	This would be a good bunch of code to port to C.
+	"""
+	numvars=0
+	mystring=" "+mystring
+	#in single, double quotes
+	insing=0
+	indoub=0
+	pos=1
+	newstring=" "
+	while (pos<len(mystring)):
+		if (mystring[pos]=="'") and (mystring[pos-1]!="\\"):
+			if (indoub):
+				newstring=newstring+"'"
+			else:
+				newstring += "'" # Quote removal is handled by shlex.
+				insing=not insing
+			pos=pos+1
+			continue
+		elif (mystring[pos]=='"') and (mystring[pos-1]!="\\"):
+			if (insing):
+				newstring=newstring+'"'
+			else:
+				newstring += '"' # Quote removal is handled by shlex.
+				indoub=not indoub
+			pos=pos+1
+			continue
+		if (not insing): 
+			#expansion time
+			if (mystring[pos]=="\n"):
+				#convert newlines to spaces
+				newstring=newstring+" "
+				pos=pos+1
+			elif (mystring[pos]=="\\"):
+				#backslash expansion time
+				if (pos+1>=len(mystring)):
+					newstring=newstring+mystring[pos]
+					break
+				else:
+					a=mystring[pos+1]
+					pos=pos+2
+					if a=='a':
+						newstring=newstring+chr(007)
+					elif a=='b':
+						newstring=newstring+chr(010)
+					elif a=='e':
+						newstring=newstring+chr(033)
+					elif (a=='f') or (a=='n'):
+						newstring=newstring+chr(012)
+					elif a=='r':
+						newstring=newstring+chr(015)
+					elif a=='t':
+						newstring=newstring+chr(011)
+					elif a=='v':
+						newstring=newstring+chr(013)
+					elif a!='\n':
+						#remove backslash only, as bash does: this takes care of \\ and \' and \" as well
+						newstring=newstring+mystring[pos-1:pos]
+						continue
+			elif (mystring[pos]=="$") and (mystring[pos-1]!="\\"):
+				pos=pos+1
+				if mystring[pos]=="{":
+					pos=pos+1
+					braced=True
+				else:
+					braced=False
+				myvstart=pos
+				validchars=string.ascii_letters+string.digits+"_"
+				while mystring[pos] in validchars:
+					if (pos+1)>=len(mystring):
+						if braced:
+							cexpand[mystring]=""
+							return ""
+						else:
+							pos=pos+1
+							break
+					pos=pos+1
+				myvarname=mystring[myvstart:pos]
+				if braced:
+					if mystring[pos]!="}":
+						cexpand[mystring]=""
+						return ""
+					else:
+						pos=pos+1
+				if len(myvarname)==0:
+					cexpand[mystring]=""
+					return ""
+				numvars=numvars+1
+				if mydict.has_key(myvarname):
+					newstring=newstring+mydict[myvarname] 
+			else:
+				newstring=newstring+mystring[pos]
+				pos=pos+1
+		else:
+			newstring=newstring+mystring[pos]
+			pos=pos+1
+	if numvars==0:
+		cexpand[mystring]=newstring[1:]
+	return newstring[1:]	
+
+def pickle_write(data,filename,debug=0):
+	import os
+	try:
+		myf=open(filename,"w")
+		cPickle.dump(data,myf,-1)
+		myf.flush()
+		myf.close()
+		writemsg("Wrote pickle: "+str(filename)+"\n",1)
+		os.chown(myefn,uid,portage_gid)
+		os.chmod(myefn,0664)
+	except SystemExit, e:
+		raise
+	except Exception, e:
+		return 0
+	return 1
+
+def pickle_read(filename,default=None,debug=0):
+	import os
+	if not os.access(filename, os.R_OK):
+		writemsg("pickle_read(): File not readable. '"+filename+"'\n",1)
+		return default
+	data = None
+	try:
+		myf = open(filename)
+		mypickle = cPickle.Unpickler(myf)
+		mypickle.find_global = None
+		data = mypickle.load()
+		myf.close()
+		del mypickle,myf
+		writemsg("pickle_read(): Loaded pickle. '"+filename+"'\n",1)
+	except SystemExit, e:
+		raise
+	except Exception, e:
+		writemsg("!!! Failed to load pickle: "+str(e)+"\n",1)
+		data = default
+	return data
+
+def dump_traceback(msg, noiselevel=1):
+	import sys, traceback
+	info = sys.exc_info()
+	if not info[2]:
+		stack = traceback.extract_stack()[:-1]
+		error = None
+	else:
+		stack = traceback.extract_tb(info[2])
+		error = str(info[1])
+	writemsg("\n====================================\n", noiselevel=noiselevel)
+	writemsg("%s\n\n" % msg, noiselevel=noiselevel)
+	for line in traceback.format_list(stack):
+		writemsg(line, noiselevel=noiselevel)
+	if error:
+		writemsg(error+"\n", noiselevel=noiselevel)
+	writemsg("====================================\n\n", noiselevel=noiselevel)
+
+def unique_array(s):
+	"""lifted from python cookbook, credit: Tim Peters
+	Return a list of the elements in s in arbitrary order, sans duplicates"""
+	n = len(s)
+	# assume all elements are hashable, if so, it's linear
+	try:
+		return list(set(s))
+	except TypeError:
+		pass
+
+	# so much for linear.  abuse sort.
+	try:
+		t = list(s)
+		t.sort()
+	except TypeError:
+		pass
+	else:
+		assert n > 0
+		last = t[0]
+		lasti = i = 1
+		while i < n:
+			if t[i] != last:
+				t[lasti] = last = t[i]
+				lasti += 1
+			i += 1
+		return t[:lasti]
+
+	# blah.	 back to original portage.unique_array
+	u = []
+	for x in s:
+		if x not in u:
+			u.append(x)
+	return u
+
+def apply_permissions(filename, uid=-1, gid=-1, mode=-1, mask=-1,
+	stat_cached=None, follow_links=True):
+	"""Apply user, group, and mode bits to a file if the existing bits do not
+	already match.  The default behavior is to force an exact match of mode
+	bits.  When mask=0 is specified, mode bits on the target file are allowed
+	to be a superset of the mode argument (via logical OR).  When mask>0, the
+	mode bits that the target file is allowed to have are restricted via
+	logical XOR.
+	Returns True if the permissions were modified and False otherwise."""
+
+	modified = False
+
+	if stat_cached is None:
+		try:
+			if follow_links:
+				stat_cached = os.stat(filename)
+			else:
+				stat_cached = os.lstat(filename)
+		except OSError, oe:
+			func_call = "stat('%s')" % filename
+			if oe.errno == errno.EPERM:
+				raise OperationNotPermitted(func_call)
+			elif oe.errno == errno.EACCES:
+				raise PermissionDenied(func_call)
+			elif oe.errno == errno.ENOENT:
+				raise FileNotFound(filename)
+			else:
+				raise
+
+	if	(uid != -1 and uid != stat_cached.st_uid) or \
+		(gid != -1 and gid != stat_cached.st_gid):
+		try:
+			if follow_links:
+				os.chown(filename, uid, gid)
+			else:
+				import portage.data
+				portage.data.lchown(filename, uid, gid)
+			modified = True
+		except OSError, oe:
+			func_call = "chown('%s', %i, %i)" % (filename, uid, gid)
+			if oe.errno == errno.EPERM:
+				raise OperationNotPermitted(func_call)
+			elif oe.errno == errno.EACCES:
+				raise PermissionDenied(func_call)
+			elif oe.errno == errno.EROFS:
+				raise ReadOnlyFileSystem(func_call)
+			elif oe.errno == errno.ENOENT:
+				raise FileNotFound(filename)
+			else:
+				raise
+
+	new_mode = -1
+	st_mode = stat_cached.st_mode & 07777 # protect from unwanted bits
+	if mask >= 0:
+		if mode == -1:
+			mode = 0 # Don't add any mode bits when mode is unspecified.
+		else:
+			mode = mode & 07777
+		if	(mode & st_mode != mode) or \
+			((mask ^ st_mode) & st_mode != st_mode):
+			new_mode = mode | st_mode
+			new_mode = (mask ^ new_mode) & new_mode
+	elif mode != -1:
+		mode = mode & 07777 # protect from unwanted bits
+		if mode != st_mode:
+			new_mode = mode
+
+	# The chown system call may clear S_ISUID and S_ISGID
+	# bits, so those bits are restored if necessary.
+	if modified and new_mode == -1 and \
+		(st_mode & stat.S_ISUID or st_mode & stat.S_ISGID):
+		if mode == -1:
+			new_mode = st_mode
+		else:
+			mode = mode & 07777
+			if mask >= 0:
+				new_mode = mode | st_mode
+				new_mode = (mask ^ new_mode) & new_mode
+			else:
+				new_mode = mode
+			if not (new_mode & stat.S_ISUID or new_mode & stat.S_ISGID):
+				new_mode = -1
+
+	if not follow_links and stat.S_ISLNK(stat_cached.st_mode):
+		# Mode doesn't matter for symlinks.
+		new_mode = -1
+
+	if new_mode != -1:
+		try:
+			os.chmod(filename, new_mode)
+			modified = True
+		except OSError, oe:
+			func_call = "chmod('%s', %s)" % (filename, oct(new_mode))
+			if oe.errno == errno.EPERM:
+				raise OperationNotPermitted(func_call)
+			elif oe.errno == errno.EACCES:
+				raise PermissionDenied(func_call)
+			elif oe.errno == errno.EROFS:
+				raise ReadOnlyFileSystem(func_call)
+			elif oe.errno == errno.ENOENT:
+				raise FileNotFound(filename)
+			raise
+	return modified
+
+def apply_stat_permissions(filename, newstat, **kwargs):
+	"""A wrapper around apply_secpass_permissions that gets
+	uid, gid, and mode from a stat object"""
+	return apply_secpass_permissions(filename, uid=newstat.st_uid, gid=newstat.st_gid,
+	mode=newstat.st_mode, **kwargs)
+
+def apply_recursive_permissions(top, uid=-1, gid=-1,
+	dirmode=-1, dirmask=-1, filemode=-1, filemask=-1, onerror=None):
+	"""A wrapper around apply_secpass_permissions that applies permissions
+	recursively.  If optional argument onerror is specified, it should be a
+	function; it will be called with one argument, a PortageException instance.
+	Returns True if all permissions are applied and False if some are left
+	unapplied."""
+
+	if onerror is None:
+		# Default behavior is to dump errors to stderr so they won't
+		# go unnoticed.  Callers can pass in a quiet instance.
+		def onerror(e):
+			if isinstance(e, OperationNotPermitted):
+				writemsg("Operation Not Permitted: %s\n" % str(e),
+					noiselevel=-1)
+			elif isinstance(e, FileNotFound):
+				writemsg("File Not Found: '%s'\n" % str(e), noiselevel=-1)
+			else:
+				raise
+
+	all_applied = True
+	for dirpath, dirnames, filenames in os.walk(top):
+		try:
+			applied = apply_secpass_permissions(dirpath,
+				uid=uid, gid=gid, mode=dirmode, mask=dirmask)
+			if not applied:
+				all_applied = False
+		except PortageException, e:
+			all_applied = False
+			onerror(e)
+
+		for name in filenames:
+			try:
+				applied = apply_secpass_permissions(os.path.join(dirpath, name),
+					uid=uid, gid=gid, mode=filemode, mask=filemask)
+				if not applied:
+					all_applied = False
+			except PortageException, e:
+				all_applied = False
+				onerror(e)
+	return all_applied
+
+def apply_secpass_permissions(filename, uid=-1, gid=-1, mode=-1, mask=-1,
+	stat_cached=None, follow_links=True):
+	"""A wrapper around apply_permissions that uses secpass and simple
+	logic to apply as much of the permissions as possible without
+	generating an obviously avoidable permission exception. Despite
+	attempts to avoid an exception, it's possible that one will be raised
+	anyway, so be prepared.
+	Returns True if all permissions are applied and False if some are left
+	unapplied."""
+
+	if stat_cached is None:
+		try:
+			if follow_links:
+				stat_cached = os.stat(filename)
+			else:
+				stat_cached = os.lstat(filename)
+		except OSError, oe:
+			func_call = "stat('%s')" % filename
+			if oe.errno == errno.EPERM:
+				raise OperationNotPermitted(func_call)
+			elif oe.errno == errno.EACCES:
+				raise PermissionDenied(func_call)
+			elif oe.errno == errno.ENOENT:
+				raise FileNotFound(filename)
+			else:
+				raise
+
+	all_applied = True
+
+	import portage.data # not imported globally because of circular dep
+	if portage.data.secpass < 2:
+
+		if uid != -1 and \
+		uid != stat_cached.st_uid:
+			all_applied = False
+			uid = -1
+
+		if gid != -1 and \
+		gid != stat_cached.st_gid and \
+		gid not in os.getgroups():
+			all_applied = False
+			gid = -1
+
+	apply_permissions(filename, uid=uid, gid=gid, mode=mode, mask=mask,
+		stat_cached=stat_cached, follow_links=follow_links)
+	return all_applied
+
+class atomic_ofstream(file):
+	"""Write a file atomically via os.rename().  Atomic replacement prevents
+	interprocess interference and prevents corruption of the target
+	file when the write is interrupted (for example, when an 'out of space'
+	error occurs)."""
+
+	def __init__(self, filename, mode='w', follow_links=True, **kargs):
+		"""Opens a temporary filename.pid in the same directory as filename."""
+		self._aborted = False
+
+		if follow_links:
+			canonical_path = os.path.realpath(filename)
+			self._real_name = canonical_path
+			tmp_name = "%s.%i" % (canonical_path, os.getpid())
+			try:
+				super(atomic_ofstream, self).__init__(tmp_name, mode=mode, **kargs)
+				return
+			except (OSError, IOError), e:
+				if canonical_path == filename:
+					raise
+				writemsg("!!! Failed to open file: '%s'\n" % tmp_name,
+					noiselevel=-1)
+				writemsg("!!! %s\n" % str(e), noiselevel=-1)
+
+		self._real_name = filename
+		tmp_name = "%s.%i" % (filename, os.getpid())
+		super(atomic_ofstream, self).__init__(tmp_name, mode=mode, **kargs)
+
+	def close(self):
+		"""Closes the temporary file, copies permissions (if possible),
+		and performs the atomic replacement via os.rename().  If the abort()
+		method has been called, then the temp file is closed and removed."""
+		if not self.closed:
+			try:
+				super(atomic_ofstream, self).close()
+				if not self._aborted:
+					try:
+						apply_stat_permissions(self.name, os.stat(self._real_name))
+					except OperationNotPermitted:
+						pass
+					except FileNotFound:
+						pass
+					except OSError, oe: # from the above os.stat call
+						if oe.errno in (errno.ENOENT, errno.EPERM):
+							pass
+						else:
+							raise
+					os.rename(self.name, self._real_name)
+			finally:
+				# Make sure we cleanup the temp file
+				# even if an exception is raised.
+				try:
+					os.unlink(self.name)
+				except OSError, oe:
+					pass
+
+	def abort(self):
+		"""If an error occurs while writing the file, the user should
+		call this method in order to leave the target file unchanged.
+		This will call close() automatically."""
+		if not self._aborted:
+			self._aborted = True
+			self.close()
+
+	def __del__(self):
+		"""If the user does not explicitely call close(), it is
+		assumed that an error has occurred, so we abort()."""
+		if not self.closed:
+			self.abort()
+		# ensure destructor from the base class is called
+		base_destructor = getattr(super(atomic_ofstream, self), '__del__', None)
+		if base_destructor is not None:
+			base_destructor()
+
+def write_atomic(file_path, content):
+	f = None
+	try:
+		f = atomic_ofstream(file_path)
+		f.write(content)
+		f.close()
+	except (IOError, OSError), e:
+		if f:
+			f.abort()
+		func_call = "write_atomic('%s')" % file_path
+		if e.errno == errno.EPERM:
+			raise OperationNotPermitted(func_call)
+		elif e.errno == errno.EACCES:
+			raise PermissionDenied(func_call)
+		elif e.errno == errno.EROFS:
+			raise ReadOnlyFileSystem(func_call)
+		elif e.errno == errno.ENOENT:
+			raise FileNotFound(file_path)
+		else:
+			raise
+
+def ensure_dirs(dir_path, *args, **kwargs):
+	"""Create a directory and call apply_permissions.
+	Returns True if a directory is created or the permissions needed to be
+	modified, and False otherwise."""
+
+	created_dir = False
+
+	try:
+		os.makedirs(dir_path)
+		created_dir = True
+	except OSError, oe:
+		func_call = "makedirs('%s')" % dir_path
+		if errno.EEXIST == oe.errno:
+			pass
+		elif oe.errno == errno.EPERM:
+			raise OperationNotPermitted(func_call)
+		elif oe.errno == errno.EACCES:
+			raise PermissionDenied(func_call)
+		elif oe.errno == errno.EROFS:
+			raise ReadOnlyFileSystem(func_call)
+		else:
+			raise
+	perms_modified = apply_permissions(dir_path, *args, **kwargs)
+	return created_dir or perms_modified
+
+class LazyItemsDict(dict):
+	"""A mapping object that behaves like a standard dict except that it allows
+	for lazy initialization of values via callable objects.  Lazy items can be
+	overwritten and deleted just as normal items."""
+	def __init__(self, initial_items=None):
+		dict.__init__(self)
+		self.lazy_items = {}
+		if initial_items is not None:
+			self.update(initial_items)
+	def addLazyItem(self, item_key, value_callable, *pargs, **kwargs):
+		"""Add a lazy item for the given key.  When the item is requested,
+		value_callable will be called with *pargs and **kwargs arguments."""
+		self.lazy_items[item_key] = (value_callable, pargs, kwargs)
+		# make it show up in self.keys(), etc...
+		dict.__setitem__(self, item_key, None)
+	def addLazySingleton(self, item_key, value_callable, *pargs, **kwargs):
+		"""This is like addLazyItem except value_callable will only be called
+		a maximum of 1 time and the result will be cached for future requests."""
+		class SingletonItem(object):
+			def __init__(self, value_callable, *pargs, **kwargs):
+				self._callable = value_callable
+				self._pargs = pargs
+				self._kwargs = kwargs
+				self._called = False
+			def __call__(self):
+				if not self._called:
+					self._called = True
+					self._value = self._callable(*self._pargs, **self._kwargs)
+				return self._value
+		self.addLazyItem(item_key, SingletonItem(value_callable, *pargs, **kwargs))
+	def update(self, map_obj):
+		if isinstance(map_obj, LazyItemsDict):
+			for k in map_obj:
+				if k in map_obj.lazy_items:
+					dict.__setitem__(self, k, None)
+				else:
+					dict.__setitem__(self, k, map_obj[k])
+			self.lazy_items.update(map_obj.lazy_items)
+		else:
+			dict.update(self, map_obj)
+	def __getitem__(self, item_key):
+		if item_key in self.lazy_items:
+			value_callable, pargs, kwargs = self.lazy_items[item_key]
+			return value_callable(*pargs, **kwargs)
+		else:
+			return dict.__getitem__(self, item_key)
+	def __setitem__(self, item_key, value):
+		if item_key in self.lazy_items:
+			del self.lazy_items[item_key]
+		dict.__setitem__(self, item_key, value)
+	def __delitem__(self, item_key):
+		if item_key in self.lazy_items:
+			del self.lazy_items[item_key]
+		dict.__delitem__(self, item_key)
+
+class ConfigProtect(object):
+	def __init__(self, myroot, protect_list, mask_list):
+		self.myroot = myroot
+		self.protect_list = protect_list
+		self.mask_list = mask_list
+		self.updateprotect()
+
+	def updateprotect(self):
+		"""Update internal state for isprotected() calls.  Nonexistent paths
+		are ignored."""
+		self.protect = []
+		self._dirs = set()
+		for x in self.protect_list:
+			ppath = normalize_path(
+				os.path.join(self.myroot + EPREFIX, x.lstrip(os.path.sep)))
+			mystat = None
+			try:
+				if stat.S_ISDIR(os.stat(ppath).st_mode):
+					self._dirs.add(ppath)
+				self.protect.append(ppath)
+			except OSError:
+				# If it doesn't exist, there's no need to protect it.
+				pass
+
+		self.protectmask = []
+		for x in self.mask_list:
+			ppath = normalize_path(
+				os.path.join(self.myroot + EPREFIX, x.lstrip(os.path.sep)))
+			mystat = None
+			try:
+				"""Use lstat so that anything, even a broken symlink can be
+				protected."""
+				if stat.S_ISDIR(os.lstat(ppath).st_mode):
+					self._dirs.add(ppath)
+				self.protectmask.append(ppath)
+				"""Now use stat in case this is a symlink to a directory."""
+				if stat.S_ISDIR(os.stat(ppath).st_mode):
+					self._dirs.add(ppath)
+			except OSError:
+				# If it doesn't exist, there's no need to mask it.
+				pass
+
+	def isprotected(self, obj):
+		"""Returns True if obj is protected, False otherwise.  The caller must
+		ensure that obj is normalized with a single leading slash.  A trailing
+		slash is optional for directories."""
+		masked = 0
+		protected = 0
+		sep = os.path.sep
+		for ppath in self.protect:
+			if len(ppath) > masked and obj.startswith(ppath):
+				if ppath in self._dirs:
+					if obj != ppath and not obj.startswith(ppath + sep):
+						# /etc/foo does not match /etc/foobaz
+						continue
+				elif obj != ppath:
+					# force exact match when CONFIG_PROTECT lists a
+					# non-directory
+					continue
+				protected = len(ppath)
+				#config file management
+				for pmpath in self.protectmask:
+					if len(pmpath) >= protected and obj.startswith(pmpath):
+						if pmpath in self._dirs:
+							if obj != pmpath and \
+								not obj.startswith(pmpath + sep):
+								# /etc/foo does not match /etc/foobaz
+								continue
+						elif obj != pmpath:
+							# force exact match when CONFIG_PROTECT_MASK lists
+							# a non-directory
+							continue
+						#skip, it's in the mask
+						masked = len(pmpath)
+		return protected > masked
+
+def new_protect_filename(mydest, newmd5=None):
+	"""Resolves a config-protect filename for merging, optionally
+	using the last filename if the md5 matches.
+	(dest,md5) ==> 'string'            --- path_to_target_filename
+	(dest)     ==> ('next', 'highest') --- next_target and most-recent_target
+	"""
+
+	# config protection filename format:
+	# ._cfg0000_foo
+	# 0123456789012
+	prot_num = -1
+	last_pfile = ""
+
+	if not os.path.exists(mydest):
+		return mydest
+
+	real_filename = os.path.basename(mydest)
+	real_dirname  = os.path.dirname(mydest)
+	for pfile in os.listdir(real_dirname):
+		if pfile[0:5] != "._cfg":
+			continue
+		if pfile[10:] != real_filename:
+			continue
+		try:
+			new_prot_num = int(pfile[5:9])
+			if new_prot_num > prot_num:
+				prot_num = new_prot_num
+				last_pfile = pfile
+		except ValueError:
+			continue
+	prot_num = prot_num + 1
+
+	new_pfile = normalize_path(os.path.join(real_dirname,
+		"._cfg" + str(prot_num).zfill(4) + "_" + real_filename))
+	old_pfile = normalize_path(os.path.join(real_dirname, last_pfile))
+	if last_pfile and newmd5:
+		import portage.checksum
+		if portage.checksum.perform_md5(
+			os.path.join(real_dirname, last_pfile)) == newmd5:
+			return old_pfile
+	return new_pfile
Index: /vendor/prefix-portage/current/pym/portage/versions.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/versions.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/versions.py	(revision 3489)
@@ -0,0 +1,333 @@
+# versions.py -- core Portage functionality
+# Copyright 1998-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+import re
+
+# PREFIX hack: -r(\\d+) -> -r(\\d+|0\\d+\\.\\d+) (see below)
+ver_regexp = re.compile("^(cvs\\.)?(\\d+)((\\.\\d+)*)([a-z]?)((_(pre|p|beta|alpha|rc)\\d*)*)(-r(\\d+|0\\.\\d+))?$")
+suffix_regexp = re.compile("^(alpha|beta|rc|pre|p)(\\d*)$")
+suffix_value = {"pre": -2, "p": 0, "alpha": -4, "beta": -3, "rc": -1}
+endversion_keys = ["pre", "p", "alpha", "beta", "rc"]
+
+from portage.exception import InvalidData
+
+def ververify(myver, silent=1):
+	if ver_regexp.match(myver):
+		return 1
+	else:
+		if not silent:
+			print "!!! syntax error in version: %s" % myver
+		return 0
+
+vercmp_cache = {}
+def vercmp(ver1, ver2, silent=1):
+	"""
+	Compare two versions
+	Example usage:
+		>>> from portage.versions import vercmp
+		>>> vercmp('1.0-r1','1.2-r3')
+		negative number
+		>>> vercmp('1.3','1.2-r3')
+		positive number
+		>>> vercmp('1.0_p3','1.0_p3')
+		0
+	
+	@param pkg1: version to compare with (see ver_regexp in portage.versions.py)
+	@type pkg1: string (example: "2.1.2-r3")
+	@param pkg2: version to compare againts (see ver_regexp in portage.versions.py)
+	@type pkg2: string (example: "2.1.2_rc5")
+	@rtype: None or float
+	@return:
+	1. positive if ver1 is greater than ver2
+	2. negative if ver1 is less than ver2 
+	3. 0 if ver1 equals ver2
+	4. None if ver1 or ver2 are invalid (see ver_regexp in portage.versions.py)
+	"""
+
+	if ver1 == ver2:
+		return 0
+	mykey=ver1+":"+ver2
+	try:
+		return vercmp_cache[mykey]
+	except KeyError:
+		pass
+	match1 = ver_regexp.match(ver1)
+	match2 = ver_regexp.match(ver2)
+	
+	# checking that the versions are valid
+	if not match1 or not match1.groups():
+		if not silent:
+			print "!!! syntax error in version: %s" % ver1
+		return None
+	if not match2 or not match2.groups():
+		if not silent:
+			print "!!! syntax error in version: %s" % ver2
+		return None
+
+	# shortcut for cvs ebuilds (new style)
+	if match1.group(1) and not match2.group(1):
+		vercmp_cache[mykey] = 1
+		return 1
+	elif match2.group(1) and not match1.group(1):
+		vercmp_cache[mykey] = -1
+		return -1
+	
+	# building lists of the version parts before the suffix
+	# first part is simple
+	list1 = [int(match1.group(2))]
+	list2 = [int(match2.group(2))]
+
+	# this part would greatly benefit from a fixed-length version pattern
+	if len(match1.group(3)) or len(match2.group(3)):
+		vlist1 = match1.group(3)[1:].split(".")
+		vlist2 = match2.group(3)[1:].split(".")
+		for i in range(0, max(len(vlist1), len(vlist2))):
+			# Implcit .0 is given a value of -1, so that 1.0.0 > 1.0, since it
+			# would be ambiguous if two versions that aren't literally equal
+			# are given the same value (in sorting, for example).
+			if len(vlist1) <= i or len(vlist1[i]) == 0:
+				list1.append(-1)
+				list2.append(int(vlist2[i]))
+			elif len(vlist2) <= i or len(vlist2[i]) == 0:
+				list1.append(int(vlist1[i]))
+				list2.append(-1)
+			# Let's make life easy and use integers unless we're forced to use floats
+			elif (vlist1[i][0] != "0" and vlist2[i][0] != "0"):
+				list1.append(int(vlist1[i]))
+				list2.append(int(vlist2[i]))
+			# now we have to use floats so 1.02 compares correctly against 1.1
+			else:
+				list1.append(float("0."+vlist1[i]))
+				list2.append(float("0."+vlist2[i]))
+
+	# and now the final letter
+	if len(match1.group(5)):
+		list1.append(ord(match1.group(5)))
+	if len(match2.group(5)):
+		list2.append(ord(match2.group(5)))
+
+	for i in range(0, max(len(list1), len(list2))):
+		if len(list1) <= i:
+			vercmp_cache[mykey] = -1
+			return -1
+		elif len(list2) <= i:
+			vercmp_cache[mykey] = 1
+			return 1
+		elif list1[i] != list2[i]:
+			vercmp_cache[mykey] = list1[i] - list2[i]
+			return list1[i] - list2[i]
+	
+	# main version is equal, so now compare the _suffix part
+	list1 = match1.group(6).split("_")[1:]
+	list2 = match2.group(6).split("_")[1:]
+	
+	for i in range(0, max(len(list1), len(list2))):
+		# Implicit _p0 is given a value of -1, so that 1 < 1_p0
+		if len(list1) <= i:
+			s1 = ("p","-1")
+		else:
+			s1 = suffix_regexp.match(list1[i]).groups()
+		if len(list2) <= i:
+			s2 = ("p","-1")
+		else:
+			s2 = suffix_regexp.match(list2[i]).groups()
+		if s1[0] != s2[0]:
+			return suffix_value[s1[0]] - suffix_value[s2[0]]
+		if s1[1] != s2[1]:
+			# it's possible that the s(1|2)[1] == ''
+			# in such a case, fudge it.
+			try:			r1 = int(s1[1])
+			except ValueError:	r1 = 0
+			try:			r2 = int(s2[1])
+			except ValueError:	r2 = 0
+			if r1 - r2:
+				return r1 - r2
+	
+	# the suffix part is equal to, so finally check the revision
+	# PREFIX hack: a revision starting with 0 is an 'inter-revision',
+	# which means that it is possible to create revisions on revisions.
+	# An example is -r01.1 which is the first revision of -r1.  Note
+	# that a period (.) is used to separate the real revision and the
+	# secondary revision number.  This trick is in use to allow revision
+	# bumps in ebuilds synced from the main tree for prefix changes,
+	# while still staying in the main tree versioning scheme.
+	if match1.group(10):
+		if match1.group(10)[0] == '0':
+			t = match1.group(10)[1:].split(".")
+			r1 = int(t[1])
+			r3 = int(t[2])
+		else:
+			r1 = int(match1.group(10))
+	else:
+		r1 = 0
+	if match2.group(10):
+		if match2.group(10)[0] == '0':
+			t = match2.group(10)[1:].split(".")
+			r2 = int(t[1])
+			r4 = int(t[2])
+		else:
+			r2 = int(match2.group(10))
+	else:
+		r2 = 0
+	if r1 == r2 and (r3 != 0 or r4 != 0):
+		r1 = r3
+		r2 = r4
+	vercmp_cache[mykey] = r1 - r2
+	return r1 - r2
+	
+def pkgcmp(pkg1, pkg2):
+	"""
+	Compare 2 package versions created in pkgsplit format.
+
+	Example usage:
+		>>> from portage.versions import *
+		>>> pkgcmp(pkgsplit('test-1.0-r1'),pkgsplit('test-1.2-r3'))
+		-1
+		>>> pkgcmp(pkgsplit('test-1.3'),pkgsplit('test-1.2-r3'))
+		1
+
+	@param pkg1: package to compare with
+	@type pkg1: list (example: ['test', '1.0', 'r1'])
+	@param pkg2: package to compare againts
+	@type pkg2: list (example: ['test', '1.0', 'r1'])
+	@rtype: None or integer
+	@return: 
+		1. None if package names are not the same
+		2. 1 if pkg1 is greater than pkg2
+		3. -1 if pkg1 is less than pkg2 
+		4. 0 if pkg1 equals pkg2
+	"""
+	if pkg1[0] != pkg2[0]:
+		return None
+	mycmp=vercmp(pkg1[1],pkg2[1])
+	if mycmp>0:
+		return 1
+	if mycmp<0:
+		return -1
+	r1=float(pkg1[2][1:])
+	r2=float(pkg2[2][1:])
+	if r1>r2:
+		return 1
+	if r2>r1:
+		return -1
+	return 0
+
+
+pkgcache={}
+
+def pkgsplit(mypkg,silent=1):
+	try:
+		if not pkgcache[mypkg]:
+			return None
+		return pkgcache[mypkg]
+	except KeyError:
+		pass
+	myparts=mypkg.split("-")
+	
+	if len(myparts)<2:
+		if not silent:
+			print "!!! Name error in",mypkg+": missing a version or name part."
+		pkgcache[mypkg]=None
+		return None
+	for x in myparts:
+		if len(x)==0:
+			if not silent:
+				print "!!! Name error in",mypkg+": empty \"-\" part."
+			pkgcache[mypkg]=None
+			return None
+	
+	#verify rev
+	revok=0
+	myrev=myparts[-1]
+	if len(myrev) and myrev[0]=="r":
+		try:
+			# PREFIX hack: allow floats in revisions
+			float(myrev[1:])
+			revok=1
+		except ValueError: # from int()
+			pass
+	if revok:
+		verPos = -2
+		revision = myparts[-1]
+	else:
+		verPos = -1
+		revision = "r0"
+
+	if ververify(myparts[verPos]):
+		if len(myparts)== (-1*verPos):
+			pkgcache[mypkg]=None
+			return None
+		else:
+			for x in myparts[:verPos]:
+				if ververify(x):
+					pkgcache[mypkg]=None
+					return None
+					#names can't have versiony looking parts
+			myval=("-".join(myparts[:verPos]),myparts[verPos],revision)
+			pkgcache[mypkg]=myval
+			return myval
+	else:
+		pkgcache[mypkg]=None
+		return None
+
+catcache={}
+def catpkgsplit(mydata,silent=1):
+	"""
+	Takes a Category/Package-Version-Rev and returns a list of each.
+	
+	@param mydata: Data to split
+	@type mydata: string 
+	@param silent: suppress error messages
+	@type silent: Boolean (integer)
+	@rype: list
+	@return:
+	1.  If each exists, it returns [cat, pkgname, version, rev]
+	2.  If cat is not specificed in mydata, cat will be "null"
+	3.  if rev does not exist it will be '-r0'
+	4.  If cat is invalid (specified but has incorrect syntax)
+ 		an InvalidData Exception will be thrown
+	"""
+	
+	# Categories may contain a-zA-z0-9+_- but cannot start with -
+	import portage.dep
+	try:
+		if not catcache[mydata]:
+			return None
+		return catcache[mydata]
+	except KeyError:
+		pass
+	mysplit=mydata.split("/")
+	p_split=None
+	if len(mysplit)==1:
+		retval=["null"]
+		p_split=pkgsplit(mydata,silent=silent)
+	elif len(mysplit)==2:
+		retval=[mysplit[0]]
+		p_split=pkgsplit(mysplit[1],silent=silent)
+	if not p_split:
+		catcache[mydata]=None
+		return None
+	retval.extend(p_split)
+	retval = tuple(retval)
+	catcache[mydata]=retval
+	return retval
+
+def catsplit(mydep):
+        return mydep.split("/", 1)
+
+def best(mymatches):
+	"""Accepts None arguments; assumes matches are valid."""
+	if mymatches is None:
+		return ""
+	if not len(mymatches):
+		return ""
+	bestmatch = mymatches[0]
+	p2 = catpkgsplit(bestmatch)[1:]
+	for x in mymatches[1:]:
+		p1 = catpkgsplit(x)[1:]
+		if pkgcmp(p1, p2) > 0:
+			bestmatch = x
+			p2 = catpkgsplit(bestmatch)[1:]
+	return bestmatch
Index: /vendor/prefix-portage/current/pym/portage/xpak.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage/xpak.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage/xpak.py	(revision 3489)
@@ -0,0 +1,421 @@
+# Copyright 2001-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: /var/cvsroot/gentoo-src/portage/pym/xpak.py,v 1.13.2.3 2005/02/26 11:22:38 carpaski Exp $
+
+
+# The format for a tbz2/xpak:
+#
+#  tbz2: tar.bz2 + xpak + (xpak_offset) + "STOP"
+#  xpak: "XPAKPACK" + (index_len) + (data_len) + index + data + "XPAKSTOP"
+# index: (pathname_len) + pathname + (data_offset) + (data_len)
+#        index entries are concatenated end-to-end.
+#  data: concatenated data chunks, end-to-end.
+#
+# [tarball]XPAKPACKIIIIDDDD[index][data]XPAKSTOPOOOOSTOP
+#
+# (integer) == encodeint(integer)  ===> 4 characters (big-endian copy)
+# '+' means concatenate the fields ===> All chunks are strings
+
+import sys,os,shutil,errno
+from stat import *
+
+def addtolist(mylist,curdir):
+	"""(list, dir) --- Takes an array(list) and appends all files from dir down
+	the directory tree. Returns nothing. list is modified."""
+	for x in os.listdir("."):
+		if os.path.isdir(x):
+			os.chdir(x)
+			addtolist(mylist,curdir+x+"/")
+			os.chdir("..")
+		else:
+			if curdir+x not in mylist:
+				mylist.append(curdir+x)
+
+def encodeint(myint):
+	"""Takes a 4 byte integer and converts it into a string of 4 characters.
+	Returns the characters in a string."""
+	part1=chr((myint >> 24 ) & 0x000000ff)
+	part2=chr((myint >> 16 ) & 0x000000ff)
+	part3=chr((myint >> 8 ) & 0x000000ff)
+	part4=chr(myint & 0x000000ff)
+	return part1+part2+part3+part4
+
+def decodeint(mystring):
+	"""Takes a 4 byte string and converts it into a 4 byte integer.
+	Returns an integer."""
+	myint=0
+	myint=myint+ord(mystring[3])
+	myint=myint+(ord(mystring[2]) << 8)
+	myint=myint+(ord(mystring[1]) << 16)
+	myint=myint+(ord(mystring[0]) << 24)
+	return myint
+
+def xpak(rootdir,outfile=None):
+	"""(rootdir,outfile) -- creates an xpak segment of the directory 'rootdir'
+	and under the name 'outfile' if it is specified. Otherwise it returns the
+	xpak segment."""
+	try:
+		origdir=os.getcwd()
+	except SystemExit, e:
+		raise
+	except:
+		os.chdir("/")
+		origdir="/"
+	os.chdir(rootdir)
+	mylist=[]
+
+	addtolist(mylist,"")
+	mylist.sort()
+	mydata = {}
+	for x in mylist:
+		a = open(x, "r")
+		mydata[x] = a.read()
+		a.close()
+	os.chdir(origdir)
+
+	xpak_segment = xpak_mem(mydata)
+	if outfile:
+		outf = open(outfile, "w")
+		outf.write(xpak_segment)
+		outf.close()
+	else:
+		return xpak_segment
+
+def xpak_mem(mydata):
+	"""Create an xpack segement from a map object."""
+	indexglob=""
+	indexpos=0
+	dataglob=""
+	datapos=0
+	for x, newglob in mydata.iteritems():
+		mydatasize=len(newglob)
+		indexglob=indexglob+encodeint(len(x))+x+encodeint(datapos)+encodeint(mydatasize)
+		indexpos=indexpos+4+len(x)+4+4
+		dataglob=dataglob+newglob
+		datapos=datapos+mydatasize
+	return "XPAKPACK" \
+	+ encodeint(len(indexglob)) \
+	+ encodeint(len(dataglob)) \
+	+ indexglob \
+	+ dataglob \
+	+ "XPAKSTOP"
+
+def xsplit(infile):
+	"""(infile) -- Splits the infile into two files.
+	'infile.index' contains the index segment.
+	'infile.dat' contails the data segment."""
+	myfile=open(infile,"r")
+	mydat=myfile.read()
+	myfile.close()
+	
+	splits = xsplit_mem(mydat)
+	if not splits:
+		return False
+	
+	myfile=open(infile+".index","w")
+	myfile.write(splits[0])
+	myfile.close()
+	myfile=open(infile+".dat","w")
+	myfile.write(splits[1])
+	myfile.close()
+	return True
+
+def xsplit_mem(mydat):
+	if mydat[0:8]!="XPAKPACK":
+		return None
+	if mydat[-8:]!="XPAKSTOP":
+		return None
+	indexsize=decodeint(mydat[8:12])
+	datasize=decodeint(mydat[12:16])
+	return (mydat[16:indexsize+16], mydat[indexsize+16:-8])
+
+def getindex(infile):
+	"""(infile) -- grabs the index segment from the infile and returns it."""
+	myfile=open(infile,"r")
+	myheader=myfile.read(16)
+	if myheader[0:8]!="XPAKPACK":
+		myfile.close()
+		return
+	indexsize=decodeint(myheader[8:12])
+	myindex=myfile.read(indexsize)
+	myfile.close()
+	return myindex
+
+def getboth(infile):
+	"""(infile) -- grabs the index and data segments from the infile.
+	Returns an array [indexSegment,dataSegment]"""
+	myfile=open(infile,"r")
+	myheader=myfile.read(16)
+	if myheader[0:8]!="XPAKPACK":
+		myfile.close()
+		return
+	indexsize=decodeint(myheader[8:12])
+	datasize=decodeint(myheader[12:16])
+	myindex=myfile.read(indexsize)
+	mydata=myfile.read(datasize)
+	myfile.close()
+	return myindex, mydata
+
+def listindex(myindex):
+	"""Print to the terminal the filenames listed in the indexglob passed in."""
+	for x in getindex_mem(myindex):
+		print x
+
+def getindex_mem(myindex):
+	"""Returns the filenames listed in the indexglob passed in."""
+	myindexlen=len(myindex)
+	startpos=0
+	myret=[]
+	while ((startpos+8)<myindexlen):
+		mytestlen=decodeint(myindex[startpos:startpos+4])
+		myret=myret+[myindex[startpos+4:startpos+4+mytestlen]]
+		startpos=startpos+mytestlen+12
+	return myret
+
+def searchindex(myindex,myitem):
+	"""(index,item) -- Finds the offset and length of the file 'item' in the
+	datasegment via the index 'index' provided."""
+	mylen=len(myitem)
+	myindexlen=len(myindex)
+	startpos=0
+	while ((startpos+8)<myindexlen):
+		mytestlen=decodeint(myindex[startpos:startpos+4])
+		if mytestlen==mylen:
+			if myitem==myindex[startpos+4:startpos+4+mytestlen]:
+				#found
+				datapos=decodeint(myindex[startpos+4+mytestlen:startpos+8+mytestlen]);
+				datalen=decodeint(myindex[startpos+8+mytestlen:startpos+12+mytestlen]);
+				return datapos, datalen
+		startpos=startpos+mytestlen+12
+		
+def getitem(myid,myitem):
+	myindex=myid[0]
+	mydata=myid[1]
+	myloc=searchindex(myindex,myitem)
+	if not myloc:
+		return None
+	return mydata[myloc[0]:myloc[0]+myloc[1]]
+
+def xpand(myid,mydest):
+	myindex=myid[0]
+	mydata=myid[1]
+	try:
+		origdir=os.getcwd()
+	except SystemExit, e:
+		raise
+	except:
+		os.chdir("/")
+		origdir="/"
+	os.chdir(mydest)
+	myindexlen=len(myindex)
+	startpos=0
+	while ((startpos+8)<myindexlen):
+		namelen=decodeint(myindex[startpos:startpos+4])
+		datapos=decodeint(myindex[startpos+4+namelen:startpos+8+namelen]);
+		datalen=decodeint(myindex[startpos+8+namelen:startpos+12+namelen]);
+		myname=myindex[startpos+4:startpos+4+namelen]
+		dirname=os.path.dirname(myname)
+		if dirname:
+			if not os.path.exists(dirname):
+				os.makedirs(dirname)
+		mydat=open(myname,"w")
+		mydat.write(mydata[datapos:datapos+datalen])
+		mydat.close()
+		startpos=startpos+namelen+12
+	os.chdir(origdir)
+
+class tbz2:
+	def __init__(self,myfile):
+		self.file=myfile
+		self.filestat=None
+		self.index=""
+		self.infosize=0
+		self.xpaksize=0
+		self.indexsize=None
+		self.datasize=None
+		self.indexpos=None
+		self.datapos=None
+		self.scan()
+
+	def decompose(self,datadir,cleanup=1):
+		"""Alias for unpackinfo() --- Complement to recompose() but optionally
+		deletes the destination directory. Extracts the xpak from the tbz2 into
+		the directory provided. Raises IOError if scan() fails.
+		Returns result of upackinfo()."""
+		if not self.scan():
+			raise IOError
+		if cleanup:
+			self.cleanup(datadir)
+		if not os.path.exists(datadir):
+			os.makedirs(datadir)
+		return self.unpackinfo(datadir)
+	def compose(self,datadir,cleanup=0):
+		"""Alias for recompose()."""
+		return recompose(datadir,cleanup)
+	def recompose(self,datadir,cleanup=0):
+		"""Creates an xpak segment from the datadir provided, truncates the tbz2
+		to the end of regular data if an xpak segment already exists, and adds
+		the new segment to the file with terminating info."""
+		xpdata = xpak(datadir)
+		self.recompose_mem(xpdata)
+		if cleanup:
+			self.cleanup(datadir)
+
+	def recompose_mem(self, xpdata):
+		self.scan() # Don't care about condition... We'll rewrite the data anyway.
+		myfile=open(self.file,"a+")
+		if not myfile:
+			raise IOError
+		myfile.seek(-self.xpaksize,2) # 0,2 or -0,2 just mean EOF.
+		myfile.truncate()
+		myfile.write(xpdata+encodeint(len(xpdata))+"STOP")
+		myfile.flush()
+		myfile.close()
+		return 1
+
+	def cleanup(self, datadir):
+		datadir_split = os.path.split(datadir)
+		if len(datadir_split) >= 2 and len(datadir_split[1]) > 0:
+			# This is potentially dangerous,
+			# thus the above sanity check.
+			try:
+				shutil.rmtree(datadir)
+			except OSError, oe:
+				if oe.errno == errno.ENOENT:
+					pass
+				else:
+					raise oe
+
+	def scan(self):
+		"""Scans the tbz2 to locate the xpak segment and setup internal values.
+		This function is called by relevant functions already."""
+		try:
+			mystat=os.stat(self.file)
+			if self.filestat:
+				changed=0
+				for x in [ST_SIZE, ST_MTIME, ST_CTIME]:
+					if mystat[x] != self.filestat[x]:
+						changed=1
+				if not changed:
+					return 1
+			self.filestat=mystat
+			a=open(self.file,"r")
+			a.seek(-16,2)
+			trailer=a.read()
+			self.infosize=0
+			self.xpaksize=0
+			if trailer[-4:]!="STOP":
+				a.close()
+				return 0
+			if trailer[0:8]!="XPAKSTOP":
+				a.close()
+				return 0
+			self.infosize=decodeint(trailer[8:12])
+			self.xpaksize=self.infosize+8
+			a.seek(-(self.xpaksize),2)
+			header=a.read(16)
+			if header[0:8]!="XPAKPACK":
+				a.close()
+				return 0
+			self.indexsize=decodeint(header[8:12])
+			self.datasize=decodeint(header[12:16])
+			self.indexpos=a.tell()
+			self.index=a.read(self.indexsize)
+			self.datapos=a.tell()
+			a.close()
+			return 2
+		except SystemExit, e:
+			raise
+		except:
+			return 0
+
+	def filelist(self):
+		"""Return an array of each file listed in the index."""
+		if not self.scan():
+			return None
+		return getindex_mem(self.index)
+
+	def getfile(self,myfile,mydefault=None):
+		"""Finds 'myfile' in the data segment and returns it."""
+		if not self.scan():
+			return None
+		myresult=searchindex(self.index,myfile)
+		if not myresult:
+			return mydefault
+		a=open(self.file,"r")
+		a.seek(self.datapos+myresult[0],0)
+		myreturn=a.read(myresult[1])
+		a.close()
+		return myreturn
+
+	def getelements(self,myfile):
+		"""A split/array representation of tbz2.getfile()"""
+		mydat=self.getfile(myfile)
+		if not mydat:
+			return []
+		return mydat.split()
+
+	def unpackinfo(self,mydest):
+		"""Unpacks all the files from the dataSegment into 'mydest'."""
+		if not self.scan():
+			return 0
+		try:
+			origdir=os.getcwd()
+		except SystemExit, e:
+			raise
+		except:
+			os.chdir("/")
+			origdir="/"
+		a=open(self.file,"r")
+		if not os.path.exists(mydest):
+			os.makedirs(mydest)
+		os.chdir(mydest)
+		startpos=0
+		while ((startpos+8)<self.indexsize):
+			namelen=decodeint(self.index[startpos:startpos+4])
+			datapos=decodeint(self.index[startpos+4+namelen:startpos+8+namelen]);
+			datalen=decodeint(self.index[startpos+8+namelen:startpos+12+namelen]);
+			myname=self.index[startpos+4:startpos+4+namelen]
+			dirname=os.path.dirname(myname)
+			if dirname:
+				if not os.path.exists(dirname):
+					os.makedirs(dirname)
+			mydat=open(myname,"w")
+			a.seek(self.datapos+datapos)
+			mydat.write(a.read(datalen))
+			mydat.close()
+			startpos=startpos+namelen+12
+		a.close()
+		os.chdir(origdir)
+		return 1
+
+	def get_data(self):
+		"""Returns all the files from the dataSegment as a map object."""
+		if not self.scan():
+			return 0
+		a = open(self.file, "r")
+		mydata = {}
+		startpos=0
+		while ((startpos+8)<self.indexsize):
+			namelen=decodeint(self.index[startpos:startpos+4])
+			datapos=decodeint(self.index[startpos+4+namelen:startpos+8+namelen]);
+			datalen=decodeint(self.index[startpos+8+namelen:startpos+12+namelen]);
+			myname=self.index[startpos+4:startpos+4+namelen]
+			a.seek(self.datapos+datapos)
+			mydata[myname] = a.read(datalen)
+			startpos=startpos+namelen+12
+		a.close()
+		return mydata
+
+	def getboth(self):
+		"""Returns an array [indexSegment,dataSegment]"""
+		if not self.scan():
+			return None
+
+		a = open(self.file,"r")
+		a.seek(self.datapos)
+		mydata =a.read(self.datasize)
+		a.close()
+
+		return self.index, mydata
+
Index: /vendor/prefix-portage/current/pym/portage_checksum.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage_checksum.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage_checksum.py	(revision 3489)
@@ -0,0 +1,35 @@
+# portage_compat_namespace.py -- provide compability layer with new namespace
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_compat_namespace.py 5981 2007-02-17 13:11:28Z genone $
+
+""" 
+This module checks the name under which it is imported and attempts to load
+the corresponding module of the new portage namespace, inserting it into the
+loaded modules list.
+It also issues a warning to the caller to migrate to the new namespace.
+Note that this module should never be used with it's true name, but only by 
+links pointing to it. Also it is limited to portage_foo -> portage.foo 
+translations, however existing subpackages shouldn't use it anyway to maintain 
+compability with 3rd party modules (like elog or cache plugins), and they 
+shouldn't be directly imported by external consumers.
+
+This module is based on an idea by Brian Harring.
+"""
+
+import sys, warnings
+
+__oldname = __name__
+if __name__.startswith("portage_"):
+	__newname = __name__.replace("_", ".")
+else:
+	__newname = "portage."+__name__
+
+try:
+	__package = __import__(__newname, globals(), locals())
+	__realmodule = getattr(__package, __newname[8:])
+except ImportError, AttributeError:
+	raise ImportError("No module named %s" % __oldname)
+
+warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname))
+sys.modules[__oldname] = __realmodule
Index: /vendor/prefix-portage/current/pym/portage_compat_namespace.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage_compat_namespace.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage_compat_namespace.py	(revision 3489)
@@ -0,0 +1,35 @@
+# portage_compat_namespace.py -- provide compability layer with new namespace
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_compat_namespace.py 6077 2007-02-26 21:16:35Z grobian $
+
+""" 
+This module checks the name under which it is imported and attempts to load
+the corresponding module of the new portage namespace, inserting it into the
+loaded modules list.
+It also issues a warning to the caller to migrate to the new namespace.
+Note that this module should never be used with it's true name, but only by 
+links pointing to it. Also it is limited to portage_foo -> portage.foo 
+translations, however existing subpackages shouldn't use it anyway to maintain 
+compability with 3rd party modules (like elog or cache plugins), and they 
+shouldn't be directly imported by external consumers.
+
+This module is based on an idea by Brian Harring.
+"""
+
+import sys, warnings
+
+__oldname = __name__
+if __name__.startswith("portage_"):
+	__newname = __name__.replace("_", ".")
+else:
+	__newname = "portage."+__name__
+
+try:
+	__package = __import__(__newname, globals(), locals())
+	__realmodule = getattr(__package, __newname[8:])
+except ImportError, AttributeError:
+	raise ImportError("No module named %s" % __oldname)
+
+warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname))
+sys.modules[__oldname] = __realmodule
Index: /vendor/prefix-portage/current/pym/portage_const.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage_const.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage_const.py	(revision 3489)
@@ -0,0 +1,35 @@
+# portage_compat_namespace.py -- provide compability layer with new namespace
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_compat_namespace.py 5981 2007-02-17 13:11:28Z genone $
+
+""" 
+This module checks the name under which it is imported and attempts to load
+the corresponding module of the new portage namespace, inserting it into the
+loaded modules list.
+It also issues a warning to the caller to migrate to the new namespace.
+Note that this module should never be used with it's true name, but only by 
+links pointing to it. Also it is limited to portage_foo -> portage.foo 
+translations, however existing subpackages shouldn't use it anyway to maintain 
+compability with 3rd party modules (like elog or cache plugins), and they 
+shouldn't be directly imported by external consumers.
+
+This module is based on an idea by Brian Harring.
+"""
+
+import sys, warnings
+
+__oldname = __name__
+if __name__.startswith("portage_"):
+	__newname = __name__.replace("_", ".")
+else:
+	__newname = "portage."+__name__
+
+try:
+	__package = __import__(__newname, globals(), locals())
+	__realmodule = getattr(__package, __newname[8:])
+except ImportError, AttributeError:
+	raise ImportError("No module named %s" % __oldname)
+
+warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname))
+sys.modules[__oldname] = __realmodule
Index: /vendor/prefix-portage/current/pym/portage_data.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage_data.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage_data.py	(revision 3489)
@@ -0,0 +1,35 @@
+# portage_compat_namespace.py -- provide compability layer with new namespace
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_compat_namespace.py 5981 2007-02-17 13:11:28Z genone $
+
+""" 
+This module checks the name under which it is imported and attempts to load
+the corresponding module of the new portage namespace, inserting it into the
+loaded modules list.
+It also issues a warning to the caller to migrate to the new namespace.
+Note that this module should never be used with it's true name, but only by 
+links pointing to it. Also it is limited to portage_foo -> portage.foo 
+translations, however existing subpackages shouldn't use it anyway to maintain 
+compability with 3rd party modules (like elog or cache plugins), and they 
+shouldn't be directly imported by external consumers.
+
+This module is based on an idea by Brian Harring.
+"""
+
+import sys, warnings
+
+__oldname = __name__
+if __name__.startswith("portage_"):
+	__newname = __name__.replace("_", ".")
+else:
+	__newname = "portage."+__name__
+
+try:
+	__package = __import__(__newname, globals(), locals())
+	__realmodule = getattr(__package, __newname[8:])
+except ImportError, AttributeError:
+	raise ImportError("No module named %s" % __oldname)
+
+warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname))
+sys.modules[__oldname] = __realmodule
Index: /vendor/prefix-portage/current/pym/portage_debug.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage_debug.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage_debug.py	(revision 3489)
@@ -0,0 +1,35 @@
+# portage_compat_namespace.py -- provide compability layer with new namespace
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_compat_namespace.py 5981 2007-02-17 13:11:28Z genone $
+
+""" 
+This module checks the name under which it is imported and attempts to load
+the corresponding module of the new portage namespace, inserting it into the
+loaded modules list.
+It also issues a warning to the caller to migrate to the new namespace.
+Note that this module should never be used with it's true name, but only by 
+links pointing to it. Also it is limited to portage_foo -> portage.foo 
+translations, however existing subpackages shouldn't use it anyway to maintain 
+compability with 3rd party modules (like elog or cache plugins), and they 
+shouldn't be directly imported by external consumers.
+
+This module is based on an idea by Brian Harring.
+"""
+
+import sys, warnings
+
+__oldname = __name__
+if __name__.startswith("portage_"):
+	__newname = __name__.replace("_", ".")
+else:
+	__newname = "portage."+__name__
+
+try:
+	__package = __import__(__newname, globals(), locals())
+	__realmodule = getattr(__package, __newname[8:])
+except ImportError, AttributeError:
+	raise ImportError("No module named %s" % __oldname)
+
+warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname))
+sys.modules[__oldname] = __realmodule
Index: /vendor/prefix-portage/current/pym/portage_dep.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage_dep.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage_dep.py	(revision 3489)
@@ -0,0 +1,35 @@
+# portage_compat_namespace.py -- provide compability layer with new namespace
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_compat_namespace.py 5981 2007-02-17 13:11:28Z genone $
+
+""" 
+This module checks the name under which it is imported and attempts to load
+the corresponding module of the new portage namespace, inserting it into the
+loaded modules list.
+It also issues a warning to the caller to migrate to the new namespace.
+Note that this module should never be used with it's true name, but only by 
+links pointing to it. Also it is limited to portage_foo -> portage.foo 
+translations, however existing subpackages shouldn't use it anyway to maintain 
+compability with 3rd party modules (like elog or cache plugins), and they 
+shouldn't be directly imported by external consumers.
+
+This module is based on an idea by Brian Harring.
+"""
+
+import sys, warnings
+
+__oldname = __name__
+if __name__.startswith("portage_"):
+	__newname = __name__.replace("_", ".")
+else:
+	__newname = "portage."+__name__
+
+try:
+	__package = __import__(__newname, globals(), locals())
+	__realmodule = getattr(__package, __newname[8:])
+except ImportError, AttributeError:
+	raise ImportError("No module named %s" % __oldname)
+
+warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname))
+sys.modules[__oldname] = __realmodule
Index: /vendor/prefix-portage/current/pym/portage_exception.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage_exception.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage_exception.py	(revision 3489)
@@ -0,0 +1,35 @@
+# portage_compat_namespace.py -- provide compability layer with new namespace
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_compat_namespace.py 5981 2007-02-17 13:11:28Z genone $
+
+""" 
+This module checks the name under which it is imported and attempts to load
+the corresponding module of the new portage namespace, inserting it into the
+loaded modules list.
+It also issues a warning to the caller to migrate to the new namespace.
+Note that this module should never be used with it's true name, but only by 
+links pointing to it. Also it is limited to portage_foo -> portage.foo 
+translations, however existing subpackages shouldn't use it anyway to maintain 
+compability with 3rd party modules (like elog or cache plugins), and they 
+shouldn't be directly imported by external consumers.
+
+This module is based on an idea by Brian Harring.
+"""
+
+import sys, warnings
+
+__oldname = __name__
+if __name__.startswith("portage_"):
+	__newname = __name__.replace("_", ".")
+else:
+	__newname = "portage."+__name__
+
+try:
+	__package = __import__(__newname, globals(), locals())
+	__realmodule = getattr(__package, __newname[8:])
+except ImportError, AttributeError:
+	raise ImportError("No module named %s" % __oldname)
+
+warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname))
+sys.modules[__oldname] = __realmodule
Index: /vendor/prefix-portage/current/pym/portage_exec.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage_exec.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage_exec.py	(revision 3489)
@@ -0,0 +1,15 @@
+# portage_compat_namespace.py -- provide compability layer with new namespace
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_compat_namespace.py 5782 2007-01-25 17:07:32Z genone $
+
+""" 
+Special edition of portage_compat_namespace.py as for this module we can't translate
+name automatically as "import portage.exec" is a SyntaxError.
+"""
+
+import sys, warnings
+
+import portage.process
+warnings.warn("DEPRECATION NOTICE: The portage_exec module was replaced by portage.process")
+sys.modules["portage_exec"] = portage.process
Index: /vendor/prefix-portage/current/pym/portage_gpg.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage_gpg.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage_gpg.py	(revision 3489)
@@ -0,0 +1,35 @@
+# portage_compat_namespace.py -- provide compability layer with new namespace
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_compat_namespace.py 5981 2007-02-17 13:11:28Z genone $
+
+""" 
+This module checks the name under which it is imported and attempts to load
+the corresponding module of the new portage namespace, inserting it into the
+loaded modules list.
+It also issues a warning to the caller to migrate to the new namespace.
+Note that this module should never be used with it's true name, but only by 
+links pointing to it. Also it is limited to portage_foo -> portage.foo 
+translations, however existing subpackages shouldn't use it anyway to maintain 
+compability with 3rd party modules (like elog or cache plugins), and they 
+shouldn't be directly imported by external consumers.
+
+This module is based on an idea by Brian Harring.
+"""
+
+import sys, warnings
+
+__oldname = __name__
+if __name__.startswith("portage_"):
+	__newname = __name__.replace("_", ".")
+else:
+	__newname = "portage."+__name__
+
+try:
+	__package = __import__(__newname, globals(), locals())
+	__realmodule = getattr(__package, __newname[8:])
+except ImportError, AttributeError:
+	raise ImportError("No module named %s" % __oldname)
+
+warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname))
+sys.modules[__oldname] = __realmodule
Index: /vendor/prefix-portage/current/pym/portage_localization.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage_localization.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage_localization.py	(revision 3489)
@@ -0,0 +1,35 @@
+# portage_compat_namespace.py -- provide compability layer with new namespace
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_compat_namespace.py 5981 2007-02-17 13:11:28Z genone $
+
+""" 
+This module checks the name under which it is imported and attempts to load
+the corresponding module of the new portage namespace, inserting it into the
+loaded modules list.
+It also issues a warning to the caller to migrate to the new namespace.
+Note that this module should never be used with it's true name, but only by 
+links pointing to it. Also it is limited to portage_foo -> portage.foo 
+translations, however existing subpackages shouldn't use it anyway to maintain 
+compability with 3rd party modules (like elog or cache plugins), and they 
+shouldn't be directly imported by external consumers.
+
+This module is based on an idea by Brian Harring.
+"""
+
+import sys, warnings
+
+__oldname = __name__
+if __name__.startswith("portage_"):
+	__newname = __name__.replace("_", ".")
+else:
+	__newname = "portage."+__name__
+
+try:
+	__package = __import__(__newname, globals(), locals())
+	__realmodule = getattr(__package, __newname[8:])
+except ImportError, AttributeError:
+	raise ImportError("No module named %s" % __oldname)
+
+warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname))
+sys.modules[__oldname] = __realmodule
Index: /vendor/prefix-portage/current/pym/portage_locks.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage_locks.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage_locks.py	(revision 3489)
@@ -0,0 +1,35 @@
+# portage_compat_namespace.py -- provide compability layer with new namespace
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_compat_namespace.py 5981 2007-02-17 13:11:28Z genone $
+
+""" 
+This module checks the name under which it is imported and attempts to load
+the corresponding module of the new portage namespace, inserting it into the
+loaded modules list.
+It also issues a warning to the caller to migrate to the new namespace.
+Note that this module should never be used with it's true name, but only by 
+links pointing to it. Also it is limited to portage_foo -> portage.foo 
+translations, however existing subpackages shouldn't use it anyway to maintain 
+compability with 3rd party modules (like elog or cache plugins), and they 
+shouldn't be directly imported by external consumers.
+
+This module is based on an idea by Brian Harring.
+"""
+
+import sys, warnings
+
+__oldname = __name__
+if __name__.startswith("portage_"):
+	__newname = __name__.replace("_", ".")
+else:
+	__newname = "portage."+__name__
+
+try:
+	__package = __import__(__newname, globals(), locals())
+	__realmodule = getattr(__package, __newname[8:])
+except ImportError, AttributeError:
+	raise ImportError("No module named %s" % __oldname)
+
+warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname))
+sys.modules[__oldname] = __realmodule
Index: /vendor/prefix-portage/current/pym/portage_mail.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage_mail.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage_mail.py	(revision 3489)
@@ -0,0 +1,35 @@
+# portage_compat_namespace.py -- provide compability layer with new namespace
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_compat_namespace.py 5981 2007-02-17 13:11:28Z genone $
+
+""" 
+This module checks the name under which it is imported and attempts to load
+the corresponding module of the new portage namespace, inserting it into the
+loaded modules list.
+It also issues a warning to the caller to migrate to the new namespace.
+Note that this module should never be used with it's true name, but only by 
+links pointing to it. Also it is limited to portage_foo -> portage.foo 
+translations, however existing subpackages shouldn't use it anyway to maintain 
+compability with 3rd party modules (like elog or cache plugins), and they 
+shouldn't be directly imported by external consumers.
+
+This module is based on an idea by Brian Harring.
+"""
+
+import sys, warnings
+
+__oldname = __name__
+if __name__.startswith("portage_"):
+	__newname = __name__.replace("_", ".")
+else:
+	__newname = "portage."+__name__
+
+try:
+	__package = __import__(__newname, globals(), locals())
+	__realmodule = getattr(__package, __newname[8:])
+except ImportError, AttributeError:
+	raise ImportError("No module named %s" % __oldname)
+
+warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname))
+sys.modules[__oldname] = __realmodule
Index: /vendor/prefix-portage/current/pym/portage_manifest.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage_manifest.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage_manifest.py	(revision 3489)
@@ -0,0 +1,35 @@
+# portage_compat_namespace.py -- provide compability layer with new namespace
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_compat_namespace.py 5981 2007-02-17 13:11:28Z genone $
+
+""" 
+This module checks the name under which it is imported and attempts to load
+the corresponding module of the new portage namespace, inserting it into the
+loaded modules list.
+It also issues a warning to the caller to migrate to the new namespace.
+Note that this module should never be used with it's true name, but only by 
+links pointing to it. Also it is limited to portage_foo -> portage.foo 
+translations, however existing subpackages shouldn't use it anyway to maintain 
+compability with 3rd party modules (like elog or cache plugins), and they 
+shouldn't be directly imported by external consumers.
+
+This module is based on an idea by Brian Harring.
+"""
+
+import sys, warnings
+
+__oldname = __name__
+if __name__.startswith("portage_"):
+	__newname = __name__.replace("_", ".")
+else:
+	__newname = "portage."+__name__
+
+try:
+	__package = __import__(__newname, globals(), locals())
+	__realmodule = getattr(__package, __newname[8:])
+except ImportError, AttributeError:
+	raise ImportError("No module named %s" % __oldname)
+
+warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname))
+sys.modules[__oldname] = __realmodule
Index: /vendor/prefix-portage/current/pym/portage_news.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage_news.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage_news.py	(revision 3489)
@@ -0,0 +1,35 @@
+# portage_compat_namespace.py -- provide compability layer with new namespace
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_compat_namespace.py 5981 2007-02-17 13:11:28Z genone $
+
+""" 
+This module checks the name under which it is imported and attempts to load
+the corresponding module of the new portage namespace, inserting it into the
+loaded modules list.
+It also issues a warning to the caller to migrate to the new namespace.
+Note that this module should never be used with it's true name, but only by 
+links pointing to it. Also it is limited to portage_foo -> portage.foo 
+translations, however existing subpackages shouldn't use it anyway to maintain 
+compability with 3rd party modules (like elog or cache plugins), and they 
+shouldn't be directly imported by external consumers.
+
+This module is based on an idea by Brian Harring.
+"""
+
+import sys, warnings
+
+__oldname = __name__
+if __name__.startswith("portage_"):
+	__newname = __name__.replace("_", ".")
+else:
+	__newname = "portage."+__name__
+
+try:
+	__package = __import__(__newname, globals(), locals())
+	__realmodule = getattr(__package, __newname[8:])
+except ImportError, AttributeError:
+	raise ImportError("No module named %s" % __oldname)
+
+warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname))
+sys.modules[__oldname] = __realmodule
Index: /vendor/prefix-portage/current/pym/portage_selinux.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage_selinux.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage_selinux.py	(revision 3489)
@@ -0,0 +1,35 @@
+# portage_compat_namespace.py -- provide compability layer with new namespace
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_compat_namespace.py 5981 2007-02-17 13:11:28Z genone $
+
+""" 
+This module checks the name under which it is imported and attempts to load
+the corresponding module of the new portage namespace, inserting it into the
+loaded modules list.
+It also issues a warning to the caller to migrate to the new namespace.
+Note that this module should never be used with it's true name, but only by 
+links pointing to it. Also it is limited to portage_foo -> portage.foo 
+translations, however existing subpackages shouldn't use it anyway to maintain 
+compability with 3rd party modules (like elog or cache plugins), and they 
+shouldn't be directly imported by external consumers.
+
+This module is based on an idea by Brian Harring.
+"""
+
+import sys, warnings
+
+__oldname = __name__
+if __name__.startswith("portage_"):
+	__newname = __name__.replace("_", ".")
+else:
+	__newname = "portage."+__name__
+
+try:
+	__package = __import__(__newname, globals(), locals())
+	__realmodule = getattr(__package, __newname[8:])
+except ImportError, AttributeError:
+	raise ImportError("No module named %s" % __oldname)
+
+warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname))
+sys.modules[__oldname] = __realmodule
Index: /vendor/prefix-portage/current/pym/portage_update.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage_update.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage_update.py	(revision 3489)
@@ -0,0 +1,35 @@
+# portage_compat_namespace.py -- provide compability layer with new namespace
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_compat_namespace.py 5981 2007-02-17 13:11:28Z genone $
+
+""" 
+This module checks the name under which it is imported and attempts to load
+the corresponding module of the new portage namespace, inserting it into the
+loaded modules list.
+It also issues a warning to the caller to migrate to the new namespace.
+Note that this module should never be used with it's true name, but only by 
+links pointing to it. Also it is limited to portage_foo -> portage.foo 
+translations, however existing subpackages shouldn't use it anyway to maintain 
+compability with 3rd party modules (like elog or cache plugins), and they 
+shouldn't be directly imported by external consumers.
+
+This module is based on an idea by Brian Harring.
+"""
+
+import sys, warnings
+
+__oldname = __name__
+if __name__.startswith("portage_"):
+	__newname = __name__.replace("_", ".")
+else:
+	__newname = "portage."+__name__
+
+try:
+	__package = __import__(__newname, globals(), locals())
+	__realmodule = getattr(__package, __newname[8:])
+except ImportError, AttributeError:
+	raise ImportError("No module named %s" % __oldname)
+
+warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname))
+sys.modules[__oldname] = __realmodule
Index: /vendor/prefix-portage/current/pym/portage_util.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage_util.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage_util.py	(revision 3489)
@@ -0,0 +1,35 @@
+# portage_compat_namespace.py -- provide compability layer with new namespace
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_compat_namespace.py 5981 2007-02-17 13:11:28Z genone $
+
+""" 
+This module checks the name under which it is imported and attempts to load
+the corresponding module of the new portage namespace, inserting it into the
+loaded modules list.
+It also issues a warning to the caller to migrate to the new namespace.
+Note that this module should never be used with it's true name, but only by 
+links pointing to it. Also it is limited to portage_foo -> portage.foo 
+translations, however existing subpackages shouldn't use it anyway to maintain 
+compability with 3rd party modules (like elog or cache plugins), and they 
+shouldn't be directly imported by external consumers.
+
+This module is based on an idea by Brian Harring.
+"""
+
+import sys, warnings
+
+__oldname = __name__
+if __name__.startswith("portage_"):
+	__newname = __name__.replace("_", ".")
+else:
+	__newname = "portage."+__name__
+
+try:
+	__package = __import__(__newname, globals(), locals())
+	__realmodule = getattr(__package, __newname[8:])
+except ImportError, AttributeError:
+	raise ImportError("No module named %s" % __oldname)
+
+warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname))
+sys.modules[__oldname] = __realmodule
Index: /vendor/prefix-portage/current/pym/portage_versions.py
===================================================================
--- /vendor/prefix-portage/current/pym/portage_versions.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/portage_versions.py	(revision 3489)
@@ -0,0 +1,35 @@
+# portage_compat_namespace.py -- provide compability layer with new namespace
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_compat_namespace.py 5981 2007-02-17 13:11:28Z genone $
+
+""" 
+This module checks the name under which it is imported and attempts to load
+the corresponding module of the new portage namespace, inserting it into the
+loaded modules list.
+It also issues a warning to the caller to migrate to the new namespace.
+Note that this module should never be used with it's true name, but only by 
+links pointing to it. Also it is limited to portage_foo -> portage.foo 
+translations, however existing subpackages shouldn't use it anyway to maintain 
+compability with 3rd party modules (like elog or cache plugins), and they 
+shouldn't be directly imported by external consumers.
+
+This module is based on an idea by Brian Harring.
+"""
+
+import sys, warnings
+
+__oldname = __name__
+if __name__.startswith("portage_"):
+	__newname = __name__.replace("_", ".")
+else:
+	__newname = "portage."+__name__
+
+try:
+	__package = __import__(__newname, globals(), locals())
+	__realmodule = getattr(__package, __newname[8:])
+except ImportError, AttributeError:
+	raise ImportError("No module named %s" % __oldname)
+
+warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname))
+sys.modules[__oldname] = __realmodule
Index: /vendor/prefix-portage/current/pym/xpak.py
===================================================================
--- /vendor/prefix-portage/current/pym/xpak.py	(revision 3489)
+++ /vendor/prefix-portage/current/pym/xpak.py	(revision 3489)
@@ -0,0 +1,35 @@
+# portage_compat_namespace.py -- provide compability layer with new namespace
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: portage_compat_namespace.py 5981 2007-02-17 13:11:28Z genone $
+
+""" 
+This module checks the name under which it is imported and attempts to load
+the corresponding module of the new portage namespace, inserting it into the
+loaded modules list.
+It also issues a warning to the caller to migrate to the new namespace.
+Note that this module should never be used with it's true name, but only by 
+links pointing to it. Also it is limited to portage_foo -> portage.foo 
+translations, however existing subpackages shouldn't use it anyway to maintain 
+compability with 3rd party modules (like elog or cache plugins), and they 
+shouldn't be directly imported by external consumers.
+
+This module is based on an idea by Brian Harring.
+"""
+
+import sys, warnings
+
+__oldname = __name__
+if __name__.startswith("portage_"):
+	__newname = __name__.replace("_", ".")
+else:
+	__newname = "portage."+__name__
+
+try:
+	__package = __import__(__newname, globals(), locals())
+	__realmodule = getattr(__package, __newname[8:])
+except ImportError, AttributeError:
+	raise ImportError("No module named %s" % __oldname)
+
+warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname))
+sys.modules[__oldname] = __realmodule
Index: /vendor/prefix-portage/current/src/Makefile.am
===================================================================
--- /vendor/prefix-portage/current/src/Makefile.am	(revision 3489)
+++ /vendor/prefix-portage/current/src/Makefile.am	(revision 3489)
@@ -0,0 +1,15 @@
+SUBDIRS 	=
+
+bin_PROGRAMS	=
+bindir = @PORTAGE_BASE@/bin
+if BUILD_TBZ2TOOL
+bin_PROGRAMS += tbz2tool
+endif
+
+if BUILD_MISSINGOS
+SUBDIRS += python-missingos
+endif
+
+tbz2tool_SOURCES = tbz2tool.c
+
+MAINTAINERCLEANFILES = Makefile.in
Index: /vendor/prefix-portage/current/src/Makefile.in
===================================================================
--- /vendor/prefix-portage/current/src/Makefile.in	(revision 3489)
+++ /vendor/prefix-portage/current/src/Makefile.in	(revision 3489)
@@ -0,0 +1,564 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+bin_PROGRAMS = $(am__EXEEXT_1)
+@BUILD_TBZ2TOOL_TRUE@am__append_1 = tbz2tool
+@BUILD_MISSINGOS_TRUE@am__append_2 = python-missingos
+subdir = src
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+@BUILD_TBZ2TOOL_TRUE@am__EXEEXT_1 = tbz2tool$(EXEEXT)
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_tbz2tool_OBJECTS = tbz2tool.$(OBJEXT)
+tbz2tool_OBJECTS = $(am_tbz2tool_OBJECTS)
+tbz2tool_LDADD = $(LDADD)
+DEFAULT_INCLUDES = -I.@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(tbz2tool_SOURCES)
+DIST_SOURCES = $(tbz2tool_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = python-missingos
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+ARCH = @ARCH@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASENAME = @BASENAME@
+BASH = @BASH@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFAULT_PATH = @DEFAULT_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DIRNAME = @DIRNAME@
+DOMAIN_PREFIX = @DOMAIN_PREFIX@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FIND = @FIND@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MV = @MV@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PORTAGE_BASE = @PORTAGE_BASE@
+PYTHON = @PYTHON@
+RM = @RM@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+WGET = @WGET@
+XARGS = @XARGS@
+XCU_ID = @XCU_ID@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @PORTAGE_BASE@/bin
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+portagegroup = @portagegroup@
+portageuser = @portageuser@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+rootuid = @rootuid@
+rootuser = @rootuser@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+wheelgid = @wheelgid@
+SUBDIRS = $(am__append_2)
+tbz2tool_SOURCES = tbz2tool.c
+MAINTAINERCLEANFILES = Makefile.in
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  if test -f $$p \
+	  ; then \
+	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+	   echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+	   $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+	  else :; fi; \
+	done
+
+uninstall-binPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+	  echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(bindir)/$$f"; \
+	done
+
+clean-binPROGRAMS:
+	-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+tbz2tool$(EXEEXT): $(tbz2tool_OBJECTS) $(tbz2tool_DEPENDENCIES) 
+	@rm -f tbz2tool$(EXEEXT)
+	$(LINK) $(tbz2tool_OBJECTS) $(tbz2tool_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tbz2tool.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(PROGRAMS)
+installdirs: installdirs-recursive
+installdirs-am:
+	for dir in "$(DESTDIR)$(bindir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+	-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-recursive
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+	install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am check check-am clean clean-binPROGRAMS \
+	clean-generic ctags ctags-recursive distclean \
+	distclean-compile distclean-generic distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-binPROGRAMS install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	installdirs-am maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
+	ps ps-am tags tags-recursive uninstall uninstall-am \
+	uninstall-binPROGRAMS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
Index: /vendor/prefix-portage/current/src/bsd-flags/Makefile.in
===================================================================
--- /vendor/prefix-portage/current/src/bsd-flags/Makefile.in	(revision 3489)
+++ /vendor/prefix-portage/current/src/bsd-flags/Makefile.in	(revision 3489)
@@ -0,0 +1,45 @@
+srcdir = @srcdir@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+
+INSTALL	= @INSTALL@
+
+DISTFILES = 	setup.py 	\
+		Makefile.in	\
+		PKG-INFO	\
+		README		\
+		missingos.c	\
+		setup.cfg	\
+		ChangeLog	
+
+all: builddir
+	setup.py build
+
+builddir:
+	test "${abs_builddir}" != "${abs_srcdir}" \
+	&& for x in $(DISTFILES) \
+	 ; do $(INSTALL) ${abs_srcdir}/$${x} ${abs_builddir}/$${x} \
+	 ; done
+
+clean-builddir:
+	if test "${abs_builddir}" != "${abs_srcdir}" \
+	 ; then for x in $(DISTFILES) \
+	      ; do rm -f ${abs_builddir}/$${x} \
+	      ; done \
+	 ; fi
+
+install: builddir
+	setup.py install --root $(DESTDIR)/
+
+distdir:
+	for x in $(DISTFILES); do \
+		$(INSTALL) -D ${srcdir}/$${x} $(distdir)/$${x}; \
+	done
+	chmod 755 $(distdir)/setup.py
+
+distclean: clean-builddir
+
+clean maintainer-clean:
+.PHONY:	all install distdir builddir
+.PHONY: distclean clean maintainer-clean clean-builddir
+
Index: /vendor/prefix-portage/current/src/bsd-flags/PKG-INFO
===================================================================
--- /vendor/prefix-portage/current/src/bsd-flags/PKG-INFO	(revision 3489)
+++ /vendor/prefix-portage/current/src/bsd-flags/PKG-INFO	(revision 3489)
@@ -0,0 +1,10 @@
+Metadata-Version: 1.0
+Name: bsd-chflags
+Version: 0.1
+Summary: UNKNOWN
+Home-page: UNKNOWN
+Author: Stephen Bennett
+Author-email: spb@gentoo.org
+License: UNKNOWN
+Description: UNKNOWN
+Platform: UNKNOWN
Index: /vendor/prefix-portage/current/src/bsd-flags/chflags.c
===================================================================
--- /vendor/prefix-portage/current/src/bsd-flags/chflags.c	(revision 3489)
+++ /vendor/prefix-portage/current/src/bsd-flags/chflags.c	(revision 3489)
@@ -0,0 +1,161 @@
+/* $Id: chflags.c 4685 2006-10-14 14:06:29Z grobian $ */
+
+#include "Python.h"
+
+#include <sys/stat.h>
+
+static char chflags_lchflags__doc__[];
+static PyObject * chflags_lchflags(PyObject *self, PyObject *args);
+static char chflags_lgetflags__doc__[];
+static PyObject * chflags_lgetflags(PyObject *self, PyObject *args);
+static char chflags_lhasproblems__doc__[];
+static PyObject * chflags_lhasproblems(PyObject *self, PyObject *args);
+
+static char chflags__doc__[] = "Provide some operations for manipulating" \
+	"FreeBSD's filesystem flags";
+
+static PyMethodDef chflags_methods[] = {
+	{"lchflags", chflags_lchflags, METH_VARARGS, chflags_lchflags__doc__},
+	{"lgetflags", chflags_lgetflags, METH_VARARGS, chflags_lgetflags__doc__},
+	{"lhasproblems", chflags_lhasproblems, METH_VARARGS, chflags_lhasproblems__doc__},
+	{NULL, NULL}
+};
+
+static char chflags_lchflags__doc__[] = 
+"lchflags(path, flags) -> None\n\
+Change the flags on path to equal flags.";
+
+static char chflags_lgetflags__doc__[] =
+"lgetflags(path) -> Integer\n\
+Returns the file flags on path.";
+
+static char chflags_lhasproblems__doc__[] = 
+"lhasproblems(path) -> Integer\n\
+Returns 1 if path has any flags set that prevent write operations;\n\
+0 otherwise.";
+
+static const unsigned long problemflags=0x00160016;
+
+#if defined __FreeBSD__
+static PyObject *chflags_lchflags(PyObject *self, PyObject *args) 
+{
+	char *path = NULL;
+	int flags;
+	int res;
+
+	if (!PyArg_ParseTuple(args, "eti:lchflags",
+			      Py_FileSystemDefaultEncoding, &path,
+			      &flags))
+	{
+		return NULL;
+	}
+
+	res = lchflags(path, flags);
+
+	PyMem_Free(path);
+	return PyInt_FromLong((long)res);
+}
+
+static PyObject *chflags_lhasproblems(PyObject *self, PyObject *args)
+{
+	char *path = NULL;
+	struct stat sb;
+	int res;
+
+	if (!PyArg_ParseTuple(args, "et:lhasproblems",
+				Py_FileSystemDefaultEncoding, &path))
+	{
+		return NULL;
+	}
+
+	res = lstat(path, &sb);
+
+	PyMem_Free(path);
+		
+	if (res < 0)
+	{
+		return PyInt_FromLong((long)res);
+	}
+
+	if (sb.st_flags & problemflags)
+		return PyInt_FromLong(1);
+	else
+		return PyInt_FromLong(0);
+}
+
+static PyObject *chflags_lgetflags(PyObject *self, PyObject *args)
+{
+	char *path = NULL;
+	struct stat sb;
+	int res;
+
+	if (!PyArg_ParseTuple(args, "et:lgetflags",
+			      Py_FileSystemDefaultEncoding, &path))
+	{
+		return NULL;
+	}
+
+	res = lstat(path, &sb);
+
+	if (res < 0)
+	{
+		PyMem_Free(path);
+		return PyInt_FromLong((long)res);
+	}
+
+	PyMem_Free(path);
+
+	return PyInt_FromLong((long)sb.st_flags);
+}
+
+#else
+#warning Not on FreeBSD; building dummy lchflags
+
+static PyObject *chflags_lgetflags(PyObject *self, PyObject *args)
+{
+	/* Obviously we can't set flags if the OS/filesystem doesn't support them. */
+	return PyInt_FromLong(0);
+}
+
+static PyObject *chflags_lchflags(PyObject *self, PyObject *args)
+{
+	/* If file system flags aren't supported, just return 0,
+	 as the effect is basically the same. */
+	return PyInt_FromLong(0);
+}
+
+static PyObject *chflags_lhasproblems(PyObject *self, PyObject *args)
+{
+	return PyInt_FromLong(0);
+}
+
+#endif
+
+static int ins(PyObject *m, char *symbolname, int value)
+{
+	return PyModule_AddIntConstant(m, symbolname, value);
+}
+
+DL_EXPORT(void) initchflags(void)
+{
+	PyObject *m;
+	m = Py_InitModule4("chflags", chflags_methods, chflags__doc__,
+			   (PyObject*)NULL, PYTHON_API_VERSION);
+	
+	ins(m, "UF_SETTABLE",  0x0000ffff);
+	ins(m, "UF_NODUMP",    0x00000001);
+	ins(m, "UF_IMMUTABLE", 0x00000002);
+	ins(m, "UF_APPEND",    0x00000004);
+	ins(m, "UF_OPAQUE",    0x00000008);
+	ins(m, "UF_NOUNLINK",  0x00000010);
+
+	ins(m, "SF_SETTABLE",  0xffff0000);
+	ins(m, "SF_NODUMP",    0x00010000);
+	ins(m, "SF_IMMUTABLE", 0x00020000);
+	ins(m, "SF_APPEND",    0x00040000);
+	ins(m, "SF_OPAQUE",    0x00080000);
+	ins(m, "SF_NOUNLINK",  0x00100000);
+	ins(m, "SF_SNAPSHOT",  0x00200000);
+
+	ins(m, "PROBLEM_FLAGS", 0x00160016);
+}
Index: /vendor/prefix-portage/current/src/bsd-flags/setup.cfg
===================================================================
--- /vendor/prefix-portage/current/src/bsd-flags/setup.cfg	(revision 3489)
+++ /vendor/prefix-portage/current/src/bsd-flags/setup.cfg	(revision 3489)
@@ -0,0 +1,6 @@
+# bsd-flags
+# $Id: setup.cfg 4685 2006-10-14 14:06:29Z grobian $
+
+[bdist_rpm]
+release = 1
+python=python2
Index: /vendor/prefix-portage/current/src/bsd-flags/setup.py
===================================================================
--- /vendor/prefix-portage/current/src/bsd-flags/setup.py	(revision 3489)
+++ /vendor/prefix-portage/current/src/bsd-flags/setup.py	(revision 3489)
@@ -0,0 +1,24 @@
+#! /usr/bin/env python
+# $Id: setup.py 4685 2006-10-14 14:06:29Z grobian $
+
+from os import chdir, stat
+from distutils.core import setup, Extension
+
+setup (# Distribution meta-data
+        name = "bsd-chflags",
+        version = "0.1",
+        description = "",
+        author = "Stephen Bennett",
+        author_email = "spb@gentoo.org",
+       	license = "",
+        long_description = \
+         '''''',
+        ext_modules = [ Extension(
+                            "chflags",
+                            ["chflags.c"],
+                            libraries=[],
+                        ) 
+                      ],
+        url = "",
+      )
+
Index: /vendor/prefix-portage/current/src/python-missingos/ChangeLog
===================================================================
--- /vendor/prefix-portage/current/src/python-missingos/ChangeLog	(revision 3489)
+++ /vendor/prefix-portage/current/src/python-missingos/ChangeLog	(revision 3489)
@@ -0,0 +1,16 @@
+# $Id: ChangeLog 4685 2006-10-14 14:06:29Z grobian $
+
+python-missingos ChangeLog
+Jonathon D Nelson <jnelson@gentoo.org>
+2 April 2002
+
+ 2 April 2002 14:15 jnelson
+  * Add optional 'mode' parameter to mknod
+  * Change from missingosmodule to missingos.
+  * Add some __doc__ entries
+  * Remove stupid hack for Python 1.5.2 support,
+    1.5.2 doesn't have Py_FileSystemDefaultEncoding anyway.
+  * Return description of error when mode not p,b,c,u in mknod
+
+ 2 April 2002 12:10 jnelson
+  * Populate files
Index: /vendor/prefix-portage/current/src/python-missingos/Makefile.in
===================================================================
--- /vendor/prefix-portage/current/src/python-missingos/Makefile.in	(revision 3489)
+++ /vendor/prefix-portage/current/src/python-missingos/Makefile.in	(revision 3489)
@@ -0,0 +1,45 @@
+srcdir = @srcdir@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+
+INSTALL	= @INSTALL@
+
+DISTFILES = 	setup.py 	\
+		Makefile.in	\
+		PKG-INFO	\
+		README		\
+		missingos.c	\
+		setup.cfg	\
+		ChangeLog	
+
+all: builddir
+	setup.py build
+
+builddir:
+	test "${abs_builddir}" != "${abs_srcdir}" \
+	&& for x in $(DISTFILES) \
+	 ; do $(INSTALL) ${abs_srcdir}/$${x} ${abs_builddir}/$${x} \
+	 ; done
+
+clean-builddir:
+	if test "${abs_builddir}" != "${abs_srcdir}" \
+	 ; then for x in $(DISTFILES) \
+	      ; do rm -f ${abs_builddir}/$${x} \
+	      ; done \
+	 ; fi
+
+install: builddir
+	setup.py install --root $(DESTDIR)/
+
+distdir:
+	for x in $(DISTFILES); do \
+		$(INSTALL) -D ${srcdir}/$${x} $(distdir)/$${x}; \
+	done
+	chmod 755 $(distdir)/setup.py
+
+distclean: clean-builddir
+
+clean maintainer-clean:
+.PHONY:	all install distdir builddir
+.PHONY: distclean clean maintainer-clean clean-builddir
+
Index: /vendor/prefix-portage/current/src/python-missingos/PKG-INFO
===================================================================
--- /vendor/prefix-portage/current/src/python-missingos/PKG-INFO	(revision 3489)
+++ /vendor/prefix-portage/current/src/python-missingos/PKG-INFO	(revision 3489)
@@ -0,0 +1,10 @@
+Metadata-Version: 1.0
+Name: python-missingos
+Version: 0.2
+Summary: UNKNOWN
+Home-page: UNKNOWN
+Author: Jonathon D Nelson
+Author-email: jnelson@gentoo.org
+License: UNKNOWN
+Description: UNKNOWN
+Platform: UNKNOWN
Index: /vendor/prefix-portage/current/src/python-missingos/README
===================================================================
--- /vendor/prefix-portage/current/src/python-missingos/README	(revision 3489)
+++ /vendor/prefix-portage/current/src/python-missingos/README	(revision 3489)
@@ -0,0 +1,15 @@
+# $Id: README 4685 2006-10-14 14:06:29Z grobian $
+
+python-missingos
+Jonathon D Nelson <jnelson@gentoo.org>
+2 April 2002
+
+INTRO
+=====
+This module provides some missing file operations that don't
+seem to be provided by the standard os and posix modules.
+This list currently includes lchown and mknod.
+
+COPYRIGHT
+=========
+GPL
Index: /vendor/prefix-portage/current/src/python-missingos/missingos.c
===================================================================
--- /vendor/prefix-portage/current/src/python-missingos/missingos.c	(revision 3489)
+++ /vendor/prefix-portage/current/src/python-missingos/missingos.c	(revision 3489)
@@ -0,0 +1,120 @@
+/* $Id: missingos.c 4685 2006-10-14 14:06:29Z grobian $ */
+
+#include "Python.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+static char missingos_lchown__doc__[];
+static PyObject * missingos_lchown(PyObject *self, PyObject *args);
+static char missingos_mknod__doc__[];
+static PyObject * missingos_mknod(PyObject *self, PyObject *args);
+
+static char missingos__doc__[] = "Provide some operations that\
+    are missing from the standard os / posix modules.";
+
+static PyMethodDef missingos_methods[] = {
+    {"lchown", missingos_lchown, METH_VARARGS, missingos_lchown__doc__},
+    {"mknod", missingos_mknod, METH_VARARGS, missingos_mknod__doc__},
+    {NULL,		NULL}		/* sentinel */
+};
+
+static PyObject *
+posix_error_with_allocated_filename(char* name)
+{
+    PyObject *rc = PyErr_SetFromErrnoWithFilename(PyExc_OSError, name);
+    PyMem_Free(name);
+    return rc;
+}
+
+static char missingos_lchown__doc__[] =
+"lchown(path, uid, gid) -> None\n\
+Change the owner and group id of path to the numeric uid and gid.";
+
+static PyObject *
+missingos_lchown(PyObject *self, PyObject *args) {
+    char *path = NULL;
+    int uid, gid;
+    int res;
+    if (!PyArg_ParseTuple(args, "etii:lchown",
+                          Py_FileSystemDefaultEncoding, &path,
+                          &uid, &gid))
+        return NULL;
+    res = lchown(path, (uid_t) uid, (gid_t) gid);
+    if (res < 0)
+        return posix_error_with_allocated_filename(path);
+    PyMem_Free(path);
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
+static char missingos_mknod__doc__[] =
+"mknod(path, type, major, minor [, mode=0600 ]) -> None\n\
+Create a special file. Mode fixed at 0600.\
+Note that for type 'p' major and minor are ignored.\
+";
+
+static PyObject *
+missingos_mknod(PyObject *self, PyObject *args) {
+    char *path = NULL;
+    char *type = NULL;
+    int major = 0;
+    int minor = 0;
+    mode_t real_mode;
+    dev_t real_dev;
+    int mode = 0600;
+
+    int res;
+    if (!PyArg_ParseTuple(args, "etsii|i:mknod",
+                          Py_FileSystemDefaultEncoding, &path,
+                          &type, &major, &minor, &mode))
+        return NULL;
+    /* type can be *one* of b, c, u, p */
+    /* major/minor are forbidden for p, reqd otherwise */
+    if (!strcmp(type, "p")) {
+        /* pipe */
+        if (major != 0 || minor != 0) {
+            return NULL;
+        }
+        real_mode = S_IFIFO;
+        major = 0;
+        minor = 0;
+    } else if (!strcmp(type, "b")) {
+        /* block */
+        real_mode = S_IFBLK;
+    } else if (!strcmp(type, "c")) {
+        real_mode = S_IFCHR;
+        /* char */
+    } else if (!strcmp(type, "u")) {
+        real_mode = S_IFCHR;
+        /* unbuffered char */
+    } else {
+        /* error */
+        PyErr_SetString(PyExc_ValueError, "type must be one of p,b,c,u");
+        return NULL;
+    }
+
+    real_mode |= mode;
+    real_dev = (major << 8) | minor;
+
+    /* use mode to modify real_mode */
+
+    res = mknod(path, real_mode, real_dev);
+    if (res < 0)
+        return posix_error_with_allocated_filename(path);
+    PyMem_Free(path);
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
+
+DL_EXPORT(void)
+initmissingos(void) {
+    PyObject *m;
+
+    m = Py_InitModule4("missingos", missingos_methods,
+                       missingos__doc__, (PyObject *)NULL,
+                       PYTHON_API_VERSION);
+}
Index: /vendor/prefix-portage/current/src/python-missingos/setup.cfg
===================================================================
--- /vendor/prefix-portage/current/src/python-missingos/setup.cfg	(revision 3489)
+++ /vendor/prefix-portage/current/src/python-missingos/setup.cfg	(revision 3489)
@@ -0,0 +1,8 @@
+# python-missingos
+# $Id: setup.cfg 4685 2006-10-14 14:06:29Z grobian $
+
+[bdist_rpm]
+release = 1
+doc_files = ChangeLog
+            README
+python=python2
Index: /vendor/prefix-portage/current/src/python-missingos/setup.py
===================================================================
--- /vendor/prefix-portage/current/src/python-missingos/setup.py	(revision 3489)
+++ /vendor/prefix-portage/current/src/python-missingos/setup.py	(revision 3489)
@@ -0,0 +1,24 @@
+#!/usr/bin/python
+# $Id: setup.py 4685 2006-10-14 14:06:29Z grobian $
+
+from os import chdir, stat
+from distutils.core import setup, Extension
+
+setup (# Distribution meta-data
+        name = "python-missingos",
+        version = "0.2",
+        description = "",
+        author = "Jonathon D Nelson",
+        author_email = "jnelson@gentoo.org",
+       	license = "",
+        long_description = \
+         '''''',
+        ext_modules = [ Extension(
+                            "missingos",
+                            ["missingos.c"],
+                            libraries=[],
+                        ) 
+                      ],
+        url = "",
+      )
+
Index: /vendor/prefix-portage/current/src/tbz2tool.c
===================================================================
--- /vendor/prefix-portage/current/src/tbz2tool.c	(revision 3489)
+++ /vendor/prefix-portage/current/src/tbz2tool.c	(revision 3489)
@@ -0,0 +1,228 @@
+/* $Id: tbz2tool.c 4685 2006-10-14 14:06:29Z grobian $ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+
+/*buffered reading/writing size*/
+#define BUFLEN 262144 
+char *myname="tbz2tool";
+struct stat *mystat=NULL;
+void *mybuf;
+FILE *datafile, *dbfile, *outfile, *infile;
+unsigned char endbuf[8];
+long seekto,insize;
+
+int exists(const char *myfile) {
+	int result;
+	result=stat(myfile,mystat);
+	if (result==-1)
+		return 0;
+	return 1;
+}
+
+void writefile(FILE *src, FILE *dest) {
+	int count=1;
+	while (count) {
+		count=fread(mybuf, 1, BUFLEN, src);
+		fwrite(mybuf, 1, count, dest);
+	}
+}
+
+void writefileto(FILE *src, FILE *dest, int endpos) {
+	int pos=ftell(src);
+	int thiscount;
+	while (pos < endpos) {
+		/* thiscount=how much to read */
+		thiscount=endpos-pos;
+		if (thiscount>BUFLEN)
+			thiscount=BUFLEN;
+		thiscount=fread(mybuf, 1, thiscount , src);
+		/* thiscount=how much we actually did read */
+		if (thiscount==0)
+			/* eof -- shouldn't happen */
+			break;
+		/* update internal position counter */
+		pos+=thiscount;
+		fwrite(mybuf, 1, thiscount, dest);
+	}
+}
+
+int main(int argc, char **argv) {
+	if ((argc==2) && (!(strcmp(argv[1],"--help"))))
+		goto usage;
+	if (argc!=5) {
+		printf("%s: four arguments expected\n",myname);
+		goto error;
+	}
+	if (!(mystat=(struct stat *) malloc(sizeof(struct stat))))
+		goto memalloc;
+		
+	if (!(mybuf=(void *) malloc(BUFLEN))) {
+		free(mystat);
+		goto memalloc;
+	}
+	
+	/* JOIN MODE */
+	if (!(strcmp(argv[1],"join"))) {
+	
+		/* check if datafile exists */
+		if (!(exists(argv[2]))) {
+			printf("%s: %s doesn't exist\n",myname,argv[2]);
+			free(mystat);
+			goto error;
+		}
+		
+		/* check if dbfile exists */
+		if (!(exists(argv[3]))) {
+			printf("%s: %s doesn't exist\n",myname,argv[3]);
+			free(mystat);
+			goto error;
+		}
+		/* create end buffer for later use */
+		endbuf[0]=((mystat->st_size) & 0xff000000) >> 24;
+		endbuf[1]=((mystat->st_size) & 0x00ff0000) >> 16;
+		endbuf[2]=((mystat->st_size) & 0x0000ff00) >> 8;
+		endbuf[3]=(mystat->st_size) & 0x000000ff;
+		endbuf[4]='S';
+		endbuf[5]='T';
+		endbuf[6]='O';
+		endbuf[7]='P';
+	
+		/* if outfile exists, unlink first (safer) */
+		if (exists(argv[4])) 
+			unlink(argv[4]);
+		
+		/* open datafile for reading */
+		if ((datafile=fopen(argv[2],"r"))==NULL) {
+			free(mybuf);
+			free(mystat);
+			printf("%s: Error opening %s\n",myname,argv[2]);
+			goto error;
+		}
+		
+		/* open dbfile for reading */
+		if ((dbfile=fopen(argv[3],"r"))==NULL) {
+			fclose(datafile);
+			free(mybuf);
+			free(mystat);
+			printf("%s: Error opening %s\n",myname,argv[3]);
+			goto error;
+		}
+	
+		/* open outfile for writing */
+		if ((outfile=fopen(argv[4],"a"))==NULL) {
+			fclose(dbfile);
+			fclose(datafile);
+			free(mybuf);
+			free(mystat);
+			printf("%s: Error opening %s\n",myname,argv[4]);
+			goto error;
+		}
+	
+		writefile(datafile,outfile);
+		writefile(dbfile,outfile);
+		fwrite(endbuf,1,8,outfile);
+		fclose(outfile);
+		fclose(dbfile);
+		fclose(datafile);
+		free(mybuf);
+		free(mystat);
+		exit(0);	
+	
+	/* SPLIT MODE */
+	} else if (!(strcmp(argv[1],"split"))) {
+	
+		/* check if infile exists */
+		if (!(exists(argv[2]))) {
+			printf("%s: %s doesn't exist\n",myname,argv[2]);
+			free(mystat);
+			goto error;
+		}
+		
+		/* store infile size for later use */
+
+		insize=mystat->st_size;
+		
+		/* if datafile exists, unlink first (safer) */
+		if (exists(argv[3])) 
+			unlink(argv[3]);
+		
+		/* if dbfile exists, unlink first (safer) */
+		if (exists(argv[4])) 
+			unlink(argv[4]);
+	
+		/* open infile for reading */
+		if ((infile=fopen(argv[2],"r"))==NULL) {
+			free(mybuf);
+			free(mystat);
+			printf("%s: Error opening %s\n",myname,argv[2]);
+			goto error;
+		}
+		
+		/* read in end buffer */
+		fseek(infile,-8,SEEK_END);	
+		fread(endbuf,1,8,infile);
+		/* quick end buffer read and verification */
+		if ( (endbuf[4]!='S') || (endbuf[5]!='T') || (endbuf[6]!='O') || (endbuf[7]!='P') )	{
+			fclose(infile);
+			free(mybuf);
+			free(mystat);
+			printf("%s: %s appears to be corrupt (end buffer invalid)\n",myname,argv[2]);
+			goto error;
+		}
+		
+		seekto=0;
+		seekto=seekto+endbuf[0]*256*256*256;
+		seekto=seekto+endbuf[1]*256*256;
+		seekto=seekto+endbuf[2]*256;
+		seekto=seekto+endbuf[3];
+		
+		/* open datafile for writing */
+		if ((datafile=fopen(argv[3],"a"))==NULL) {
+			fclose(infile);
+			free(mybuf);
+			free(mystat);
+			printf("%s: Error opening %s\n",myname,argv[3]);
+			goto error;
+		}
+	
+		/* open dbfile for writing */
+		if ((dbfile=fopen(argv[4],"a"))==NULL) {
+			fclose(datafile);
+			fclose(infile);
+			free(mybuf);
+			free(mystat);
+			printf("%s: Error opening %s\n",myname,argv[4]);
+			goto error;
+		}
+
+		rewind(infile);
+		writefileto(infile,datafile,insize-(seekto+8));
+		fseek(infile,-(seekto+8),SEEK_END);
+		writefileto(infile,dbfile,insize-8);
+		fclose(infile);
+		fclose(dbfile);
+		fclose(datafile);
+		free(mybuf);
+		free(mystat);
+		exit(0);	
+		
+	} else {
+		free(mybuf);
+		free(mystat);
+		goto usage;
+	}
+	
+	usage:
+	printf("Usage: %s join DATAFILE DBFILE OUTFILE (datafile + dbfile -> outfile)\n       %s split INFILE DATAFILE DBFILE (infile -> datafile + dbfile)\n",myname,myname);
+error:
+	exit(1);
+memalloc:
+	printf("%s: memory allocation error\n",myname);
+	exit(2);
+}
Index: /vendor/prefix-portage/current/subst-install.in
===================================================================
--- /vendor/prefix-portage/current/subst-install.in	(revision 3489)
+++ /vendor/prefix-portage/current/subst-install.in	(revision 3489)
@@ -0,0 +1,72 @@
+#! @SHELL@
+
+SED="@SED@"
+RM="@RM@"
+BASENAME="@BASENAME@"
+DIRNAME="@DIRNAME@"
+
+case "${SED}" in ""|@*@) SED=sed ;; esac
+case "${RM}" in ""|@*@) RM=rm ;; esac
+case "${BASENAME}" in ""|@*@) BASENAME=basename ;; esac
+case "${DIRNAME}" in ""|@*@) DIRNAME=dirname ;; esac
+
+mydir=`${DIRNAME} $0`
+myname=`${BASENAME} $0`
+mydir=`cd ${mydir};pwd`
+me=${mydir}/${myname}
+
+. ${mydir}/subst-install.vars
+
+substinstall_tmpdir=${TMPDIR-/tmp}/${myname}.$$
+trap "${RM} -rf \${substinstall_tmpdir}" "0"
+mkdir -p ${substinstall_tmpdir} \
+|| { echo "cannot create directory ${substinstall_tmpdir}" >&2 ; exit 1 ; }
+
+substinstall_tmpsed=${substinstall_tmpdir}/sedscript
+
+{	for v in ${all_configurevars}
+	do
+		eval "echo \"s,@${v}@,\${${v}},g;\""
+	done
+} | ${SED} 's/^s,@/s@@/; s/@,/@@/; s/,g;$/@;/; s/[\\&,]/\\&/g;
+   s/^s@@/s,@/; s/@@/@,/; s/@;$/,g;/' > ${substinstall_tmpsed}
+
+substinstall_installcmd=
+substinstall_sources=
+substinstall_target=
+
+while [ "$1" ]
+do
+	substinstall_arg=$1
+	shift
+	case "${substinstall_arg}" in
+	--installcmd=*)
+		substinstall_installcmd=`echo ${substinstall_arg} | ${SED} -e 's,^--installcmd=,,'`
+		;;
+	*)
+		substinstall_sources="${substinstall_sources} ${substinstall_target}"
+		substinstall_target=${substinstall_arg}
+		;;
+	esac
+done
+
+[ -n "${substinstall_installcmd}" ] || { echo "missing --installcmd=" ; exit 1 ; }
+
+substinstall_tmpsources=
+
+for substinstall_s in ${substinstall_sources}
+do
+	[ -r ${substinstall_s} ] || { echo "cannot read ${substinstall_s}" >&2 ; exit 1 ; }
+	tmpsource=${substinstall_tmpdir}/`basename ${substinstall_s}`.subst
+	${SED} -f ${substinstall_tmpsed} < ${substinstall_s} > ${tmpsource} \
+	|| { echo "cannot sed from ${substinstall_s} to ${tmpsource}" >&2 ; exit 1 ; }
+	substinstall_tmpsources="${substinstall_tmpsources} ${tmpsource}"
+done
+
+${substinstall_installcmd} ${substinstall_tmpsources} ${substinstall_target}
+
+substinstall_installrv=$?
+
+${RM} -rf ${substinstall_tmpdir}
+
+exit ${substinstall_installrv}
Index: /vendor/prefix-portage/current/subst-install.vars.in.in
===================================================================
--- /vendor/prefix-portage/current/subst-install.vars.in.in	(revision 3489)
+++ /vendor/prefix-portage/current/subst-install.vars.in.in	(revision 3489)
@@ -0,0 +1,133 @@
+SHELL=@SHELL@
+PATH_SEPARATOR=@PATH_SEPARATOR@
+PACKAGE_NAME=@PACKAGE_NAME@
+PACKAGE_TARNAME=@PACKAGE_TARNAME@
+PACKAGE_VERSION=@PACKAGE_VERSION@
+PACKAGE_STRING=@PACKAGE_STRING@
+PACKAGE_BUGREPORT=@PACKAGE_BUGREPORT@
+exec_prefix=@exec_prefix@
+prefix=@prefix@
+program_transform_name=@program_transform_name@
+bindir=@bindir@
+sbindir=@sbindir@
+libexecdir=@libexecdir@
+datadir=@datadir@
+sysconfdir=@sysconfdir@
+sharedstatedir=@sharedstatedir@
+localstatedir=@localstatedir@
+libdir=@libdir@
+includedir=@includedir@
+oldincludedir=@oldincludedir@
+infodir=@infodir@
+mandir=@mandir@
+build_alias=@build_alias@
+host_alias=@host_alias@
+target_alias=@target_alias@
+DEFS=@DEFS@
+ECHO_C=@ECHO_C@
+ECHO_N=@ECHO_N@
+ECHO_T=@ECHO_T@
+LIBS=@LIBS@
+build=@build@
+build_cpu=@build_cpu@
+build_vendor=@build_vendor@
+build_os=@build_os@
+host=@host@
+host_cpu=@host_cpu@
+host_vendor=@host_vendor@
+host_os=@host_os@
+target=@target@
+target_cpu=@target_cpu@
+target_vendor=@target_vendor@
+target_os=@target_os@
+INSTALL_PROGRAM=@INSTALL_PROGRAM@
+INSTALL_SCRIPT=@INSTALL_SCRIPT@
+INSTALL_DATA=@INSTALL_DATA@
+CYGPATH_W=@CYGPATH_W@
+PACKAGE=@PACKAGE@
+VERSION=@VERSION@
+ACLOCAL=@ACLOCAL@
+AUTOCONF=@AUTOCONF@
+AUTOMAKE=@AUTOMAKE@
+AUTOHEADER=@AUTOHEADER@
+MAKEINFO=@MAKEINFO@
+AMTAR=@AMTAR@
+install_sh=@install_sh@
+STRIP=@STRIP@
+ac_ct_STRIP=@ac_ct_STRIP@
+INSTALL_STRIP_PROGRAM=@INSTALL_STRIP_PROGRAM@
+mkdir_p=@mkdir_p@
+AWK=@AWK@
+SET_MAKE=@SET_MAKE@
+am__leading_dot=@am__leading_dot@
+CC=@CC@
+CFLAGS=@CFLAGS@
+LDFLAGS=@LDFLAGS@
+CPPFLAGS=@CPPFLAGS@
+ac_ct_CC=@ac_ct_CC@
+EXEEXT=@EXEEXT@
+OBJEXT=@OBJEXT@
+DEPDIR=@DEPDIR@
+am__include=@am__include@
+am__quote=@am__quote@
+AMDEP_TRUE=@AMDEP_TRUE@
+AMDEP_FALSE=@AMDEP_FALSE@
+AMDEPBACKSLASH=@AMDEPBACKSLASH@
+CCDEPMODE=@CCDEPMODE@
+am__fastdepCC_TRUE=@am__fastdepCC_TRUE@
+am__fastdepCC_FALSE=@am__fastdepCC_FALSE@
+LN_S=@LN_S@
+EGREP=@EGREP@
+XCU_ID=@XCU_ID@
+RM=@RM@
+MV=@MV@
+SED=@SED@
+BASH=@BASH@
+PYTHON=@PYTHON@
+PERL=@PERL@
+BASENAME=@BASENAME@
+DIRNAME=@DIRNAME@
+DIALOG=@DIALOG@
+WGET=@WGET@
+INSTALL_INFO=@INSTALL_INFO@
+SANDBOX=@SANDBOX@
+PRELINK=@PRELINK@
+RSYNC=@RSYNC@
+CVS=@CVS@
+SVN=@SVN@
+GPG=@GPG@
+MD5SUM=@MD5SUM@
+LOGGER=@LOGGER@
+FIND=@FIND@
+FILE=@FILE@
+READELF=@READELF@
+SETFILES=@SETFILES@
+FAKEROOT=@FAKEROOT@
+CPP=@CPP@
+ALLOCA=@ALLOCA@
+portageuser=@portageuser@
+portagegroup=@portagegroup@
+wheelgid=@wheelgid@
+rootuser=@rootuser@
+DOMAIN_PREFIX=@DOMAIN_PREFIX@
+ARCH=@ARCH@
+PORTAGE_BASE=@PORTAGE_BASE@
+INSTALL_PYTHON_SOURCES_TRUE=@INSTALL_PYTHON_SOURCES_TRUE@
+INSTALL_PYTHON_SOURCES_FALSE=@INSTALL_PYTHON_SOURCES_FALSE@
+BUILD_TBZ2TOOL_TRUE=@BUILD_TBZ2TOOL_TRUE@
+BUILD_TBZ2TOOL_FALSE=@BUILD_TBZ2TOOL_FALSE@
+BUILD_MISSINGOS_TRUE=@BUILD_MISSINGOS_TRUE@
+BUILD_MISSINGOS_FALSE=@BUILD_MISSINGOS_FALSE@
+LIBOBJS=@LIBOBJS@
+LTLIBOBJS=@LTLIBOBJS@
+configure_input=@configure_input@
+srcdir=@srcdir@
+abs_srcdir=@abs_srcdir@
+top_srcdir=@top_srcdir@
+abs_top_srcdir=@abs_top_srcdir@
+builddir=@builddir@
+abs_builddir=@abs_builddir@
+top_builddir=@top_builddir@
+abs_top_builddir=@abs_top_builddir@
+INSTALL=@INSTALL@
+all_configurevars=' SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE LN_S EGREP XCU_ID RM MV SED BASH PYTHON PERL BASENAME DIRNAME DIALOG WGET INSTALL_INFO SANDBOX PRELINK RSYNC CVS GPG MD5SUM LOGGER FIND FILE READELF SETFILES FAKEROOT CPP ALLOCA portageuser portagegroup wheelgid rootuser DOMAIN_PREFIX ARCH PORTAGE_BASE INSTALL_PYTHON_SOURCES_TRUE INSTALL_PYTHON_SOURCES_FALSE BUILD_TBZ2TOOL_TRUE BUILD_TBZ2TOOL_FALSE BUILD_MISSINGOS_TRUE BUILD_MISSINGOS_FALSE LIBOBJS LTLIBOBJS configure_input srcdir abs_srcdir top_srcdir abs_top_srcdir builddir abs_builddir top_builddir abs_top_builddir INSTALL'
Index: /vendor/prefix-portage/current/svnlogmsg.awk
===================================================================
--- /vendor/prefix-portage/current/svnlogmsg.awk	(revision 3489)
+++ /vendor/prefix-portage/current/svnlogmsg.awk	(revision 3489)
@@ -0,0 +1,42 @@
+#!/usr/bin/env bash
+
+# bla bla
+# probably can be done much better, but I got tired of copy 'n' paste
+# from mutt into a commit message ...
+
+[[ -z $1 ]] && exit -1
+
+svn log ../../trunk -r$1 | awk -v revs=$1 '
+BEGIN {
+	term = 0
+	print "<html>"
+	print "Merged from trunk " revs
+	print "<table border=\"1\" width=\"100%\">"
+}
+{
+	if ($0 ~ /^--*$/) {
+		if (term == 1) {
+			print "</td></tr>"
+			term = 0
+		}
+		print "<tr>"
+	} else if ($0 ~ /^r[0-9][0-9]* \| .*$/) {
+		print "<td valign=\"top\" width=\"1%\">" substr($1, 2) "<br />"
+		if ($3 == "vapier") {
+			$3 = "SpankMan"
+		} else if ($3 == "antarus") {
+			$3 = "WarnerBro"
+		}
+		print $3 "</td><td>"
+	} else if ($0 ~ /^..*$/) {
+		print $0
+		term = 1
+	}
+}
+END {
+	if (term == 1) {
+		print "</td></tr>"
+	}
+	print "</table></html>"
+}
+' | elinks -dump
